diff --git a/build.gradle b/build.gradle index 446f23c7..41cc605a 100755 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ plugins { + id 'java-library' id 'idea' - id "org.sonarqube" version "4.3.1.3277" - id "maven-publish" - id 'net.neoforged.gradle' version '[6.0.18,6.2)' - id 'org.parchmentmc.librarian.forgegradle' version '1.+' + id 'maven-publish' + id 'net.neoforged.moddev' version '1.0.14' + id "org.sonarqube" version "5.0.0.4638" id "net.darkhax.curseforgegradle" version "1.1.15" id "com.modrinth.minotaur" version "2.+" } @@ -15,6 +15,10 @@ idea { } } +version = "${project.minecraft_version}-${project.mod_version}.${getBuildNumber()}${getStable()}" +group = mod_group_id + + repositories { mavenCentral() maven { url "https://dvs1.progwml6.com/files/maven" } @@ -30,41 +34,48 @@ repositories { } } -group = 'reliquary' -version = "${project.minecraft_version}-${project.mod_version}.${getBuildNumber()}${getStable()}" -archivesBaseName = 'reliquary' +base { + archivesName = mod_id +} -sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '17' +java.toolchain.languageVersion = JavaLanguageVersion.of(21) + +neoForge { + version = project.neo_version + + accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg') -minecraft { - mappings channel: 'parchment', version: "$parchment_version" - copyIdeResources = true - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { configureEach { - workingDirectory project.file("run/${it.name}") - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' - property 'forge.logging.console.level', 'debug' - property "mixin.env.disableRefMap", "true" - jvmArg '-XX:+AllowEnhancedClassRedefinition' - jvmArg '-XX:HotswapAgent=fatjar' - - mods { - "${mod_id}" { - source sourceSets.main - } - } + systemProperty 'forge.logging.markers', 'REGISTRIES' + systemProperty 'forge.logging.console.level', 'debug' + systemProperty 'mixin.env.disableRefMap', 'true' } + client { + client() } + + client2 { + client() + + programArguments.addAll '--username', 'Dev2' + } + server { + server() + programArgument '--nogui' } + data { - property 'fml.earlyprogresswindow', 'false' - //property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" - workingDirectory project.file('run') - args '--mod', mod_id, '--all', '--output', file('src/generated/resources/') + data() + programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() + } + } + mods { + "${mod_id}" { + sourceSet(sourceSets.main) } } } @@ -73,66 +84,56 @@ sourceSets.main.resources { srcDir 'src/generated/resources' } -dependencies { - minecraft "net.neoforged:forge:${minecraft_version}-${neo_version}" - - compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}:${jei_version}") - runtimeOnly fg.deobf("mezz.jei:jei-${jei_mc_version}:${jei_version}") - //compileOnly fg.deobf("vazkii.botania:Botania:${botania_version}:api") - //runtimeOnly fg.deobf("vazkii.botania:Botania:${botania_version}") - //compileOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}:api") - //runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}") //deobfCompile "slimeknights.mantle:Mantle:${mantle_version}" - //deobfCompile "slimeknights:TConstruct:${tconstruct_version}" - //deobfCompile "jeresources:JustEnoughResources-${minecraft_version}:${jer_version}" - //deobfCompile "slimeknights.mantle:Mantle:${mantle_version}" - //deobfCompile "slimeknights:TConstruct:${tconstruct_version}" - compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api") - runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}") - compileOnly fg.deobf("curse.maven:jade-324717:${jade_cf_file_id}") - runtimeOnly fg.deobf("curse.maven:jade-324717:${jade_cf_file_id}") - -// compileOnly fg.deobf("curse.maven:tinkers-74072:3576393") -// runtimeOnly fg.deobf("curse.maven:tinkers-74072:3576393") -// compileOnly fg.deobf("curse.maven:mantle-74924:3576386") -// runtimeOnly fg.deobf("curse.maven:mantle-74924:3576386") -} - -task generateSources(type: Copy) { - from 'src/replaceme/java' - into "$buildDir/generated-src" - filter { line -> line.replaceAll('@MOD_VERSION@', '${project.version}') } +configurations { + runtimeClasspath.extendsFrom localRuntime } -tasks.named('jar', Jar).configure { - from('/') { - include 'LICENSE' - } - - manifest { - attributes([ - 'Specification-Title' : mod_id, - 'Specification-Vendor' : "p3pp3rf1y", - 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : project.name, - 'Implementation-Version' : project.jar.archiveVersion, - 'Implementation-Vendor' : "p3pp3rf1y", - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - } +dependencies { + compileOnly "mezz.jei:jei-${jei_mc_version}:${jei_version}" + localRuntime "mezz.jei:jei-${jei_mc_version}:${jei_version}" + compileOnly "curse.maven:curios-1037991:${curios_cf_file_id}" + localRuntime "curse.maven:curios-1037991:${curios_cf_file_id}" + compileOnly "curse.maven:jade-324717:${jade_cf_file_id}" + localRuntime "curse.maven:jade-324717:${jade_cf_file_id}" } -tasks.withType(ProcessResources).configureEach { +var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) { var replaceProperties = [ minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, neo_version : neo_version, neo_version_range: neo_version_range, loader_version_range: loader_version_range, - mod_id : mod_id, mod_version: mod_version, + mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, + mod_issue_tracker_url: mod_issue_tracker_url, mod_logo_file: mod_logo_file, mod_credits: mod_credits, + mod_authors : mod_authors, mod_description: mod_description, mod_display_url: mod_display_url, mod_full_version : "${project.mod_version}.${getBuildNumber()}${getStable()}" + ] inputs.properties replaceProperties - filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { - expand replaceProperties + [project: project] + expand replaceProperties + from "src/main/templates" + into "build/generated/sources/modMetadata" +} + +// Include the output of "generateModMetadata" as an input directory for the build +// this works with both building through Gradle and the IDE. +sourceSets.main.resources.srcDir generateModMetadata +// To avoid having to run "generateModMetadata" manually, make it run on every project reload +neoForge.ideSyncTask generateModMetadata + +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' +} + +jar { + manifest { + attributes(["Specification-Title" : project.mod_id, + "Specification-Vendor" : project.mod_id, + "Specification-Version" : "1", + "Implementation-Title" : project.name, + "Implementation-Version" : "${version}", + "Implementation-Vendor" : project.mod_id, + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],) } } @@ -150,15 +151,11 @@ static def getStable() { return "" } -tasks.named('publish').configure { - dependsOn 'reobfJar' -} - publishing { repositories { maven { - name = "ReliquaryMaven" - url = uri("https://maven.pkg.github.com/P3pp3rF1y/Reliquary") + name = "GitHubPackages" + url = uri("${github_package_url}") credentials { username = System.getenv("GITHUB_ACTOR") password = System.getenv("GITHUB_TOKEN") @@ -167,7 +164,7 @@ publishing { } publications { gpr(MavenPublication) { - artifactId = 'reliquary' + artifactId = mod_id from(components.java) } } @@ -232,7 +229,7 @@ task generateChangelog { // Single commit log commitMessages = "git log -1 --pretty=%B".execute().text.split('\n\n') // Split by two newlines for each commit - logger.info("Single commit, ran git log command: git log -1 --pretty=%B and got ${commitMessages}"); + logger.info("Single commit, ran git log command: git log -1 --pretty=%B and got ${commitMessages}") } def features = [] @@ -272,7 +269,6 @@ task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) { mainFile.changelogType = 'markdown' mainFile.changelog = { project.ext.changelog } mainFile.addModLoader('NeoForge') - mainFile.addModLoader('Forge') mainFile.releaseType = "${release_type}" "${release_versions}".split(',').each { mainFile.addGameVersion("${it}") @@ -289,7 +285,7 @@ modrinth { versionType = "${release_type}" uploadFile = jar gameVersions = "${release_versions}".split(',').collect {e -> e} - loaders = ["forge", "neoforge"] + loaders = ["neoforge"] dependencies { optional.project "jei" optional.project "jade" @@ -299,6 +295,7 @@ modrinth { project.ext.changelog } } + tasks.modrinth { dependsOn(tasks.generateChangelog) onlyIf { !project.ext.changelog.isEmpty() } diff --git a/gradle.properties b/gradle.properties index b2456861..d7c1f1bb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,31 +1,36 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false +org.gradle.debug=false + +parchment_minecraft_version=1.21 +parchment_mappings_version=2024.07.28 +minecraft_version=1.21.1 +minecraft_version_range=[1.21.1, 1.22) +neo_version=21.1.73 +neo_version_range=[21.1.0,) +loader_version_range=[4,) mod_id=reliquary -mod_group_id=reliquary +mod_name=Reliquary Reincarnations +mod_license=GNU General Public License v3.0 mod_version=2.0.44 +mod_group_id=reliquary +mod_authors=P3pp3rF1y +mod_description=Two words: magical swag. Oh, and a gun. +mod_credits=Originally made by Xeno and TheMike, now maintained by P3pp3rF1y. +mod_logo_file=logo.png +mod_display_url=https://www.curseforge.com/minecraft/mc-mods/reliquary-reincarnations +mod_issue_tracker_url=https://github.com/P3pp3rF1y/Reliquary/issues sonar_project_key=xreliquary:Reliquary github_package_url=https://maven.pkg.github.com/P3pp3rF1y/Reliquary -#neoforge -minecraft_version=1.20.1 -minecraft_version_range=[1.20,1.21) -neo_version=47.1.5 -neo_version_range=[47.1,) -loader_version_range=[47,) +jei_mc_version=1.21.1-neoforge +jei_version=19.12.0.131 +curios_cf_file_id=5546342 +jade_cf_file_id=5842011 #publish curseforge_id=241319 release_type=release -release_versions=1.20.1 -modrinth_project_id=fQO83PId - -#deps -jei_mc_version=1.20.1-forge -jei_version=15.1.0.19 -curios_version=5.2.0-beta.3+1.20.1 -# botania_version=1.16.5-415-SNAPSHOT -jade_cf_file_id=4654448 -# hwyla_version = 1.8.20-B35_1.12 -# jer_version = 0.8.7.41 -parchment_version=2023.07.16-1.20.1 \ No newline at end of file +release_versions=1.21.1 +modrinth_project_id=fQO83PId \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 54ef14c2..e4a5f610 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Sat Sep 05 10:21:38 EDT 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index eaf6f0d1..fd1434c1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,14 +1,11 @@ pluginManagement { repositories { + mavenLocal() gradlePluginPortal() - maven { url = 'https://maven.parchmentmc.org' } - maven { - name = 'NeoForged' - url = 'https://maven.neoforged.net/releases' - } + maven { url = 'https://maven.neoforged.net/releases' } } } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } \ No newline at end of file diff --git a/src/generated/resources/data/c/tags/fluid/experience.json b/src/generated/resources/data/c/tags/fluid/experience.json new file mode 100644 index 00000000..35dcdc2a --- /dev/null +++ b/src/generated/resources/data/c/tags/fluid/experience.json @@ -0,0 +1,5 @@ +{ + "values": [ + "reliquary:xp_still" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/fluids/experience.json b/src/generated/resources/data/forge/tags/fluids/experience.json deleted file mode 100644 index 9132d39b..00000000 --- a/src/generated/resources/data/forge/tags/fluids/experience.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "values": [ - "reliquary:xp_juice_still" - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.json similarity index 100% rename from src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json rename to src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.json diff --git a/src/generated/resources/data/minecraft/tags/block/wall_post_override.json b/src/generated/resources/data/minecraft/tags/block/wall_post_override.json new file mode 100644 index 00000000..163db7ce --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/block/wall_post_override.json @@ -0,0 +1,5 @@ +{ + "values": [ + "reliquary:interdiction_torch" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/items/arrows.json b/src/generated/resources/data/minecraft/tags/item/arrows.json similarity index 100% rename from src/generated/resources/data/minecraft/tags/items/arrows.json rename to src/generated/resources/data/minecraft/tags/item/arrows.json diff --git a/src/generated/resources/data/minecraft/tags/item/enchantable/mining.json b/src/generated/resources/data/minecraft/tags/item/enchantable/mining.json new file mode 100644 index 00000000..68c155b2 --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/item/enchantable/mining.json @@ -0,0 +1,5 @@ +{ + "values": [ + "reliquary:shears_of_winter" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/item/swords.json b/src/generated/resources/data/minecraft/tags/item/swords.json new file mode 100644 index 00000000..4c4c16aa --- /dev/null +++ b/src/generated/resources/data/minecraft/tags/item/swords.json @@ -0,0 +1,6 @@ +{ + "values": [ + "reliquary:magicbane", + "reliquary:mercy_cross" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json b/src/generated/resources/data/neoforge/loot_modifiers/global_loot_modifiers.json similarity index 93% rename from src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json rename to src/generated/resources/data/neoforge/loot_modifiers/global_loot_modifiers.json index 96b8eaa2..2db8848b 100644 --- a/src/generated/resources/data/forge/loot_modifiers/global_loot_modifiers.json +++ b/src/generated/resources/data/neoforge/loot_modifiers/global_loot_modifiers.json @@ -29,8 +29,8 @@ "reliquary:entities/blaze", "reliquary:entities/ghast", "reliquary:entities/guardian", - "reliquary:chests/jungle_temple", - "reliquary:chests/desert_pyramid" + "reliquary:chests/desert_pyramid", + "reliquary:chests/jungle_temple" ], "replace": false } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/alkahestry_altar.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/alkahestry_altar.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/alkahestry_altar.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/alkahestry_altar.json index dfdb67af..846cd9ca 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/alkahestry_altar.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/alkahestry_altar.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:alkahestry_altar" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/alkahestry_tome.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/alkahestry_tome.json new file mode 100644 index 00000000..f5add401 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/alkahestry_tome.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:alkahestry_tome" + }, + "trigger": "minecraft:recipe_unlocked" + }, + "has_witch_hat": { + "conditions": { + "items": [ + { + "items": "reliquary:witch_hat" + } + ] + }, + "trigger": "minecraft:inventory_changed" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_witch_hat" + ] + ], + "rewards": { + "recipes": [ + "reliquary:alkahestry_tome" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/angelheart_vial.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/angelheart_vial.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/angelheart_vial.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/angelheart_vial.json index c8f81c98..8b4d28d0 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/angelheart_vial.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/angelheart_vial.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:fertile_essence" - ] + "items": "reliquary:fertile_essence" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_fertile_essence", - "has_the_recipe" + "has_the_recipe", + "has_fertile_essence" ] ], "rewards": { "recipes": [ "reliquary:angelheart_vial" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/angelic_feather.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/angelic_feather.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/angelic_feather.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/angelic_feather.json index 8292367e..9ea41c98 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/angelic_feather.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/angelic_feather.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:angelic_feather" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/aphrodite_potion.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/aphrodite_potion.json new file mode 100644 index 00000000..6fce8a0f --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/aphrodite_potion.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_fertile_essence": { + "conditions": { + "items": [ + { + "items": "reliquary:fertile_essence" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:aphrodite_potion" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_fertile_essence" + ] + ], + "rewards": { + "recipes": [ + "reliquary:aphrodite_potion" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/apothecary_cauldron.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/apothecary_cauldron.json new file mode 100644 index 00000000..c66d90e5 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/apothecary_cauldron.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_nebulous_heart": { + "conditions": { + "items": [ + { + "items": "reliquary:nebulous_heart" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:apothecary_cauldron" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_nebulous_heart" + ] + ], + "rewards": { + "recipes": [ + "reliquary:apothecary_cauldron" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/apothecary_mortar.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/apothecary_mortar.json new file mode 100644 index 00000000..f8c713d0 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/apothecary_mortar.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_catalyzing_gland": { + "conditions": { + "items": [ + { + "items": "reliquary:catalyzing_gland" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:apothecary_mortar" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_catalyzing_gland" + ] + ], + "rewards": { + "recipes": [ + "reliquary:apothecary_mortar" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/barrel_assembly.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/barrel_assembly.json new file mode 100644 index 00000000..58d00818 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/barrel_assembly.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_nebulous_heart": { + "conditions": { + "items": [ + { + "items": "reliquary:nebulous_heart" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:barrel_assembly" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_nebulous_heart" + ] + ], + "rewards": { + "recipes": [ + "reliquary:barrel_assembly" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bat_wing.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bat_wing.json new file mode 100644 index 00000000..a5aac19b --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bat_wing.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_feather": { + "conditions": { + "items": [ + { + "items": "#c:feathers" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bat_wing" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_feather" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bat_wing" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/blaze_bullet.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/blaze_bullet.json new file mode 100644 index 00000000..bff8b828 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/blaze_bullet.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_blaze_rod": { + "conditions": { + "items": [ + { + "items": "minecraft:blaze_rod" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bullets/blaze_bullet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_blaze_rod" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bullets/blaze_bullet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/buster_bullet.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/buster_bullet.json new file mode 100644 index 00000000..53cb7c52 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/buster_bullet.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_concussive_bullet": { + "conditions": { + "items": [ + { + "items": "reliquary:bullets/concussive_bullet" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bullets/buster_bullet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_concussive_bullet" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bullets/buster_bullet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/concussive_bullet.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/concussive_bullet.json new file mode 100644 index 00000000..4919b0a1 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/concussive_bullet.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_gunpowder": { + "conditions": { + "items": [ + { + "items": "minecraft:gunpowder" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bullets/concussive_bullet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gunpowder" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bullets/concussive_bullet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/ender_bullet.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/ender_bullet.json new file mode 100644 index 00000000..6f9792ca --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/ender_bullet.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_seeker_bullet": { + "conditions": { + "items": [ + { + "items": "reliquary:bullets/seeker_bullet" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bullets/ender_bullet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_seeker_bullet" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bullets/ender_bullet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/exorcism_bullet.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/exorcism_bullet.json new file mode 100644 index 00000000..9ec75c30 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/exorcism_bullet.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_neutral_bullet": { + "conditions": { + "items": [ + { + "items": "reliquary:bullets/neutral_bullet" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bullets/exorcism_bullet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_neutral_bullet" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bullets/exorcism_bullet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/neutral_bullet.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/neutral_bullet.json new file mode 100644 index 00000000..09af695c --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/neutral_bullet.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_gunpowder": { + "conditions": { + "items": [ + { + "items": "minecraft:gunpowder" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bullets/neutral_bullet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gunpowder" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bullets/neutral_bullet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/sand_bullet.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/sand_bullet.json new file mode 100644 index 00000000..13fa4a89 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/sand_bullet.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_gunpowder": { + "conditions": { + "items": [ + { + "items": "minecraft:gunpowder" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bullets/sand_bullet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gunpowder" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bullets/sand_bullet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/seeker_bullet.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/seeker_bullet.json new file mode 100644 index 00000000..79399512 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/seeker_bullet.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_gunpowder": { + "conditions": { + "items": [ + { + "items": "minecraft:gunpowder" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bullets/seeker_bullet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gunpowder" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bullets/seeker_bullet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/storm_bullet.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/storm_bullet.json new file mode 100644 index 00000000..78668ce4 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/bullets/storm_bullet.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_gunpowder": { + "conditions": { + "items": [ + { + "items": "minecraft:gunpowder" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:bullets/storm_bullet" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gunpowder" + ] + ], + "rewards": { + "recipes": [ + "reliquary:bullets/storm_bullet" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/catalyzing_gland.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/catalyzing_gland.json new file mode 100644 index 00000000..9937863a --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/catalyzing_gland.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_gunpowder": { + "conditions": { + "items": [ + { + "items": "#c:gunpowders" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:catalyzing_gland" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_gunpowder" + ] + ], + "rewards": { + "recipes": [ + "reliquary:catalyzing_gland" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/chelicerae.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/chelicerae.json new file mode 100644 index 00000000..d5231912 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/chelicerae.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_string": { + "conditions": { + "items": [ + { + "items": "#c:strings" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:chelicerae" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_string" + ] + ], + "rewards": { + "recipes": [ + "reliquary:chelicerae" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/crimson_cloth.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/crimson_cloth.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/crimson_cloth.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/crimson_cloth.json index d39f3680..b990234d 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/crimson_cloth.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/crimson_cloth.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:crimson_cloth" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/destruction_catalyst.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/destruction_catalyst.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/destruction_catalyst.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/destruction_catalyst.json index ebde7b3d..eaa9864e 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/destruction_catalyst.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/destruction_catalyst.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:molten_core" - ] + "items": "reliquary:molten_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_molten_core", - "has_the_recipe" + "has_the_recipe", + "has_molten_core" ] ], "rewards": { "recipes": [ "reliquary:destruction_catalyst" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/emperor_chalice.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/emperor_chalice.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/emperor_chalice.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/emperor_chalice.json index a0dc7b75..51aa813c 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/emperor_chalice.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/emperor_chalice.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:void_tear" - ] + "items": "reliquary:void_tear" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_void_tear", - "has_the_recipe" + "has_the_recipe", + "has_void_tear" ] ], "rewards": { "recipes": [ "reliquary:emperor_chalice" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/empty_potion_vial.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/empty_potion_vial.json new file mode 100644 index 00000000..c7af1383 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/empty_potion_vial.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_glass_pane": { + "conditions": { + "items": [ + { + "items": "minecraft:glass_pane" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:empty_potion_vial" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_glass_pane" + ] + ], + "rewards": { + "recipes": [ + "reliquary:empty_potion_vial" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/ender_staff.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/ender_staff.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/ender_staff.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/ender_staff.json index 74947f76..283ebed1 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/ender_staff.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/ender_staff.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:ender_staff" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/eye_of_the_storm.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/eye_of_the_storm.json new file mode 100644 index 00000000..a1f90931 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/eye_of_the_storm.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_catalyzing_gland": { + "conditions": { + "items": [ + { + "items": "reliquary:catalyzing_gland" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:eye_of_the_storm" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_catalyzing_gland" + ] + ], + "rewards": { + "recipes": [ + "reliquary:eye_of_the_storm" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/fertile_essence.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/fertile_essence.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/fertile_essence.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/fertile_essence.json index cc539f59..ebad0c1c 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/fertile_essence.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/fertile_essence.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:slime_pearl" - ] + "items": "reliquary:slime_pearl" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_slime_pearl", - "has_the_recipe" + "has_the_recipe", + "has_slime_pearl" ] ], "rewards": { "recipes": [ "reliquary:fertile_essence" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/fertile_lily_pad.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/fertile_lily_pad.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/fertile_lily_pad.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/fertile_lily_pad.json index eec8224e..a0d5dfcc 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/fertile_lily_pad.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/fertile_lily_pad.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:fertile_essence" - ] + "items": "reliquary:fertile_essence" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_fertile_essence", - "has_the_recipe" + "has_the_recipe", + "has_fertile_essence" ] ], "rewards": { "recipes": [ "reliquary:fertile_lily_pad" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/fertile_potion.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/fertile_potion.json new file mode 100644 index 00000000..1c43bc8d --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/fertile_potion.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_fertile_essence": { + "conditions": { + "items": [ + { + "items": "reliquary:fertile_essence" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:fertile_potion" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_fertile_essence" + ] + ], + "rewards": { + "recipes": [ + "reliquary:fertile_potion" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/fortune_coin.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/fortune_coin.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/fortune_coin.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/fortune_coin.json index 86c4930c..3e2b4bb4 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/fortune_coin.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/fortune_coin.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:fortune_coin" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/frozen_core.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/frozen_core.json new file mode 100644 index 00000000..b9740f81 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/frozen_core.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_snow": { + "conditions": { + "items": [ + { + "items": "minecraft:snow" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:frozen_core" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_snow" + ] + ], + "rewards": { + "recipes": [ + "reliquary:frozen_core" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/glacial_staff.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/glacial_staff.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/glacial_staff.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/glacial_staff.json index d067780b..f9869fe7 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/glacial_staff.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/glacial_staff.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:void_tear" - ] + "items": "reliquary:void_tear" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_void_tear", - "has_the_recipe" + "has_the_recipe", + "has_void_tear" ] ], "rewards": { "recipes": [ "reliquary:glacial_staff" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/glowing_bread.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/glowing_bread.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/glowing_bread.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/glowing_bread.json index 1a6bb577..fd4a32ac 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/glowing_bread.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/glowing_bread.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:glowing_water" - ] + "items": "reliquary:glowing_water" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_glowing_water", - "has_the_recipe" + "has_the_recipe", + "has_glowing_water" ] ], "rewards": { "recipes": [ "reliquary:glowing_bread" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/glowing_water.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/glowing_water.json similarity index 78% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/glowing_water.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/glowing_water.json index b344453e..c85dd106 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/glowing_water.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/glowing_water.json @@ -5,7 +5,7 @@ "conditions": { "items": [ { - "tag": "forge:crops/nether_wart" + "items": "#c:crops/nether_wart" } ] }, @@ -20,14 +20,13 @@ }, "requirements": [ [ - "has_nether_wart", - "has_the_recipe" + "has_the_recipe", + "has_nether_wart" ] ], "rewards": { "recipes": [ "reliquary:glowing_water" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/glowing_water_from_potion_vial.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/glowing_water_from_potion_vial.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/glowing_water_from_potion_vial.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/glowing_water_from_potion_vial.json index 6d2dddae..d4952a02 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/glowing_water_from_potion_vial.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/glowing_water_from_potion_vial.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:empty_potion_vial" - ] + "items": "reliquary:empty_potion_vial" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_empty_potion_vial", - "has_the_recipe" + "has_the_recipe", + "has_empty_potion_vial" ] ], "rewards": { "recipes": [ "reliquary:glowing_water_from_potion_vial" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/gold_nugget.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/gold_nugget.json similarity index 73% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/gold_nugget.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/gold_nugget.json index aef8fcf0..288522c3 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/gold_nugget.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/gold_nugget.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:bullets/empty_bullet" - ] + "items": "reliquary:bullets/empty_bullet" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_empty_bullet", - "has_the_recipe" + "has_the_recipe", + "has_empty_bullet" ] ], "rewards": { "recipes": [ "reliquary:gold_nugget" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/grip_assembly.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/grip_assembly.json new file mode 100644 index 00000000..0f3fb3a9 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/grip_assembly.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_magma_cream": { + "conditions": { + "items": [ + { + "items": "minecraft:magma_cream" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:grip_assembly" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_magma_cream" + ] + ], + "rewards": { + "recipes": [ + "reliquary:grip_assembly" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/guardian_spike.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/guardian_spike.json new file mode 100644 index 00000000..ec9b90a8 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/guardian_spike.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_prismarine": { + "conditions": { + "items": [ + { + "items": "minecraft:prismarine_shard" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:guardian_spike" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_prismarine" + ] + ], + "rewards": { + "recipes": [ + "reliquary:guardian_spike" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/hammer_assembly.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/hammer_assembly.json new file mode 100644 index 00000000..61815106 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/hammer_assembly.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_molten_core": { + "conditions": { + "items": [ + { + "items": "reliquary:molten_core" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:hammer_assembly" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_molten_core" + ] + ], + "rewards": { + "recipes": [ + "reliquary:hammer_assembly" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/handgun.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/handgun.json new file mode 100644 index 00000000..53066333 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/handgun.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_barrel_assembly": { + "conditions": { + "items": [ + { + "items": "reliquary:barrel_assembly" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:handgun" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_barrel_assembly" + ] + ], + "rewards": { + "recipes": [ + "reliquary:handgun" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/harvest_rod.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/harvest_rod.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/harvest_rod.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/harvest_rod.json index c0f4ef01..df6e9b1b 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/harvest_rod.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/harvest_rod.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:void_tear" - ] + "items": "reliquary:void_tear" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_void_tear", - "has_the_recipe" + "has_the_recipe", + "has_void_tear" ] ], "rewards": { "recipes": [ "reliquary:harvest_rod" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/hero_medallion.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/hero_medallion.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/hero_medallion.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/hero_medallion.json index e486ab3d..92ca98d3 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/hero_medallion.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/hero_medallion.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:infernal_tear" - ] + "items": "reliquary:infernal_tear" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_infernal_tear", - "has_the_recipe" + "has_the_recipe", + "has_infernal_tear" ] ], "rewards": { "recipes": [ "reliquary:hero_medallion" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/holy_hand_grenade.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/holy_hand_grenade.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/holy_hand_grenade.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/holy_hand_grenade.json index 1d39a7ff..c5b92f10 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/holy_hand_grenade.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/holy_hand_grenade.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:glowing_water" - ] + "items": "reliquary:glowing_water" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_glowing_water", - "has_the_recipe" + "has_the_recipe", + "has_glowing_water" ] ], "rewards": { "recipes": [ "reliquary:holy_hand_grenade" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/ice_magus_rod.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/ice_magus_rod.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/ice_magus_rod.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/ice_magus_rod.json index 0a37f4ad..0843a7d7 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/ice_magus_rod.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/ice_magus_rod.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:frozen_core" - ] + "items": "reliquary:frozen_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_frozen_core", - "has_the_recipe" + "has_the_recipe", + "has_frozen_core" ] ], "rewards": { "recipes": [ "reliquary:ice_magus_rod" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_chalice.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_chalice.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_chalice.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_chalice.json index 6229d54b..4dc94708 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_chalice.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_chalice.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:emperor_chalice" - ] + "items": "reliquary:emperor_chalice" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_emperor_chalice", - "has_the_recipe" + "has_the_recipe", + "has_emperor_chalice" ] ], "rewards": { "recipes": [ "reliquary:infernal_chalice" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_claw.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_claw.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_claw.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_claw.json index 0e287b87..bc691bf1 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_claw.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_claw.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:slime_pearl" - ] + "items": "reliquary:slime_pearl" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_slime_pearl", - "has_the_recipe" + "has_the_recipe", + "has_slime_pearl" ] ], "rewards": { "recipes": [ "reliquary:infernal_claw" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_claws.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_claws.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_claws.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_claws.json index 5b2eda52..865c7f2a 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_claws.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_claws.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:infernal_claw" - ] + "items": "reliquary:infernal_claw" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_infernal_claw", - "has_the_recipe" + "has_the_recipe", + "has_infernal_claw" ] ], "rewards": { "recipes": [ "reliquary:infernal_claws" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_tear.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_tear.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_tear.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_tear.json index 7735c13a..31ff0d87 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/infernal_tear.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/infernal_tear.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:infernal_claw" - ] + "items": "reliquary:infernal_claw" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_infernal_claw", - "has_the_recipe" + "has_the_recipe", + "has_infernal_claw" ] ], "rewards": { "recipes": [ "reliquary:infernal_tear" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/interdiction_torch.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/interdiction_torch.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/interdiction_torch.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/interdiction_torch.json index b62736ee..c363cd12 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/interdiction_torch.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/interdiction_torch.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:molten_core" - ] + "items": "reliquary:molten_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_molten_core", - "has_the_recipe" + "has_the_recipe", + "has_molten_core" ] ], "rewards": { "recipes": [ "reliquary:interdiction_torch" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/kraken_shell.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/kraken_shell.json similarity index 73% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/kraken_shell.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/kraken_shell.json index d1fb5d88..83368488 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/kraken_shell.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/kraken_shell.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:kraken_shell_fragment" - ] + "items": "reliquary:kraken_shell_fragment" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_kraken_shell_fragment", - "has_the_recipe" + "has_the_recipe", + "has_kraken_shell_fragment" ] ], "rewards": { "recipes": [ "reliquary:kraken_shell" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/kraken_shell_fragment.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/kraken_shell_fragment.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/kraken_shell_fragment.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/kraken_shell_fragment.json index e14b11fd..16f31f7c 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/kraken_shell_fragment.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/kraken_shell_fragment.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:squid_beak" - ] + "items": "reliquary:squid_beak" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_squid_beak", - "has_the_recipe" + "has_the_recipe", + "has_squid_beak" ] ], "rewards": { "recipes": [ "reliquary:kraken_shell_fragment" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/lantern_of_paranoia.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/lantern_of_paranoia.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/lantern_of_paranoia.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/lantern_of_paranoia.json index 1f4d920a..e5781845 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/lantern_of_paranoia.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/lantern_of_paranoia.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:molten_core" - ] + "items": "reliquary:molten_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_molten_core", - "has_the_recipe" + "has_the_recipe", + "has_molten_core" ] ], "rewards": { "recipes": [ "reliquary:lantern_of_paranoia" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/magazines/empty_magazine.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/magazines/empty_magazine.json new file mode 100644 index 00000000..d0a4e4ed --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/magazines/empty_magazine.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_iron_ingot": { + "conditions": { + "items": [ + { + "items": "minecraft:iron_ingot" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:magazines/empty_magazine" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_iron_ingot" + ] + ], + "rewards": { + "recipes": [ + "reliquary:magazines/empty_magazine" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/magicbane.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/magicbane.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/magicbane.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/magicbane.json index 3ec10168..c939da13 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/magicbane.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/magicbane.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:magicbane" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mercy_cross.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mercy_cross.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mercy_cross.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mercy_cross.json index a2a339d9..dbe8f65c 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mercy_cross.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mercy_cross.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:withered_rib" - ] + "items": "reliquary:withered_rib" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_withered_rib", - "has_the_recipe" + "has_the_recipe", + "has_withered_rib" ] ], "rewards": { "recipes": [ "reliquary:mercy_cross" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/midas_touchstone.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/midas_touchstone.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/midas_touchstone.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/midas_touchstone.json index 9afdee92..370af3ed 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/midas_touchstone.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/midas_touchstone.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:molten_core" - ] + "items": "reliquary:molten_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_molten_core", - "has_the_recipe" + "has_the_recipe", + "has_molten_core" ] ], "rewards": { "recipes": [ "reliquary:midas_touchstone" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_belt.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_belt.json similarity index 73% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_belt.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_belt.json index 90dc3b8f..5bcc353d 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_belt.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_belt.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:mob_charm_fragment" - ] + "items": "reliquary:mob_charm_fragment" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_mob_charm_fragment", - "has_the_recipe" + "has_the_recipe", + "has_mob_charm_fragment" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_belt" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/blaze.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/blaze.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/blaze.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/blaze.json index ea89bef6..11ff70c5 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/blaze.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/blaze.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:molten_core" - ] + "items": "reliquary:molten_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_molten_core", - "has_the_recipe" + "has_the_recipe", + "has_molten_core" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/blaze" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/cave_spider.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/cave_spider.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/cave_spider.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/cave_spider.json index 9d586444..57ffbbe1 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/cave_spider.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/cave_spider.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:chelicerae" - ] + "items": "reliquary:chelicerae" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_chelicerae", - "has_the_recipe" + "has_the_recipe", + "has_chelicerae" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/cave_spider" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/creeper.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/creeper.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/creeper.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/creeper.json index bc8d83dc..12e918ff 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/creeper.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/creeper.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:catalyzing_gland" - ] + "items": "reliquary:catalyzing_gland" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_catalyzing_gland", - "has_the_recipe" + "has_the_recipe", + "has_catalyzing_gland" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/creeper" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/enderman.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/enderman.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/enderman.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/enderman.json index eea4df0e..a3d39e11 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/enderman.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/enderman.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/enderman" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/ghast.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/ghast.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/ghast.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/ghast.json index 92c057e8..42e516a9 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/ghast.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/ghast.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:catalyzing_gland" - ] + "items": "reliquary:catalyzing_gland" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_catalyzing_gland", - "has_the_recipe" + "has_the_recipe", + "has_catalyzing_gland" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/ghast" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/guardian.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/guardian.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/guardian.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/guardian.json index da088d6f..85632c3c 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/guardian.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/guardian.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:guardian_spike" - ] + "items": "reliquary:guardian_spike" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_guardian_spike", - "has_the_recipe" + "has_the_recipe", + "has_guardian_spike" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/guardian" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/magma_cube.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/magma_cube.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/magma_cube.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/magma_cube.json index 1d70ec73..b09c39f6 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/magma_cube.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/magma_cube.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:molten_core" - ] + "items": "reliquary:molten_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_molten_core", - "has_the_recipe" + "has_the_recipe", + "has_molten_core" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/magma_cube" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/skeleton.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/skeleton.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/skeleton.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/skeleton.json index 94d552c0..6c2c9524 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/skeleton.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/skeleton.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:rib_bone" - ] + "items": "reliquary:rib_bone" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_rib_bone", - "has_the_recipe" + "has_the_recipe", + "has_rib_bone" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/skeleton" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/slime.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/slime.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/slime.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/slime.json index a24b53e4..ce401346 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/slime.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/slime.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:slime_pearl" - ] + "items": "reliquary:slime_pearl" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_slime_pearl", - "has_the_recipe" + "has_the_recipe", + "has_slime_pearl" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/slime" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/spider.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/spider.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/spider.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/spider.json index 1748d0dc..4cb45e76 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/spider.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/spider.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:chelicerae" - ] + "items": "reliquary:chelicerae" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_chelicerae", - "has_the_recipe" + "has_the_recipe", + "has_chelicerae" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/spider" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/witch.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/witch.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/witch.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/witch.json index a76636d9..bcb6fa3b 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/witch.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/witch.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:witch_hat" - ] + "items": "reliquary:witch_hat" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_witch_hat", - "has_the_recipe" + "has_the_recipe", + "has_witch_hat" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/witch" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/wither_skeleton.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/wither_skeleton.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/wither_skeleton.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/wither_skeleton.json index 2e89f363..3204f6c1 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/wither_skeleton.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/wither_skeleton.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:withered_rib" - ] + "items": "reliquary:withered_rib" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_withered_rib", - "has_the_recipe" + "has_the_recipe", + "has_withered_rib" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/wither_skeleton" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/zombie.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/zombie.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/zombie.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/zombie.json index 84e544f2..dcc80dab 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/zombie.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/zombie.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:zombie_heart" - ] + "items": "reliquary:zombie_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_zombie_heart", - "has_the_recipe" + "has_the_recipe", + "has_zombie_heart" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/zombie" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/zombified_piglin.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/zombified_piglin.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/zombified_piglin.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/zombified_piglin.json index adbadab1..04338fae 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/mob_charm_fragments/zombified_piglin.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/mob_charm_fragments/zombified_piglin.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:zombie_heart" - ] + "items": "reliquary:zombie_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_zombie_heart", - "has_the_recipe" + "has_the_recipe", + "has_zombie_heart" ] ], "rewards": { "recipes": [ "reliquary:mob_charm_fragments/zombified_piglin" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/molten_core.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/molten_core.json new file mode 100644 index 00000000..d12b03d4 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/molten_core.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_magma_cream": { + "conditions": { + "items": [ + { + "items": "minecraft:magma_cream" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:molten_core" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_magma_cream" + ] + ], + "rewards": { + "recipes": [ + "reliquary:molten_core" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/nebulous_heart.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/nebulous_heart.json new file mode 100644 index 00000000..e1752b79 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/nebulous_heart.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_ender_pearl": { + "conditions": { + "items": [ + { + "items": "#c:ender_pearls" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:nebulous_heart" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_ender_pearl" + ] + ], + "rewards": { + "recipes": [ + "reliquary:nebulous_heart" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/black_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/black_pedestal.json new file mode 100644 index 00000000..3fbb8c61 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/black_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/black_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/black_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/blue_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/blue_pedestal.json new file mode 100644 index 00000000..76c355bc --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/blue_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/blue_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/blue_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/brown_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/brown_pedestal.json new file mode 100644 index 00000000..1aa07ec9 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/brown_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/brown_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/brown_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/cyan_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/cyan_pedestal.json new file mode 100644 index 00000000..83eb0cd9 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/cyan_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/cyan_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/cyan_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/gray_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/gray_pedestal.json new file mode 100644 index 00000000..34ad4012 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/gray_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/gray_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/gray_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/green_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/green_pedestal.json new file mode 100644 index 00000000..251a1611 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/green_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/green_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/green_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/light_blue_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/light_blue_pedestal.json new file mode 100644 index 00000000..e359791f --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/light_blue_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/light_blue_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/light_blue_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/light_gray_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/light_gray_pedestal.json new file mode 100644 index 00000000..35707764 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/light_gray_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/light_gray_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/light_gray_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/lime_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/lime_pedestal.json new file mode 100644 index 00000000..56cbeba0 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/lime_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/lime_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/lime_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/magenta_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/magenta_pedestal.json new file mode 100644 index 00000000..259e6619 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/magenta_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/magenta_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/magenta_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/orange_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/orange_pedestal.json new file mode 100644 index 00000000..a93738b1 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/orange_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/orange_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/orange_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/black_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/black_passive_pedestal.json new file mode 100644 index 00000000..f62aa97c --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/black_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/black_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/black_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/blue_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/blue_passive_pedestal.json new file mode 100644 index 00000000..fdfe7421 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/blue_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/blue_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/blue_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/brown_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/brown_passive_pedestal.json new file mode 100644 index 00000000..21469082 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/brown_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/brown_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/brown_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/cyan_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/cyan_passive_pedestal.json new file mode 100644 index 00000000..53c3b875 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/cyan_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/cyan_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/cyan_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/gray_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/gray_passive_pedestal.json new file mode 100644 index 00000000..ab5ba031 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/gray_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/gray_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/gray_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/green_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/green_passive_pedestal.json new file mode 100644 index 00000000..2ac18eb3 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/green_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/green_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/green_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/light_blue_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/light_blue_passive_pedestal.json new file mode 100644 index 00000000..79a0a0ad --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/light_blue_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/light_blue_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/light_blue_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/light_gray_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/light_gray_passive_pedestal.json new file mode 100644 index 00000000..91f4d003 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/light_gray_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/light_gray_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/light_gray_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/lime_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/lime_passive_pedestal.json new file mode 100644 index 00000000..b3a0fbfc --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/lime_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/lime_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/lime_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/magenta_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/magenta_passive_pedestal.json new file mode 100644 index 00000000..b2528e30 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/magenta_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/magenta_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/magenta_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/orange_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/orange_passive_pedestal.json new file mode 100644 index 00000000..d58d416e --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/orange_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/orange_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/orange_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/pink_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/pink_passive_pedestal.json new file mode 100644 index 00000000..c4104842 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/pink_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/pink_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/pink_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/purple_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/purple_passive_pedestal.json new file mode 100644 index 00000000..06147477 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/purple_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/purple_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/purple_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/red_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/red_passive_pedestal.json new file mode 100644 index 00000000..12e40209 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/red_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/red_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/red_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/white_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/white_passive_pedestal.json new file mode 100644 index 00000000..b55cc997 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/white_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/white_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/white_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/yellow_passive_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/yellow_passive_pedestal.json new file mode 100644 index 00000000..8b25d379 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/passive/yellow_passive_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_quartz_block": { + "conditions": { + "items": [ + { + "items": "minecraft:quartz_block" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/passive/yellow_passive_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_quartz_block" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/passive/yellow_passive_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/pink_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/pink_pedestal.json new file mode 100644 index 00000000..c598f0b6 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/pink_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/pink_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/pink_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/purple_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/purple_pedestal.json new file mode 100644 index 00000000..ffcedc1b --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/purple_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/purple_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/purple_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/red_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/red_pedestal.json new file mode 100644 index 00000000..97fa5cf0 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/red_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/red_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/red_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/white_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/white_pedestal.json new file mode 100644 index 00000000..b6745c7b --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/white_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/white_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/white_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/yellow_pedestal.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/yellow_pedestal.json new file mode 100644 index 00000000..81c566ec --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pedestals/yellow_pedestal.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_passive_pedestal": { + "conditions": { + "items": [ + { + "items": "reliquary:pedestals/passive/white_passive_pedestal" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:pedestals/yellow_pedestal" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_passive_pedestal" + ] + ], + "rewards": { + "recipes": [ + "reliquary:pedestals/yellow_pedestal" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/phoenix_down.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/phoenix_down.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/phoenix_down.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/phoenix_down.json index 9f17abfb..eab88c58 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/phoenix_down.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/phoenix_down.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:angelic_feather" - ] + "items": "reliquary:angelic_feather" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_angelic_feather", - "has_the_recipe" + "has_the_recipe", + "has_angelic_feather" ] ], "rewards": { "recipes": [ "reliquary:phoenix_down" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/pyromancer_staff.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/pyromancer_staff.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/pyromancer_staff.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/pyromancer_staff.json index 755e312f..b1250a75 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/pyromancer_staff.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/pyromancer_staff.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:infernal_claws" - ] + "items": "reliquary:infernal_claws" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_infernal_claws", - "has_the_recipe" + "has_the_recipe", + "has_infernal_claws" ] ], "rewards": { "recipes": [ "reliquary:pyromancer_staff" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/rending_gale.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/rending_gale.json similarity index 73% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/rending_gale.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/rending_gale.json index 4ad0ac15..aa3c07b2 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/rending_gale.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/rending_gale.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:eye_of_the_storm" - ] + "items": "reliquary:eye_of_the_storm" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_eye_of_the_storm", - "has_the_recipe" + "has_the_recipe", + "has_eye_of_the_storm" ] ], "rewards": { "recipes": [ "reliquary:rending_gale" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/rib_bone.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/rib_bone.json new file mode 100644 index 00000000..d8001024 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/rib_bone.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_bone": { + "conditions": { + "items": [ + { + "items": "#c:bones" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:rib_bone" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_bone" + ] + ], + "rewards": { + "recipes": [ + "reliquary:rib_bone" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/rod_of_lyssa.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/rod_of_lyssa.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/rod_of_lyssa.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/rod_of_lyssa.json index 43ec577a..ff63246e 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/rod_of_lyssa.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/rod_of_lyssa.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:infernal_claw" - ] + "items": "reliquary:infernal_claw" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_infernal_claw", - "has_the_recipe" + "has_the_recipe", + "has_infernal_claw" ] ], "rewards": { "recipes": [ "reliquary:rod_of_lyssa" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/salamander_eye.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/salamander_eye.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/salamander_eye.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/salamander_eye.json index 9a3eda39..944b300a 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/salamander_eye.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/salamander_eye.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:molten_core" - ] + "items": "reliquary:molten_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_molten_core", - "has_the_recipe" + "has_the_recipe", + "has_molten_core" ] ], "rewards": { "recipes": [ "reliquary:salamander_eye" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/serpent_staff.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/serpent_staff.json similarity index 73% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/serpent_staff.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/serpent_staff.json index d23e4fac..d341d30e 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/serpent_staff.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/serpent_staff.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:kraken_shell_fragment" - ] + "items": "reliquary:kraken_shell_fragment" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_kraken_shell_fragment", - "has_the_recipe" + "has_the_recipe", + "has_kraken_shell_fragment" ] ], "rewards": { "recipes": [ "reliquary:serpent_staff" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/shears_of_winter.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/shears_of_winter.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/shears_of_winter.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/shears_of_winter.json index 9de27564..ea2b7563 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/shears_of_winter.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/shears_of_winter.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:frozen_core" - ] + "items": "reliquary:frozen_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_frozen_core", - "has_the_recipe" + "has_the_recipe", + "has_frozen_core" ] ], "rewards": { "recipes": [ "reliquary:shears_of_winter" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/slime_pearl.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/slime_pearl.json new file mode 100644 index 00000000..2606816c --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/slime_pearl.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_slimeball": { + "conditions": { + "items": [ + { + "items": "#c:slimeballs" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:slime_pearl" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_slimeball" + ] + ], + "rewards": { + "recipes": [ + "reliquary:slime_pearl" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/sojourner_staff.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/sojourner_staff.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/sojourner_staff.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/sojourner_staff.json index e4305353..4c026906 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/sojourner_staff.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/sojourner_staff.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:void_tear" - ] + "items": "reliquary:void_tear" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_void_tear", - "has_the_recipe" + "has_the_recipe", + "has_void_tear" ] ], "rewards": { "recipes": [ "reliquary:sojourner_staff" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/squid_beak.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/squid_beak.json new file mode 100644 index 00000000..7c605db3 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/squid_beak.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_ink_sac": { + "conditions": { + "items": [ + { + "items": "minecraft:ink_sac" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:squid_beak" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_ink_sac" + ] + ], + "rewards": { + "recipes": [ + "reliquary:squid_beak" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/twilight_cloak.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/twilight_cloak.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/twilight_cloak.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/twilight_cloak.json index 45809efa..bca8083a 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/twilight_cloak.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/twilight_cloak.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:crimson_cloth" - ] + "items": "reliquary:crimson_cloth" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_crimson_cloth", - "has_the_recipe" + "has_the_recipe", + "has_crimson_cloth" ] ], "rewards": { "recipes": [ "reliquary:twilight_cloak" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/blaze_rod.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/blaze_rod.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/blaze_rod.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/blaze_rod.json index 29c4f8fe..687f8edf 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/blaze_rod.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/blaze_rod.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:molten_core" - ] + "items": "reliquary:molten_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_molten_core", - "has_the_recipe" + "has_the_recipe", + "has_molten_core" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/blaze_rod" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/bone.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/bone.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/bone.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/bone.json index dd85feec..9ffbfd3a 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/bone.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/bone.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:rib_bone" - ] + "items": "reliquary:rib_bone" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_rib_bone", - "has_the_recipe" + "has_the_recipe", + "has_rib_bone" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/bone" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/ender_pearl.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/ender_pearl.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/ender_pearl.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/ender_pearl.json index 79220048..3fbd6171 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/ender_pearl.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/ender_pearl.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/ender_pearl" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/ghast_tear.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/ghast_tear.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/ghast_tear.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/ghast_tear.json index eba824de..45da4f7d 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/ghast_tear.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/ghast_tear.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:catalyzing_gland" - ] + "items": "reliquary:catalyzing_gland" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_catalyzing_gland", - "has_the_recipe" + "has_the_recipe", + "has_catalyzing_gland" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/ghast_tear" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/glass_bottle.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/glass_bottle.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/glass_bottle.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/glass_bottle.json index a71b6bf8..b1aad00f 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/glass_bottle.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/glass_bottle.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:witch_hat" - ] + "items": "reliquary:witch_hat" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_witch_hat", - "has_the_recipe" + "has_the_recipe", + "has_witch_hat" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/glass_bottle" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/glowstone_dust.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/glowstone_dust.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/glowstone_dust.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/glowstone_dust.json index 867cb82f..e670c4af 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/glowstone_dust.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/glowstone_dust.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:witch_hat" - ] + "items": "reliquary:witch_hat" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_witch_hat", - "has_the_recipe" + "has_the_recipe", + "has_witch_hat" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/glowstone_dust" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gold_nugget.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gold_nugget.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gold_nugget.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gold_nugget.json index b5eda3d1..a3ab1785 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gold_nugget.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gold_nugget.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:zombie_heart" - ] + "items": "reliquary:zombie_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_zombie_heart", - "has_the_recipe" + "has_the_recipe", + "has_zombie_heart" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/gold_nugget" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gunpowder_creeper_gland.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gunpowder_creeper_gland.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gunpowder_creeper_gland.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gunpowder_creeper_gland.json index 5344527b..1f4a1aae 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gunpowder_creeper_gland.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gunpowder_creeper_gland.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:catalyzing_gland" - ] + "items": "reliquary:catalyzing_gland" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_catalyzing_gland", - "has_the_recipe" + "has_the_recipe", + "has_catalyzing_gland" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/gunpowder_creeper_gland" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gunpowder_storm_eye.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gunpowder_storm_eye.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gunpowder_storm_eye.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gunpowder_storm_eye.json index 4ec80361..2406b232 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gunpowder_storm_eye.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gunpowder_storm_eye.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:eye_of_the_storm" - ] + "items": "reliquary:eye_of_the_storm" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_eye_of_the_storm", - "has_the_recipe" + "has_the_recipe", + "has_eye_of_the_storm" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/gunpowder_storm_eye" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gunpowder_witch_hat.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gunpowder_witch_hat.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gunpowder_witch_hat.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gunpowder_witch_hat.json index e60b5ef5..8bf0b937 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/gunpowder_witch_hat.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/gunpowder_witch_hat.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:witch_hat" - ] + "items": "reliquary:witch_hat" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_witch_hat", - "has_the_recipe" + "has_the_recipe", + "has_witch_hat" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/gunpowder_witch_hat" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/ink_sac.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/ink_sac.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/ink_sac.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/ink_sac.json index 3c89404a..4a62e78e 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/ink_sac.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/ink_sac.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:squid_beak" - ] + "items": "reliquary:squid_beak" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_squid_beak", - "has_the_recipe" + "has_the_recipe", + "has_squid_beak" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/ink_sac" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/magma_cream.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/magma_cream.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/magma_cream.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/magma_cream.json index 4ee050d8..861de425 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/magma_cream.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/magma_cream.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:molten_core" - ] + "items": "reliquary:molten_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_molten_core", - "has_the_recipe" + "has_the_recipe", + "has_molten_core" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/magma_cream" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/packed_ice.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/packed_ice.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/packed_ice.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/packed_ice.json index 1928926e..f8ea2171 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/packed_ice.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/packed_ice.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:frozen_core" - ] + "items": "reliquary:frozen_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_frozen_core", - "has_the_recipe" + "has_the_recipe", + "has_frozen_core" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/packed_ice" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/prismarine_crystals.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/prismarine_crystals.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/prismarine_crystals.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/prismarine_crystals.json index 8201e3fe..8e6155cf 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/prismarine_crystals.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/prismarine_crystals.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:guardian_spike" - ] + "items": "reliquary:guardian_spike" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_guardian_spike", - "has_the_recipe" + "has_the_recipe", + "has_guardian_spike" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/prismarine_crystals" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/prismarine_shard.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/prismarine_shard.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/prismarine_shard.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/prismarine_shard.json index 5abe7934..7de2b0ad 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/prismarine_shard.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/prismarine_shard.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:guardian_spike" - ] + "items": "reliquary:guardian_spike" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_guardian_spike", - "has_the_recipe" + "has_the_recipe", + "has_guardian_spike" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/prismarine_shard" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/redstone.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/redstone.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/redstone.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/redstone.json index 9e61ebb9..8968fdf6 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/redstone.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/redstone.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:witch_hat" - ] + "items": "reliquary:witch_hat" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_witch_hat", - "has_the_recipe" + "has_the_recipe", + "has_witch_hat" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/redstone" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/rotten_flesh.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/rotten_flesh.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/rotten_flesh.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/rotten_flesh.json index f9b327b2..f6b378ed 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/rotten_flesh.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/rotten_flesh.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:zombie_heart" - ] + "items": "reliquary:zombie_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_zombie_heart", - "has_the_recipe" + "has_the_recipe", + "has_zombie_heart" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/rotten_flesh" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/slime_ball.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/slime_ball.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/slime_ball.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/slime_ball.json index 693461b0..f847840a 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/slime_ball.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/slime_ball.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:slime_pearl" - ] + "items": "reliquary:slime_pearl" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_slime_pearl", - "has_the_recipe" + "has_the_recipe", + "has_slime_pearl" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/slime_ball" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/snowball.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/snowball.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/snowball.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/snowball.json index d566db05..8fa1c65b 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/snowball.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/snowball.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:frozen_core" - ] + "items": "reliquary:frozen_core" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_frozen_core", - "has_the_recipe" + "has_the_recipe", + "has_frozen_core" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/snowball" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/spider_eye.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/spider_eye.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/spider_eye.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/spider_eye.json index 94b26c49..13219e29 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/spider_eye.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/spider_eye.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:chelicerae" - ] + "items": "reliquary:chelicerae" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_chelicerae", - "has_the_recipe" + "has_the_recipe", + "has_chelicerae" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/spider_eye" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/stick.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/stick.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/stick.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/stick.json index 7459a392..25fadc3a 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/stick.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/stick.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:witch_hat" - ] + "items": "reliquary:witch_hat" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_witch_hat", - "has_the_recipe" + "has_the_recipe", + "has_witch_hat" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/stick" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/string.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/string.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/string.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/string.json index 1c484fa4..923652c3 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/string.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/string.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:chelicerae" - ] + "items": "reliquary:chelicerae" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_chelicerae", - "has_the_recipe" + "has_the_recipe", + "has_chelicerae" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/string" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/sugar.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/sugar.json similarity index 75% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/sugar.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/sugar.json index a30fc7ac..c447d812 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/sugar.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/sugar.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:witch_hat" - ] + "items": "reliquary:witch_hat" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_witch_hat", - "has_the_recipe" + "has_the_recipe", + "has_witch_hat" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/sugar" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/wither_skeleton_skull.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/wither_skeleton_skull.json similarity index 76% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/wither_skeleton_skull.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/wither_skeleton_skull.json index 3e44e072..02c7baf2 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/uncrafting/wither_skeleton_skull.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/uncrafting/wither_skeleton_skull.json @@ -11,9 +11,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:withered_rib" - ] + "items": "reliquary:withered_rib" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_withered_rib", - "has_the_recipe" + "has_the_recipe", + "has_withered_rib" ] ], "rewards": { "recipes": [ "reliquary:uncrafting/wither_skeleton_skull" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/void_tear.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/void_tear.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/void_tear.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/void_tear.json index 138dfc05..217d6480 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/void_tear.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/void_tear.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:void_tear" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/witch_hat.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/witch_hat.json new file mode 100644 index 00000000..c123dd79 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/witch_hat.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_glowstone": { + "conditions": { + "items": [ + { + "items": "#c:dusts/glowstone" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:witch_hat" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_glowstone" + ] + ], + "rewards": { + "recipes": [ + "reliquary:witch_hat" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/withered_rib.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/withered_rib.json new file mode 100644 index 00000000..0b1dca94 --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/withered_rib.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_skeleton_skull": { + "conditions": { + "items": [ + { + "items": "minecraft:skeleton_skull" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:withered_rib" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_skeleton_skull" + ] + ], + "rewards": { + "recipes": [ + "reliquary:withered_rib" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/witherless_rose.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/witherless_rose.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/witherless_rose.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/witherless_rose.json index 3c72bd4e..3a72c167 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/witherless_rose.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/witherless_rose.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:fertile_essence" - ] + "items": "reliquary:fertile_essence" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_fertile_essence", - "has_the_recipe" + "has_the_recipe", + "has_fertile_essence" ] ], "rewards": { "recipes": [ "reliquary:witherless_rose" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/misc/wraith_node.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/wraith_node.json similarity index 74% rename from src/generated/resources/data/reliquary/advancements/recipes/misc/wraith_node.json rename to src/generated/resources/data/reliquary/advancement/recipes/misc/wraith_node.json index 54a61653..be4b2c65 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/misc/wraith_node.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/wraith_node.json @@ -5,9 +5,7 @@ "conditions": { "items": [ { - "items": [ - "reliquary:nebulous_heart" - ] + "items": "reliquary:nebulous_heart" } ] }, @@ -22,14 +20,13 @@ }, "requirements": [ [ - "has_nebulous_heart", - "has_the_recipe" + "has_the_recipe", + "has_nebulous_heart" ] ], "rewards": { "recipes": [ "reliquary:wraith_node" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancement/recipes/misc/zombie_heart.json b/src/generated/resources/data/reliquary/advancement/recipes/misc/zombie_heart.json new file mode 100644 index 00000000..d20b8b7f --- /dev/null +++ b/src/generated/resources/data/reliquary/advancement/recipes/misc/zombie_heart.json @@ -0,0 +1,37 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "parent": "minecraft:recipes/root", + "criteria": { + "has_rotten_flesh": { + "conditions": { + "items": [ + { + "items": "minecraft:rotten_flesh" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "reliquary:zombie_heart" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_rotten_flesh" + ] + ], + "rewards": { + "recipes": [ + "reliquary:zombie_heart" + ] + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/advancements/recipes/mob_charm.json b/src/generated/resources/data/reliquary/advancement/recipes/uncrafting/spawn_egg.json similarity index 58% rename from src/generated/resources/data/reliquary/advancements/recipes/mob_charm.json rename to src/generated/resources/data/reliquary/advancement/recipes/uncrafting/spawn_egg.json index 3d0d0e0d..5344a5b5 100644 --- a/src/generated/resources/data/reliquary/advancements/recipes/mob_charm.json +++ b/src/generated/resources/data/reliquary/advancement/recipes/uncrafting/spawn_egg.json @@ -1,13 +1,16 @@ { + "neoforge:conditions": [ + { + "type": "reliquary:spawn_egg_enabled" + } + ], "parent": "minecraft:recipes/root", "criteria": { "has_mob_charm_fragment": { "conditions": { "items": [ { - "items": [ - "reliquary:mob_charm_fragment" - ] + "items": "reliquary:mob_charm_fragment" } ] }, @@ -15,21 +18,20 @@ }, "has_the_recipe": { "conditions": { - "recipe": "reliquary:mob_charm" + "recipe": "reliquary:uncrafting/spawn_egg" }, "trigger": "minecraft:recipe_unlocked" } }, "requirements": [ [ - "has_mob_charm_fragment", - "has_the_recipe" + "has_the_recipe", + "has_mob_charm_fragment" ] ], "rewards": { "recipes": [ - "reliquary:mob_charm" + "reliquary:uncrafting/spawn_egg" ] - }, - "sends_telemetry_event": true + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/enchantment/severing.json b/src/generated/resources/data/reliquary/enchantment/severing.json new file mode 100644 index 00000000..c2f9a841 --- /dev/null +++ b/src/generated/resources/data/reliquary/enchantment/severing.json @@ -0,0 +1,20 @@ +{ + "anvil_cost": 6, + "description": { + "translate": "enchantment.reliquary.severing" + }, + "max_cost": { + "base": 65, + "per_level_above_first": 9 + }, + "max_level": 5, + "min_cost": { + "base": 15, + "per_level_above_first": 9 + }, + "slots": [ + "mainhand" + ], + "supported_items": "#minecraft:enchantable/sword", + "weight": 1 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/abandoned_mineshaft.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/abandoned_mineshaft.json index fd7b3628..7dc6280f 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/abandoned_mineshaft.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/abandoned_mineshaft.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/abandoned_mineshaft" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/desert_pyramid.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/desert_pyramid.json index 978253bd..7a15900e 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/desert_pyramid.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/desert_pyramid.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/desert_pyramid" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/end_city_treasure.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/end_city_treasure.json index 63caad35..4375d2a4 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/end_city_treasure.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/end_city_treasure.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/end_city_treasure" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/igloo_chest.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/igloo_chest.json index b7a5031a..9015fb95 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/igloo_chest.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/igloo_chest.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/igloo_chest" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/jungle_temple.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/jungle_temple.json index aa9c2948..b6fb136e 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/jungle_temple.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/jungle_temple.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/jungle_temple" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/nether_bridge.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/nether_bridge.json index 6eda5d07..90739a89 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/nether_bridge.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/nether_bridge.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/nether_bridge" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/simple_dungeon.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/simple_dungeon.json index 5aa6b6a9..1b3fde22 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/simple_dungeon.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/simple_dungeon.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/simple_dungeon" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_corridor.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_corridor.json index 4b791a60..49173339 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_corridor.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_corridor.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/stronghold_corridor" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_crossing.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_crossing.json index a4bfd546..65039a56 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_crossing.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_crossing.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/stronghold_crossing" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_library.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_library.json index a465a848..3f1df876 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_library.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/stronghold_library.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/stronghold_library" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/chests/village/village_weaponsmith.json b/src/generated/resources/data/reliquary/loot_modifiers/chests/village/village_weaponsmith.json index 68f195a9..3b49b31d 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/chests/village/village_weaponsmith.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/chests/village/village_weaponsmith.json @@ -5,7 +5,7 @@ "condition": "reliquary:chest_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/village/village_weaponsmith" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/bat.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/bat.json index ae3230c7..b84c2f6b 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/bat.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/bat.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/bat" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/blaze.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/blaze.json index cda3f24f..cd26b5e9 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/blaze.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/blaze.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/blaze" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/cave_spider.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/cave_spider.json index dd2e9d66..1f23694e 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/cave_spider.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/cave_spider.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/cave_spider" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/creeper.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/creeper.json index 0903fbd6..e16e5870 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/creeper.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/creeper.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/creeper" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/enderman.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/enderman.json index e933e0d5..e7b24fa9 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/enderman.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/enderman.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/enderman" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/ghast.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/ghast.json index de4de90e..bee8e41c 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/ghast.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/ghast.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/ghast" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/guardian.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/guardian.json index d6221209..2c3d113d 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/guardian.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/guardian.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/guardian" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/husk.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/husk.json index 2c8d5628..73c410f4 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/husk.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/husk.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/husk" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/magma_cube.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/magma_cube.json index 84b89f67..53a79cc6 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/magma_cube.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/magma_cube.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/magma_cube" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/skeleton.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/skeleton.json index 5f77cd0f..0af67f17 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/skeleton.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/skeleton.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/skeleton" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/slime.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/slime.json index d3a40618..3e99ff79 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/slime.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/slime.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/slime" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/snow_golem.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/snow_golem.json index c6e1957a..898f6f04 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/snow_golem.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/snow_golem.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/snow_golem" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/spider.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/spider.json index 0c883ace..5f1ce2bb 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/spider.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/spider.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/spider" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/squid.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/squid.json index 3a3621b3..7cddb212 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/squid.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/squid.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/squid" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/stray.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/stray.json index 2dd0c074..9800df0f 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/stray.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/stray.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/stray" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/witch.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/witch.json index e68ab74b..85928789 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/witch.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/witch.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/witch" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/wither_skeleton.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/wither_skeleton.json index e5873392..1514d993 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/wither_skeleton.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/wither_skeleton.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/wither_skeleton" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/zombie.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/zombie.json index 8b4575b7..14d457aa 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/zombie.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/zombie.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/zombie" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/zombie_villager.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/zombie_villager.json index 0051354d..6b76dd84 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/zombie_villager.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/zombie_villager.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/zombie_villager" } ], diff --git a/src/generated/resources/data/reliquary/loot_modifiers/entities/zombified_piglin.json b/src/generated/resources/data/reliquary/loot_modifiers/entities/zombified_piglin.json index a86acb5f..2a4a88f3 100644 --- a/src/generated/resources/data/reliquary/loot_modifiers/entities/zombified_piglin.json +++ b/src/generated/resources/data/reliquary/loot_modifiers/entities/zombified_piglin.json @@ -5,7 +5,7 @@ "condition": "reliquary:entity_loot_enabled" }, { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:entities/zombified_piglin" } ], diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/alkahestry_altar.json b/src/generated/resources/data/reliquary/loot_table/blocks/alkahestry_altar.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/alkahestry_altar.json rename to src/generated/resources/data/reliquary/loot_table/blocks/alkahestry_altar.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/apothecary_cauldron.json b/src/generated/resources/data/reliquary/loot_table/blocks/apothecary_cauldron.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/apothecary_cauldron.json rename to src/generated/resources/data/reliquary/loot_table/blocks/apothecary_cauldron.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/apothecary_mortar.json b/src/generated/resources/data/reliquary/loot_table/blocks/apothecary_mortar.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/apothecary_mortar.json rename to src/generated/resources/data/reliquary/loot_table/blocks/apothecary_mortar.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/fertile_lily_pad.json b/src/generated/resources/data/reliquary/loot_table/blocks/fertile_lily_pad.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/fertile_lily_pad.json rename to src/generated/resources/data/reliquary/loot_table/blocks/fertile_lily_pad.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/interdiction_torch.json b/src/generated/resources/data/reliquary/loot_table/blocks/interdiction_torch.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/interdiction_torch.json rename to src/generated/resources/data/reliquary/loot_table/blocks/interdiction_torch.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/black_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/black_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/black_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/black_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/blue_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/blue_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/blue_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/blue_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/brown_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/brown_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/brown_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/brown_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/cyan_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/cyan_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/cyan_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/cyan_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/gray_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/gray_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/gray_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/gray_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/green_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/green_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/green_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/green_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/light_blue_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/light_blue_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/light_blue_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/light_blue_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/light_gray_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/light_gray_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/light_gray_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/light_gray_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/lime_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/lime_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/lime_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/lime_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/magenta_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/magenta_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/magenta_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/magenta_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/orange_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/orange_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/orange_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/orange_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/black_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/black_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/black_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/black_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/blue_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/blue_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/blue_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/blue_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/brown_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/brown_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/brown_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/brown_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/cyan_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/cyan_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/cyan_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/cyan_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/gray_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/gray_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/gray_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/gray_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/green_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/green_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/green_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/green_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/light_blue_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/light_blue_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/light_blue_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/light_blue_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/light_gray_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/light_gray_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/light_gray_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/light_gray_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/lime_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/lime_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/lime_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/lime_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/magenta_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/magenta_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/magenta_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/magenta_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/orange_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/orange_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/orange_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/orange_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/pink_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/pink_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/pink_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/pink_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/purple_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/purple_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/purple_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/purple_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/red_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/red_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/red_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/red_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/white_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/white_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/white_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/white_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/yellow_passive_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/yellow_passive_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/passive/yellow_passive_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/passive/yellow_passive_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/pink_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/pink_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/pink_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/pink_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/purple_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/purple_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/purple_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/purple_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/red_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/red_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/red_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/red_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/white_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/white_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/white_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/white_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/yellow_pedestal.json b/src/generated/resources/data/reliquary/loot_table/blocks/pedestals/yellow_pedestal.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/pedestals/yellow_pedestal.json rename to src/generated/resources/data/reliquary/loot_table/blocks/pedestals/yellow_pedestal.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/wall_interdiction_torch.json b/src/generated/resources/data/reliquary/loot_table/blocks/wall_interdiction_torch.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/wall_interdiction_torch.json rename to src/generated/resources/data/reliquary/loot_table/blocks/wall_interdiction_torch.json diff --git a/src/generated/resources/data/reliquary/loot_tables/blocks/wraith_node.json b/src/generated/resources/data/reliquary/loot_table/blocks/wraith_node.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/blocks/wraith_node.json rename to src/generated/resources/data/reliquary/loot_table/blocks/wraith_node.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/abandoned_mineshaft.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/abandoned_mineshaft.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/abandoned_mineshaft.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/abandoned_mineshaft.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/desert_pyramid.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/desert_pyramid.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/desert_pyramid.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/desert_pyramid.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/end_city_treasure.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/end_city_treasure.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/end_city_treasure.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/end_city_treasure.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/igloo_chest.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/igloo_chest.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/igloo_chest.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/igloo_chest.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/jungle_temple.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/jungle_temple.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/jungle_temple.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/jungle_temple.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/nether_bridge.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/nether_bridge.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/nether_bridge.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/nether_bridge.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/simple_dungeon.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/simple_dungeon.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/simple_dungeon.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/simple_dungeon.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/stronghold_corridor.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/stronghold_corridor.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/stronghold_corridor.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/stronghold_corridor.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/stronghold_crossing.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/stronghold_crossing.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/stronghold_crossing.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/stronghold_crossing.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/stronghold_library.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/stronghold_library.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/stronghold_library.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/stronghold_library.json diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/chests/village/village_weaponsmith.json b/src/generated/resources/data/reliquary/loot_table/inject/chests/village/village_weaponsmith.json similarity index 100% rename from src/generated/resources/data/reliquary/loot_tables/inject/chests/village/village_weaponsmith.json rename to src/generated/resources/data/reliquary/loot_table/inject/chests/village/village_weaponsmith.json diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/bat.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/bat.json new file mode 100644 index 00000000..9d04712f --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/bat.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:bat_wing" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:bat_wing" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/bat" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/blaze.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/blaze.json new file mode 100644 index 00000000..bfc9879d --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/blaze.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.07, + "per_level_above_first": 0.04 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.03 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:molten_core" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.14999999, + "per_level_above_first": 0.12 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.03 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:molten_core" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/blaze" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/cave_spider.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/cave_spider.json new file mode 100644 index 00000000..fe46118c --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/cave_spider.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.07, + "per_level_above_first": 0.04 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.03 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:chelicerae" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.14999999, + "per_level_above_first": 0.12 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.03 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:chelicerae" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/cave_spider" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/creeper.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/creeper.json new file mode 100644 index 00000000..0efc1f3b --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/creeper.json @@ -0,0 +1,124 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:catalyzing_gland" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:catalyzing_gland" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.08, + "per_level_above_first": 0.05 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.03 + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "nbt": "{powered:1b}" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:eye_of_the_storm" + } + ], + "name": "reliquary_powered_creeper_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.18, + "per_level_above_first": 0.15 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.03 + }, + { + "condition": "minecraft:entity_properties", + "entity": "this", + "predicate": { + "nbt": "{powered:1b}" + } + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:eye_of_the_storm" + } + ], + "name": "reliquary_powered_creeper_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/creeper" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/enderman.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/enderman.json new file mode 100644 index 00000000..c01f4fee --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/enderman.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:nebulous_heart" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:nebulous_heart" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/enderman" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/ghast.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/ghast.json new file mode 100644 index 00000000..349da7f8 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/ghast.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.07, + "per_level_above_first": 0.04 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.03 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:catalyzing_gland" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.14999999, + "per_level_above_first": 0.12 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.03 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:catalyzing_gland" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/ghast" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/guardian.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/guardian.json new file mode 100644 index 00000000..dee35c38 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/guardian.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:guardian_spike" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:guardian_spike" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/guardian" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/husk.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/husk.json new file mode 100644 index 00000000..83c67407 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/husk.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:zombie_heart" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:zombie_heart" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/husk" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/magma_cube.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/magma_cube.json new file mode 100644 index 00000000..5c24473b --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/magma_cube.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:molten_core" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:molten_core" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/magma_cube" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/skeleton.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/skeleton.json new file mode 100644 index 00000000..68a2dd45 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/skeleton.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:rib_bone" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:rib_bone" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/skeleton" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/slime.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/slime.json new file mode 100644 index 00000000..73a890ba --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/slime.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:slime_pearl" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:slime_pearl" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/slime" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/snow_golem.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/snow_golem.json new file mode 100644 index 00000000..b64b4232 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/snow_golem.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:frozen_core" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:frozen_core" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/snow_golem" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/spider.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/spider.json new file mode 100644 index 00000000..7bafc103 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/spider.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:chelicerae" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:chelicerae" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/spider" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/squid.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/squid.json new file mode 100644 index 00000000..4ee04894 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/squid.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:squid_beak" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:squid_beak" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/squid" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/stray.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/stray.json new file mode 100644 index 00000000..92584628 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/stray.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:rib_bone" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:rib_bone" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/stray" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/witch.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/witch.json new file mode 100644 index 00000000..a49a5a3e --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/witch.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:witch_hat" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:witch_hat" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/witch" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/wither_skeleton.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/wither_skeleton.json new file mode 100644 index 00000000..89a7b6ee --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/wither_skeleton.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:withered_rib" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:withered_rib" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/wither_skeleton" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/zombie.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/zombie.json new file mode 100644 index 00000000..e3a254a8 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/zombie.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:zombie_heart" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:zombie_heart" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/zombie" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/zombie_villager.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/zombie_villager.json new file mode 100644 index 00000000..8f747338 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/zombie_villager.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.049999997, + "per_level_above_first": 0.03 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:zombie_heart" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.120000005, + "per_level_above_first": 0.1 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.02 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:zombie_heart" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/zombie_villager" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_table/inject/entities/zombified_piglin.json b/src/generated/resources/data/reliquary/loot_table/inject/entities/zombified_piglin.json new file mode 100644 index 00000000..bdba9e41 --- /dev/null +++ b/src/generated/resources/data/reliquary/loot_table/inject/entities/zombified_piglin.json @@ -0,0 +1,58 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.07, + "per_level_above_first": 0.04 + }, + "enchantment": "minecraft:looting", + "unenchanted_chance": 0.03 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:zombie_heart" + } + ], + "name": "reliquary_looting", + "rolls": 1.0 + }, + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:killed_by_player" + }, + { + "condition": "minecraft:random_chance_with_enchanted_bonus", + "enchanted_chance": { + "type": "minecraft:linear", + "base": 0.14999999, + "per_level_above_first": 0.12 + }, + "enchantment": "reliquary:severing", + "unenchanted_chance": 0.03 + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "reliquary:zombie_heart" + } + ], + "name": "reliquary_severing", + "rolls": 1.0 + } + ], + "random_sequence": "reliquary:inject/entities/zombified_piglin" +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/bat.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/bat.json deleted file mode 100644 index 600ef6d1..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/bat.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:bat_wing" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/bat" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/blaze.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/blaze.json deleted file mode 100644 index af6b4035..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/blaze.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.03, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.04, - "severing_multiplier": 0.12 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:molten_core" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/blaze" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/cave_spider.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/cave_spider.json deleted file mode 100644 index 5472b8ad..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/cave_spider.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.03, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.04, - "severing_multiplier": 0.12 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:chelicerae" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/cave_spider" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/creeper.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/creeper.json deleted file mode 100644 index 9cd17bd8..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/creeper.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:catalyzing_gland" - } - ], - "name": "main", - "rolls": 1.0 - }, - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "nbt": "{powered:1b}" - } - }, - { - "chance": 0.03, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.05, - "severing_multiplier": 0.15 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:eye_of_the_storm" - } - ], - "name": "powered_creeper", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/creeper" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/enderman.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/enderman.json deleted file mode 100644 index d472fad9..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/enderman.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:nebulous_heart" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/enderman" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/ghast.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/ghast.json deleted file mode 100644 index f5cb9edd..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/ghast.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.03, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.04, - "severing_multiplier": 0.12 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:catalyzing_gland" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/ghast" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/guardian.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/guardian.json deleted file mode 100644 index 97f9a4f2..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/guardian.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:guardian_spike" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/guardian" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/husk.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/husk.json deleted file mode 100644 index 16b3d7ff..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/husk.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:zombie_heart" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/husk" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/magma_cube.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/magma_cube.json deleted file mode 100644 index 5c76a113..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/magma_cube.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:molten_core" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/magma_cube" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/skeleton.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/skeleton.json deleted file mode 100644 index 6586ee47..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/skeleton.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:rib_bone" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/skeleton" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/slime.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/slime.json deleted file mode 100644 index 97dd277f..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/slime.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:slime_pearl" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/slime" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/snow_golem.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/snow_golem.json deleted file mode 100644 index 7d63bcb9..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/snow_golem.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:frozen_core" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/snow_golem" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/spider.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/spider.json deleted file mode 100644 index 192ae612..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/spider.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:chelicerae" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/spider" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/squid.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/squid.json deleted file mode 100644 index 17071e03..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/squid.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:squid_beak" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/squid" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/stray.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/stray.json deleted file mode 100644 index 34acd8d2..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/stray.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:rib_bone" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/stray" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/witch.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/witch.json deleted file mode 100644 index db08113e..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/witch.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:witch_hat" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/witch" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/wither_skeleton.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/wither_skeleton.json deleted file mode 100644 index 23d4b767..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/wither_skeleton.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:withered_rib" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/wither_skeleton" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/zombie.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/zombie.json deleted file mode 100644 index 624174f9..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/zombie.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:zombie_heart" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/zombie" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/zombie_villager.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/zombie_villager.json deleted file mode 100644 index 75ece6ee..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/zombie_villager.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.02, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.03, - "severing_multiplier": 0.1 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:zombie_heart" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/zombie_villager" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/loot_tables/inject/entities/zombified_piglin.json b/src/generated/resources/data/reliquary/loot_tables/inject/entities/zombified_piglin.json deleted file mode 100644 index bdd4e9d8..00000000 --- a/src/generated/resources/data/reliquary/loot_tables/inject/entities/zombified_piglin.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "type": "minecraft:entity", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:killed_by_player" - }, - { - "chance": 0.03, - "condition": "reliquary:random_chance_looting_severing", - "looting_multiplier": 0.04, - "severing_multiplier": 0.12 - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "reliquary:zombie_heart" - } - ], - "name": "main", - "rolls": 1.0 - } - ], - "random_sequence": "reliquary:inject/entities/zombified_piglin" -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/charging/glowstone.json b/src/generated/resources/data/reliquary/recipe/alkahestry/charging/glowstone.json new file mode 100644 index 00000000..678753f0 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/charging/glowstone.json @@ -0,0 +1,12 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_charging", + "charge": 4, + "ingredient": { + "item": "minecraft:glowstone" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/charging/glowstone_dust.json b/src/generated/resources/data/reliquary/recipe/alkahestry/charging/glowstone_dust.json new file mode 100644 index 00000000..6fefae26 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/charging/glowstone_dust.json @@ -0,0 +1,12 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_charging", + "charge": 1, + "ingredient": { + "item": "minecraft:glowstone_dust" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/charging/redstone.json b/src/generated/resources/data/reliquary/recipe/alkahestry/charging/redstone.json new file mode 100644 index 00000000..de9fb114 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/charging/redstone.json @@ -0,0 +1,12 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_charging", + "charge": 1, + "ingredient": { + "item": "minecraft:redstone" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/charging/redstone_block.json b/src/generated/resources/data/reliquary/recipe/alkahestry/charging/redstone_block.json new file mode 100644 index 00000000..43bf8cf7 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/charging/redstone_block.json @@ -0,0 +1,12 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_charging", + "charge": 9, + "ingredient": { + "item": "minecraft:redstone_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/charcoal.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/charcoal.json new file mode 100644 index 00000000..86a7cb39 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/charcoal.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 4, + "ingredient": { + "item": "minecraft:charcoal" + }, + "result_count": 5 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/clay.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/clay.json new file mode 100644 index 00000000..d32c3e5a --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/clay.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 4, + "ingredient": { + "item": "minecraft:clay" + }, + "result_count": 3 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/copper_ingot.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/copper_ingot.json new file mode 100644 index 00000000..582c5adb --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/copper_ingot.json @@ -0,0 +1,20 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "forge:ingots/copper" + } + }, + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 8, + "ingredient": { + "tag": "forge:ingots/copper" + }, + "result_count": 5 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/diamond.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/diamond.json new file mode 100644 index 00000000..efdee611 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/diamond.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 64, + "ingredient": { + "tag": "c:gems/diamond" + }, + "result_count": 2 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/dirt.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/dirt.json new file mode 100644 index 00000000..3dd32af6 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/dirt.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 4, + "ingredient": { + "item": "minecraft:dirt" + }, + "result_count": 33 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/emerald.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/emerald.json new file mode 100644 index 00000000..2469fefe --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/emerald.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 32, + "ingredient": { + "tag": "c:gems/emerald" + }, + "result_count": 2 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/end_stone.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/end_stone.json new file mode 100644 index 00000000..0adf9fc1 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/end_stone.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 8, + "ingredient": { + "tag": "c:end_stones" + }, + "result_count": 17 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/flint.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/flint.json new file mode 100644 index 00000000..858e340f --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/flint.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 8, + "ingredient": { + "item": "minecraft:flint" + }, + "result_count": 9 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/gold_ingot.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/gold_ingot.json new file mode 100644 index 00000000..3b777371 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/gold_ingot.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 32, + "ingredient": { + "tag": "c:ingots/gold" + }, + "result_count": 2 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/gravel.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/gravel.json new file mode 100644 index 00000000..8c012513 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/gravel.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 4, + "ingredient": { + "tag": "c:gravels" + }, + "result_count": 17 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/gunpowder.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/gunpowder.json new file mode 100644 index 00000000..d92e665a --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/gunpowder.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 8, + "ingredient": { + "tag": "c:gunpowders" + }, + "result_count": 3 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/iron_ingot.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/iron_ingot.json new file mode 100644 index 00000000..bdc089f6 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/iron_ingot.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 32, + "ingredient": { + "tag": "c:ingots/iron" + }, + "result_count": 2 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/lapis_lazuli.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/lapis_lazuli.json new file mode 100644 index 00000000..a36a4a74 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/lapis_lazuli.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 4, + "ingredient": { + "tag": "c:gems/lapis" + }, + "result_count": 2 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/nether_star.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/nether_star.json new file mode 100644 index 00000000..24ec3700 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/nether_star.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 256, + "ingredient": { + "tag": "c:nether_stars" + }, + "result_count": 2 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/netherrack.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/netherrack.json new file mode 100644 index 00000000..fb3c65d2 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/netherrack.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 4, + "ingredient": { + "tag": "c:netherracks" + }, + "result_count": 9 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/obsidian.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/obsidian.json new file mode 100644 index 00000000..8e994dda --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/obsidian.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 8, + "ingredient": { + "tag": "c:obsidians" + }, + "result_count": 5 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/sand.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/sand.json new file mode 100644 index 00000000..f598dcda --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/sand.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 4, + "ingredient": { + "tag": "c:sands" + }, + "result_count": 33 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/sandstone.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/sandstone.json new file mode 100644 index 00000000..97dbcfdd --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/sandstone.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 4, + "ingredient": { + "tag": "c:sandstone/blocks" + }, + "result_count": 9 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/silver_ingot.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/silver_ingot.json new file mode 100644 index 00000000..985328aa --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/silver_ingot.json @@ -0,0 +1,20 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "forge:ingots/silver" + } + }, + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 32, + "ingredient": { + "tag": "forge:ingots/silver" + }, + "result_count": 2 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/soul_sand.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/soul_sand.json new file mode 100644 index 00000000..c09e7d3d --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/soul_sand.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 8, + "ingredient": { + "item": "minecraft:soul_sand" + }, + "result_count": 9 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/steel_ingot.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/steel_ingot.json new file mode 100644 index 00000000..e577e9dd --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/steel_ingot.json @@ -0,0 +1,20 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "forge:ingots/steel" + } + }, + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 32, + "ingredient": { + "tag": "forge:ingots/steel" + }, + "result_count": 2 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/tin_ingot.json b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/tin_ingot.json new file mode 100644 index 00000000..12263416 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/crafting/tin_ingot.json @@ -0,0 +1,20 @@ +{ + "neoforge:conditions": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "forge:ingots/tin" + } + }, + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_crafting", + "charge": 32, + "ingredient": { + "tag": "forge:ingots/tin" + }, + "result_count": 2 +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry/drain/redstone.json b/src/generated/resources/data/reliquary/recipe/alkahestry/drain/redstone.json new file mode 100644 index 00000000..444b2f51 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry/drain/redstone.json @@ -0,0 +1,13 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "reliquary:alkahestry_drain", + "charge": 1, + "result": { + "count": 1, + "id": "minecraft:redstone" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry_altar.json b/src/generated/resources/data/reliquary/recipe/alkahestry_altar.json similarity index 77% rename from src/generated/resources/data/reliquary/recipes/alkahestry_altar.json rename to src/generated/resources/data/reliquary/recipe/alkahestry_altar.json index ab751683..ce20df08 100644 --- a/src/generated/resources/data/reliquary/recipes/alkahestry_altar.json +++ b/src/generated/resources/data/reliquary/recipe/alkahestry_altar.json @@ -3,7 +3,7 @@ "category": "misc", "ingredients": [ { - "tag": "forge:obsidian" + "tag": "c:obsidians" }, { "item": "minecraft:redstone_lamp" @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:alkahestry_altar" + "count": 1, + "id": "reliquary:alkahestry_altar" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/alkahestry_tome.json b/src/generated/resources/data/reliquary/recipe/alkahestry_tome.json new file mode 100644 index 00000000..29f16fc3 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/alkahestry_tome.json @@ -0,0 +1,42 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:alkahestry_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "reliquary:molten_core" + }, + { + "item": "reliquary:witch_hat" + }, + { + "item": "reliquary:eye_of_the_storm" + }, + { + "item": "reliquary:catalyzing_gland" + }, + { + "item": "minecraft:book" + }, + { + "item": "reliquary:slime_pearl" + }, + { + "item": "reliquary:chelicerae" + }, + { + "item": "minecraft:wither_skeleton_skull" + }, + { + "item": "reliquary:nebulous_heart" + } + ], + "result": { + "count": 1, + "id": "reliquary:alkahestry_tome" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/angelheart_vial.json b/src/generated/resources/data/reliquary/recipe/angelheart_vial.json similarity index 76% rename from src/generated/resources/data/reliquary/recipes/angelheart_vial.json rename to src/generated/resources/data/reliquary/recipe/angelheart_vial.json index b5f4ce3f..dae2c66c 100644 --- a/src/generated/resources/data/reliquary/recipes/angelheart_vial.json +++ b/src/generated/resources/data/reliquary/recipe/angelheart_vial.json @@ -12,7 +12,7 @@ "item": "reliquary:fertile_essence" }, "G": { - "tag": "forge:glass_panes" + "tag": "c:glass_panes" } }, "pattern": [ @@ -21,7 +21,7 @@ "FGF" ], "result": { - "item": "reliquary:angelheart_vial" - }, - "show_notification": true + "count": 1, + "id": "reliquary:angelheart_vial" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/angelic_feather.json b/src/generated/resources/data/reliquary/recipe/angelic_feather.json similarity index 77% rename from src/generated/resources/data/reliquary/recipes/angelic_feather.json rename to src/generated/resources/data/reliquary/recipe/angelic_feather.json index 02740e18..3360864f 100644 --- a/src/generated/resources/data/reliquary/recipes/angelic_feather.json +++ b/src/generated/resources/data/reliquary/recipe/angelic_feather.json @@ -3,7 +3,7 @@ "category": "misc", "ingredients": [ { - "tag": "forge:feathers" + "tag": "c:feathers" }, { "item": "reliquary:nebulous_heart" @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:angelic_feather" + "count": 1, + "id": "reliquary:angelic_feather" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/aphrodite_potion.json b/src/generated/resources/data/reliquary/recipe/aphrodite_potion.json new file mode 100644 index 00000000..b2e269bf --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/aphrodite_potion.json @@ -0,0 +1,35 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:water_bucket" + }, + "C": { + "item": "minecraft:cocoa_beans" + }, + "F": { + "item": "reliquary:fertile_essence" + }, + "G": { + "tag": "c:glass_panes" + }, + "R": { + "tag": "c:dyes/red" + } + }, + "pattern": [ + "GBG", + "GFG", + "RGC" + ], + "result": { + "count": 1, + "id": "reliquary:aphrodite_potion" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/apothecary_cauldron.json b/src/generated/resources/data/reliquary/recipe/apothecary_cauldron.json new file mode 100644 index 00000000..b9637165 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/apothecary_cauldron.json @@ -0,0 +1,35 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:cauldron" + }, + "G": { + "item": "reliquary:catalyzing_gland" + }, + "I": { + "item": "reliquary:infernal_claw" + }, + "M": { + "item": "reliquary:molten_core" + }, + "N": { + "item": "reliquary:nebulous_heart" + } + }, + "pattern": [ + "GNG", + "ICI", + "NMN" + ], + "result": { + "count": 1, + "id": "reliquary:apothecary_cauldron" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/apothecary_mortar.json b/src/generated/resources/data/reliquary/recipe/apothecary_mortar.json new file mode 100644 index 00000000..37986a62 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/apothecary_mortar.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "item": "reliquary:catalyzing_gland" + }, + "N": { + "item": "minecraft:quartz_block" + } + }, + "pattern": [ + "GNG", + "NGN", + "NNN" + ], + "result": { + "count": 1, + "id": "reliquary:apothecary_mortar" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/barrel_assembly.json b/src/generated/resources/data/reliquary/recipe/barrel_assembly.json new file mode 100644 index 00000000..4a9192bc --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/barrel_assembly.json @@ -0,0 +1,29 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "E": { + "item": "reliquary:nebulous_heart" + }, + "I": { + "tag": "c:ingots/iron" + }, + "M": { + "item": "minecraft:magma_cream" + } + }, + "pattern": [ + "III", + "EME", + "III" + ], + "result": { + "count": 1, + "id": "reliquary:barrel_assembly" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bat_wing.json b/src/generated/resources/data/reliquary/recipe/bat_wing.json new file mode 100644 index 00000000..4a52a7a9 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bat_wing.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "F": { + "tag": "c:feathers" + }, + "G": { + "tag": "c:ingots/gold" + } + }, + "pattern": [ + "GGG", + "GFG", + "GGG" + ], + "result": { + "count": 1, + "id": "reliquary:bat_wing" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/blaze_bullet.json b/src/generated/resources/data/reliquary/recipe/bullets/blaze_bullet.json new file mode 100644 index 00000000..740c41e1 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/blaze_bullet.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "minecraft:blaze_powder" + }, + { + "tag": "c:rods/blaze" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:nuggets/gold" + } + ], + "result": { + "count": 8, + "id": "reliquary:bullets/blaze_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/blaze_bullet_potion.json b/src/generated/resources/data/reliquary/recipe/bullets/blaze_bullet_potion.json new file mode 100644 index 00000000..e4a06932 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/blaze_bullet_potion.json @@ -0,0 +1,29 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + }, + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.2, + "key": { + "B": { + "item": "reliquary:bullets/blaze_bullet" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "BBB", + "BPB", + "BBB" + ], + "result": { + "count": 8, + "id": "reliquary:bullets/blaze_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/buster_bullet.json b/src/generated/resources/data/reliquary/recipe/bullets/buster_bullet.json new file mode 100644 index 00000000..3ef319be --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/buster_bullet.json @@ -0,0 +1,42 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "reliquary:bullets/concussive_bullet" + }, + { + "item": "reliquary:bullets/concussive_bullet" + }, + { + "item": "reliquary:bullets/concussive_bullet" + }, + { + "item": "reliquary:bullets/concussive_bullet" + }, + { + "item": "reliquary:bullets/concussive_bullet" + }, + { + "item": "reliquary:bullets/concussive_bullet" + }, + { + "item": "reliquary:bullets/concussive_bullet" + }, + { + "item": "reliquary:bullets/concussive_bullet" + }, + { + "item": "reliquary:catalyzing_gland" + } + ], + "result": { + "count": 8, + "id": "reliquary:bullets/buster_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/buster_bullet_potion.json b/src/generated/resources/data/reliquary/recipe/bullets/buster_bullet_potion.json new file mode 100644 index 00000000..5cadb1c5 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/buster_bullet_potion.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.2, + "key": { + "B": { + "item": "reliquary:bullets/buster_bullet" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "BBB", + "BPB", + "BBB" + ], + "result": { + "count": 8, + "id": "reliquary:bullets/buster_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/concussive_bullet.json b/src/generated/resources/data/reliquary/recipe/bullets/concussive_bullet.json new file mode 100644 index 00000000..e24298cf --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/concussive_bullet.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "c:slimeballs" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:gunpowders" + } + ], + "result": { + "count": 8, + "id": "reliquary:bullets/concussive_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/concussive_bullet_potion.json b/src/generated/resources/data/reliquary/recipe/bullets/concussive_bullet_potion.json new file mode 100644 index 00000000..c60d64af --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/concussive_bullet_potion.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.2, + "key": { + "B": { + "item": "reliquary:bullets/concussive_bullet" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "BBB", + "BPB", + "BBB" + ], + "result": { + "count": 8, + "id": "reliquary:bullets/concussive_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/ender_bullet.json b/src/generated/resources/data/reliquary/recipe/bullets/ender_bullet.json new file mode 100644 index 00000000..177649f4 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/ender_bullet.json @@ -0,0 +1,42 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "reliquary:bullets/seeker_bullet" + }, + { + "item": "reliquary:bullets/seeker_bullet" + }, + { + "item": "reliquary:bullets/seeker_bullet" + }, + { + "item": "reliquary:bullets/seeker_bullet" + }, + { + "item": "reliquary:bullets/seeker_bullet" + }, + { + "item": "reliquary:bullets/seeker_bullet" + }, + { + "item": "reliquary:bullets/seeker_bullet" + }, + { + "item": "reliquary:bullets/seeker_bullet" + }, + { + "item": "reliquary:nebulous_heart" + } + ], + "result": { + "count": 8, + "id": "reliquary:bullets/ender_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/ender_bullet_potion.json b/src/generated/resources/data/reliquary/recipe/bullets/ender_bullet_potion.json new file mode 100644 index 00000000..1f65850b --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/ender_bullet_potion.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.2, + "key": { + "B": { + "item": "reliquary:bullets/ender_bullet" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "BBB", + "BPB", + "BBB" + ], + "result": { + "count": 8, + "id": "reliquary:bullets/ender_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/exorcism_bullet.json b/src/generated/resources/data/reliquary/recipe/bullets/exorcism_bullet.json new file mode 100644 index 00000000..2cc4fdf7 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/exorcism_bullet.json @@ -0,0 +1,42 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "reliquary:bullets/neutral_bullet" + }, + { + "item": "reliquary:bullets/neutral_bullet" + }, + { + "item": "reliquary:bullets/neutral_bullet" + }, + { + "item": "reliquary:bullets/neutral_bullet" + }, + { + "item": "reliquary:bullets/neutral_bullet" + }, + { + "item": "reliquary:bullets/neutral_bullet" + }, + { + "item": "reliquary:bullets/neutral_bullet" + }, + { + "item": "reliquary:bullets/neutral_bullet" + }, + { + "item": "reliquary:zombie_heart" + } + ], + "result": { + "count": 8, + "id": "reliquary:bullets/exorcism_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/exorcism_bullet_potion.json b/src/generated/resources/data/reliquary/recipe/bullets/exorcism_bullet_potion.json new file mode 100644 index 00000000..2c208c0a --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/exorcism_bullet_potion.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.2, + "key": { + "B": { + "item": "reliquary:bullets/exorcism_bullet" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "BBB", + "BPB", + "BBB" + ], + "result": { + "count": 8, + "id": "reliquary:bullets/exorcism_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/neutral_bullet.json b/src/generated/resources/data/reliquary/recipe/bullets/neutral_bullet.json new file mode 100644 index 00000000..ef527296 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/neutral_bullet.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "minecraft:flint" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:gunpowders" + } + ], + "result": { + "count": 8, + "id": "reliquary:bullets/neutral_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/neutral_bullet_potion.json b/src/generated/resources/data/reliquary/recipe/bullets/neutral_bullet_potion.json new file mode 100644 index 00000000..29f5105e --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/neutral_bullet_potion.json @@ -0,0 +1,29 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + }, + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.2, + "key": { + "B": { + "item": "reliquary:bullets/neutral_bullet" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "BBB", + "BPB", + "BBB" + ], + "result": { + "count": 8, + "id": "reliquary:bullets/neutral_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/sand_bullet.json b/src/generated/resources/data/reliquary/recipe/bullets/sand_bullet.json new file mode 100644 index 00000000..b18cd2aa --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/sand_bullet.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "c:sandstone/blocks" + }, + { + "tag": "c:slimeballs" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:gunpowders" + } + ], + "result": { + "count": 8, + "id": "reliquary:bullets/sand_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/sand_bullet_potion.json b/src/generated/resources/data/reliquary/recipe/bullets/sand_bullet_potion.json new file mode 100644 index 00000000..97da3f68 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/sand_bullet_potion.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.2, + "key": { + "B": { + "item": "reliquary:bullets/sand_bullet" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "BBB", + "BPB", + "BBB" + ], + "result": { + "count": 8, + "id": "reliquary:bullets/sand_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/seeker_bullet.json b/src/generated/resources/data/reliquary/recipe/bullets/seeker_bullet.json new file mode 100644 index 00000000..04410971 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/seeker_bullet.json @@ -0,0 +1,27 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "c:gems/lapis" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:gunpowders" + } + ], + "result": { + "count": 8, + "id": "reliquary:bullets/seeker_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/seeker_bullet_potion.json b/src/generated/resources/data/reliquary/recipe/bullets/seeker_bullet_potion.json new file mode 100644 index 00000000..0dcf1b93 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/seeker_bullet_potion.json @@ -0,0 +1,29 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + }, + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.2, + "key": { + "B": { + "item": "reliquary:bullets/seeker_bullet" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "BBB", + "BPB", + "BBB" + ], + "result": { + "count": 8, + "id": "reliquary:bullets/seeker_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/storm_bullet.json b/src/generated/resources/data/reliquary/recipe/bullets/storm_bullet.json new file mode 100644 index 00000000..29209992 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/storm_bullet.json @@ -0,0 +1,30 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "reliquary:catalyzing_gland" + }, + { + "item": "reliquary:catalyzing_gland" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:nuggets/gold" + }, + { + "tag": "c:gunpowders" + } + ], + "result": { + "count": 8, + "id": "reliquary:bullets/storm_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/bullets/storm_bullet_potion.json b/src/generated/resources/data/reliquary/recipe/bullets/storm_bullet_potion.json new file mode 100644 index 00000000..fbad4b9c --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/bullets/storm_bullet_potion.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.2, + "key": { + "B": { + "item": "reliquary:bullets/storm_bullet" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "BBB", + "BPB", + "BBB" + ], + "result": { + "count": 8, + "id": "reliquary:bullets/storm_bullet" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/catalyzing_gland.json b/src/generated/resources/data/reliquary/recipe/catalyzing_gland.json new file mode 100644 index 00000000..106174ec --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/catalyzing_gland.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "tag": "c:ingots/gold" + }, + "P": { + "tag": "c:gunpowders" + } + }, + "pattern": [ + "GGG", + "GPG", + "GGG" + ], + "result": { + "count": 1, + "id": "reliquary:catalyzing_gland" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/chelicerae.json b/src/generated/resources/data/reliquary/recipe/chelicerae.json new file mode 100644 index 00000000..7eafca98 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/chelicerae.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "tag": "c:ingots/gold" + }, + "S": { + "tag": "c:strings" + } + }, + "pattern": [ + "GGG", + "GSG", + "GGG" + ], + "result": { + "count": 1, + "id": "reliquary:chelicerae" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/crimson_cloth.json b/src/generated/resources/data/reliquary/recipe/crimson_cloth.json similarity index 85% rename from src/generated/resources/data/reliquary/recipes/crimson_cloth.json rename to src/generated/resources/data/reliquary/recipe/crimson_cloth.json index 2e6f0624..3fa402f8 100644 --- a/src/generated/resources/data/reliquary/recipes/crimson_cloth.json +++ b/src/generated/resources/data/reliquary/recipe/crimson_cloth.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:crimson_cloth" + "count": 1, + "id": "reliquary:crimson_cloth" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/destruction_catalyst.json b/src/generated/resources/data/reliquary/recipe/destruction_catalyst.json similarity index 84% rename from src/generated/resources/data/reliquary/recipes/destruction_catalyst.json rename to src/generated/resources/data/reliquary/recipe/destruction_catalyst.json index f020dc38..a5e10231 100644 --- a/src/generated/resources/data/reliquary/recipes/destruction_catalyst.json +++ b/src/generated/resources/data/reliquary/recipe/destruction_catalyst.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:destruction_catalyst" + "count": 1, + "id": "reliquary:destruction_catalyst" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/emperor_chalice.json b/src/generated/resources/data/reliquary/recipe/emperor_chalice.json new file mode 100644 index 00000000..642c53ee --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/emperor_chalice.json @@ -0,0 +1,36 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "c:gems/emerald" + }, + { + "tag": "c:ingots/gold" + }, + { + "item": "minecraft:bucket" + }, + { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 64, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "reliquary:void_tear", + "strict": true + } + ], + "result": { + "count": 1, + "id": "reliquary:emperor_chalice" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/empty_potion_vial.json b/src/generated/resources/data/reliquary/recipe/empty_potion_vial.json new file mode 100644 index 00000000..00aa0a1d --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/empty_potion_vial.json @@ -0,0 +1,23 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "tag": "c:glass_panes" + } + }, + "pattern": [ + "G G", + "G G", + " G " + ], + "result": { + "count": 1, + "id": "reliquary:empty_potion_vial" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/ender_staff.json b/src/generated/resources/data/reliquary/recipe/ender_staff.json new file mode 100644 index 00000000..76f5340c --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/ender_staff.json @@ -0,0 +1,44 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "reliquary:bat_wing" + }, + "E": { + "item": "minecraft:ender_eye" + }, + "N": { + "item": "reliquary:nebulous_heart" + }, + "S": { + "item": "minecraft:stick" + }, + "V": { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 64, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "reliquary:void_tear", + "strict": true + } + }, + "pattern": [ + " BE", + "NVB", + "SN " + ], + "result": { + "count": 1, + "id": "reliquary:ender_staff" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/eye_of_the_storm.json b/src/generated/resources/data/reliquary/recipe/eye_of_the_storm.json new file mode 100644 index 00000000..2eca711b --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/eye_of_the_storm.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "reliquary:catalyzing_gland" + }, + "G": { + "tag": "c:ingots/gold" + } + }, + "pattern": [ + "GGG", + "GCG", + "GGG" + ], + "result": { + "count": 1, + "id": "reliquary:eye_of_the_storm" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/fertile_essence.json b/src/generated/resources/data/reliquary/recipe/fertile_essence.json similarity index 77% rename from src/generated/resources/data/reliquary/recipes/fertile_essence.json rename to src/generated/resources/data/reliquary/recipe/fertile_essence.json index faae8038..e41c6379 100644 --- a/src/generated/resources/data/reliquary/recipes/fertile_essence.json +++ b/src/generated/resources/data/reliquary/recipe/fertile_essence.json @@ -9,13 +9,14 @@ "item": "reliquary:catalyzing_gland" }, { - "tag": "forge:dyes/green" + "tag": "c:dyes/green" }, { "item": "reliquary:slime_pearl" } ], "result": { - "item": "reliquary:fertile_essence" + "count": 1, + "id": "reliquary:fertile_essence" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/fertile_lily_pad.json b/src/generated/resources/data/reliquary/recipe/fertile_lily_pad.json similarity index 85% rename from src/generated/resources/data/reliquary/recipes/fertile_lily_pad.json rename to src/generated/resources/data/reliquary/recipe/fertile_lily_pad.json index c20db723..41524d19 100644 --- a/src/generated/resources/data/reliquary/recipes/fertile_lily_pad.json +++ b/src/generated/resources/data/reliquary/recipe/fertile_lily_pad.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:fertile_lily_pad" + "count": 1, + "id": "reliquary:fertile_lily_pad" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/fertile_potion.json b/src/generated/resources/data/reliquary/recipe/fertile_potion.json new file mode 100644 index 00000000..11c17ec7 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/fertile_potion.json @@ -0,0 +1,35 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:water_bucket" + }, + "C": { + "tag": "c:dyes/green" + }, + "F": { + "item": "reliquary:fertile_essence" + }, + "G": { + "tag": "c:glass_panes" + }, + "Y": { + "tag": "c:dyes/yellow" + } + }, + "pattern": [ + "GBG", + "GFG", + "CGY" + ], + "result": { + "count": 1, + "id": "reliquary:fertile_potion" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/fortune_coin.json b/src/generated/resources/data/reliquary/recipe/fortune_coin.json similarity index 77% rename from src/generated/resources/data/reliquary/recipes/fortune_coin.json rename to src/generated/resources/data/reliquary/recipe/fortune_coin.json index 6020e334..80907ff7 100644 --- a/src/generated/resources/data/reliquary/recipes/fortune_coin.json +++ b/src/generated/resources/data/reliquary/recipe/fortune_coin.json @@ -6,7 +6,7 @@ "item": "reliquary:nebulous_heart" }, { - "tag": "forge:nuggets/gold" + "tag": "c:nuggets/gold" }, { "item": "reliquary:slime_pearl" @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:fortune_coin" + "count": 1, + "id": "reliquary:fortune_coin" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/frozen_core.json b/src/generated/resources/data/reliquary/recipe/frozen_core.json new file mode 100644 index 00000000..26b42497 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/frozen_core.json @@ -0,0 +1,29 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "tag": "c:ingots/gold" + }, + "P": { + "item": "minecraft:pumpkin" + }, + "S": { + "item": "minecraft:snow" + } + }, + "pattern": [ + "GPG", + "GSG", + "GSG" + ], + "result": { + "count": 1, + "id": "reliquary:frozen_core" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/glacial_staff.json b/src/generated/resources/data/reliquary/recipe/glacial_staff.json new file mode 100644 index 00000000..e15f1d41 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/glacial_staff.json @@ -0,0 +1,36 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "reliquary:ice_magus_rod" + }, + { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 64, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "reliquary:void_tear", + "strict": true + }, + { + "item": "reliquary:frozen_core" + }, + { + "item": "reliquary:shears_of_winter" + } + ], + "result": { + "count": 1, + "id": "reliquary:glacial_staff" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/glowing_bread.json b/src/generated/resources/data/reliquary/recipe/glowing_bread.json similarity index 89% rename from src/generated/resources/data/reliquary/recipes/glowing_bread.json rename to src/generated/resources/data/reliquary/recipe/glowing_bread.json index d00b07ab..a2fd0246 100644 --- a/src/generated/resources/data/reliquary/recipes/glowing_bread.json +++ b/src/generated/resources/data/reliquary/recipe/glowing_bread.json @@ -17,6 +17,6 @@ ], "result": { "count": 3, - "item": "reliquary:glowing_bread" + "id": "reliquary:glowing_bread" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/glowing_water.json b/src/generated/resources/data/reliquary/recipe/glowing_water.json similarity index 56% rename from src/generated/resources/data/reliquary/recipes/glowing_water.json rename to src/generated/resources/data/reliquary/recipe/glowing_water.json index 4733a75e..267e59b8 100644 --- a/src/generated/resources/data/reliquary/recipes/glowing_water.json +++ b/src/generated/resources/data/reliquary/recipe/glowing_water.json @@ -6,16 +6,16 @@ "item": "minecraft:water_bucket" }, "D": { - "tag": "forge:dusts/glowstone" + "tag": "c:dusts/glowstone" }, "G": { - "tag": "forge:glass_panes" + "tag": "c:glass_panes" }, "N": { - "tag": "forge:crops/nether_wart" + "tag": "c:crops/nether_wart" }, "P": { - "tag": "forge:gunpowder" + "tag": "c:gunpowders" } }, "pattern": [ @@ -24,7 +24,7 @@ "NGP" ], "result": { - "item": "reliquary:glowing_water" - }, - "show_notification": true + "count": 1, + "id": "reliquary:glowing_water" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/glowing_water_from_potion_vial.json b/src/generated/resources/data/reliquary/recipe/glowing_water_from_potion_vial.json similarity index 63% rename from src/generated/resources/data/reliquary/recipes/glowing_water_from_potion_vial.json rename to src/generated/resources/data/reliquary/recipe/glowing_water_from_potion_vial.json index d1f3cb05..58b5af35 100644 --- a/src/generated/resources/data/reliquary/recipes/glowing_water_from_potion_vial.json +++ b/src/generated/resources/data/reliquary/recipe/glowing_water_from_potion_vial.json @@ -9,16 +9,17 @@ "item": "minecraft:water_bucket" }, { - "tag": "forge:dusts/glowstone" + "tag": "c:dusts/glowstone" }, { - "tag": "forge:gunpowder" + "tag": "c:gunpowders" }, { - "tag": "forge:crops/nether_wart" + "tag": "c:crops/nether_wart" } ], "result": { - "item": "reliquary:glowing_water" + "count": 1, + "id": "reliquary:glowing_water" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/gold_nugget.json b/src/generated/resources/data/reliquary/recipe/gold_nugget.json similarity index 87% rename from src/generated/resources/data/reliquary/recipes/gold_nugget.json rename to src/generated/resources/data/reliquary/recipe/gold_nugget.json index 67066288..4be53990 100644 --- a/src/generated/resources/data/reliquary/recipes/gold_nugget.json +++ b/src/generated/resources/data/reliquary/recipe/gold_nugget.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "minecraft:gold_nugget" + "count": 1, + "id": "minecraft:gold_nugget" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/grip_assembly.json b/src/generated/resources/data/reliquary/recipe/grip_assembly.json new file mode 100644 index 00000000..cbb40f26 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/grip_assembly.json @@ -0,0 +1,29 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "reliquary:magazines/empty_magazine" + }, + "I": { + "tag": "c:ingots/iron" + }, + "M": { + "item": "minecraft:magma_cream" + } + }, + "pattern": [ + "III", + "IMI", + "ICI" + ], + "result": { + "count": 1, + "id": "reliquary:grip_assembly" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/guardian_spike.json b/src/generated/resources/data/reliquary/recipe/guardian_spike.json new file mode 100644 index 00000000..44efa04f --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/guardian_spike.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "tag": "c:ingots/gold" + }, + "P": { + "item": "minecraft:prismarine_shard" + } + }, + "pattern": [ + "GGG", + "GPG", + "GGG" + ], + "result": { + "count": 1, + "id": "reliquary:guardian_spike" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/hammer_assembly.json b/src/generated/resources/data/reliquary/recipe/hammer_assembly.json new file mode 100644 index 00000000..fc509c30 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/hammer_assembly.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "minecraft:stone_button" + }, + "I": { + "tag": "c:ingots/iron" + }, + "M": { + "item": "reliquary:molten_core" + }, + "R": { + "tag": "c:rods/blaze" + } + }, + "pattern": [ + "IIB", + "RMI", + "III" + ], + "result": { + "count": 1, + "id": "reliquary:hammer_assembly" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/handgun.json b/src/generated/resources/data/reliquary/recipe/handgun.json new file mode 100644 index 00000000..e2025fbd --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/handgun.json @@ -0,0 +1,35 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "reliquary:barrel_assembly" + }, + "G": { + "item": "reliquary:grip_assembly" + }, + "I": { + "tag": "c:ingots/iron" + }, + "M": { + "item": "reliquary:hammer_assembly" + }, + "S": { + "item": "reliquary:slime_pearl" + } + }, + "pattern": [ + "BIM", + "ISI", + "IGI" + ], + "result": { + "count": 1, + "id": "reliquary:handgun" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/harvest_rod.json b/src/generated/resources/data/reliquary/recipe/harvest_rod.json new file mode 100644 index 00000000..5d7b4616 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/harvest_rod.json @@ -0,0 +1,44 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "F": { + "item": "reliquary:fertile_essence" + }, + "R": { + "item": "minecraft:rose_bush" + }, + "S": { + "item": "minecraft:stick" + }, + "T": { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 64, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "reliquary:void_tear", + "strict": true + }, + "V": { + "item": "minecraft:vine" + } + }, + "pattern": [ + " RF", + "VTR", + "SV " + ], + "result": { + "count": 1, + "id": "reliquary:harvest_rod" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/hero_medallion.json b/src/generated/resources/data/reliquary/recipe/hero_medallion.json similarity index 85% rename from src/generated/resources/data/reliquary/recipes/hero_medallion.json rename to src/generated/resources/data/reliquary/recipe/hero_medallion.json index 07da5fa3..c6f01c21 100644 --- a/src/generated/resources/data/reliquary/recipes/hero_medallion.json +++ b/src/generated/resources/data/reliquary/recipe/hero_medallion.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:hero_medallion" + "count": 1, + "id": "reliquary:hero_medallion" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/holy_hand_grenade.json b/src/generated/resources/data/reliquary/recipe/holy_hand_grenade.json similarity index 79% rename from src/generated/resources/data/reliquary/recipes/holy_hand_grenade.json rename to src/generated/resources/data/reliquary/recipe/holy_hand_grenade.json index 709c7192..a6011cf4 100644 --- a/src/generated/resources/data/reliquary/recipes/holy_hand_grenade.json +++ b/src/generated/resources/data/reliquary/recipe/holy_hand_grenade.json @@ -6,7 +6,7 @@ "item": "reliquary:glowing_water" }, { - "tag": "forge:nuggets/gold" + "tag": "c:nuggets/gold" }, { "item": "minecraft:tnt" @@ -17,6 +17,6 @@ ], "result": { "count": 4, - "item": "reliquary:holy_hand_grenade" + "id": "reliquary:holy_hand_grenade" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/ice_magus_rod.json b/src/generated/resources/data/reliquary/recipe/ice_magus_rod.json new file mode 100644 index 00000000..0e4ff2ac --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/ice_magus_rod.json @@ -0,0 +1,41 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "F": { + "item": "reliquary:frozen_core" + }, + "I": { + "tag": "c:ingots/iron" + }, + "V": { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 64, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "reliquary:void_tear", + "strict": true + } + }, + "pattern": [ + " DF", + " VD", + "I " + ], + "result": { + "count": 1, + "id": "reliquary:ice_magus_rod" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/infernal_chalice.json b/src/generated/resources/data/reliquary/recipe/infernal_chalice.json similarity index 85% rename from src/generated/resources/data/reliquary/recipes/infernal_chalice.json rename to src/generated/resources/data/reliquary/recipe/infernal_chalice.json index e364a75c..e2a9af96 100644 --- a/src/generated/resources/data/reliquary/recipes/infernal_chalice.json +++ b/src/generated/resources/data/reliquary/recipe/infernal_chalice.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:infernal_chalice" + "count": 1, + "id": "reliquary:infernal_chalice" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/infernal_claw.json b/src/generated/resources/data/reliquary/recipe/infernal_claw.json similarity index 77% rename from src/generated/resources/data/reliquary/recipes/infernal_claw.json rename to src/generated/resources/data/reliquary/recipe/infernal_claw.json index 2a13eb1b..616708df 100644 --- a/src/generated/resources/data/reliquary/recipes/infernal_claw.json +++ b/src/generated/resources/data/reliquary/recipe/infernal_claw.json @@ -3,7 +3,7 @@ "category": "misc", "ingredients": [ { - "tag": "forge:leather" + "tag": "c:leathers" }, { "item": "reliquary:molten_core" @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:infernal_claw" + "count": 1, + "id": "reliquary:infernal_claw" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/infernal_claws.json b/src/generated/resources/data/reliquary/recipe/infernal_claws.json similarity index 85% rename from src/generated/resources/data/reliquary/recipes/infernal_claws.json rename to src/generated/resources/data/reliquary/recipe/infernal_claws.json index 9b958c73..6ea988a1 100644 --- a/src/generated/resources/data/reliquary/recipes/infernal_claws.json +++ b/src/generated/resources/data/reliquary/recipe/infernal_claws.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:infernal_claws" + "count": 1, + "id": "reliquary:infernal_claws" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/infernal_tear.json b/src/generated/resources/data/reliquary/recipe/infernal_tear.json new file mode 100644 index 00000000..34bf6937 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/infernal_tear.json @@ -0,0 +1,36 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 64, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "reliquary:void_tear", + "strict": true + }, + { + "item": "reliquary:witch_hat" + }, + { + "item": "reliquary:molten_core" + }, + { + "item": "reliquary:infernal_claw" + } + ], + "result": { + "count": 1, + "id": "reliquary:infernal_tear" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/interdiction_torch.json b/src/generated/resources/data/reliquary/recipe/interdiction_torch.json similarity index 76% rename from src/generated/resources/data/reliquary/recipes/interdiction_torch.json rename to src/generated/resources/data/reliquary/recipe/interdiction_torch.json index 40b41b2a..720fadee 100644 --- a/src/generated/resources/data/reliquary/recipes/interdiction_torch.json +++ b/src/generated/resources/data/reliquary/recipe/interdiction_torch.json @@ -6,7 +6,7 @@ "item": "reliquary:bat_wing" }, { - "tag": "forge:rods/blaze" + "tag": "c:rods/blaze" }, { "item": "reliquary:molten_core" @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:interdiction_torch" + "count": 1, + "id": "reliquary:interdiction_torch" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/kraken_shell.json b/src/generated/resources/data/reliquary/recipe/kraken_shell.json similarity index 87% rename from src/generated/resources/data/reliquary/recipes/kraken_shell.json rename to src/generated/resources/data/reliquary/recipe/kraken_shell.json index 0e939264..5883dc3f 100644 --- a/src/generated/resources/data/reliquary/recipes/kraken_shell.json +++ b/src/generated/resources/data/reliquary/recipe/kraken_shell.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:kraken_shell" + "count": 1, + "id": "reliquary:kraken_shell" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/kraken_shell_fragment.json b/src/generated/resources/data/reliquary/recipe/kraken_shell_fragment.json similarity index 83% rename from src/generated/resources/data/reliquary/recipes/kraken_shell_fragment.json rename to src/generated/resources/data/reliquary/recipe/kraken_shell_fragment.json index a641a66a..d286b200 100644 --- a/src/generated/resources/data/reliquary/recipes/kraken_shell_fragment.json +++ b/src/generated/resources/data/reliquary/recipe/kraken_shell_fragment.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:kraken_shell_fragment" + "count": 1, + "id": "reliquary:kraken_shell_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/lantern_of_paranoia.json b/src/generated/resources/data/reliquary/recipe/lantern_of_paranoia.json similarity index 68% rename from src/generated/resources/data/reliquary/recipes/lantern_of_paranoia.json rename to src/generated/resources/data/reliquary/recipe/lantern_of_paranoia.json index 7688169b..8dd74749 100644 --- a/src/generated/resources/data/reliquary/recipes/lantern_of_paranoia.json +++ b/src/generated/resources/data/reliquary/recipe/lantern_of_paranoia.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "G": { - "tag": "forge:glass" + "tag": "c:glass_blocks" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "M": { "item": "reliquary:molten_core" @@ -21,7 +21,7 @@ " I " ], "result": { - "item": "reliquary:lantern_of_paranoia" - }, - "show_notification": true + "count": 1, + "id": "reliquary:lantern_of_paranoia" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/blaze_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/blaze_magazine.json new file mode 100644 index 00000000..e84d055c --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/blaze_magazine.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 1.0, + "key": { + "B": { + "item": "reliquary:bullets/blaze_bullet" + }, + "M": { + "item": "reliquary:magazines/empty_magazine" + } + }, + "pattern": [ + "BBB", + "BMB", + "BBB" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/blaze_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/buster_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/buster_magazine.json new file mode 100644 index 00000000..78485ad5 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/buster_magazine.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 1.0, + "key": { + "B": { + "item": "reliquary:bullets/buster_bullet" + }, + "M": { + "item": "reliquary:magazines/empty_magazine" + } + }, + "pattern": [ + "BBB", + "BMB", + "BBB" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/buster_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/concussive_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/concussive_magazine.json new file mode 100644 index 00000000..d641d551 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/concussive_magazine.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 1.0, + "key": { + "B": { + "item": "reliquary:bullets/concussive_bullet" + }, + "M": { + "item": "reliquary:magazines/empty_magazine" + } + }, + "pattern": [ + "BBB", + "BMB", + "BBB" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/concussive_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/empty_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/empty_magazine.json new file mode 100644 index 00000000..b2b8e135 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/empty_magazine.json @@ -0,0 +1,29 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:handgun_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "tag": "c:glass_blocks" + }, + "I": { + "tag": "c:ingots/iron" + }, + "S": { + "tag": "c:stones" + } + }, + "pattern": [ + "I I", + "IGI", + "SIS" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/empty_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/ender_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/ender_magazine.json new file mode 100644 index 00000000..6e215e5a --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/ender_magazine.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 1.0, + "key": { + "B": { + "item": "reliquary:bullets/ender_bullet" + }, + "M": { + "item": "reliquary:magazines/empty_magazine" + } + }, + "pattern": [ + "BBB", + "BMB", + "BBB" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/ender_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/exorcism_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/exorcism_magazine.json new file mode 100644 index 00000000..5d8631fb --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/exorcism_magazine.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 1.0, + "key": { + "B": { + "item": "reliquary:bullets/exorcism_bullet" + }, + "M": { + "item": "reliquary:magazines/empty_magazine" + } + }, + "pattern": [ + "BBB", + "BMB", + "BBB" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/exorcism_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/neutral_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/neutral_magazine.json new file mode 100644 index 00000000..da380357 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/neutral_magazine.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 1.0, + "key": { + "B": { + "item": "reliquary:bullets/neutral_bullet" + }, + "M": { + "item": "reliquary:magazines/empty_magazine" + } + }, + "pattern": [ + "BBB", + "BMB", + "BBB" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/neutral_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/sand_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/sand_magazine.json new file mode 100644 index 00000000..285fe40a --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/sand_magazine.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 1.0, + "key": { + "B": { + "item": "reliquary:bullets/sand_bullet" + }, + "M": { + "item": "reliquary:magazines/empty_magazine" + } + }, + "pattern": [ + "BBB", + "BMB", + "BBB" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/sand_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/seeker_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/seeker_magazine.json new file mode 100644 index 00000000..b37f214e --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/seeker_magazine.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 1.0, + "key": { + "B": { + "item": "reliquary:bullets/seeker_bullet" + }, + "M": { + "item": "reliquary:magazines/empty_magazine" + } + }, + "pattern": [ + "BBB", + "BMB", + "BBB" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/seeker_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/magazines/storm_magazine.json b/src/generated/resources/data/reliquary/recipe/magazines/storm_magazine.json new file mode 100644 index 00000000..6336f14b --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/magazines/storm_magazine.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 1.0, + "key": { + "B": { + "item": "reliquary:bullets/storm_bullet" + }, + "M": { + "item": "reliquary:magazines/empty_magazine" + } + }, + "pattern": [ + "BBB", + "BMB", + "BBB" + ], + "result": { + "count": 1, + "id": "reliquary:magazines/storm_magazine" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magicbane.json b/src/generated/resources/data/reliquary/recipe/magicbane.json similarity index 63% rename from src/generated/resources/data/reliquary/recipes/magicbane.json rename to src/generated/resources/data/reliquary/recipe/magicbane.json index 3e21803a..32af2d5d 100644 --- a/src/generated/resources/data/reliquary/recipes/magicbane.json +++ b/src/generated/resources/data/reliquary/recipe/magicbane.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" }, "N": { "item": "reliquary:nebulous_heart" @@ -17,7 +17,7 @@ "IN" ], "result": { - "item": "reliquary:magicbane" - }, - "show_notification": true + "count": 1, + "id": "reliquary:magicbane" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mercy_cross.json b/src/generated/resources/data/reliquary/recipe/mercy_cross.json similarity index 75% rename from src/generated/resources/data/reliquary/recipes/mercy_cross.json rename to src/generated/resources/data/reliquary/recipe/mercy_cross.json index 4b4e2d3e..219db2aa 100644 --- a/src/generated/resources/data/reliquary/recipes/mercy_cross.json +++ b/src/generated/resources/data/reliquary/recipe/mercy_cross.json @@ -3,10 +3,10 @@ "category": "misc", "key": { "G": { - "tag": "forge:ingots/gold" + "tag": "c:ingots/gold" }, "L": { - "tag": "forge:leather" + "tag": "c:leathers" }, "R": { "item": "reliquary:rib_bone" @@ -27,7 +27,7 @@ "SGZ" ], "result": { - "item": "reliquary:mercy_cross" - }, - "show_notification": true + "count": 1, + "id": "reliquary:mercy_cross" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/midas_touchstone.json b/src/generated/resources/data/reliquary/recipe/midas_touchstone.json new file mode 100644 index 00000000..2f7f7528 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/midas_touchstone.json @@ -0,0 +1,51 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "minecraft:anvil" + }, + { + "tag": "c:storage_blocks/gold" + }, + { + "tag": "c:storage_blocks/gold" + }, + { + "item": "reliquary:molten_core" + }, + { + "item": "reliquary:molten_core" + }, + { + "item": "reliquary:molten_core" + }, + { + "item": "reliquary:catalyzing_gland" + }, + { + "item": "reliquary:catalyzing_gland" + }, + { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 64, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "reliquary:void_tear", + "strict": true + } + ], + "result": { + "count": 1, + "id": "reliquary:midas_touchstone" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm.json b/src/generated/resources/data/reliquary/recipe/mob_charm.json similarity index 64% rename from src/generated/resources/data/reliquary/recipes/mob_charm.json rename to src/generated/resources/data/reliquary/recipe/mob_charm.json index 13aa8b35..ff5adad0 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm.json @@ -1,14 +1,15 @@ { "type": "reliquary:mob_charm", + "category": "misc", "key": { "F": { "item": "reliquary:mob_charm_fragment" }, "L": { - "tag": "forge:leather" + "tag": "c:leathers" }, "S": { - "tag": "forge:string" + "tag": "c:strings" } }, "pattern": [ @@ -17,6 +18,7 @@ "F F" ], "result": { - "item": "reliquary:mob_charm" + "count": 1, + "id": "reliquary:mob_charm" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_belt.json b/src/generated/resources/data/reliquary/recipe/mob_charm_belt.json similarity index 69% rename from src/generated/resources/data/reliquary/recipes/mob_charm_belt.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_belt.json index a288f262..474d23cb 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_belt.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_belt.json @@ -6,7 +6,7 @@ "item": "reliquary:mob_charm_fragment" }, "L": { - "tag": "forge:leather" + "tag": "c:leathers" } }, "pattern": [ @@ -15,7 +15,7 @@ "FFF" ], "result": { - "item": "reliquary:mob_charm_belt" - }, - "show_notification": true + "count": 1, + "id": "reliquary:mob_charm_belt" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/blaze.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/blaze.json similarity index 58% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/blaze.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/blaze.json index 305d2de4..957df840 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/blaze.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/blaze.json @@ -1,11 +1,12 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:molten_core" }, "S": { - "tag": "forge:rods/blaze" + "tag": "c:rods/blaze" }, "T": { "item": "minecraft:blaze_powder" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:blaze\"}" + "components": { + "reliquary:entity_name": "minecraft:blaze" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/cave_spider.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/cave_spider.json new file mode 100644 index 00000000..d990a51b --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/cave_spider.json @@ -0,0 +1,44 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "P": { + "item": "reliquary:chelicerae" + }, + "S": { + "tag": "c:strings" + }, + "T": { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 1, + "minecraft:potion_contents": { + "potion": "minecraft:poison" + }, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "minecraft:potion", + "strict": true + } + }, + "pattern": [ + "PPP", + "STS", + "PPP" + ], + "result": { + "components": { + "reliquary:entity_name": "minecraft:cave_spider" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/creeper.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/creeper.json similarity index 57% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/creeper.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/creeper.json index 59514851..616cb201 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/creeper.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/creeper.json @@ -1,11 +1,12 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:catalyzing_gland" }, "S": { - "tag": "forge:gunpowder" + "tag": "c:gunpowders" }, "T": { "item": "minecraft:bone" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:creeper\"}" + "components": { + "reliquary:entity_name": "minecraft:creeper" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/enderman.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/enderman.json similarity index 52% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/enderman.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/enderman.json index b3df9808..aeccd4ec 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/enderman.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/enderman.json @@ -1,11 +1,12 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:nebulous_heart" }, "S": { - "tag": "forge:ender_pearls" + "tag": "c:ender_pearls" } }, "pattern": [ @@ -14,7 +15,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:enderman\"}" + "components": { + "reliquary:entity_name": "minecraft:enderman" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/ghast.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/ghast.json similarity index 58% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/ghast.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/ghast.json index f14c4cf1..95fc84e9 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/ghast.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/ghast.json @@ -1,11 +1,12 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "minecraft:ghast_tear" }, "S": { - "tag": "forge:gunpowder" + "tag": "c:gunpowders" }, "T": { "item": "reliquary:catalyzing_gland" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:ghast\"}" + "components": { + "reliquary:entity_name": "minecraft:ghast" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/guardian.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/guardian.json similarity index 55% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/guardian.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/guardian.json index f9afca95..805e06d1 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/guardian.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/guardian.json @@ -1,11 +1,12 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:guardian_spike" }, "S": { - "tag": "forge:dusts/prismarine" + "item": "minecraft:prismarine_shard" }, "T": { "item": "minecraft:cod" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:guardian\"}" + "components": { + "reliquary:entity_name": "minecraft:guardian" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/magma_cube.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/magma_cube.json similarity index 59% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/magma_cube.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/magma_cube.json index 3aa91f31..3c47318d 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/magma_cube.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/magma_cube.json @@ -1,5 +1,6 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:molten_core" @@ -14,7 +15,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:magma_cube\"}" + "components": { + "reliquary:entity_name": "minecraft:magma_cube" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/skeleton.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/skeleton.json similarity index 63% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/skeleton.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/skeleton.json index ff84e523..bb3a1213 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/skeleton.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/skeleton.json @@ -1,5 +1,6 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:rib_bone" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:skeleton\"}" + "components": { + "reliquary:entity_name": "minecraft:skeleton" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/slime.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/slime.json similarity index 52% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/slime.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/slime.json index 88bc52bf..f02d27b2 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/slime.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/slime.json @@ -1,11 +1,12 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:slime_pearl" }, "S": { - "tag": "forge:slimeballs" + "tag": "c:slimeballs" } }, "pattern": [ @@ -14,7 +15,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:slime\"}" + "components": { + "reliquary:entity_name": "minecraft:slime" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/spider.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/spider.json similarity index 58% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/spider.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/spider.json index 3f7de667..14e0ed9b 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/spider.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/spider.json @@ -1,11 +1,12 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:chelicerae" }, "S": { - "tag": "forge:string" + "tag": "c:strings" }, "T": { "item": "minecraft:spider_eye" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:spider\"}" + "components": { + "reliquary:entity_name": "minecraft:spider" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/witch.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/witch.json similarity index 65% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/witch.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/witch.json index 72059045..5daf64c7 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/witch.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/witch.json @@ -1,5 +1,6 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:witch_hat" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:witch\"}" + "components": { + "reliquary:entity_name": "minecraft:witch" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/wither_skeleton.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/wither_skeleton.json similarity index 64% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/wither_skeleton.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/wither_skeleton.json index 9414b629..14783117 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/wither_skeleton.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/wither_skeleton.json @@ -1,5 +1,6 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:withered_rib" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:wither_skeleton\"}" + "components": { + "reliquary:entity_name": "minecraft:wither_skeleton" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/zombie.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/zombie.json similarity index 65% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/zombie.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/zombie.json index ae3d4dcb..54ce9b17 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/zombie.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/zombie.json @@ -1,5 +1,6 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:zombie_heart" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:zombie\"}" + "components": { + "reliquary:entity_name": "minecraft:zombie" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/zombified_piglin.json b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/zombified_piglin.json similarity index 64% rename from src/generated/resources/data/reliquary/recipes/mob_charm_fragments/zombified_piglin.json rename to src/generated/resources/data/reliquary/recipe/mob_charm_fragments/zombified_piglin.json index ead8683f..58c20607 100644 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/zombified_piglin.json +++ b/src/generated/resources/data/reliquary/recipe/mob_charm_fragments/zombified_piglin.json @@ -1,5 +1,6 @@ { "type": "minecraft:crafting_shaped", + "category": "misc", "key": { "P": { "item": "reliquary:zombie_heart" @@ -17,7 +18,10 @@ "PPP" ], "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:zombified_piglin\"}" + "components": { + "reliquary:entity_name": "minecraft:zombified_piglin" + }, + "count": 1, + "id": "reliquary:mob_charm_fragment" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/molten_core.json b/src/generated/resources/data/reliquary/recipe/molten_core.json new file mode 100644 index 00000000..3ef66fd6 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/molten_core.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "tag": "c:ingots/gold" + }, + "M": { + "item": "minecraft:magma_cream" + } + }, + "pattern": [ + "GGG", + "GMG", + "GGG" + ], + "result": { + "count": 1, + "id": "reliquary:molten_core" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/nebulous_heart.json b/src/generated/resources/data/reliquary/recipe/nebulous_heart.json new file mode 100644 index 00000000..f0028992 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/nebulous_heart.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "E": { + "tag": "c:ender_pearls" + }, + "G": { + "tag": "c:ingots/gold" + } + }, + "pattern": [ + "GGG", + "GEG", + "GGG" + ], + "result": { + "count": 1, + "id": "reliquary:nebulous_heart" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/black_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/black_pedestal.json new file mode 100644 index 00000000..c619d475 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/black_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/black_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/black_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/blue_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/blue_pedestal.json new file mode 100644 index 00000000..2846afae --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/blue_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/blue_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/blue_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/brown_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/brown_pedestal.json new file mode 100644 index 00000000..0c3a8787 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/brown_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/brown_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/brown_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/cyan_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/cyan_pedestal.json new file mode 100644 index 00000000..35791e6e --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/cyan_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/cyan_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/cyan_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/gray_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/gray_pedestal.json new file mode 100644 index 00000000..f1f98c01 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/gray_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/gray_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/gray_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/green_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/green_pedestal.json new file mode 100644 index 00000000..d6c0c656 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/green_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/green_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/green_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/light_blue_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/light_blue_pedestal.json new file mode 100644 index 00000000..f689fc40 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/light_blue_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/light_blue_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/light_blue_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/light_gray_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/light_gray_pedestal.json new file mode 100644 index 00000000..6531fcef --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/light_gray_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/light_gray_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/light_gray_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/lime_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/lime_pedestal.json new file mode 100644 index 00000000..ca74dcef --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/lime_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/lime_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/lime_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/magenta_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/magenta_pedestal.json new file mode 100644 index 00000000..077db181 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/magenta_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/magenta_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/magenta_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/orange_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/orange_pedestal.json new file mode 100644 index 00000000..484a95f8 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/orange_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/orange_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/orange_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/black_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/black_passive_pedestal.json new file mode 100644 index 00000000..5a6fb1e9 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/black_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:black_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/black_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/blue_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/blue_passive_pedestal.json new file mode 100644 index 00000000..0ee887c9 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/blue_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:blue_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/blue_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/brown_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/brown_passive_pedestal.json new file mode 100644 index 00000000..475a6b1b --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/brown_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:brown_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/brown_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/cyan_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/cyan_passive_pedestal.json new file mode 100644 index 00000000..6d45531e --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/cyan_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:cyan_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/cyan_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/gray_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/gray_passive_pedestal.json new file mode 100644 index 00000000..3ea1c837 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/gray_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:gray_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/gray_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/green_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/green_passive_pedestal.json new file mode 100644 index 00000000..21c81684 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/green_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:green_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/green_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/light_blue_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/light_blue_passive_pedestal.json new file mode 100644 index 00000000..90706ca8 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/light_blue_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:light_blue_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/light_blue_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/light_gray_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/light_gray_passive_pedestal.json new file mode 100644 index 00000000..716e1f93 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/light_gray_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:light_gray_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/light_gray_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/lime_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/lime_passive_pedestal.json new file mode 100644 index 00000000..7bad52d9 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/lime_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:lime_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/lime_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/magenta_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/magenta_passive_pedestal.json new file mode 100644 index 00000000..7448f49b --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/magenta_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:magenta_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/magenta_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/orange_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/orange_passive_pedestal.json new file mode 100644 index 00000000..be73b4b6 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/orange_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:orange_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/orange_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/pink_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/pink_passive_pedestal.json new file mode 100644 index 00000000..d765671e --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/pink_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:pink_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/pink_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/purple_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/purple_passive_pedestal.json new file mode 100644 index 00000000..8b55b241 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/purple_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:purple_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/purple_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/red_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/red_passive_pedestal.json new file mode 100644 index 00000000..1ef8f10e --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/red_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:red_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/red_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/white_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/white_passive_pedestal.json new file mode 100644 index 00000000..8b77c7eb --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/white_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:white_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/white_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/passive/yellow_passive_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/passive/yellow_passive_pedestal.json new file mode 100644 index 00000000..687073b9 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/passive/yellow_passive_pedestal.json @@ -0,0 +1,32 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:passive_pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "minecraft:yellow_carpet" + }, + "G": { + "tag": "c:nuggets/gold" + }, + "Q": { + "item": "minecraft:quartz_block" + }, + "S": { + "item": "minecraft:quartz_slab" + } + }, + "pattern": [ + " C ", + "GQG", + "SSS" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/passive/yellow_passive_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/pink_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/pink_pedestal.json new file mode 100644 index 00000000..6556ae69 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/pink_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/pink_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/pink_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/purple_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/purple_pedestal.json new file mode 100644 index 00000000..3a3e076f --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/purple_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/purple_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/purple_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/red_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/red_pedestal.json new file mode 100644 index 00000000..aa25864e --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/red_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/red_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/red_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/white_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/white_pedestal.json new file mode 100644 index 00000000..8a9a460c --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/white_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/white_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/white_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/pedestals/yellow_pedestal.json b/src/generated/resources/data/reliquary/recipe/pedestals/yellow_pedestal.json new file mode 100644 index 00000000..4f37f463 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/pedestals/yellow_pedestal.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:pedestal_enabled" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "P": { + "item": "reliquary:pedestals/passive/yellow_passive_pedestal" + } + }, + "pattern": [ + "D D", + " P ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:pedestals/yellow_pedestal" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/phoenix_down.json b/src/generated/resources/data/reliquary/recipe/phoenix_down.json similarity index 86% rename from src/generated/resources/data/reliquary/recipes/phoenix_down.json rename to src/generated/resources/data/reliquary/recipe/phoenix_down.json index 9aa8b372..4300686e 100644 --- a/src/generated/resources/data/reliquary/recipes/phoenix_down.json +++ b/src/generated/resources/data/reliquary/recipe/phoenix_down.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:phoenix_down" + "count": 1, + "id": "reliquary:phoenix_down" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pyromancer_staff.json b/src/generated/resources/data/reliquary/recipe/pyromancer_staff.json similarity index 77% rename from src/generated/resources/data/reliquary/recipes/pyromancer_staff.json rename to src/generated/resources/data/reliquary/recipe/pyromancer_staff.json index 1da1728b..ea10e2ed 100644 --- a/src/generated/resources/data/reliquary/recipes/pyromancer_staff.json +++ b/src/generated/resources/data/reliquary/recipe/pyromancer_staff.json @@ -6,7 +6,7 @@ "item": "reliquary:infernal_claws" }, { - "tag": "forge:rods/blaze" + "tag": "c:rods/blaze" }, { "item": "reliquary:infernal_tear" @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:pyromancer_staff" + "count": 1, + "id": "reliquary:pyromancer_staff" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/rending_gale.json b/src/generated/resources/data/reliquary/recipe/rending_gale.json new file mode 100644 index 00000000..a108f10b --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/rending_gale.json @@ -0,0 +1,44 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "item": "reliquary:bat_wing" + }, + "E": { + "item": "reliquary:eye_of_the_storm" + }, + "G": { + "tag": "c:ingots/gold" + }, + "S": { + "item": "minecraft:stick" + }, + "V": { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 64, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "reliquary:void_tear", + "strict": true + } + }, + "pattern": [ + " BE", + "GVB", + "SG " + ], + "result": { + "count": 1, + "id": "reliquary:rending_gale" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/rib_bone.json b/src/generated/resources/data/reliquary/recipe/rib_bone.json new file mode 100644 index 00000000..0238ad26 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/rib_bone.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "B": { + "tag": "c:bones" + }, + "I": { + "tag": "c:ingots/iron" + } + }, + "pattern": [ + "III", + "IBI", + "III" + ], + "result": { + "count": 1, + "id": "reliquary:rib_bone" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/rod_of_lyssa.json b/src/generated/resources/data/reliquary/recipe/rod_of_lyssa.json similarity index 86% rename from src/generated/resources/data/reliquary/recipes/rod_of_lyssa.json rename to src/generated/resources/data/reliquary/recipe/rod_of_lyssa.json index 2839d337..5d5e75d9 100644 --- a/src/generated/resources/data/reliquary/recipes/rod_of_lyssa.json +++ b/src/generated/resources/data/reliquary/recipe/rod_of_lyssa.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:rod_of_lyssa" + "count": 1, + "id": "reliquary:rod_of_lyssa" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/salamander_eye.json b/src/generated/resources/data/reliquary/recipe/salamander_eye.json similarity index 85% rename from src/generated/resources/data/reliquary/recipes/salamander_eye.json rename to src/generated/resources/data/reliquary/recipe/salamander_eye.json index c73fc9cc..3973c4ab 100644 --- a/src/generated/resources/data/reliquary/recipes/salamander_eye.json +++ b/src/generated/resources/data/reliquary/recipe/salamander_eye.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "reliquary:salamander_eye" + "count": 1, + "id": "reliquary:salamander_eye" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/serpent_staff.json b/src/generated/resources/data/reliquary/recipe/serpent_staff.json similarity index 83% rename from src/generated/resources/data/reliquary/recipes/serpent_staff.json rename to src/generated/resources/data/reliquary/recipe/serpent_staff.json index c62bee12..45b332a8 100644 --- a/src/generated/resources/data/reliquary/recipes/serpent_staff.json +++ b/src/generated/resources/data/reliquary/recipe/serpent_staff.json @@ -21,7 +21,7 @@ "S " ], "result": { - "item": "reliquary:serpent_staff" - }, - "show_notification": true + "count": 1, + "id": "reliquary:serpent_staff" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/shears_of_winter.json b/src/generated/resources/data/reliquary/recipe/shears_of_winter.json similarity index 66% rename from src/generated/resources/data/reliquary/recipes/shears_of_winter.json rename to src/generated/resources/data/reliquary/recipe/shears_of_winter.json index 58d67d29..7f254a0a 100644 --- a/src/generated/resources/data/reliquary/recipes/shears_of_winter.json +++ b/src/generated/resources/data/reliquary/recipe/shears_of_winter.json @@ -9,13 +9,14 @@ "item": "minecraft:shears" }, { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" }, { - "tag": "forge:gems/diamond" + "tag": "c:gems/diamond" } ], "result": { - "item": "reliquary:shears_of_winter" + "count": 1, + "id": "reliquary:shears_of_winter" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/slime_pearl.json b/src/generated/resources/data/reliquary/recipe/slime_pearl.json new file mode 100644 index 00000000..b58dd8e4 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/slime_pearl.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "I": { + "tag": "c:ingots/iron" + }, + "S": { + "tag": "c:slimeballs" + } + }, + "pattern": [ + "III", + "ISI", + "III" + ], + "result": { + "count": 1, + "id": "reliquary:slime_pearl" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/sojourner_staff.json b/src/generated/resources/data/reliquary/recipe/sojourner_staff.json new file mode 100644 index 00000000..5649fb46 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/sojourner_staff.json @@ -0,0 +1,36 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "reliquary:molten_core" + }, + { + "tag": "c:ingots/gold" + }, + { + "tag": "c:rods/blaze" + }, + { + "type": "neoforge:components", + "components": { + "minecraft:attribute_modifiers": { + "modifiers": [] + }, + "minecraft:enchantments": { + "levels": {} + }, + "minecraft:lore": [], + "minecraft:max_stack_size": 64, + "minecraft:rarity": "common", + "minecraft:repair_cost": 0 + }, + "items": "reliquary:void_tear", + "strict": true + } + ], + "result": { + "count": 1, + "id": "reliquary:sojourner_staff" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/squid_beak.json b/src/generated/resources/data/reliquary/recipe/squid_beak.json new file mode 100644 index 00000000..ba3850d7 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/squid_beak.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "tag": "c:ingots/gold" + }, + "I": { + "item": "minecraft:ink_sac" + } + }, + "pattern": [ + "GGG", + "GIG", + "GGG" + ], + "result": { + "count": 1, + "id": "reliquary:squid_beak" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/tipped_arrow.json b/src/generated/resources/data/reliquary/recipe/tipped_arrow.json new file mode 100644 index 00000000..29e1fab4 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/tipped_arrow.json @@ -0,0 +1,29 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:potions_enabled" + }, + { + "type": "reliquary:potions_enabled" + } + ], + "type": "reliquary:potion_effects", + "duration_factor": 0.125, + "key": { + "A": { + "item": "minecraft:arrow" + }, + "P": { + "item": "reliquary:lingering_potion" + } + }, + "pattern": [ + "AAA", + "APA", + "AAA" + ], + "result": { + "count": 8, + "id": "reliquary:tipped_arrow" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/twilight_cloak.json b/src/generated/resources/data/reliquary/recipe/twilight_cloak.json similarity index 72% rename from src/generated/resources/data/reliquary/recipes/twilight_cloak.json rename to src/generated/resources/data/reliquary/recipe/twilight_cloak.json index 628b32b8..9089367c 100644 --- a/src/generated/resources/data/reliquary/recipes/twilight_cloak.json +++ b/src/generated/resources/data/reliquary/recipe/twilight_cloak.json @@ -9,7 +9,7 @@ "item": "reliquary:crimson_cloth" }, "I": { - "tag": "forge:ingots/iron" + "tag": "c:ingots/iron" } }, "pattern": [ @@ -18,7 +18,7 @@ "BCB" ], "result": { - "item": "reliquary:twilight_cloak" - }, - "show_notification": true + "count": 1, + "id": "reliquary:twilight_cloak" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/blaze_rod.json b/src/generated/resources/data/reliquary/recipe/uncrafting/blaze_rod.json similarity index 86% rename from src/generated/resources/data/reliquary/recipes/uncrafting/blaze_rod.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/blaze_rod.json index ffb3f35b..8881c215 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/blaze_rod.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/blaze_rod.json @@ -11,6 +11,6 @@ ], "result": { "count": 4, - "item": "minecraft:blaze_rod" + "id": "minecraft:blaze_rod" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/bone.json b/src/generated/resources/data/reliquary/recipe/uncrafting/bone.json similarity index 85% rename from src/generated/resources/data/reliquary/recipes/uncrafting/bone.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/bone.json index bbe65b3a..87faeecf 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/bone.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/bone.json @@ -8,6 +8,6 @@ ], "result": { "count": 5, - "item": "minecraft:bone" + "id": "minecraft:bone" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/ender_pearl.json b/src/generated/resources/data/reliquary/recipe/uncrafting/ender_pearl.json similarity index 83% rename from src/generated/resources/data/reliquary/recipes/uncrafting/ender_pearl.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/ender_pearl.json index c0e2ac53..fe938b14 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/ender_pearl.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/ender_pearl.json @@ -8,6 +8,6 @@ ], "result": { "count": 3, - "item": "minecraft:ender_pearl" + "id": "minecraft:ender_pearl" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/ghast_tear.json b/src/generated/resources/data/reliquary/recipe/uncrafting/ghast_tear.json similarity index 84% rename from src/generated/resources/data/reliquary/recipes/uncrafting/ghast_tear.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/ghast_tear.json index 1326a5cc..bc7db287 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/ghast_tear.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/ghast_tear.json @@ -13,6 +13,7 @@ } ], "result": { - "item": "minecraft:ghast_tear" + "count": 1, + "id": "minecraft:ghast_tear" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/glass_bottle.json b/src/generated/resources/data/reliquary/recipe/uncrafting/glass_bottle.json similarity index 74% rename from src/generated/resources/data/reliquary/recipes/uncrafting/glass_bottle.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/glass_bottle.json index 9fbeed2c..90b4726a 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/glass_bottle.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/glass_bottle.json @@ -12,7 +12,6 @@ ], "result": { "count": 6, - "item": "minecraft:glass_bottle" - }, - "show_notification": true + "id": "minecraft:glass_bottle" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/glowstone_dust.json b/src/generated/resources/data/reliquary/recipe/uncrafting/glowstone_dust.json similarity index 74% rename from src/generated/resources/data/reliquary/recipes/uncrafting/glowstone_dust.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/glowstone_dust.json index b0af49a2..2ac7344a 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/glowstone_dust.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/glowstone_dust.json @@ -13,7 +13,6 @@ ], "result": { "count": 6, - "item": "minecraft:glowstone_dust" - }, - "show_notification": true + "id": "minecraft:glowstone_dust" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/gold_nugget.json b/src/generated/resources/data/reliquary/recipe/uncrafting/gold_nugget.json similarity index 86% rename from src/generated/resources/data/reliquary/recipes/uncrafting/gold_nugget.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/gold_nugget.json index d1682ec5..201b3796 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/gold_nugget.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/gold_nugget.json @@ -11,6 +11,6 @@ ], "result": { "count": 6, - "item": "minecraft:gold_nugget" + "id": "minecraft:gold_nugget" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/gunpowder_creeper_gland.json b/src/generated/resources/data/reliquary/recipe/uncrafting/gunpowder_creeper_gland.json similarity index 84% rename from src/generated/resources/data/reliquary/recipes/uncrafting/gunpowder_creeper_gland.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/gunpowder_creeper_gland.json index 8994fa59..7f0fa350 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/gunpowder_creeper_gland.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/gunpowder_creeper_gland.json @@ -8,6 +8,6 @@ ], "result": { "count": 6, - "item": "minecraft:gunpowder" + "id": "minecraft:gunpowder" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/gunpowder_storm_eye.json b/src/generated/resources/data/reliquary/recipe/uncrafting/gunpowder_storm_eye.json similarity index 84% rename from src/generated/resources/data/reliquary/recipes/uncrafting/gunpowder_storm_eye.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/gunpowder_storm_eye.json index 7d5075f8..410f3cf8 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/gunpowder_storm_eye.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/gunpowder_storm_eye.json @@ -8,6 +8,6 @@ ], "result": { "count": 10, - "item": "minecraft:gunpowder" + "id": "minecraft:gunpowder" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/gunpowder_witch_hat.json b/src/generated/resources/data/reliquary/recipe/uncrafting/gunpowder_witch_hat.json similarity index 76% rename from src/generated/resources/data/reliquary/recipes/uncrafting/gunpowder_witch_hat.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/gunpowder_witch_hat.json index a3b42d68..dd64ffe8 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/gunpowder_witch_hat.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/gunpowder_witch_hat.json @@ -13,7 +13,6 @@ ], "result": { "count": 6, - "item": "minecraft:gunpowder" - }, - "show_notification": true + "id": "minecraft:gunpowder" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/ink_sac.json b/src/generated/resources/data/reliquary/recipe/uncrafting/ink_sac.json similarity index 84% rename from src/generated/resources/data/reliquary/recipes/uncrafting/ink_sac.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/ink_sac.json index 59993e02..faece9e5 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/ink_sac.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/ink_sac.json @@ -8,6 +8,6 @@ ], "result": { "count": 6, - "item": "minecraft:ink_sac" + "id": "minecraft:ink_sac" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/magma_cream.json b/src/generated/resources/data/reliquary/recipe/uncrafting/magma_cream.json similarity index 82% rename from src/generated/resources/data/reliquary/recipes/uncrafting/magma_cream.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/magma_cream.json index 25474eeb..ec2e123a 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/magma_cream.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/magma_cream.json @@ -8,6 +8,6 @@ ], "result": { "count": 3, - "item": "minecraft:magma_cream" + "id": "minecraft:magma_cream" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/packed_ice.json b/src/generated/resources/data/reliquary/recipe/uncrafting/packed_ice.json similarity index 78% rename from src/generated/resources/data/reliquary/recipes/uncrafting/packed_ice.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/packed_ice.json index a5bcf4be..d1427f73 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/packed_ice.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/packed_ice.json @@ -15,7 +15,7 @@ "III" ], "result": { - "item": "minecraft:packed_ice" - }, - "show_notification": true + "count": 1, + "id": "minecraft:packed_ice" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/prismarine_crystals.json b/src/generated/resources/data/reliquary/recipe/uncrafting/prismarine_crystals.json similarity index 84% rename from src/generated/resources/data/reliquary/recipes/uncrafting/prismarine_crystals.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/prismarine_crystals.json index 3b1cabbf..82a2a38f 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/prismarine_crystals.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/prismarine_crystals.json @@ -11,6 +11,6 @@ ], "result": { "count": 10, - "item": "minecraft:prismarine_crystals" + "id": "minecraft:prismarine_crystals" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/prismarine_shard.json b/src/generated/resources/data/reliquary/recipe/uncrafting/prismarine_shard.json similarity index 81% rename from src/generated/resources/data/reliquary/recipes/uncrafting/prismarine_shard.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/prismarine_shard.json index 0797b608..edc8f975 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/prismarine_shard.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/prismarine_shard.json @@ -8,6 +8,6 @@ ], "result": { "count": 5, - "item": "minecraft:prismarine_shard" + "id": "minecraft:prismarine_shard" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/redstone.json b/src/generated/resources/data/reliquary/recipe/uncrafting/redstone.json similarity index 76% rename from src/generated/resources/data/reliquary/recipes/uncrafting/redstone.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/redstone.json index a1ac2d25..9706fbda 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/redstone.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/redstone.json @@ -13,7 +13,6 @@ ], "result": { "count": 6, - "item": "minecraft:redstone" - }, - "show_notification": true + "id": "minecraft:redstone" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/rotten_flesh.json b/src/generated/resources/data/reliquary/recipe/uncrafting/rotten_flesh.json similarity index 82% rename from src/generated/resources/data/reliquary/recipes/uncrafting/rotten_flesh.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/rotten_flesh.json index 8d81f19c..4bb51f57 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/rotten_flesh.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/rotten_flesh.json @@ -8,6 +8,6 @@ ], "result": { "count": 6, - "item": "minecraft:rotten_flesh" + "id": "minecraft:rotten_flesh" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/slime_ball.json b/src/generated/resources/data/reliquary/recipe/uncrafting/slime_ball.json similarity index 83% rename from src/generated/resources/data/reliquary/recipes/uncrafting/slime_ball.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/slime_ball.json index e76cfe70..c3de959d 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/slime_ball.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/slime_ball.json @@ -8,6 +8,6 @@ ], "result": { "count": 6, - "item": "minecraft:slime_ball" + "id": "minecraft:slime_ball" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/snowball.json b/src/generated/resources/data/reliquary/recipe/uncrafting/snowball.json similarity index 84% rename from src/generated/resources/data/reliquary/recipes/uncrafting/snowball.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/snowball.json index 0411a8f3..37cf26d3 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/snowball.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/snowball.json @@ -8,6 +8,6 @@ ], "result": { "count": 5, - "item": "minecraft:snowball" + "id": "minecraft:snowball" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/uncrafting/spawn_egg.json b/src/generated/resources/data/reliquary/recipe/uncrafting/spawn_egg.json new file mode 100644 index 00000000..9f4fb6ab --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/spawn_egg.json @@ -0,0 +1,24 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:spawn_egg_enabled" + } + ], + "type": "reliquary:fragment_to_spawn_egg", + "category": "misc", + "ingredients": [ + { + "item": "reliquary:mob_charm_fragment" + }, + { + "item": "reliquary:mob_charm_fragment" + }, + { + "item": "minecraft:egg" + } + ], + "result": { + "count": 1, + "id": "minecraft:chicken_spawn_egg" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/spider_eye.json b/src/generated/resources/data/reliquary/recipe/uncrafting/spider_eye.json similarity index 86% rename from src/generated/resources/data/reliquary/recipes/uncrafting/spider_eye.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/spider_eye.json index 4892fa2c..a86f4e5e 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/spider_eye.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/spider_eye.json @@ -11,6 +11,6 @@ ], "result": { "count": 2, - "item": "minecraft:spider_eye" + "id": "minecraft:spider_eye" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/stick.json b/src/generated/resources/data/reliquary/recipe/uncrafting/stick.json similarity index 85% rename from src/generated/resources/data/reliquary/recipes/uncrafting/stick.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/stick.json index d2a90a69..85d60519 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/stick.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/stick.json @@ -8,6 +8,6 @@ ], "result": { "count": 4, - "item": "minecraft:stick" + "id": "minecraft:stick" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/string.json b/src/generated/resources/data/reliquary/recipe/uncrafting/string.json similarity index 84% rename from src/generated/resources/data/reliquary/recipes/uncrafting/string.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/string.json index b67733cb..3c44f2ec 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/string.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/string.json @@ -8,6 +8,6 @@ ], "result": { "count": 6, - "item": "minecraft:string" + "id": "minecraft:string" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/sugar.json b/src/generated/resources/data/reliquary/recipe/uncrafting/sugar.json similarity index 75% rename from src/generated/resources/data/reliquary/recipes/uncrafting/sugar.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/sugar.json index c62fd2f1..f29c6e74 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/sugar.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/sugar.json @@ -11,7 +11,6 @@ ], "result": { "count": 6, - "item": "minecraft:sugar" - }, - "show_notification": true + "id": "minecraft:sugar" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/wither_skeleton_skull.json b/src/generated/resources/data/reliquary/recipe/uncrafting/wither_skeleton_skull.json similarity index 84% rename from src/generated/resources/data/reliquary/recipes/uncrafting/wither_skeleton_skull.json rename to src/generated/resources/data/reliquary/recipe/uncrafting/wither_skeleton_skull.json index 4d2356b4..ed13f071 100644 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/wither_skeleton_skull.json +++ b/src/generated/resources/data/reliquary/recipe/uncrafting/wither_skeleton_skull.json @@ -16,6 +16,7 @@ } ], "result": { - "item": "minecraft:wither_skeleton_skull" + "count": 1, + "id": "minecraft:wither_skeleton_skull" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/void_tear.json b/src/generated/resources/data/reliquary/recipe/void_tear.json similarity index 78% rename from src/generated/resources/data/reliquary/recipes/void_tear.json rename to src/generated/resources/data/reliquary/recipe/void_tear.json index a6281c96..264b058c 100644 --- a/src/generated/resources/data/reliquary/recipes/void_tear.json +++ b/src/generated/resources/data/reliquary/recipe/void_tear.json @@ -12,10 +12,11 @@ "item": "reliquary:slime_pearl" }, { - "tag": "forge:gems/lapis" + "tag": "c:gems/lapis" } ], "result": { - "item": "reliquary:void_tear" + "count": 1, + "id": "reliquary:void_tear" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/witch_hat.json b/src/generated/resources/data/reliquary/recipe/witch_hat.json new file mode 100644 index 00000000..440ab26a --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/witch_hat.json @@ -0,0 +1,35 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "G": { + "tag": "c:ingots/gold" + }, + "L": { + "tag": "c:dusts/glowstone" + }, + "R": { + "tag": "c:dusts/redstone" + }, + "S": { + "item": "minecraft:sugar" + }, + "T": { + "item": "minecraft:stick" + } + }, + "pattern": [ + "SLS", + "RGR", + "TLT" + ], + "result": { + "count": 1, + "id": "reliquary:witch_hat" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/withered_rib.json b/src/generated/resources/data/reliquary/recipe/withered_rib.json new file mode 100644 index 00000000..33085434 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/withered_rib.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "D": { + "tag": "c:gems/diamond" + }, + "S": { + "item": "minecraft:skeleton_skull" + } + }, + "pattern": [ + "D D", + " S ", + "D D" + ], + "result": { + "count": 1, + "id": "reliquary:withered_rib" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/witherless_rose.json b/src/generated/resources/data/reliquary/recipe/witherless_rose.json similarity index 72% rename from src/generated/resources/data/reliquary/recipes/witherless_rose.json rename to src/generated/resources/data/reliquary/recipe/witherless_rose.json index 05d8fb20..b3051e1f 100644 --- a/src/generated/resources/data/reliquary/recipes/witherless_rose.json +++ b/src/generated/resources/data/reliquary/recipe/witherless_rose.json @@ -6,7 +6,7 @@ "item": "reliquary:fertile_essence" }, "N": { - "tag": "forge:nether_stars" + "tag": "c:nether_stars" }, "R": { "item": "minecraft:rose_bush" @@ -18,7 +18,7 @@ "FNF" ], "result": { - "item": "reliquary:witherless_rose" - }, - "show_notification": true + "count": 1, + "id": "reliquary:witherless_rose" + } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/wraith_node.json b/src/generated/resources/data/reliquary/recipe/wraith_node.json similarity index 68% rename from src/generated/resources/data/reliquary/recipes/wraith_node.json rename to src/generated/resources/data/reliquary/recipe/wraith_node.json index fcb8f866..c7ad4c6d 100644 --- a/src/generated/resources/data/reliquary/recipes/wraith_node.json +++ b/src/generated/resources/data/reliquary/recipe/wraith_node.json @@ -6,10 +6,11 @@ "item": "reliquary:nebulous_heart" }, { - "tag": "forge:gems/emerald" + "tag": "c:gems/emerald" } ], "result": { - "item": "reliquary:wraith_node" + "count": 1, + "id": "reliquary:wraith_node" } } \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipe/zombie_heart.json b/src/generated/resources/data/reliquary/recipe/zombie_heart.json new file mode 100644 index 00000000..e8bc0804 --- /dev/null +++ b/src/generated/resources/data/reliquary/recipe/zombie_heart.json @@ -0,0 +1,26 @@ +{ + "neoforge:conditions": [ + { + "type": "reliquary:mob_drops_craftable" + } + ], + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "F": { + "item": "minecraft:rotten_flesh" + }, + "I": { + "tag": "c:ingots/iron" + } + }, + "pattern": [ + "III", + "IFI", + "III" + ], + "result": { + "count": 1, + "id": "reliquary:zombie_heart" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/charging/glowstone.json b/src/generated/resources/data/reliquary/recipes/alkahestry/charging/glowstone.json deleted file mode 100644 index 36973add..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/charging/glowstone.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_charging", - "charge": 4, - "ingredient": { - "item": "minecraft:glowstone" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/charging/glowstone_dust.json b/src/generated/resources/data/reliquary/recipes/alkahestry/charging/glowstone_dust.json deleted file mode 100644 index a30f31cd..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/charging/glowstone_dust.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_charging", - "charge": 1, - "ingredient": { - "item": "minecraft:glowstone_dust" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/charging/redstone.json b/src/generated/resources/data/reliquary/recipes/alkahestry/charging/redstone.json deleted file mode 100644 index 2e62c30b..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/charging/redstone.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_charging", - "charge": 1, - "ingredient": { - "item": "minecraft:redstone" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/charging/redstone_block.json b/src/generated/resources/data/reliquary/recipes/alkahestry/charging/redstone_block.json deleted file mode 100644 index fbfbd3cf..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/charging/redstone_block.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_charging", - "charge": 9, - "ingredient": { - "item": "minecraft:redstone_block" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/charcoal.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/charcoal.json deleted file mode 100644 index 58c8a693..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/charcoal.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 4, - "ingredient": { - "item": "minecraft:charcoal" - }, - "result_count": 5 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/clay.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/clay.json deleted file mode 100644 index 2209bb07..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/clay.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 4, - "ingredient": { - "item": "minecraft:clay" - }, - "result_count": 3 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/copper_ingot.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/copper_ingot.json deleted file mode 100644 index 36c4697d..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/copper_ingot.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - }, - { - "type": "forge:not", - "value": { - "type": "forge:tag_empty", - "tag": "forge:ingots/copper" - } - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 8, - "ingredient": { - "tag": "forge:ingots/copper" - }, - "result_count": 5 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/diamond.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/diamond.json deleted file mode 100644 index 85dbdca5..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/diamond.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 64, - "ingredient": { - "tag": "forge:gems/diamond" - }, - "result_count": 2 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/dirt.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/dirt.json deleted file mode 100644 index 511a2ef3..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/dirt.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 4, - "ingredient": { - "item": "minecraft:dirt" - }, - "result_count": 33 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/emerald.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/emerald.json deleted file mode 100644 index c3ef3fae..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/emerald.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 32, - "ingredient": { - "tag": "forge:gems/emerald" - }, - "result_count": 2 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/end_stone.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/end_stone.json deleted file mode 100644 index ae5ff15e..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/end_stone.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 8, - "ingredient": { - "tag": "forge:end_stones" - }, - "result_count": 17 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/flint.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/flint.json deleted file mode 100644 index 97f38f90..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/flint.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 8, - "ingredient": { - "item": "minecraft:flint" - }, - "result_count": 9 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/gold_ingot.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/gold_ingot.json deleted file mode 100644 index 1c35d150..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/gold_ingot.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 32, - "ingredient": { - "tag": "forge:ingots/gold" - }, - "result_count": 2 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/gravel.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/gravel.json deleted file mode 100644 index a7ee77ed..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/gravel.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 4, - "ingredient": { - "tag": "forge:gravel" - }, - "result_count": 17 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/gunpowder.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/gunpowder.json deleted file mode 100644 index 6d9f8320..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/gunpowder.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 8, - "ingredient": { - "tag": "forge:gunpowder" - }, - "result_count": 3 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/iron_ingot.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/iron_ingot.json deleted file mode 100644 index e128a09f..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/iron_ingot.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 32, - "ingredient": { - "tag": "forge:ingots/iron" - }, - "result_count": 2 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/lapis_lazuli.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/lapis_lazuli.json deleted file mode 100644 index c425fe94..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/lapis_lazuli.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 4, - "ingredient": { - "tag": "forge:gems/lapis" - }, - "result_count": 2 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/nether_star.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/nether_star.json deleted file mode 100644 index 10f2ca4b..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/nether_star.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 256, - "ingredient": { - "tag": "forge:nether_stars" - }, - "result_count": 2 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/netherrack.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/netherrack.json deleted file mode 100644 index bb603e7c..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/netherrack.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 4, - "ingredient": { - "tag": "forge:netherrack" - }, - "result_count": 9 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/obsidian.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/obsidian.json deleted file mode 100644 index d41c61a8..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/obsidian.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 8, - "ingredient": { - "tag": "forge:obsidian" - }, - "result_count": 5 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/sand.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/sand.json deleted file mode 100644 index a3c2bc39..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/sand.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 4, - "ingredient": { - "tag": "forge:sand" - }, - "result_count": 33 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/sandstone.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/sandstone.json deleted file mode 100644 index 1cce75fb..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/sandstone.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 4, - "ingredient": { - "tag": "forge:sandstone" - }, - "result_count": 9 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/silver_ingot.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/silver_ingot.json deleted file mode 100644 index 1985e009..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/silver_ingot.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - }, - { - "type": "forge:not", - "value": { - "type": "forge:tag_empty", - "tag": "forge:ingots/silver" - } - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 32, - "ingredient": { - "tag": "forge:ingots/silver" - }, - "result_count": 2 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/soul_sand.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/soul_sand.json deleted file mode 100644 index c5b95fc2..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/soul_sand.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 8, - "ingredient": { - "item": "minecraft:soul_sand" - }, - "result_count": 9 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/steel_ingot.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/steel_ingot.json deleted file mode 100644 index 686d1599..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/steel_ingot.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - }, - { - "type": "forge:not", - "value": { - "type": "forge:tag_empty", - "tag": "forge:ingots/steel" - } - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 32, - "ingredient": { - "tag": "forge:ingots/steel" - }, - "result_count": 2 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/tin_ingot.json b/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/tin_ingot.json deleted file mode 100644 index 58d8cdec..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/crafting/tin_ingot.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - }, - { - "type": "forge:not", - "value": { - "type": "forge:tag_empty", - "tag": "forge:ingots/tin" - } - } - ], - "recipe": { - "type": "reliquary:alkahestry_crafting", - "charge": 32, - "ingredient": { - "tag": "forge:ingots/tin" - }, - "result_count": 2 - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry/drain/redstone.json b/src/generated/resources/data/reliquary/recipes/alkahestry/drain/redstone.json deleted file mode 100644 index 89628efe..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry/drain/redstone.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "reliquary:alkahestry_drain", - "charge": 1, - "result": { - "item": "minecraft:redstone" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/alkahestry_tome.json b/src/generated/resources/data/reliquary/recipes/alkahestry_tome.json deleted file mode 100644 index 9363edc9..00000000 --- a/src/generated/resources/data/reliquary/recipes/alkahestry_tome.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:alkahestry_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "reliquary:molten_core" - }, - { - "item": "reliquary:witch_hat" - }, - { - "item": "reliquary:eye_of_the_storm" - }, - { - "item": "reliquary:catalyzing_gland" - }, - { - "item": "minecraft:book" - }, - { - "item": "reliquary:slime_pearl" - }, - { - "item": "reliquary:chelicerae" - }, - { - "item": "minecraft:wither_skeleton_skull" - }, - { - "item": "reliquary:nebulous_heart" - } - ], - "result": { - "item": "reliquary:alkahestry_tome" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/aphrodite_potion.json b/src/generated/resources/data/reliquary/recipes/aphrodite_potion.json deleted file mode 100644 index 850682fa..00000000 --- a/src/generated/resources/data/reliquary/recipes/aphrodite_potion.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "item": "minecraft:water_bucket" - }, - "C": { - "item": "minecraft:cocoa_beans" - }, - "F": { - "item": "reliquary:fertile_essence" - }, - "G": { - "tag": "forge:glass_panes" - }, - "R": { - "tag": "forge:dyes/red" - } - }, - "pattern": [ - "GBG", - "GFG", - "RGC" - ], - "result": { - "item": "reliquary:aphrodite_potion" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/apothecary_cauldron.json b/src/generated/resources/data/reliquary/recipes/apothecary_cauldron.json deleted file mode 100644 index 77e8aad3..00000000 --- a/src/generated/resources/data/reliquary/recipes/apothecary_cauldron.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:cauldron" - }, - "G": { - "item": "reliquary:catalyzing_gland" - }, - "I": { - "item": "reliquary:infernal_claw" - }, - "M": { - "item": "reliquary:molten_core" - }, - "N": { - "item": "reliquary:nebulous_heart" - } - }, - "pattern": [ - "GNG", - "ICI", - "NMN" - ], - "result": { - "item": "reliquary:apothecary_cauldron" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/apothecary_mortar.json b/src/generated/resources/data/reliquary/recipes/apothecary_mortar.json deleted file mode 100644 index e8eb1f66..00000000 --- a/src/generated/resources/data/reliquary/recipes/apothecary_mortar.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "G": { - "item": "reliquary:catalyzing_gland" - }, - "N": { - "tag": "forge:storage_blocks/quartz" - } - }, - "pattern": [ - "GNG", - "NGN", - "NNN" - ], - "result": { - "item": "reliquary:apothecary_mortar" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/barrel_assembly.json b/src/generated/resources/data/reliquary/recipes/barrel_assembly.json deleted file mode 100644 index 8ac798bd..00000000 --- a/src/generated/resources/data/reliquary/recipes/barrel_assembly.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "E": { - "item": "reliquary:nebulous_heart" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "M": { - "item": "minecraft:magma_cream" - } - }, - "pattern": [ - "III", - "EME", - "III" - ], - "result": { - "item": "reliquary:barrel_assembly" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bat_wing.json b/src/generated/resources/data/reliquary/recipes/bat_wing.json deleted file mode 100644 index 749666a7..00000000 --- a/src/generated/resources/data/reliquary/recipes/bat_wing.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "F": { - "tag": "forge:feathers" - }, - "G": { - "tag": "forge:ingots/gold" - } - }, - "pattern": [ - "GGG", - "GFG", - "GGG" - ], - "result": { - "item": "reliquary:bat_wing" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/blaze_bullet.json b/src/generated/resources/data/reliquary/recipes/bullets/blaze_bullet.json deleted file mode 100644 index 1ad04642..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/blaze_bullet.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "minecraft:blaze_powder" - }, - { - "tag": "forge:rods/blaze" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:nuggets/gold" - } - ], - "result": { - "count": 8, - "item": "reliquary:bullets/blaze_bullet" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/blaze_bullet_potion.json b/src/generated/resources/data/reliquary/recipes/bullets/blaze_bullet_potion.json deleted file mode 100644 index f61d942c..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/blaze_bullet_potion.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.2, - "key": { - "B": { - "item": "reliquary:bullets/blaze_bullet" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "BBB", - "BPB", - "BBB" - ], - "result": { - "count": 8, - "item": "reliquary:bullets/blaze_bullet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/buster_bullet.json b/src/generated/resources/data/reliquary/recipes/bullets/buster_bullet.json deleted file mode 100644 index 35ac890a..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/buster_bullet.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "reliquary:bullets/concussive_bullet" - }, - { - "item": "reliquary:bullets/concussive_bullet" - }, - { - "item": "reliquary:bullets/concussive_bullet" - }, - { - "item": "reliquary:bullets/concussive_bullet" - }, - { - "item": "reliquary:bullets/concussive_bullet" - }, - { - "item": "reliquary:bullets/concussive_bullet" - }, - { - "item": "reliquary:bullets/concussive_bullet" - }, - { - "item": "reliquary:bullets/concussive_bullet" - }, - { - "item": "reliquary:catalyzing_gland" - } - ], - "result": { - "count": 8, - "item": "reliquary:bullets/buster_bullet" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/buster_bullet_potion.json b/src/generated/resources/data/reliquary/recipes/bullets/buster_bullet_potion.json deleted file mode 100644 index 849c1bc5..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/buster_bullet_potion.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.2, - "key": { - "B": { - "item": "reliquary:bullets/buster_bullet" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "BBB", - "BPB", - "BBB" - ], - "result": { - "count": 8, - "item": "reliquary:bullets/buster_bullet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/concussive_bullet.json b/src/generated/resources/data/reliquary/recipes/bullets/concussive_bullet.json deleted file mode 100644 index 16725c98..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/concussive_bullet.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "tag": "forge:slimeballs" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:gunpowder" - } - ], - "result": { - "count": 8, - "item": "reliquary:bullets/concussive_bullet" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/concussive_bullet_potion.json b/src/generated/resources/data/reliquary/recipes/bullets/concussive_bullet_potion.json deleted file mode 100644 index 08144486..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/concussive_bullet_potion.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.2, - "key": { - "B": { - "item": "reliquary:bullets/concussive_bullet" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "BBB", - "BPB", - "BBB" - ], - "result": { - "count": 8, - "item": "reliquary:bullets/concussive_bullet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/ender_bullet.json b/src/generated/resources/data/reliquary/recipes/bullets/ender_bullet.json deleted file mode 100644 index 055bacbb..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/ender_bullet.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "reliquary:bullets/seeker_bullet" - }, - { - "item": "reliquary:bullets/seeker_bullet" - }, - { - "item": "reliquary:bullets/seeker_bullet" - }, - { - "item": "reliquary:bullets/seeker_bullet" - }, - { - "item": "reliquary:bullets/seeker_bullet" - }, - { - "item": "reliquary:bullets/seeker_bullet" - }, - { - "item": "reliquary:bullets/seeker_bullet" - }, - { - "item": "reliquary:bullets/seeker_bullet" - }, - { - "item": "reliquary:nebulous_heart" - } - ], - "result": { - "count": 8, - "item": "reliquary:bullets/ender_bullet" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/ender_bullet_potion.json b/src/generated/resources/data/reliquary/recipes/bullets/ender_bullet_potion.json deleted file mode 100644 index d2bb879f..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/ender_bullet_potion.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.2, - "key": { - "B": { - "item": "reliquary:bullets/ender_bullet" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "BBB", - "BPB", - "BBB" - ], - "result": { - "count": 8, - "item": "reliquary:bullets/ender_bullet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/exorcism_bullet.json b/src/generated/resources/data/reliquary/recipes/bullets/exorcism_bullet.json deleted file mode 100644 index 8cdab8ec..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/exorcism_bullet.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "reliquary:bullets/neutral_bullet" - }, - { - "item": "reliquary:bullets/neutral_bullet" - }, - { - "item": "reliquary:bullets/neutral_bullet" - }, - { - "item": "reliquary:bullets/neutral_bullet" - }, - { - "item": "reliquary:bullets/neutral_bullet" - }, - { - "item": "reliquary:bullets/neutral_bullet" - }, - { - "item": "reliquary:bullets/neutral_bullet" - }, - { - "item": "reliquary:bullets/neutral_bullet" - }, - { - "item": "reliquary:zombie_heart" - } - ], - "result": { - "count": 8, - "item": "reliquary:bullets/exorcism_bullet" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/exorcism_bullet_potion.json b/src/generated/resources/data/reliquary/recipes/bullets/exorcism_bullet_potion.json deleted file mode 100644 index e3541c39..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/exorcism_bullet_potion.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.2, - "key": { - "B": { - "item": "reliquary:bullets/exorcism_bullet" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "BBB", - "BPB", - "BBB" - ], - "result": { - "count": 8, - "item": "reliquary:bullets/exorcism_bullet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/neutral_bullet.json b/src/generated/resources/data/reliquary/recipes/bullets/neutral_bullet.json deleted file mode 100644 index 958f9dc3..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/neutral_bullet.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "minecraft:flint" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:gunpowder" - } - ], - "result": { - "count": 8, - "item": "reliquary:bullets/neutral_bullet" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/neutral_bullet_potion.json b/src/generated/resources/data/reliquary/recipes/bullets/neutral_bullet_potion.json deleted file mode 100644 index 2cee0bd2..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/neutral_bullet_potion.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.2, - "key": { - "B": { - "item": "reliquary:bullets/neutral_bullet" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "BBB", - "BPB", - "BBB" - ], - "result": { - "count": 8, - "item": "reliquary:bullets/neutral_bullet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/sand_bullet.json b/src/generated/resources/data/reliquary/recipes/bullets/sand_bullet.json deleted file mode 100644 index a03a54ef..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/sand_bullet.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "tag": "forge:sandstone" - }, - { - "tag": "forge:slimeballs" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:gunpowder" - } - ], - "result": { - "count": 8, - "item": "reliquary:bullets/sand_bullet" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/sand_bullet_potion.json b/src/generated/resources/data/reliquary/recipes/bullets/sand_bullet_potion.json deleted file mode 100644 index 87ea75ce..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/sand_bullet_potion.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.2, - "key": { - "B": { - "item": "reliquary:bullets/sand_bullet" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "BBB", - "BPB", - "BBB" - ], - "result": { - "count": 8, - "item": "reliquary:bullets/sand_bullet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/seeker_bullet.json b/src/generated/resources/data/reliquary/recipes/bullets/seeker_bullet.json deleted file mode 100644 index 97b29a5e..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/seeker_bullet.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "tag": "forge:gems/lapis" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:gunpowder" - } - ], - "result": { - "count": 8, - "item": "reliquary:bullets/seeker_bullet" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/seeker_bullet_potion.json b/src/generated/resources/data/reliquary/recipes/bullets/seeker_bullet_potion.json deleted file mode 100644 index 370485db..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/seeker_bullet_potion.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.2, - "key": { - "B": { - "item": "reliquary:bullets/seeker_bullet" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "BBB", - "BPB", - "BBB" - ], - "result": { - "count": 8, - "item": "reliquary:bullets/seeker_bullet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/storm_bullet.json b/src/generated/resources/data/reliquary/recipes/bullets/storm_bullet.json deleted file mode 100644 index 4fc262ce..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/storm_bullet.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "reliquary:catalyzing_gland" - }, - { - "item": "reliquary:catalyzing_gland" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:nuggets/gold" - }, - { - "tag": "forge:gunpowder" - } - ], - "result": { - "count": 8, - "item": "reliquary:bullets/storm_bullet" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/bullets/storm_bullet_potion.json b/src/generated/resources/data/reliquary/recipes/bullets/storm_bullet_potion.json deleted file mode 100644 index ba9a5b9e..00000000 --- a/src/generated/resources/data/reliquary/recipes/bullets/storm_bullet_potion.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.2, - "key": { - "B": { - "item": "reliquary:bullets/storm_bullet" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "BBB", - "BPB", - "BBB" - ], - "result": { - "count": 8, - "item": "reliquary:bullets/storm_bullet" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/catalyzing_gland.json b/src/generated/resources/data/reliquary/recipes/catalyzing_gland.json deleted file mode 100644 index da9902b7..00000000 --- a/src/generated/resources/data/reliquary/recipes/catalyzing_gland.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "G": { - "tag": "forge:ingots/gold" - }, - "P": { - "tag": "forge:gunpowder" - } - }, - "pattern": [ - "GGG", - "GPG", - "GGG" - ], - "result": { - "item": "reliquary:catalyzing_gland" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/chelicerae.json b/src/generated/resources/data/reliquary/recipes/chelicerae.json deleted file mode 100644 index 114799d2..00000000 --- a/src/generated/resources/data/reliquary/recipes/chelicerae.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "G": { - "tag": "forge:ingots/gold" - }, - "S": { - "tag": "forge:string" - } - }, - "pattern": [ - "GGG", - "GSG", - "GGG" - ], - "result": { - "item": "reliquary:chelicerae" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/emperor_chalice.json b/src/generated/resources/data/reliquary/recipes/emperor_chalice.json deleted file mode 100644 index a5e936a3..00000000 --- a/src/generated/resources/data/reliquary/recipes/emperor_chalice.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "tag": "forge:gems/emerald" - }, - { - "tag": "forge:ingots/gold" - }, - { - "item": "minecraft:bucket" - }, - { - "type": "forge:nbt", - "count": 1, - "item": "reliquary:void_tear" - } - ], - "result": { - "item": "reliquary:emperor_chalice" - } -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/empty_potion_vial.json b/src/generated/resources/data/reliquary/recipes/empty_potion_vial.json deleted file mode 100644 index 9c331815..00000000 --- a/src/generated/resources/data/reliquary/recipes/empty_potion_vial.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "G": { - "tag": "forge:glass_panes" - } - }, - "pattern": [ - "G G", - "G G", - " G " - ], - "result": { - "item": "reliquary:empty_potion_vial" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/ender_staff.json b/src/generated/resources/data/reliquary/recipes/ender_staff.json deleted file mode 100644 index 468c79e4..00000000 --- a/src/generated/resources/data/reliquary/recipes/ender_staff.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "item": "reliquary:bat_wing" - }, - "E": { - "item": "minecraft:ender_eye" - }, - "N": { - "item": "reliquary:nebulous_heart" - }, - "S": { - "item": "minecraft:stick" - }, - "V": { - "type": "forge:nbt", - "count": 1, - "item": "reliquary:void_tear" - } - }, - "pattern": [ - " BE", - "NVB", - "SN " - ], - "result": { - "item": "reliquary:ender_staff" - }, - "show_notification": true -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/eye_of_the_storm.json b/src/generated/resources/data/reliquary/recipes/eye_of_the_storm.json deleted file mode 100644 index 03637269..00000000 --- a/src/generated/resources/data/reliquary/recipes/eye_of_the_storm.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "reliquary:catalyzing_gland" - }, - "G": { - "tag": "forge:ingots/gold" - } - }, - "pattern": [ - "GGG", - "GCG", - "GGG" - ], - "result": { - "item": "reliquary:eye_of_the_storm" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/fertile_potion.json b/src/generated/resources/data/reliquary/recipes/fertile_potion.json deleted file mode 100644 index 0c3efd7c..00000000 --- a/src/generated/resources/data/reliquary/recipes/fertile_potion.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "item": "minecraft:water_bucket" - }, - "C": { - "tag": "forge:dyes/green" - }, - "F": { - "item": "reliquary:fertile_essence" - }, - "G": { - "tag": "forge:glass_panes" - }, - "Y": { - "tag": "forge:dyes/yellow" - } - }, - "pattern": [ - "GBG", - "GFG", - "CGY" - ], - "result": { - "item": "reliquary:fertile_potion" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/frozen_core.json b/src/generated/resources/data/reliquary/recipes/frozen_core.json deleted file mode 100644 index a19aa625..00000000 --- a/src/generated/resources/data/reliquary/recipes/frozen_core.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "G": { - "tag": "forge:ingots/gold" - }, - "P": { - "item": "minecraft:pumpkin" - }, - "S": { - "item": "minecraft:snow" - } - }, - "pattern": [ - "GPG", - "GSG", - "GSG" - ], - "result": { - "item": "reliquary:frozen_core" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/glacial_staff.json b/src/generated/resources/data/reliquary/recipes/glacial_staff.json deleted file mode 100644 index 889f0578..00000000 --- a/src/generated/resources/data/reliquary/recipes/glacial_staff.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "reliquary:ice_magus_rod" - }, - { - "type": "forge:nbt", - "count": 1, - "item": "reliquary:void_tear" - }, - { - "item": "reliquary:frozen_core" - }, - { - "item": "reliquary:shears_of_winter" - } - ], - "result": { - "item": "reliquary:glacial_staff" - } -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/grip_assembly.json b/src/generated/resources/data/reliquary/recipes/grip_assembly.json deleted file mode 100644 index 2f559a21..00000000 --- a/src/generated/resources/data/reliquary/recipes/grip_assembly.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "reliquary:magazines/empty_magazine" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "M": { - "item": "minecraft:magma_cream" - } - }, - "pattern": [ - "III", - "IMI", - "ICI" - ], - "result": { - "item": "reliquary:grip_assembly" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/guardian_spike.json b/src/generated/resources/data/reliquary/recipes/guardian_spike.json deleted file mode 100644 index 86a83b9a..00000000 --- a/src/generated/resources/data/reliquary/recipes/guardian_spike.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "G": { - "tag": "forge:ingots/gold" - }, - "P": { - "tag": "forge:dusts/prismarine" - } - }, - "pattern": [ - "GGG", - "GPG", - "GGG" - ], - "result": { - "item": "reliquary:guardian_spike" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/hammer_assembly.json b/src/generated/resources/data/reliquary/recipes/hammer_assembly.json deleted file mode 100644 index 71ed6214..00000000 --- a/src/generated/resources/data/reliquary/recipes/hammer_assembly.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "item": "minecraft:stone_button" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "M": { - "item": "reliquary:molten_core" - }, - "R": { - "tag": "forge:rods/blaze" - } - }, - "pattern": [ - "IIB", - "RMI", - "III" - ], - "result": { - "item": "reliquary:hammer_assembly" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/handgun.json b/src/generated/resources/data/reliquary/recipes/handgun.json deleted file mode 100644 index a01c3f1a..00000000 --- a/src/generated/resources/data/reliquary/recipes/handgun.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "item": "reliquary:barrel_assembly" - }, - "G": { - "item": "reliquary:grip_assembly" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "M": { - "item": "reliquary:hammer_assembly" - }, - "S": { - "item": "reliquary:slime_pearl" - } - }, - "pattern": [ - "BIM", - "ISI", - "IGI" - ], - "result": { - "item": "reliquary:handgun" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/harvest_rod.json b/src/generated/resources/data/reliquary/recipes/harvest_rod.json deleted file mode 100644 index cf064491..00000000 --- a/src/generated/resources/data/reliquary/recipes/harvest_rod.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "F": { - "item": "reliquary:fertile_essence" - }, - "R": { - "item": "minecraft:rose_bush" - }, - "S": { - "item": "minecraft:stick" - }, - "T": { - "type": "forge:nbt", - "count": 1, - "item": "reliquary:void_tear" - }, - "V": { - "item": "minecraft:vine" - } - }, - "pattern": [ - " RF", - "VTR", - "SV " - ], - "result": { - "item": "reliquary:harvest_rod" - }, - "show_notification": true -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/ice_magus_rod.json b/src/generated/resources/data/reliquary/recipes/ice_magus_rod.json deleted file mode 100644 index 7ccdd082..00000000 --- a/src/generated/resources/data/reliquary/recipes/ice_magus_rod.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "F": { - "item": "reliquary:frozen_core" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "V": { - "type": "forge:nbt", - "count": 1, - "item": "reliquary:void_tear" - } - }, - "pattern": [ - " DF", - " VD", - "I " - ], - "result": { - "item": "reliquary:ice_magus_rod" - }, - "show_notification": true -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/infernal_tear.json b/src/generated/resources/data/reliquary/recipes/infernal_tear.json deleted file mode 100644 index 3f2a0131..00000000 --- a/src/generated/resources/data/reliquary/recipes/infernal_tear.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "type": "forge:nbt", - "count": 1, - "item": "reliquary:void_tear" - }, - { - "item": "reliquary:witch_hat" - }, - { - "item": "reliquary:molten_core" - }, - { - "item": "reliquary:infernal_claw" - } - ], - "result": { - "item": "reliquary:infernal_tear" - } -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/blaze_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/blaze_magazine.json deleted file mode 100644 index 0151173e..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/blaze_magazine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 1.0, - "key": { - "B": { - "item": "reliquary:bullets/blaze_bullet" - }, - "M": { - "item": "reliquary:magazines/empty_magazine" - } - }, - "pattern": [ - "BBB", - "BMB", - "BBB" - ], - "result": { - "item": "reliquary:magazines/blaze_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/buster_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/buster_magazine.json deleted file mode 100644 index 9ab73f56..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/buster_magazine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 1.0, - "key": { - "B": { - "item": "reliquary:bullets/buster_bullet" - }, - "M": { - "item": "reliquary:magazines/empty_magazine" - } - }, - "pattern": [ - "BBB", - "BMB", - "BBB" - ], - "result": { - "item": "reliquary:magazines/buster_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/concussive_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/concussive_magazine.json deleted file mode 100644 index 59fde789..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/concussive_magazine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 1.0, - "key": { - "B": { - "item": "reliquary:bullets/concussive_bullet" - }, - "M": { - "item": "reliquary:magazines/empty_magazine" - } - }, - "pattern": [ - "BBB", - "BMB", - "BBB" - ], - "result": { - "item": "reliquary:magazines/concussive_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/empty_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/empty_magazine.json deleted file mode 100644 index 611efd92..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/empty_magazine.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "G": { - "tag": "forge:glass" - }, - "I": { - "tag": "forge:ingots/iron" - }, - "S": { - "tag": "forge:stone" - } - }, - "pattern": [ - "I I", - "IGI", - "SIS" - ], - "result": { - "item": "reliquary:magazines/empty_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/ender_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/ender_magazine.json deleted file mode 100644 index 979ed1aa..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/ender_magazine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 1.0, - "key": { - "B": { - "item": "reliquary:bullets/ender_bullet" - }, - "M": { - "item": "reliquary:magazines/empty_magazine" - } - }, - "pattern": [ - "BBB", - "BMB", - "BBB" - ], - "result": { - "item": "reliquary:magazines/ender_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/exorcism_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/exorcism_magazine.json deleted file mode 100644 index 222e4e61..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/exorcism_magazine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 1.0, - "key": { - "B": { - "item": "reliquary:bullets/exorcism_bullet" - }, - "M": { - "item": "reliquary:magazines/empty_magazine" - } - }, - "pattern": [ - "BBB", - "BMB", - "BBB" - ], - "result": { - "item": "reliquary:magazines/exorcism_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/neutral_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/neutral_magazine.json deleted file mode 100644 index 6f807594..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/neutral_magazine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 1.0, - "key": { - "B": { - "item": "reliquary:bullets/neutral_bullet" - }, - "M": { - "item": "reliquary:magazines/empty_magazine" - } - }, - "pattern": [ - "BBB", - "BMB", - "BBB" - ], - "result": { - "item": "reliquary:magazines/neutral_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/sand_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/sand_magazine.json deleted file mode 100644 index 7ba6c7db..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/sand_magazine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 1.0, - "key": { - "B": { - "item": "reliquary:bullets/sand_bullet" - }, - "M": { - "item": "reliquary:magazines/empty_magazine" - } - }, - "pattern": [ - "BBB", - "BMB", - "BBB" - ], - "result": { - "item": "reliquary:magazines/sand_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/seeker_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/seeker_magazine.json deleted file mode 100644 index fac4b8ea..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/seeker_magazine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 1.0, - "key": { - "B": { - "item": "reliquary:bullets/seeker_bullet" - }, - "M": { - "item": "reliquary:magazines/empty_magazine" - } - }, - "pattern": [ - "BBB", - "BMB", - "BBB" - ], - "result": { - "item": "reliquary:magazines/seeker_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/magazines/storm_magazine.json b/src/generated/resources/data/reliquary/recipes/magazines/storm_magazine.json deleted file mode 100644 index af3adcee..00000000 --- a/src/generated/resources/data/reliquary/recipes/magazines/storm_magazine.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 1.0, - "key": { - "B": { - "item": "reliquary:bullets/storm_bullet" - }, - "M": { - "item": "reliquary:magazines/empty_magazine" - } - }, - "pattern": [ - "BBB", - "BMB", - "BBB" - ], - "result": { - "item": "reliquary:magazines/storm_magazine" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/midas_touchstone.json b/src/generated/resources/data/reliquary/recipes/midas_touchstone.json deleted file mode 100644 index 560fb22e..00000000 --- a/src/generated/resources/data/reliquary/recipes/midas_touchstone.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "minecraft:anvil" - }, - { - "tag": "forge:storage_blocks/gold" - }, - { - "tag": "forge:storage_blocks/gold" - }, - { - "item": "reliquary:molten_core" - }, - { - "item": "reliquary:molten_core" - }, - { - "item": "reliquary:molten_core" - }, - { - "item": "reliquary:catalyzing_gland" - }, - { - "item": "reliquary:catalyzing_gland" - }, - { - "type": "forge:nbt", - "count": 1, - "item": "reliquary:void_tear" - } - ], - "result": { - "item": "reliquary:midas_touchstone" - } -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/cave_spider.json b/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/cave_spider.json deleted file mode 100644 index bf2fc002..00000000 --- a/src/generated/resources/data/reliquary/recipes/mob_charm_fragments/cave_spider.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "key": { - "P": { - "item": "reliquary:chelicerae" - }, - "S": { - "tag": "forge:string" - }, - "T": { - "type": "forge:nbt", - "count": 1, - "item": "minecraft:potion", - "nbt": "{Potion:\"minecraft:poison\"}" - } - }, - "pattern": [ - "PPP", - "STS", - "PPP" - ], - "result": { - "item": "reliquary:mob_charm_fragment", - "nbt": "{entity:\"minecraft:cave_spider\"}" - } -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/molten_core.json b/src/generated/resources/data/reliquary/recipes/molten_core.json deleted file mode 100644 index 99bcda87..00000000 --- a/src/generated/resources/data/reliquary/recipes/molten_core.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "G": { - "tag": "forge:ingots/gold" - }, - "M": { - "item": "minecraft:magma_cream" - } - }, - "pattern": [ - "GGG", - "GMG", - "GGG" - ], - "result": { - "item": "reliquary:molten_core" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/nebulous_heart.json b/src/generated/resources/data/reliquary/recipes/nebulous_heart.json deleted file mode 100644 index e8b86b73..00000000 --- a/src/generated/resources/data/reliquary/recipes/nebulous_heart.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "E": { - "tag": "forge:ender_pearls" - }, - "G": { - "tag": "forge:ingots/gold" - } - }, - "pattern": [ - "GGG", - "GEG", - "GGG" - ], - "result": { - "item": "reliquary:nebulous_heart" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/black_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/black_pedestal.json deleted file mode 100644 index d8ebc7e4..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/black_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/black_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/black_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/blue_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/blue_pedestal.json deleted file mode 100644 index f9359427..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/blue_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/blue_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/blue_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/brown_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/brown_pedestal.json deleted file mode 100644 index a52f45c4..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/brown_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/brown_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/brown_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/cyan_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/cyan_pedestal.json deleted file mode 100644 index c2e0f70e..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/cyan_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/cyan_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/cyan_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/gray_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/gray_pedestal.json deleted file mode 100644 index 21515036..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/gray_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/gray_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/gray_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/green_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/green_pedestal.json deleted file mode 100644 index 7cc52c5e..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/green_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/green_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/green_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/light_blue_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/light_blue_pedestal.json deleted file mode 100644 index 25da0649..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/light_blue_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/light_blue_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/light_blue_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/light_gray_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/light_gray_pedestal.json deleted file mode 100644 index 298b2fd2..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/light_gray_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/light_gray_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/light_gray_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/lime_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/lime_pedestal.json deleted file mode 100644 index 38811261..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/lime_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/lime_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/lime_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/magenta_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/magenta_pedestal.json deleted file mode 100644 index 140c4a52..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/magenta_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/magenta_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/magenta_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/orange_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/orange_pedestal.json deleted file mode 100644 index ccf408fd..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/orange_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/orange_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/orange_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/black_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/black_passive_pedestal.json deleted file mode 100644 index 685a730c..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/black_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:black_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/black_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/blue_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/blue_passive_pedestal.json deleted file mode 100644 index a07fdbcc..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/blue_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:blue_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/blue_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/brown_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/brown_passive_pedestal.json deleted file mode 100644 index 30f078f0..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/brown_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:brown_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/brown_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/cyan_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/cyan_passive_pedestal.json deleted file mode 100644 index 7561d3a6..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/cyan_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:cyan_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/cyan_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/gray_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/gray_passive_pedestal.json deleted file mode 100644 index 624e3cec..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/gray_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:gray_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/gray_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/green_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/green_passive_pedestal.json deleted file mode 100644 index bba10db5..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/green_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:green_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/green_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/light_blue_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/light_blue_passive_pedestal.json deleted file mode 100644 index feaee66b..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/light_blue_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:light_blue_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/light_blue_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/light_gray_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/light_gray_passive_pedestal.json deleted file mode 100644 index 90d5cf62..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/light_gray_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:light_gray_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/light_gray_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/lime_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/lime_passive_pedestal.json deleted file mode 100644 index 15c08762..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/lime_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:lime_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/lime_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/magenta_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/magenta_passive_pedestal.json deleted file mode 100644 index 20e41e4f..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/magenta_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:magenta_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/magenta_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/orange_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/orange_passive_pedestal.json deleted file mode 100644 index 5367f88e..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/orange_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:orange_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/orange_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/pink_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/pink_passive_pedestal.json deleted file mode 100644 index c1ab771b..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/pink_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:pink_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/pink_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/purple_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/purple_passive_pedestal.json deleted file mode 100644 index 70f99165..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/purple_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:purple_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/purple_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/red_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/red_passive_pedestal.json deleted file mode 100644 index fbe2ea1f..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/red_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:red_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/red_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/white_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/white_passive_pedestal.json deleted file mode 100644 index 6dfab1f0..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/white_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:white_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/white_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/passive/yellow_passive_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/passive/yellow_passive_pedestal.json deleted file mode 100644 index 119895af..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/passive/yellow_passive_pedestal.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:passive_pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "C": { - "item": "minecraft:yellow_carpet" - }, - "G": { - "tag": "forge:nuggets/gold" - }, - "Q": { - "tag": "forge:storage_blocks/quartz" - }, - "S": { - "item": "minecraft:quartz_slab" - } - }, - "pattern": [ - " C ", - "GQG", - "SSS" - ], - "result": { - "item": "reliquary:pedestals/passive/yellow_passive_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/pink_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/pink_pedestal.json deleted file mode 100644 index 21ac7189..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/pink_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/pink_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/pink_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/purple_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/purple_pedestal.json deleted file mode 100644 index 675ad3a6..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/purple_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/purple_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/purple_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/red_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/red_pedestal.json deleted file mode 100644 index fbd315e5..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/red_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/red_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/red_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/white_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/white_pedestal.json deleted file mode 100644 index b42ba630..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/white_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/white_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/white_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/pedestals/yellow_pedestal.json b/src/generated/resources/data/reliquary/recipes/pedestals/yellow_pedestal.json deleted file mode 100644 index caafa76e..00000000 --- a/src/generated/resources/data/reliquary/recipes/pedestals/yellow_pedestal.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:pedestal_enabled" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "P": { - "item": "reliquary:pedestals/passive/yellow_passive_pedestal" - } - }, - "pattern": [ - "D D", - " P ", - "D D" - ], - "result": { - "item": "reliquary:pedestals/yellow_pedestal" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/rending_gale.json b/src/generated/resources/data/reliquary/recipes/rending_gale.json deleted file mode 100644 index 78e39e68..00000000 --- a/src/generated/resources/data/reliquary/recipes/rending_gale.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "item": "reliquary:bat_wing" - }, - "E": { - "item": "reliquary:eye_of_the_storm" - }, - "G": { - "tag": "forge:ingots/gold" - }, - "S": { - "item": "minecraft:stick" - }, - "V": { - "type": "forge:nbt", - "count": 1, - "item": "reliquary:void_tear" - } - }, - "pattern": [ - " BE", - "GVB", - "SG " - ], - "result": { - "item": "reliquary:rending_gale" - }, - "show_notification": true -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/rib_bone.json b/src/generated/resources/data/reliquary/recipes/rib_bone.json deleted file mode 100644 index ebc37c76..00000000 --- a/src/generated/resources/data/reliquary/recipes/rib_bone.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "B": { - "tag": "forge:bones" - }, - "I": { - "tag": "forge:ingots/iron" - } - }, - "pattern": [ - "III", - "IBI", - "III" - ], - "result": { - "item": "reliquary:rib_bone" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/slime_pearl.json b/src/generated/resources/data/reliquary/recipes/slime_pearl.json deleted file mode 100644 index 28d81c67..00000000 --- a/src/generated/resources/data/reliquary/recipes/slime_pearl.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "I": { - "tag": "forge:ingots/iron" - }, - "S": { - "tag": "forge:slimeballs" - } - }, - "pattern": [ - "III", - "ISI", - "III" - ], - "result": { - "item": "reliquary:slime_pearl" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/sojourner_staff.json b/src/generated/resources/data/reliquary/recipes/sojourner_staff.json deleted file mode 100644 index 386901bd..00000000 --- a/src/generated/resources/data/reliquary/recipes/sojourner_staff.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "type": "minecraft:crafting_shapeless", - "category": "misc", - "ingredients": [ - { - "item": "reliquary:molten_core" - }, - { - "tag": "forge:ingots/gold" - }, - { - "tag": "forge:rods/blaze" - }, - { - "type": "forge:nbt", - "count": 1, - "item": "reliquary:void_tear" - } - ], - "result": { - "item": "reliquary:sojourner_staff" - } -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/squid_beak.json b/src/generated/resources/data/reliquary/recipes/squid_beak.json deleted file mode 100644 index e798d2aa..00000000 --- a/src/generated/resources/data/reliquary/recipes/squid_beak.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "G": { - "tag": "forge:ingots/gold" - }, - "I": { - "item": "minecraft:ink_sac" - } - }, - "pattern": [ - "GGG", - "GIG", - "GGG" - ], - "result": { - "item": "reliquary:squid_beak" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/tipped_arrow.json b/src/generated/resources/data/reliquary/recipes/tipped_arrow.json deleted file mode 100644 index 97d1c24a..00000000 --- a/src/generated/resources/data/reliquary/recipes/tipped_arrow.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:potions_enabled" - }, - { - "type": "reliquary:handgun_enabled" - } - ], - "recipe": { - "type": "reliquary:potion_effects", - "category": "misc", - "duration_factor": 0.125, - "key": { - "A": { - "item": "minecraft:arrow" - }, - "P": { - "item": "reliquary:lingering_potion" - } - }, - "pattern": [ - "AAA", - "APA", - "AAA" - ], - "result": { - "count": 8, - "item": "reliquary:tipped_arrow" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/uncrafting/spawn_egg.json b/src/generated/resources/data/reliquary/recipes/uncrafting/spawn_egg.json deleted file mode 100644 index 0ffffa13..00000000 --- a/src/generated/resources/data/reliquary/recipes/uncrafting/spawn_egg.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:spawn_egg_enabled" - } - ], - "recipe": { - "type": "reliquary:fragment_to_spawn_egg", - "ingredients": [ - { - "item": "reliquary:mob_charm_fragment" - }, - { - "item": "reliquary:mob_charm_fragment" - }, - { - "item": "minecraft:egg" - } - ], - "result": { - "item": "minecraft:chicken_spawn_egg" - } - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/withered_rib.json b/src/generated/resources/data/reliquary/recipes/withered_rib.json deleted file mode 100644 index c6a55d34..00000000 --- a/src/generated/resources/data/reliquary/recipes/withered_rib.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "D": { - "tag": "forge:gems/diamond" - }, - "S": { - "item": "minecraft:skeleton_skull" - } - }, - "pattern": [ - "D D", - " S ", - "D D" - ], - "result": { - "item": "reliquary:withered_rib" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/generated/resources/data/reliquary/recipes/zombie_heart.json b/src/generated/resources/data/reliquary/recipes/zombie_heart.json deleted file mode 100644 index 356f87db..00000000 --- a/src/generated/resources/data/reliquary/recipes/zombie_heart.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "type": "forge:conditional", - "recipes": [ - { - "conditions": [ - { - "type": "reliquary:mob_drops_craftable" - } - ], - "recipe": { - "type": "minecraft:crafting_shaped", - "category": "misc", - "key": { - "F": { - "item": "minecraft:rotten_flesh" - }, - "I": { - "tag": "forge:ingots/iron" - } - }, - "pattern": [ - "III", - "IFI", - "III" - ], - "result": { - "item": "reliquary:zombie_heart" - }, - "show_notification": true - } - } - ] -} \ No newline at end of file diff --git a/src/main/java/reliquary/Reliquary.java b/src/main/java/reliquary/Reliquary.java index da50fc19..f668c7f0 100644 --- a/src/main/java/reliquary/Reliquary.java +++ b/src/main/java/reliquary/Reliquary.java @@ -1,77 +1,66 @@ package reliquary; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.fml.loading.FMLEnvironment; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.config.ModConfig; +import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.fml.event.lifecycle.FMLLoadCompleteEvent; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.common.NeoForgeMod; import reliquary.client.init.ModParticles; import reliquary.crafting.AlkahestryRecipeRegistry; import reliquary.data.DataGenerators; import reliquary.handler.ClientEventHandler; import reliquary.handler.CommonEventHandler; -import reliquary.init.ModBlocks; -import reliquary.init.ModCapabilities; -import reliquary.init.ModCompat; -import reliquary.init.ModEnchantments; -import reliquary.init.ModEntities; -import reliquary.init.ModFluids; -import reliquary.init.ModItems; -import reliquary.init.ModPotions; -import reliquary.init.ModSounds; -import reliquary.init.PedestalItems; +import reliquary.init.*; import reliquary.items.MobCharmRegistry; -import reliquary.network.PacketHandler; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.potions.PotionMap; -@Mod(Reference.MOD_ID) +@Mod(Reliquary.MOD_ID) public class Reliquary { + public static final String MOD_ID = "reliquary"; + + @SuppressWarnings("java:S1118") //needs to be public for mod to work - public Reliquary() { - ForgeMod.enableMilkFluid(); - IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); - if (FMLEnvironment.dist == Dist.CLIENT) { - ClientEventHandler.registerHandlers(); + public Reliquary(IEventBus modBus, Dist dist, ModContainer container) { + NeoForgeMod.enableMilkFluid(); + if (dist == Dist.CLIENT) { + ClientEventHandler.registerHandlers(container); } modBus.addListener(Reliquary::setup); modBus.addListener(Reliquary::loadComplete); - modBus.addListener(Settings::onFileChange); + modBus.addListener(Config::onFileChange); modBus.addListener(DataGenerators::gatherData); + modBus.addListener(ModPayloads::registerPackets); ModFluids.registerHandlers(modBus); ModItems.registerListeners(modBus); ModBlocks.registerListeners(modBus); ModEntities.registerListeners(modBus); - ModCapabilities.registerListeners(modBus); - ModPotions.registerListeners(modBus); + ModEffects.registerListeners(modBus); ModSounds.registerListeners(modBus); - ModEnchantments.register(modBus); ModParticles.registerListeners(modBus); + ModDataComponents.register(modBus); - ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, Settings.CLIENT_SPEC); - ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Settings.COMMON_SPEC); + container.registerConfig(ModConfig.Type.CLIENT, Config.CLIENT_SPEC); + container.registerConfig(ModConfig.Type.COMMON, Config.COMMON_SPEC); - IEventBus eventBus = MinecraftForge.EVENT_BUS; + IEventBus eventBus = NeoForge.EVENT_BUS; CommonEventHandler.registerEventBusListeners(eventBus); eventBus.addListener(MobCharmRegistry::handleAddingFragmentDrops); eventBus.addListener(AlkahestryRecipeRegistry::onResourceReload); - ModCompat.initCompats(); + ModCompat.initCompats(modBus); } public static void setup(FMLCommonSetupEvent event) { event.enqueueWork(ModItems::registerDispenseBehaviors); PotionMap.initPotionMap(); - PacketHandler.init(); ModItems.registerHandgunMagazines(); PedestalItems.init(); } @@ -79,4 +68,8 @@ public static void setup(FMLCommonSetupEvent event) { public static void loadComplete(FMLLoadCompleteEvent event) { MobCharmRegistry.registerDynamicCharmDefinitions(); } + + public static ResourceLocation getRL(String regName) { + return ResourceLocation.fromNamespaceAndPath(MOD_ID, regName); + } } diff --git a/src/main/java/reliquary/api/IPedestal.java b/src/main/java/reliquary/api/IPedestal.java index 4389e916..688fe5c1 100644 --- a/src/main/java/reliquary/api/IPedestal.java +++ b/src/main/java/reliquary/api/IPedestal.java @@ -3,9 +3,9 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.common.util.FakePlayer; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; import javax.annotation.Nullable; import java.util.List; diff --git a/src/main/java/reliquary/api/client/IPedestalItemRenderer.java b/src/main/java/reliquary/api/client/IPedestalItemRenderer.java index 7fe9b1cb..5dc9647b 100644 --- a/src/main/java/reliquary/api/client/IPedestalItemRenderer.java +++ b/src/main/java/reliquary/api/client/IPedestalItemRenderer.java @@ -5,5 +5,5 @@ import reliquary.blocks.tile.PedestalBlockEntity; public interface IPedestalItemRenderer { - void doRender(PedestalBlockEntity te, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int packedOverlay); + void doRender(PedestalBlockEntity te, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay); } diff --git a/src/main/java/reliquary/blocks/AlkahestryAltarBlock.java b/src/main/java/reliquary/blocks/AlkahestryAltarBlock.java index b6df0774..7e0ae771 100644 --- a/src/main/java/reliquary/blocks/AlkahestryAltarBlock.java +++ b/src/main/java/reliquary/blocks/AlkahestryAltarBlock.java @@ -1,13 +1,14 @@ package reliquary.blocks; import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.ParticleTypes; 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.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -27,7 +28,7 @@ import reliquary.init.ModBlocks; import reliquary.items.AlkahestryTomeItem; import reliquary.items.ICreativeTabItemGenerator; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.BlockEntityHelper; import javax.annotation.Nullable; @@ -52,7 +53,7 @@ public int getLightEmission(BlockState state, BlockGetter level, BlockPos pos) { } private static int getAltarActiveLightLevel() { - return Settings.COMMON.blocks.altar.outputLightLevelWhileActive.get(); + return Config.COMMON.blocks.altar.outputLightLevelWhileActive.get(); } @Override @@ -81,40 +82,38 @@ public void animateTick(BlockState state, Level level, BlockPos pos, RandomSourc if (Boolean.FALSE.equals(state.getValue(ACTIVE)) || level.getDayTime() >= 12000 || !level.canSeeSkyFromBelowWater(pos.above()) || rand.nextInt(3) != 0) { return; } - level.addParticle(ParticleTypes.ENTITY_EFFECT, pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 1.1D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0.9D, 0.9D, 0.0D); + level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.9F, 0.9F, 0.0F), pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY() + 1.1D, pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0D, 0D, 0D); } - @SuppressWarnings("deprecation") @Override - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { - ItemStack heldItem = player.getItemInHand(hand); + protected ItemInteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult p_316140_) { if (Boolean.TRUE.equals(state.getValue(ACTIVE))) { - return InteractionResult.CONSUME; + return ItemInteractionResult.CONSUME; } AlkahestryAltarBlockEntity altar = (AlkahestryAltarBlockEntity) level.getBlockEntity(pos); if (altar == null || heldItem.isEmpty()) { - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } if (heldItem.getItem() == Items.REDSTONE) { int slot = getSlotWithRedstoneDust(player); if (slot == -1) { - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } playSoundAndSpawnParticles(level, pos, altar); if (level.isClientSide) { - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } player.getInventory().removeItem(slot, 1); altar.addRedstone(level, pos); } else if (heldItem.getItem() instanceof AlkahestryTomeItem && AlkahestryTomeItem.getCharge(heldItem) > 0) { playSoundAndSpawnParticles(level, pos, altar); if (level.isClientSide) { - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } AlkahestryTomeItem.useCharge(heldItem, 1); altar.addRedstone(level, pos); } - return InteractionResult.CONSUME; + return ItemInteractionResult.CONSUME; } private void playSoundAndSpawnParticles(Level level, BlockPos pos, AlkahestryAltarBlockEntity altar) { diff --git a/src/main/java/reliquary/blocks/ApothecaryCauldronBlock.java b/src/main/java/reliquary/blocks/ApothecaryCauldronBlock.java index 485d0572..578b8a91 100644 --- a/src/main/java/reliquary/blocks/ApothecaryCauldronBlock.java +++ b/src/main/java/reliquary/blocks/ApothecaryCauldronBlock.java @@ -2,7 +2,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -26,7 +26,7 @@ import reliquary.blocks.tile.ApothecaryCauldronBlockEntity; import reliquary.init.ModBlocks; import reliquary.items.ICreativeTabItemGenerator; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.BlockEntityHelper; import reliquary.util.WorldHelper; @@ -65,7 +65,7 @@ public ApothecaryCauldronBlock() { @Override public void addCreativeTabItems(Consumer itemConsumer) { - if (Boolean.TRUE.equals(Settings.COMMON.disable.disablePotions.get())) { + if (Boolean.TRUE.equals(Config.COMMON.disable.disablePotions.get())) { return; } itemConsumer.accept(new ItemStack(this)); @@ -77,42 +77,41 @@ protected void createBlockStateDefinition(StateDefinition.Builder itemConsumer) { - if (Boolean.TRUE.equals(Settings.COMMON.disable.disablePotions.get())) { + if (Boolean.TRUE.equals(Config.COMMON.disable.disablePotions.get())) { return; } itemConsumer.accept(new ItemStack(this)); @@ -64,7 +66,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder { if (player.isCrouching()) { - InventoryHelper.getItemHandlerFrom(mortar).ifPresent(itemHandler -> InventoryHelper.tryRemovingLastStack(itemHandler, level, mortar.getBlockPos())); + InventoryHelper.executeOnItemHandlerAt(level, pos, state, mortar, itemHandler -> InventoryHelper.tryRemovingLastStack(itemHandler, level, mortar.getBlockPos())); return InteractionResult.SUCCESS; } - boolean done = mortar.usePestle(level); - level.playSound(null, pos, soundType.getStepSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); - player.swing(hand); - return done ? InteractionResult.SUCCESS : InteractionResult.CONSUME; - } - //if we're in cooldown prevent player from insta inserting essence that they just got from mortar - if (mortar.isInCooldown(level) && heldItem.getItem() == ModItems.POTION_ESSENCE.get()) { - return InteractionResult.CONSUME; - } + if (mortar.usePestle(level)) { + level.playSound(null, pos, soundType.getStepSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); + player.swing(InteractionHand.MAIN_HAND); + return InteractionResult.CONSUME; + } + return InteractionResult.FAIL; + }).orElse(InteractionResult.FAIL); + } - ItemStack stackToAdd = heldItem.copy(); - stackToAdd.setCount(1); + @Override + protected ItemInteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) { + return level.getBlockEntity(pos, ModBlocks.APOTHECARY_MORTAR_TILE_TYPE.get()).map(mortar -> { + //if we're in cooldown prevent player from insta inserting essence that they just got from mortar + if (mortar.isInCooldown(level) && heldItem.getItem() == ModItems.POTION_ESSENCE.get()) { + return ItemInteractionResult.FAIL; + } - boolean putItemInSlot = InventoryHelper.getItemHandlerFrom(mortar).map(itemHandler -> { - if (InventoryHelper.insertIntoInventory(stackToAdd, itemHandler) == 1) { - heldItem.shrink(1); - return true; + ItemStack stackToAdd = heldItem.copy(); + stackToAdd.setCount(1); + + boolean putItemInSlot = InventoryHelper.executeOnItemHandlerAt(level, pos, state, mortar, itemHandler -> { + if (InventoryHelper.insertIntoInventory(stackToAdd, itemHandler) == 1) { + heldItem.shrink(1); + return true; + } + return false; + }, false); + + if (!putItemInSlot) { + if (mortar.usePestle(level)) { + level.playSound(null, pos, soundType.getStepSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); + return ItemInteractionResult.CONSUME; + } else { + return ItemInteractionResult.FAIL; + } + } else { + mortar.setChanged(); } - return false; - }).orElse(false); - - if (!putItemInSlot) { - mortar.usePestle(level); - level.playSound(null, pos, soundType.getStepSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); - return InteractionResult.CONSUME; - } else { - mortar.setChanged(); - } - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; + }).orElse(ItemInteractionResult.FAIL); } @Nullable diff --git a/src/main/java/reliquary/blocks/FertileLilyPadBlock.java b/src/main/java/reliquary/blocks/FertileLilyPadBlock.java index 36292341..560bf262 100644 --- a/src/main/java/reliquary/blocks/FertileLilyPadBlock.java +++ b/src/main/java/reliquary/blocks/FertileLilyPadBlock.java @@ -1,6 +1,8 @@ package reliquary.blocks; +import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; @@ -10,22 +12,16 @@ import net.minecraft.world.item.ItemStack; 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.Blocks; -import net.minecraft.world.level.block.BonemealableBlock; -import net.minecraft.world.level.block.BushBlock; -import net.minecraft.world.level.block.DoublePlantBlock; -import net.minecraft.world.level.block.IceBlock; +import net.minecraft.world.level.block.*; 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.level.material.MapColor; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.common.IPlantable; -import net.minecraftforge.common.PlantType; +import net.neoforged.neoforge.common.SpecialPlantable; import reliquary.items.ICreativeTabItemGenerator; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.HashMap; import java.util.HashSet; @@ -34,17 +30,17 @@ import java.util.function.Consumer; public class FertileLilyPadBlock extends BushBlock implements ICreativeTabItemGenerator { + public static final MapCodec CODEC = simpleCodec(FertileLilyPadBlock::new); private static final Map, Long> currentDimensionTicks = new HashMap<>(); private static final Map, Set> dimensionPositionsTicked = new HashMap<>(); private static final VoxelShape AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 1.5D, 15.0D); - @Override - public PlantType getPlantType(BlockGetter world, BlockPos pos) { - return PlantType.WATER; + public FertileLilyPadBlock() { + super(Properties.of().mapColor(MapColor.PLANT)); } - public FertileLilyPadBlock() { - super(Properties.of().mapColor(MapColor.PLANT).randomTicks()); + private FertileLilyPadBlock(Properties properties) { + super(properties); } @Override @@ -52,88 +48,98 @@ public void addCreativeTabItems(Consumer itemConsumer) { itemConsumer.accept(new ItemStack(this)); } - @SuppressWarnings("deprecation") @Override - public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { - ResourceKey dimKey = world.dimension(); - if (!currentDimensionTicks.containsKey(dimKey) || currentDimensionTicks.get(dimKey) != world.getGameTime()) { - currentDimensionTicks.put(dimKey, world.getGameTime()); + public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { + super.onPlace(state, level, pos, oldState, movedByPiston); + + if (!level.isClientSide()) { + level.scheduleTick(pos, this, 1); + } + } + + @Override + public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { + ResourceKey dimKey = level.dimension(); + if (!currentDimensionTicks.containsKey(dimKey) || currentDimensionTicks.get(dimKey) != level.getGameTime()) { + currentDimensionTicks.put(dimKey, level.getGameTime()); dimensionPositionsTicked.put(dimKey, new HashSet<>()); } else if (dimensionPositionsTicked.computeIfAbsent(dimKey, k -> new HashSet<>()).contains(pos)) { return; } - growCropsNearby(world, pos, state); + growCropsNearby(level, pos, state); dimensionPositionsTicked.computeIfAbsent(dimKey, k -> new HashSet<>()).add(pos); } @Override - public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource rand) { - world.addParticle(ParticleTypes.ENTITY_EFFECT, pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY(), pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0.0D, 0.9D, 0.5D); + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource rand) { + level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.0F, 0.9F, 0.5F), pos.getX() + 0.5D + rand.nextGaussian() / 8, pos.getY(), pos.getZ() + 0.5D + rand.nextGaussian() / 8, 0D, 0D, 0D); } private int secondsBetweenGrowthTicks() { - return Settings.COMMON.blocks.fertileLilypad.secondsBetweenGrowthTicks.get(); + return Config.COMMON.blocks.fertileLilypad.secondsBetweenGrowthTicks.get(); } private int tileRange() { - return Settings.COMMON.blocks.fertileLilypad.tileRange.get(); + return Config.COMMON.blocks.fertileLilypad.tileRange.get(); } private int fullPotencyRange() { - return Settings.COMMON.blocks.fertileLilypad.fullPotencyRange.get(); + return Config.COMMON.blocks.fertileLilypad.fullPotencyRange.get(); } @SuppressWarnings("deprecation") - private void growCropsNearby(ServerLevel world, BlockPos pos, BlockState state) { + private void growCropsNearby(ServerLevel level, BlockPos pos, BlockState state) { BlockPos.betweenClosed(pos.offset(-tileRange(), -1, -tileRange()), pos.offset(tileRange(), tileRange(), tileRange())).forEach(cropPos -> { - if (!world.hasChunkAt(cropPos)) { + if (!level.hasChunkAt(cropPos)) { return; } - BlockState cropState = world.getBlockState(cropPos); + BlockState cropState = level.getBlockState(cropPos); Block cropBlock = cropState.getBlock(); - if (isAllowedCropBlock(cropBlock) && (cropBlock instanceof IPlantable || cropBlock instanceof BonemealableBlock) && !(cropBlock instanceof FertileLilyPadBlock)) { + if (isAllowedCropBlock(cropBlock) && (cropBlock instanceof SpecialPlantable || cropBlock instanceof BonemealableBlock) && !(cropBlock instanceof FertileLilyPadBlock)) { double distance = Math.sqrt(cropPos.distSqr(pos)); - tickCropBlock(world, cropPos, cropState, cropBlock, distance); + tickCropBlock(level, cropPos, cropState, cropBlock, distance); } }); - world.scheduleTick(pos, state.getBlock(), secondsBetweenGrowthTicks() * 20); + level.scheduleTick(pos, state.getBlock(), secondsBetweenGrowthTicks() * 20); } private boolean isAllowedCropBlock(Block cropBlock) { return cropBlock != Blocks.GRASS_BLOCK && !(cropBlock instanceof DoublePlantBlock); } - @SuppressWarnings("deprecation") - private void tickCropBlock(ServerLevel world, BlockPos cropPos, BlockState cropState, Block cropBlock, double distance) { + private void tickCropBlock(ServerLevel level, BlockPos cropPos, BlockState cropState, Block cropBlock, double distance) { distance -= fullPotencyRange(); distance = Math.max(1D, distance); double distanceCoefficient = 1D - (distance / tileRange()); //it schedules the next tick. - world.scheduleTick(cropPos, cropBlock, (int) (distanceCoefficient * secondsBetweenGrowthTicks() * 20F)); - cropBlock.randomTick(cropState, world, cropPos, world.random); - world.levelEvent(2005, cropPos, Math.max((int) (tileRange() - distance), 1)); + level.scheduleTick(cropPos, cropBlock, (int) (distanceCoefficient * secondsBetweenGrowthTicks() * 20F)); + cropState.randomTick(level, cropPos, level.random); + level.levelEvent(2005, cropPos, Math.max((int) (tileRange() - distance), 1)); } - @SuppressWarnings("deprecation") @Override - public void entityInside(BlockState state, Level worldIn, BlockPos pos, Entity entityIn) { - super.entityInside(state, worldIn, pos, entityIn); + public void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn) { + super.entityInside(state, level, pos, entityIn); if (entityIn instanceof Boat) { - worldIn.destroyBlock(pos, true); + level.destroyBlock(pos, true); } } - @SuppressWarnings("deprecation") @Override - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return AABB; } @Override - protected boolean mayPlaceOn(BlockState state, BlockGetter worldIn, BlockPos pos) { - FluidState ifluidstate = worldIn.getFluidState(pos); + protected MapCodec codec() { + return CODEC; + } + + @Override + protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) { + FluidState ifluidstate = level.getFluidState(pos); return ifluidstate.getType() == Fluids.WATER || state.getBlock() instanceof IceBlock; } } diff --git a/src/main/java/reliquary/blocks/InterdictionTorchBlock.java b/src/main/java/reliquary/blocks/InterdictionTorchBlock.java index 394e964d..61786d01 100644 --- a/src/main/java/reliquary/blocks/InterdictionTorchBlock.java +++ b/src/main/java/reliquary/blocks/InterdictionTorchBlock.java @@ -2,9 +2,12 @@ import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.MutableComponent; import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.FastColor; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; @@ -18,12 +21,9 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.registries.ForgeRegistries; -import reliquary.entities.shot.ShotEntityBase; +import reliquary.entities.shot.ShotBase; import reliquary.items.ICreativeTabItemGenerator; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.List; import java.util.function.Consumer; @@ -32,7 +32,7 @@ public class InterdictionTorchBlock extends TorchBlock implements ICreativeTabIt protected static final int TICK_RATE = 1; public InterdictionTorchBlock() { - super(Properties.of().strength(0).lightLevel(value -> 15).randomTicks().sound(SoundType.WOOD).noCollission(), ParticleTypes.FLAME); + super(ParticleTypes.FLAME, Properties.of().strength(0).lightLevel(value -> 15).randomTicks().sound(SoundType.WOOD).noCollission()); } @Override @@ -45,26 +45,24 @@ public MutableComponent getName() { return super.getName().withStyle(ChatFormatting.YELLOW); } - @SuppressWarnings("deprecation") @Override - public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean isMoving) { - world.scheduleTick(pos, this, TICK_RATE); - super.onPlace(state, world, pos, oldState, isMoving); + public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) { + level.scheduleTick(pos, this, TICK_RATE); + super.onPlace(state, level, pos, oldState, isMoving); } - @SuppressWarnings("deprecation") @Override - public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { - super.tick(state, world, pos, random); - world.scheduleTick(pos, this, TICK_RATE); - if (world.isClientSide) { + public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { + super.tick(state, level, pos, random); + level.scheduleTick(pos, this, TICK_RATE); + if (level.isClientSide) { return; } - int radius = Settings.COMMON.blocks.interdictionTorch.pushRadius.get(); + int radius = Config.COMMON.blocks.interdictionTorch.pushRadius.get(); - List entities = world.getEntitiesOfClass(Entity.class, new AABB(pos).inflate(radius), e -> (e instanceof Mob || e instanceof Projectile)); + List entities = level.getEntitiesOfClass(Entity.class, new AABB(pos).inflate(radius), e -> (e instanceof Mob || e instanceof Projectile)); for (Entity entity : entities) { - if (entity instanceof Player || entity instanceof ShotEntityBase || entity instanceof FishingHook || isBlacklistedEntity(entity)) { + if (entity instanceof Player || entity instanceof ShotBase || entity instanceof FishingHook || isBlacklistedEntity(entity)) { continue; } double distance = Math.sqrt(entity.distanceToSqr(pos.getX(), pos.getY(), pos.getZ())); @@ -103,30 +101,24 @@ private void moveEntity(BlockPos pos, Entity entity, double distance) { } private boolean isBlacklistedEntity(Entity entity) { - if (ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()) == null) { - return false; - } - - //noinspection ConstantConditions - String entityName = ForgeRegistries.ENTITY_TYPES.getKey(entity.getType()).toString(); - return isBlacklistedLivingEntity(entity, entityName) || Settings.COMMON.blocks.interdictionTorch.canPushProjectiles.get() && isBlacklistedProjectile(entity, entityName); + String entityName = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); + return isBlacklistedLivingEntity(entity, entityName) || Config.COMMON.blocks.interdictionTorch.canPushProjectiles.get() && isBlacklistedProjectile(entity, entityName); } private boolean isBlacklistedProjectile(Entity entity, String entityName) { - return entity instanceof Projectile && Settings.COMMON.blocks.interdictionTorch.pushableProjectilesBlacklist.get().contains(entityName); + return entity instanceof Projectile && Config.COMMON.blocks.interdictionTorch.pushableProjectilesBlacklist.get().contains(entityName); } private boolean isBlacklistedLivingEntity(Entity entity, String entityName) { - return entity instanceof Mob && Settings.COMMON.blocks.interdictionTorch.pushableEntitiesBlacklist.get().contains(entityName); + return entity instanceof Mob && Config.COMMON.blocks.interdictionTorch.pushableEntitiesBlacklist.get().contains(entityName); } @Override - @OnlyIn(Dist.CLIENT) - public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { double xOffset = pos.getX() + 0.5F; double yOffset = pos.getY() + 0.7F; double zOffset = pos.getZ() + 0.5F; - world.addParticle(ParticleTypes.ENTITY_EFFECT, xOffset, yOffset, zOffset, 0.0D, 0.0D, 0.0D); - world.addParticle(ParticleTypes.FLAME, xOffset, yOffset, zOffset, 0.0D, 0.0D, 0.0D); + level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, FastColor.ARGB32.opaque( 0)), xOffset, yOffset, zOffset, 0.0D, 0.0D, 0.0D); + level.addParticle(ParticleTypes.FLAME, xOffset, yOffset, zOffset, 0.0D, 0.0D, 0.0D); } } diff --git a/src/main/java/reliquary/blocks/PassivePedestalBlock.java b/src/main/java/reliquary/blocks/PassivePedestalBlock.java index 9529460c..51850cd6 100644 --- a/src/main/java/reliquary/blocks/PassivePedestalBlock.java +++ b/src/main/java/reliquary/blocks/PassivePedestalBlock.java @@ -4,37 +4,44 @@ import net.minecraft.core.Direction; 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.LevelAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; 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.DirectionProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.MapColor; 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.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; import reliquary.blocks.tile.PassivePedestalBlockEntity; import reliquary.items.ICreativeTabItemGenerator; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; import reliquary.util.WorldHelper; import javax.annotation.Nullable; -import java.util.Optional; import java.util.function.Consumer; import java.util.stream.Stream; -public class PassivePedestalBlock extends Block implements EntityBlock, ICreativeTabItemGenerator { +public class PassivePedestalBlock extends Block implements EntityBlock, ICreativeTabItemGenerator, SimpleWaterloggedBlock { static final DirectionProperty FACING = DirectionProperty.create("facing", Direction.Plane.HORIZONTAL); + static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; private static final VoxelShape SHAPE = Stream.of( Block.box(4, 10, 4, 12, 11, 12), Block.box(3, 0, 3, 13, 1, 13), @@ -48,8 +55,8 @@ public class PassivePedestalBlock extends Block implements EntityBlock, ICreativ ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); public PassivePedestalBlock() { - super(Properties.of().mapColor(MapColor.STONE).strength(1.5F, 2.0F)); - registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH)); + super(Properties.of().mapColor(MapColor.STONE).strength(1.5F, 2.0F).forceSolidOn()); + registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false)); } @Override @@ -62,12 +69,12 @@ public void addCreativeTabItems(Consumer itemConsumer) { } protected boolean isDisabled() { - return Boolean.TRUE.equals(Settings.COMMON.disable.disablePassivePedestal.get()); + return Boolean.TRUE.equals(Config.COMMON.disable.disablePassivePedestal.get()); } @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { - builder.add(FACING); + builder.add(FACING, WATERLOGGED); } @Nullable @@ -76,46 +83,62 @@ public BlockState getStateForPlacement(BlockPlaceContext context) { if (context.getPlayer() == null) { return defaultBlockState(); } - return defaultBlockState().setValue(FACING, context.getPlayer().getDirection()); + return defaultBlockState() + .setValue(FACING, context.getPlayer().getDirection()) + .setValue(WATERLOGGED, context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER); } - @SuppressWarnings("deprecation") @Override - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { - ItemStack heldItem = player.getItemInHand(hand); - if (level.isClientSide) { - return (!heldItem.isEmpty() || player.isCrouching()) ? InteractionResult.SUCCESS : InteractionResult.CONSUME; + public FluidState getFluidState(BlockState state) { + return Boolean.TRUE.equals(state.getValue(WATERLOGGED)) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + @Override + public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) { + if (facing != Direction.DOWN && Boolean.TRUE.equals(state.getValue(WATERLOGGED))) { + level.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); } - if (!(level.getBlockEntity(pos) instanceof PassivePedestalBlockEntity)) { - return InteractionResult.FAIL; + return super.updateShape(state, facing, facingState, level, currentPos, facingPos); + } + + @Override + protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) { + if (level.isClientSide) { + return player.isCrouching() ? InteractionResult.SUCCESS : InteractionResult.FAIL; } - Optional pedestal = WorldHelper.getBlockEntity(level, pos, PassivePedestalBlockEntity.class); - if (heldItem.isEmpty()) { - if (player.isCrouching() && pedestal.isPresent()) { - pedestal.get().removeAndSpawnItem(level); - return InteractionResult.SUCCESS; - } else { - return InteractionResult.FAIL; - } - } else { - return pedestal.map(ped -> InventoryHelper.getItemHandlerFrom(ped) - .map(itemHandler -> InventoryHelper.tryAddingPlayerCurrentItem(player, itemHandler, InteractionHand.MAIN_HAND) ? InteractionResult.SUCCESS : InteractionResult.CONSUME) - .orElse(InteractionResult.CONSUME)).orElse(InteractionResult.CONSUME); + return WorldHelper.getBlockEntity(level, pos, PassivePedestalBlockEntity.class) + .map(pedestal -> { + if (player.isCrouching()) { + pedestal.removeAndSpawnItem(level); + return InteractionResult.SUCCESS; + } + return InteractionResult.FAIL; + }).orElse(InteractionResult.FAIL); + } + + @Override + protected ItemInteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) { + if (level.isClientSide) { + return ItemInteractionResult.SUCCESS; } + + return WorldHelper.getBlockEntity(level, pos, PassivePedestalBlockEntity.class).map(pedestal -> + InventoryHelper.executeOnItemHandlerAt(level, pos, state, pedestal, itemHandler -> + InventoryHelper.tryAddingPlayerCurrentItem(player, itemHandler, InteractionHand.MAIN_HAND) ? ItemInteractionResult.SUCCESS : ItemInteractionResult.CONSUME, ItemInteractionResult.CONSUME + ) + ).orElse(ItemInteractionResult.FAIL); } - @SuppressWarnings("deprecation") @Override public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) { WorldHelper.getBlockEntity(level, pos, PassivePedestalBlockEntity.class).ifPresent(pedestal -> pedestal.dropPedestalInventory(level)); super.onRemove(state, level, pos, newState, isMoving); } - @SuppressWarnings("deprecation") @Override - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; } @@ -129,7 +152,7 @@ public static void onRightClicked(PlayerInteractEvent.RightClickBlock event) { Player player = event.getEntity(); //should only really use the event in case that the player is sneaking with something in offhand and empty mainhand - if (!player.isCrouching() || !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty()) { + if (player.level().isClientSide() || !player.isCrouching() || !player.getMainHandItem().isEmpty() || player.getOffhandItem().isEmpty()) { return; } diff --git a/src/main/java/reliquary/blocks/PedestalBlock.java b/src/main/java/reliquary/blocks/PedestalBlock.java index 9f083055..6e6ba8e3 100644 --- a/src/main/java/reliquary/blocks/PedestalBlock.java +++ b/src/main/java/reliquary/blocks/PedestalBlock.java @@ -6,7 +6,7 @@ import net.minecraft.core.particles.DustParticleOptions; 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.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -25,12 +25,10 @@ import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import reliquary.blocks.tile.PedestalBlockEntity; import reliquary.init.ModBlocks; import reliquary.pedestal.PedestalRegistry; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.BlockEntityHelper; import reliquary.util.WorldHelper; @@ -67,11 +65,11 @@ protected void createBlockStateDefinition(StateDefinition.Builder BlockEntityTicker getTicker(Level level, Block return BlockEntityHelper.createTickerHelper(blockEntityType, ModBlocks.PEDESTAL_TILE_TYPE.get(), (l, p, s, be) -> be.serverTick(l)); } - @SuppressWarnings("deprecation") @Override public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) { super.neighborChanged(state, level, pos, blockIn, fromPos, isMoving); @@ -112,8 +109,7 @@ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block b } @Override - @OnlyIn(Dist.CLIENT) - public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource rand) { + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource rand) { if (Boolean.TRUE.equals(state.getValue(ENABLED)) && rand.nextInt(2) == 1) { Direction dir = Direction.from2DDataValue(rand.nextInt(4)); @@ -125,25 +121,24 @@ public void animateTick(BlockState state, Level world, BlockPos pos, RandomSourc Vec3i normal = dir.getNormal(); - world.addParticle(DustParticleOptions.REDSTONE, xMiddle + normal.getX() * sideOffset + normal.getZ() * alongTheSideOffset, y, zMiddle + normal.getZ() * sideOffset + normal.getX() * alongTheSideOffset, 0.0D, 0.0D, 0.0D); + level.addParticle(DustParticleOptions.REDSTONE, xMiddle + normal.getX() * sideOffset + normal.getZ() * alongTheSideOffset, y, zMiddle + normal.getZ() * sideOffset + normal.getX() * alongTheSideOffset, 0.0D, 0.0D, 0.0D); } } @Override - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { - ItemStack heldItem = player.getItemInHand(hand); + protected ItemInteractionResult useItemOn(ItemStack heldItem, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) { if (level.isClientSide) { - return !heldItem.isEmpty() || player.isCrouching() ? InteractionResult.SUCCESS : InteractionResult.CONSUME; + return ItemInteractionResult.CONSUME; } return WorldHelper.getBlockEntity(level, pos, PedestalBlockEntity.class).map(pedestal -> { - if (heldItem.isEmpty() && !player.isCrouching() && hand == InteractionHand.MAIN_HAND && switchClicked(hit.getLocation().subtract(pos.getX(), pos.getY(), pos.getZ()))) { + if (heldItem.isEmpty() && !player.isCrouching() && hand == InteractionHand.MAIN_HAND && switchClicked(hitResult.getLocation().subtract(pos.getX(), pos.getY(), pos.getZ()))) { pedestal.toggleSwitch(level); - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } - return super.use(state, level, pos, player, hand, hit); + return super.useItemOn(heldItem, state, level, pos, player, hand, hitResult); } - ).orElse(InteractionResult.FAIL); + ).orElse(ItemInteractionResult.FAIL); } private boolean switchClicked(Vec3 hitVec) { diff --git a/src/main/java/reliquary/blocks/WallInterdictionTorchBlock.java b/src/main/java/reliquary/blocks/WallInterdictionTorchBlock.java index 1ebe7d71..438c0fab 100644 --- a/src/main/java/reliquary/blocks/WallInterdictionTorchBlock.java +++ b/src/main/java/reliquary/blocks/WallInterdictionTorchBlock.java @@ -3,7 +3,9 @@ import com.google.common.collect.Maps; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.util.FastColor; import net.minecraft.util.RandomSource; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; @@ -34,7 +36,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder itemConsumer) { } @Override - public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; } } diff --git a/src/main/java/reliquary/blocks/tile/AlkahestryAltarBlockEntity.java b/src/main/java/reliquary/blocks/tile/AlkahestryAltarBlockEntity.java index 495a3497..8d1f301e 100644 --- a/src/main/java/reliquary/blocks/tile/AlkahestryAltarBlockEntity.java +++ b/src/main/java/reliquary/blocks/tile/AlkahestryAltarBlockEntity.java @@ -1,13 +1,14 @@ package reliquary.blocks.tile; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import reliquary.blocks.AlkahestryAltarBlock; import reliquary.init.ModBlocks; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.WorldHelper; public class AlkahestryAltarBlockEntity extends BlockEntityBase { @@ -36,9 +37,9 @@ public void serverTick(Level level, BlockPos pos) { public void startCycle(Level level) { //grabs the cycle time from the configs - int defaultCycleTime = Settings.COMMON.blocks.altar.timeInMinutes.get() * 60 * 20; - int maximumVariance = Settings.COMMON.blocks.altar.maximumTimeVarianceInMinutes.get() * 60 * 20; - cycleTime = (int) (defaultCycleTime + (double) maximumVariance * level.random.nextGaussian()); + int defaultCycleTime = Config.COMMON.blocks.altar.timeInMinutes.get() * 60 * 20; + int maximumVariance = Config.COMMON.blocks.altar.maximumTimeVarianceInMinutes.get() * 60 * 20; + cycleTime = (int) (defaultCycleTime + maximumVariance * level.random.nextGaussian()); redstoneCount = 0; isActive = true; } @@ -48,19 +49,19 @@ public void stopCycle() { } @Override - public void load(CompoundTag compound) { - super.load(compound); - cycleTime = compound.getShort("cycleTime"); - redstoneCount = compound.getShort("redstoneCount"); - isActive = compound.getBoolean("isActive"); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); + cycleTime = tag.getShort("cycleTime"); + redstoneCount = tag.getShort("redstoneCount"); + isActive = tag.getBoolean("isActive"); } @Override - protected void saveAdditional(CompoundTag compound) { - super.saveAdditional(compound); - compound.putShort("cycleTime", (short) cycleTime); - compound.putShort("redstoneCount", (short) redstoneCount); - compound.putBoolean("isActive", isActive); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + tag.putShort("cycleTime", (short) cycleTime); + tag.putShort("redstoneCount", (short) redstoneCount); + tag.putBoolean("isActive", isActive); } public void addRedstone(Level level, BlockPos pos) { @@ -72,7 +73,7 @@ public void addRedstone(Level level, BlockPos pos) { } private static int getRedstoneCost() { - return Settings.COMMON.blocks.altar.redstoneCost.get(); + return Config.COMMON.blocks.altar.redstoneCost.get(); } public int getRedstoneCount() { diff --git a/src/main/java/reliquary/blocks/tile/ApothecaryCauldronBlockEntity.java b/src/main/java/reliquary/blocks/tile/ApothecaryCauldronBlockEntity.java index 474c56bb..0d9c5a14 100644 --- a/src/main/java/reliquary/blocks/tile/ApothecaryCauldronBlockEntity.java +++ b/src/main/java/reliquary/blocks/tile/ApothecaryCauldronBlockEntity.java @@ -1,17 +1,22 @@ package reliquary.blocks.tile; -import com.google.common.collect.Lists; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.Containers; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; @@ -20,29 +25,25 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.PotionContents; 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.material.Fluids; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.IFluidHandlerItem; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; import reliquary.blocks.ApothecaryCauldronBlock; -import reliquary.client.particle.BubbleColorParticleData; -import reliquary.client.particle.SteamColorParticleData; +import reliquary.client.init.ModParticles; import reliquary.compat.jade.provider.IJadeDataChangeIndicator; import reliquary.init.ModBlocks; import reliquary.init.ModItems; import reliquary.items.PotionEssenceItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; -import reliquary.util.potions.XRPotionHelper; +import reliquary.util.potions.PotionHelper; import java.util.HashSet; import java.util.List; @@ -50,7 +51,7 @@ public class ApothecaryCauldronBlockEntity extends BlockEntityBase implements IJadeDataChangeIndicator { private int redstoneCount = 0; - private List effects = Lists.newArrayList(); + private PotionContents potionContents = PotionContents.EMPTY; private int glowstoneCount = 0; private boolean hasGunpowder = false; private boolean hasNetherwart = false; @@ -67,7 +68,7 @@ public ApothecaryCauldronBlockEntity(BlockPos pos, BlockState state) { public void serverTick(Level level, BlockPos pos) { //Item addition gets handled by the block's onEntityCollided method. if (getHeatSources().contains(level.getBlockState(pos.offset(0, -1, 0)).getBlock()) && getLiquidLevel() > 0) { - if (!effects.isEmpty() && hasNetherwart && cookTime < getTotalCookTime()) { + if (potionContents.hasEffects() && hasNetherwart && cookTime < getTotalCookTime()) { cookTime++; } if (level.isClientSide) { @@ -101,7 +102,6 @@ private void spawnParticles(Level level, BlockPos pos) { } } - @OnlyIn(Dist.CLIENT) private void spawnBoilingParticles(Level level, BlockPos pos) { if (level.random.nextInt(getTotalCookTime() * getTotalCookTime()) > cookTime * cookTime) { return; @@ -109,16 +109,16 @@ private void spawnBoilingParticles(Level level, BlockPos pos) { float xOffset = (level.random.nextFloat() - 0.5F) / 1.33F; float zOffset = (level.random.nextFloat() - 0.5F) / 1.33F; - int color = PotionUtils.getColor(effects); + int color = potionContents.getColor(); float red = (((color >> 16) & 255) / 256F); float green = (((color >> 8) & 255) / 256F); float blue = ((color & 255) / 256F); - level.addParticle(new BubbleColorParticleData(red, green, blue), pos.getX() + 0.5D + xOffset, pos.getY() + 0.01D + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, 0D, 0D, 0D); + level.addParticle(ColorParticleOption.create(ModParticles.CAULDRON_BUBBLE.get(), red, green, blue), pos.getX() + 0.5D + xOffset, pos.getY() + 0.01D + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, 0D, 0D, 0D); if (level.random.nextInt(6) == 0) { - level.addParticle(new SteamColorParticleData(red, green, blue), pos.getX() + 0.5D + xOffset, pos.getY() + 0.01D + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, 0D, 0.05D + 0.02F * getRenderLiquidLevel(), 0D); + level.addParticle(ColorParticleOption.create(ModParticles.CAULDRON_STEAM.get(), red, green, blue), pos.getX() + 0.5D + xOffset, pos.getY() + 0.01D + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, 0D, 0.05D + 0.02F * getRenderLiquidLevel(), 0D); } } @@ -127,7 +127,6 @@ private float getRenderLiquidLevel() { return (6 + 3 * j) / 16.0F; } - @OnlyIn(Dist.CLIENT) private void spawnGunpowderParticles(Level level, BlockPos pos) { if (level.random.nextInt(8) > 0) { return; @@ -137,7 +136,6 @@ private void spawnGunpowderParticles(Level level, BlockPos pos) { level.addParticle(ParticleTypes.SMOKE, pos.getX() + 0.5D + xOffset, pos.getY() + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, 0.0D, 0.1D, 0.0D); } - @OnlyIn(Dist.CLIENT) private void spawnDragonBreathParticles(Level level, BlockPos pos) { if (level.random.nextInt(8) > 0) { return; @@ -147,29 +145,26 @@ private void spawnDragonBreathParticles(Level level, BlockPos pos) { level.addParticle(ParticleTypes.DRAGON_BREATH, pos.getX() + 0.5D + xOffset, pos.getY() + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, 0.0D, 0.1D, 0.0D); } - @OnlyIn(Dist.CLIENT) private void spawnGlowstoneParticles(Level level, BlockPos pos) { if (level.random.nextInt(8) > 0) { return; } - double gauss = 0.5D + level.random.nextFloat() / 2; + float gauss = 0.5F + level.random.nextFloat() / 2; float xOffset = (level.random.nextFloat() - 0.5F) / 1.66F; float zOffset = (level.random.nextFloat() - 0.5F) / 1.66F; - level.addParticle(ParticleTypes.ENTITY_EFFECT, pos.getX() + 0.5D + xOffset, pos.getY() + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, gauss, gauss, 0.0F); + level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, gauss, gauss, 0.0F), pos.getX() + 0.5D + xOffset, pos.getY() + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, 0, 0, 0); } - @OnlyIn(Dist.CLIENT) private void spawnNetherwartParticles(Level level, BlockPos pos) { if (level.random.nextInt(8) > 0) { return; } - double gauss = 0.5D + level.random.nextFloat() / 2; + float gauss = 0.5F + level.random.nextFloat() / 2; float xOffset = (level.random.nextFloat() - 0.5F) / 1.66F; float zOffset = (level.random.nextFloat() - 0.5F) / 1.66F; - level.addParticle(ParticleTypes.ENTITY_EFFECT, pos.getX() + 0.5D + xOffset, pos.getY() + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, gauss, 0.0F, gauss); + level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, gauss, 0.0F, gauss), pos.getX() + 0.5D + xOffset, pos.getY() + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, 0, 0, 0); } - @OnlyIn(Dist.CLIENT) private void spawnRedstoneParticles(Level level, BlockPos pos) { if (level.random.nextInt(10) / redstoneCount > 0) { return; @@ -179,7 +174,6 @@ private void spawnRedstoneParticles(Level level, BlockPos pos) { level.addParticle(DustParticleOptions.REDSTONE, pos.getX() + 0.5D + xOffset, pos.getY() + getRenderLiquidLevel(), pos.getZ() + 0.5D + zOffset, 1D, 0D, 0D); } - @OnlyIn(Dist.CLIENT) private void spawnFinishedParticles(Level level, BlockPos pos) { if (level.random.nextInt(8) > 0) { return; @@ -190,8 +184,8 @@ private void spawnFinishedParticles(Level level, BlockPos pos) { } @Override - public void load(CompoundTag tag) { - super.load(tag); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); setLiquidLevel(tag.getShort("liquidLevel")); glowstoneCount = tag.getInt("glowstoneCount"); hasNetherwart = tag.getBoolean("hasNetherwart"); @@ -199,12 +193,12 @@ public void load(CompoundTag tag) { hasDragonBreath = tag.getBoolean("hasDragonBreath"); redstoneCount = tag.getInt("redstoneCount"); cookTime = tag.getInt("cookTime"); - effects = XRPotionHelper.getPotionEffectsFromCompoundTag(tag); + potionContents = PotionHelper.getPotionContentsFromCompoundTag(tag); } @Override - public void saveAdditional(CompoundTag compound) { - super.saveAdditional(compound); + public void saveAdditional(CompoundTag compound, HolderLookup.Provider registries) { + super.saveAdditional(compound, registries); compound.putInt("liquidLevel", getLiquidLevel()); compound.putInt("cookTime", cookTime); compound.putInt("redstoneCount", redstoneCount); @@ -212,11 +206,11 @@ public void saveAdditional(CompoundTag compound) { compound.putBoolean("hasGunpowder", hasGunpowder); compound.putBoolean("hasDragonBreath", hasDragonBreath); compound.putBoolean("hasNetherwart", hasNetherwart); - XRPotionHelper.addPotionEffectsToCompoundTag(compound, effects); + PotionHelper.addPotionContentsToCompoundTag(compound, potionContents); } private boolean finishedCooking() { - return hasNetherwart && !effects.isEmpty() && cookTime >= getTotalCookTime() && (!hasDragonBreath || hasGunpowder); + return hasNetherwart && potionContents.hasEffects() && cookTime >= getTotalCookTime() && (!hasDragonBreath || hasGunpowder); } private ItemStack removeContainedPotion(Level level, BlockPos pos) { @@ -228,7 +222,7 @@ private ItemStack removeContainedPotion(Level level, BlockPos pos) { } else { potion = new ItemStack(ModItems.POTION.get()); } - XRPotionHelper.addPotionEffectsToStack(potion, XRPotionHelper.augmentPotionEffects(effects, redstoneCount, glowstoneCount)); + potion.set(DataComponents.POTION_CONTENTS, PotionHelper.augmentPotionContents(potionContents, redstoneCount, glowstoneCount)); setLiquidLevel(getLiquidLevel() - 1); if (getLiquidLevel() <= 0) { @@ -243,7 +237,7 @@ private void clearAllFields(Level level, BlockPos pos) { hasGunpowder = false; hasNetherwart = false; redstoneCount = 0; - effects.clear(); + potionContents = PotionContents.EMPTY; dataChanged = true; hasDragonBreath = false; level.sendBlockUpdated(pos, getBlockState(), getBlockState(), 3); @@ -251,11 +245,11 @@ private void clearAllFields(Level level, BlockPos pos) { @SuppressWarnings("SimplifiableIfStatement") private boolean isItemValidForInput(ItemStack stack) { - if (stack.getItem() instanceof PotionEssenceItem && effects.isEmpty()) { + if (stack.getItem() instanceof PotionEssenceItem && !potionContents.hasEffects()) { return true; } - if (effects.isEmpty()) { + if (!potionContents.hasEffects()) { return false; } @@ -276,7 +270,7 @@ private boolean isItemValidForInput(ItemStack stack) { private void addItem(ItemStack stack, Level level, BlockPos pos) { if (stack.getItem() instanceof PotionEssenceItem) { - effects = XRPotionHelper.getPotionEffectsFromStack(stack); + potionContents = stack.get(DataComponents.POTION_CONTENTS); } else if (stack.getItem() == Items.GUNPOWDER) { hasGunpowder = true; } else if (stack.getItem() == Items.GLOWSTONE_DUST) { @@ -293,18 +287,18 @@ private void addItem(ItemStack stack, Level level, BlockPos pos) { } private int getGlowstoneAmpLimit() { - return Settings.COMMON.blocks.apothecaryCauldron.glowstoneLimit.get(); + return Config.COMMON.blocks.apothecaryCauldron.glowstoneLimit.get(); } private int getRedstoneAmpLimit() { - return Settings.COMMON.blocks.apothecaryCauldron.redstoneLimit.get(); + return Config.COMMON.blocks.apothecaryCauldron.redstoneLimit.get(); } private Set getHeatSources() { Set heatSources = new HashSet<>(); - List heatSourceBlockNames = Settings.COMMON.blocks.apothecaryCauldron.heatSources.get(); + List heatSourceBlockNames = Config.COMMON.blocks.apothecaryCauldron.heatSources.get(); - heatSourceBlockNames.forEach(blockName -> heatSources.add(ForgeRegistries.BLOCKS.getValue(new ResourceLocation(blockName)))); + heatSourceBlockNames.forEach(blockName -> heatSources.add(BuiltInRegistries.BLOCK.get(ResourceLocation.parse(blockName)))); //defaults that can't be removed. heatSources.add(Blocks.LAVA); heatSources.add(Blocks.FIRE); @@ -316,11 +310,11 @@ private Set getHeatSources() { } private int getTotalCookTime() { - return Settings.COMMON.blocks.apothecaryCauldron.cookTime.get(); + return Config.COMMON.blocks.apothecaryCauldron.cookTime.get(); } - public List getEffects() { - return effects; + public PotionContents getPotionContents() { + return potionContents; } public boolean hasNetherwart() { @@ -371,13 +365,13 @@ private void pickupItem(Level level, BlockPos pos, ItemEntity itemEntity) { } private boolean addEffectsToEntity(Level level, Entity collidingEntity, LivingEntity livingEntity) { - if (effects.isEmpty()) { + if (!potionContents.hasEffects()) { return false; } //apply potion effects when done cooking potion (potion essence and netherwart in and fire below at the minimum) if (finishedCooking()) { - for (MobEffectInstance effect : effects) { - MobEffect potion = effect.getEffect(); + for (MobEffectInstance effect : potionContents.getAllEffects()) { + MobEffect potion = effect.getEffect().value(); if (potion.isInstantenous() && level.getGameTime() % 20 != 0) { continue; } @@ -393,7 +387,7 @@ private boolean addEffectsToEntity(Level level, Entity collidingEntity, LivingEn } public int getColorMultiplier() { - return PotionUtils.getColor(effects); + return potionContents.getColor(); } public int getLiquidLevel() { @@ -406,40 +400,40 @@ public void fillWithRain() { } } - public InteractionResult handleBlockActivation(Level level, Player player, InteractionHand hand, BlockPos pos) { + public ItemInteractionResult handleBlockActivation(Level level, Player player, InteractionHand hand, BlockPos pos) { ItemStack itemStack = player.getItemInHand(hand); if (itemStack.isEmpty()) { - return InteractionResult.CONSUME; + return ItemInteractionResult.CONSUME; } if (getLiquidLevel() < 3 && !finishedCooking()) { return fillWithWater(player, hand, itemStack); } else if (itemStack.getItem() == ModItems.EMPTY_POTION_VIAL.get() && finishedCooking() && getLiquidLevel() > 0) { if (fillVial(level, player, hand, itemStack, pos)) { - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } } else if (getLiquidLevel() == 3 && isItemValidForInput(itemStack)) { return addIngredient(level, player, itemStack, pos); } - return InteractionResult.CONSUME; + return ItemInteractionResult.CONSUME; } - private InteractionResult addIngredient(Level level, Player player, ItemStack itemStack, BlockPos pos) { + private ItemInteractionResult addIngredient(Level level, Player player, ItemStack itemStack, BlockPos pos) { addItem(itemStack, level, pos); if (itemStack.getItem() == Items.DRAGON_BREATH - && InventoryHelper.getItemHandlerFrom(player).map(handler -> InventoryHelper.tryToAddToInventory(new ItemStack(Items.GLASS_BOTTLE), handler, 1)).orElse(0) != 1) { + && InventoryHelper.tryToAddToInventory(new ItemStack(Items.GLASS_BOTTLE), InventoryHelper.getMainInventoryItemHandlerFrom(player), 1) != 1) { Containers.dropItemStack(level, worldPosition.getX() + 0.5f, worldPosition.getY() + 1.5f, worldPosition.getZ() + 0.5f, new ItemStack(Items.GLASS_BOTTLE)); } itemStack.shrink(1); - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } private boolean fillVial(Level level, Player player, InteractionHand hand, ItemStack itemStack, BlockPos pos) { - if (finishedCooking() && hasNetherwart && !effects.isEmpty() && getLiquidLevel() > 0) { + if (finishedCooking() && hasNetherwart && potionContents.hasEffects() && getLiquidLevel() > 0) { ItemStack potion = removeContainedPotion(level, pos); itemStack.shrink(1); @@ -455,19 +449,23 @@ private boolean fillVial(Level level, Player player, InteractionHand hand, ItemS return false; } - private InteractionResult fillWithWater(Player player, InteractionHand hand, ItemStack itemStack) { + private ItemInteractionResult fillWithWater(Player player, InteractionHand hand, ItemStack itemStack) { if (itemStack.getItem() == Items.WATER_BUCKET) { if (!player.isCreative()) { player.setItemInHand(hand, new ItemStack(Items.BUCKET)); } - } else if (Boolean.FALSE.equals(itemStack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM, null).map(fh -> drainWater(player, fh)).orElse(false))) { - return InteractionResult.CONSUME; + } else { + IFluidHandlerItem fluidHandlerCapability = itemStack.getCapability(Capabilities.FluidHandler.ITEM); + if (fluidHandlerCapability == null || !drainWater(player, fluidHandlerCapability)) { + return ItemInteractionResult.CONSUME; + } } setLiquidLevel(3); + player.level().playSound(null, worldPosition, SoundEvents.BUCKET_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); cookTime = 0; - return InteractionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } private Boolean drainWater(Player player, IFluidHandlerItem fh) { @@ -500,8 +498,8 @@ public boolean getDataChanged() { } @Override - public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket packet) { - super.onDataPacket(net, packet); + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket packet, HolderLookup.Provider registries) { + super.onDataPacket(net, packet, registries); dataChanged = true; } } diff --git a/src/main/java/reliquary/blocks/tile/ApothecaryMortarBlockEntity.java b/src/main/java/reliquary/blocks/tile/ApothecaryMortarBlockEntity.java index 3c9c35dc..08d5a4ae 100644 --- a/src/main/java/reliquary/blocks/tile/ApothecaryMortarBlockEntity.java +++ b/src/main/java/reliquary/blocks/tile/ApothecaryMortarBlockEntity.java @@ -1,28 +1,25 @@ package reliquary.blocks.tile; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.ItemStackHandler; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.ItemStackHandler; import reliquary.compat.jade.provider.IJadeDataChangeIndicator; import reliquary.init.ModBlocks; import reliquary.init.ModItems; import reliquary.util.InventoryHelper; import reliquary.util.WorldHelper; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionIngredient; -import reliquary.util.potions.XRPotionHelper; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; @@ -59,7 +56,7 @@ private boolean isItemValid(ItemStack stack) { return false; } } - return XRPotionHelper.isIngredient(stack) || XRPotionHelper.isItemEssence(stack); + return PotionHelper.isIngredient(stack) || PotionHelper.isItemEssence(stack); } @Override @@ -76,17 +73,17 @@ public ApothecaryMortarBlockEntity(BlockPos pos, BlockState state) { } @Override - public void load(CompoundTag tag) { - super.load(tag); - items.deserializeNBT(tag.getCompound("items")); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); + items.deserializeNBT(registries, tag.getCompound("items")); pestleUsedCounter = tag.getShort("pestleUsed"); } @Override - public void saveAdditional(CompoundTag compound) { - super.saveAdditional(compound); + public void saveAdditional(CompoundTag compound, HolderLookup.Provider registries) { + super.saveAdditional(compound, registries); compound.putShort("pestleUsed", (short) pestleUsedCounter); - compound.put("items", items.serializeNBT()); + compound.put("items", items.serializeNBT(registries)); } // gets the contents of the tile entity as an array of inventory @@ -103,7 +100,7 @@ public boolean usePestle(Level level) { continue; } ++itemCount; - XRPotionHelper.getIngredient(item).ifPresent(potionIngredients::add); + PotionHelper.getIngredient(item).ifPresent(potionIngredients::add); } if (itemCount > 1) { pestleUsedCounter++; @@ -113,8 +110,8 @@ public boolean usePestle(Level level) { } private boolean createPotionEssence(List potionIngredients, Level level) { - List resultEffects = XRPotionHelper.combineIngredients(potionIngredients); - if (resultEffects.isEmpty()) { + PotionContents potionContents = PotionHelper.combineIngredients(potionIngredients); + if (!potionContents.hasEffects()) { pestleUsedCounter = 0; for (int clearSlot = 0; clearSlot < items.getSlots(); ++clearSlot) { if (items.getStackInSlot(clearSlot).isEmpty()) { @@ -136,7 +133,7 @@ private boolean createPotionEssence(List potionIngredients, Le return true; } ItemStack resultItem = new ItemStack(ModItems.POTION_ESSENCE.get()); - XRPotionHelper.addPotionEffectsToStack(resultItem, resultEffects); + PotionHelper.addPotionContentsToStack(resultItem, potionContents); ItemEntity itemEntity = new ItemEntity(level, getBlockPos().getX() + 0.5D, getBlockPos().getY() + 0.5D, getBlockPos().getZ() + 0.5D, resultItem); level.addFreshEntity(itemEntity); @@ -160,14 +157,8 @@ public boolean getDataChanged() { return ret; } - - @Override - public LazyOptional getCapability(Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.ITEM_HANDLER) { - return ForgeCapabilities.ITEM_HANDLER.orEmpty(cap, LazyOptional.of(() -> items)); - } - - return super.getCapability(cap, side); + public IItemHandler getItems() { + return items; } public void dropItems(Level level) { diff --git a/src/main/java/reliquary/blocks/tile/BlockEntityBase.java b/src/main/java/reliquary/blocks/tile/BlockEntityBase.java index 0a5d0710..6604de92 100644 --- a/src/main/java/reliquary/blocks/tile/BlockEntityBase.java +++ b/src/main/java/reliquary/blocks/tile/BlockEntityBase.java @@ -1,6 +1,7 @@ package reliquary.blocks.tile; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.Connection; import net.minecraft.network.protocol.Packet; @@ -16,9 +17,9 @@ protected BlockEntityBase(BlockEntityType tileEntityType, BlockPos pos, Block } @Override - public CompoundTag getUpdateTag() { + public CompoundTag getUpdateTag(HolderLookup.Provider registries) { CompoundTag tag = new CompoundTag(); - saveAdditional(tag); + saveAdditional(tag, registries); return tag; } @@ -28,14 +29,14 @@ public Packet getUpdatePacket() { } @Override - public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket packet) { + public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket packet, HolderLookup.Provider registries) { if (level == null || packet.getTag() == null) { - super.onDataPacket(net, packet); + super.onDataPacket(net, packet, registries); return; } BlockState blockState = level.getBlockState(getBlockPos()); - load(packet.getTag()); + loadAdditional(packet.getTag(), registries); level.sendBlockUpdated(getBlockPos(), blockState, blockState, 3); } diff --git a/src/main/java/reliquary/blocks/tile/PassivePedestalBlockEntity.java b/src/main/java/reliquary/blocks/tile/PassivePedestalBlockEntity.java index 72c66ff6..6f47a8a2 100644 --- a/src/main/java/reliquary/blocks/tile/PassivePedestalBlockEntity.java +++ b/src/main/java/reliquary/blocks/tile/PassivePedestalBlockEntity.java @@ -1,7 +1,7 @@ package reliquary.blocks.tile; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.Container; import net.minecraft.world.entity.item.ItemEntity; @@ -10,18 +10,15 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.wrapper.InvWrapper; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.wrapper.InvWrapper; import reliquary.init.ModBlocks; import reliquary.util.InventoryHelper; - -import javax.annotation.Nullable; +import reliquary.util.WorldHelper; public class PassivePedestalBlockEntity extends BlockEntityBase implements Container { protected ItemStack item; + private final IItemHandler inventoryWrapper = new InvWrapper(this); public ItemStack getItem() { @@ -37,6 +34,10 @@ public PassivePedestalBlockEntity(BlockPos pos, BlockState state) { item = ItemStack.EMPTY; } + public IItemHandler getItemHandler() { + return inventoryWrapper; + } + public void dropPedestalInventory(Level level) { if (!item.isEmpty()) { InventoryHelper.spawnItemStack(level, worldPosition, item); @@ -49,6 +50,7 @@ public void removeAndSpawnItem(Level level) { setChanged(); ItemEntity itemEntity = new ItemEntity(level, worldPosition.getX() + 0.5D, worldPosition.getY() + 1D, worldPosition.getZ() + 0.5D, item); level.addFreshEntity(itemEntity); + WorldHelper.notifyBlockUpdate(this); } item = ItemStack.EMPTY; } @@ -107,17 +109,17 @@ private void notifyBlock() { } @Override - public void load(CompoundTag nbt) { - super.load(nbt); - item = nbt.contains("item") ? ItemStack.of(nbt.getCompound("item")) : ItemStack.EMPTY; + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); + item = tag.contains("item") ? ItemStack.parse(registries, tag.getCompound("item")).orElse(ItemStack.EMPTY) : ItemStack.EMPTY; } @Override - public void saveAdditional(CompoundTag compound) { - super.saveAdditional(compound); + public void saveAdditional(CompoundTag compound, HolderLookup.Provider registries) { + super.saveAdditional(compound, registries); if (!item.isEmpty()) { - compound.put("item", item.save(new CompoundTag())); + compound.put("item", item.save(registries)); } } @@ -160,13 +162,4 @@ public void clearContent() { public boolean isEmpty() { return item.isEmpty(); } - - - @Override - public LazyOptional getCapability(Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.ITEM_HANDLER) { - return ForgeCapabilities.ITEM_HANDLER.orEmpty(cap, LazyOptional.of(() -> inventoryWrapper)); - } - return super.getCapability(cap, side); - } } diff --git a/src/main/java/reliquary/blocks/tile/PedestalBlockEntity.java b/src/main/java/reliquary/blocks/tile/PedestalBlockEntity.java index aee359ee..ec2d7e43 100644 --- a/src/main/java/reliquary/blocks/tile/PedestalBlockEntity.java +++ b/src/main/java/reliquary/blocks/tile/PedestalBlockEntity.java @@ -2,6 +2,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.LongTag; @@ -10,28 +11,23 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.AABB; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.common.util.FakePlayer; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; +import net.neoforged.neoforge.items.IItemHandler; import reliquary.api.IPedestal; import reliquary.api.IPedestalActionItem; import reliquary.api.IPedestalRedstoneItem; import reliquary.api.IPedestalRedstoneItemWrapper; import reliquary.blocks.PedestalBlock; import reliquary.init.ModBlocks; -import reliquary.items.util.FilteredItemStackHandler; import reliquary.pedestal.PedestalRegistry; import reliquary.util.CombinedItemHandler; +import reliquary.util.FakePlayerFactory; import reliquary.util.InventoryHelper; -import reliquary.util.WorldHelper; -import reliquary.util.XRFakePlayerFactory; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; @@ -48,7 +44,7 @@ public class PedestalBlockEntity extends PassivePedestalBlockEntity implements I @Nullable private IItemHandler itemHandler = null; @Nullable - private LazyOptional combinedHandler = null; + private IItemHandler combinedHandler = null; private ItemStack fluidContainer = ItemStack.EMPTY; private boolean switchedOn = false; private final List onSwitches = new ArrayList<>(); @@ -62,8 +58,8 @@ public PedestalBlockEntity(BlockPos pos, BlockState state) { } @Override - public void load(CompoundTag tag) { - super.load(tag); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); switchedOn = tag.getBoolean("SwitchedOn"); powered = tag.getBoolean("Powered"); @@ -80,8 +76,8 @@ public void load(CompoundTag tag) { } @Override - public void saveAdditional(CompoundTag compound) { - super.saveAdditional(compound); + public void saveAdditional(CompoundTag compound, HolderLookup.Provider registries) { + super.saveAdditional(compound, registries); compound.putBoolean("SwitchedOn", switchedOn); compound.putBoolean("Powered", powered); @@ -94,15 +90,6 @@ public void saveAdditional(CompoundTag compound) { compound.put("OnSwitches", onLocations); } - @Override - public void setChanged() { - if (itemHandler instanceof FilteredItemStackHandler filteredHandler) { - filteredHandler.markDirty(); - } - - super.setChanged(); - } - @Override public void onChunkUnloaded() { if (level != null && !level.isClientSide) { @@ -121,27 +108,26 @@ public void onLoad() { super.onLoad(); } - @Nonnull @Override - public LazyOptional getCapability(Capability cap, @Nullable Direction side) { - if (cap == ForgeCapabilities.FLUID_HANDLER) { - if (pedestalFluidHandler == null) { - pedestalFluidHandler = new PedestalFluidHandler(this); - } - return ForgeCapabilities.FLUID_HANDLER.orEmpty(cap, LazyOptional.of(() -> pedestalFluidHandler)); - } else if (cap == ForgeCapabilities.ITEM_HANDLER && itemHandler != null) { - if (combinedHandler == null) { - combinedHandler = LazyOptional.of(() -> super.getCapability(ForgeCapabilities.ITEM_HANDLER, side) - .map(superHandler -> (IItemHandler) new CombinedItemHandler(superHandler, itemHandler)) - .orElse(itemHandler)); - } - return combinedHandler.cast(); + public IItemHandler getItemHandler() { + IItemHandler superInventory = super.getItemHandler(); + if (itemHandler == null) { + return superInventory; + } + if (combinedHandler == null) { + combinedHandler = new CombinedItemHandler(superInventory, itemHandler); } + return combinedHandler; + } - return super.getCapability(cap, side); + public IFluidHandler getFluidHandler() { + if (pedestalFluidHandler == null) { + pedestalFluidHandler = new PedestalFluidHandler(this); + } + return pedestalFluidHandler; } - private void executeOnActionItem(Consumer execute) { + public void executeOnActionItem(Consumer execute) { if (actionItem == null) { return; } @@ -162,7 +148,10 @@ private void updateSpecialItems() { return; } - item.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(ih -> itemHandler = ih); + IItemHandler ih = item.getCapability(Capabilities.ItemHandler.ITEM); + if (ih != null) { + itemHandler = ih; + } if (item.getItem() instanceof IPedestalActionItem pedestalActionItem) { tickable = true; @@ -181,8 +170,11 @@ private void updateSpecialItems() { }); } - item.getCapability(ForgeCapabilities.FLUID_HANDLER, null).ifPresent(fh -> fluidContainer = item); - item.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM, null).ifPresent(fh -> fluidContainer = item); + + IFluidHandlerItem itemFluidHandler = item.getCapability(Capabilities.FluidHandler.ITEM); + if (itemFluidHandler != null) { + fluidContainer = item; + } actionCooldown = 0; } @@ -194,7 +186,7 @@ private void resetSpecialItems() { redstoneItem = null; itemHandler = null; if (combinedHandler != null) { - combinedHandler.invalidate(); + level.invalidateCapabilities(getBlockPos()); } combinedHandler = null; } @@ -245,10 +237,7 @@ public BlockPos getBlockPosition() { public int addToConnectedInventory(Level level, ItemStack stack) { int numberAdded = 0; for (Direction side : Direction.values()) { - LazyOptional inventory = InventoryHelper.getInventoryAtPos(level, worldPosition.offset(side.getNormal()), side.getOpposite()); - - int finalNumberAdded = numberAdded; - numberAdded += inventory.map(handler -> InventoryHelper.tryToAddToInventory(stack, handler, stack.getCount() - finalNumberAdded)).orElse(0); + numberAdded += InventoryHelper.tryToAddToInventoryAtPos(stack, level, worldPosition.offset(side.getNormal()), side.getOpposite(), stack.getCount() - numberAdded); if (numberAdded >= stack.getCount()) { break; } @@ -291,13 +280,10 @@ public void setActionCoolDown(int coolDownTicks) { @Override public Optional getFakePlayer() { - if (level == null || level.isClientSide) { + if (level == null || !(level instanceof ServerLevel serverLevel)) { return Optional.empty(); } - - ServerLevel world = (ServerLevel) level; - - return Optional.of(XRFakePlayerFactory.get(world)); + return Optional.of(FakePlayerFactory.get(serverLevel)); } @Override @@ -399,7 +385,10 @@ private List getAdjacentTanks() { } private void addIfTank(List adjacentTanks, BlockPos tankPos, Direction tankDirection) { - WorldHelper.getBlockEntity(level, tankPos).ifPresent(te -> te.getCapability(ForgeCapabilities.FLUID_HANDLER, tankDirection).ifPresent(adjacentTanks::add)); + IFluidHandler fh = level.getCapability(Capabilities.FluidHandler.BLOCK, tankPos, tankDirection); + if (fh != null) { + adjacentTanks.add(fh); + } } public void removeSpecialItems(Level level) { @@ -491,12 +480,4 @@ ItemStack getFluidContainer() { public boolean isEnabled() { return getBlockState().getValue(PedestalBlock.ENABLED); } - - @Override - public AABB getRenderBoundingBox() { - BlockPos pos = getBlockPos(); - AABB aabb = new AABB(pos.offset(-1, 0, -1), pos.offset(1, 1, 1)); - executeOnActionItem(ai -> ai.getRenderBoundingBoxOuterPosition().ifPresent(aabb::expandTowards)); - return aabb; - } } \ No newline at end of file diff --git a/src/main/java/reliquary/blocks/tile/PedestalFluidHandler.java b/src/main/java/reliquary/blocks/tile/PedestalFluidHandler.java index a1694bad..a45d79e2 100644 --- a/src/main/java/reliquary/blocks/tile/PedestalFluidHandler.java +++ b/src/main/java/reliquary/blocks/tile/PedestalFluidHandler.java @@ -1,11 +1,10 @@ package reliquary.blocks.tile; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.IFluidHandlerItem; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; import org.jetbrains.annotations.NotNull; import java.util.Optional; @@ -66,11 +65,7 @@ private Optional getFluidHandlerValue(Function mapValue if (fluidContainer.isEmpty()) { return Optional.empty(); } - LazyOptional cap = fluidContainer.getCapability(ForgeCapabilities.FLUID_HANDLER); - if (cap.isPresent()) { - return cap.map(fh -> Optional.of(mapValue.apply(fh))).orElse(Optional.empty()); - } - return fluidContainer.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).map(fh -> Optional.of(mapValue.apply(fh))).orElse(Optional.empty()); - + IFluidHandler fh = fluidContainer.getCapability(Capabilities.FluidHandler.ITEM); + return Optional.ofNullable(mapValue.apply(fh)); } } diff --git a/src/main/java/reliquary/client/gui/AlkahestryTomeGui.java b/src/main/java/reliquary/client/gui/AlkahestryTomeScreen.java similarity index 90% rename from src/main/java/reliquary/client/gui/AlkahestryTomeGui.java rename to src/main/java/reliquary/client/gui/AlkahestryTomeScreen.java index 66505b20..6bec67da 100644 --- a/src/main/java/reliquary/client/gui/AlkahestryTomeGui.java +++ b/src/main/java/reliquary/client/gui/AlkahestryTomeScreen.java @@ -12,18 +12,18 @@ import net.minecraft.util.FormattedCharSequence; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.item.ItemStack; +import reliquary.Reliquary; import reliquary.common.gui.AlkahestTomeMenu; import reliquary.crafting.AlkahestryRecipeRegistry; import reliquary.init.ModItems; -import reliquary.reference.Reference; import java.util.List; @SuppressWarnings("squid:MaximumInheritanceDepth") -public class AlkahestryTomeGui extends GuiBase { - private static final ResourceLocation BOOK_TEX = new ResourceLocation(Reference.MOD_ID, "textures/gui/book.png"); +public class AlkahestryTomeScreen extends BaseScreen { + private static final ResourceLocation BOOK_TEX = Reliquary.getRL("textures/gui/book.png"); - public AlkahestryTomeGui(AlkahestTomeMenu container, Inventory playerInventory, Component title) { + public AlkahestryTomeScreen(AlkahestTomeMenu container, Inventory playerInventory, Component title) { super(container, playerInventory, title); } diff --git a/src/main/java/reliquary/client/gui/GuiBase.java b/src/main/java/reliquary/client/gui/BaseScreen.java similarity index 83% rename from src/main/java/reliquary/client/gui/GuiBase.java rename to src/main/java/reliquary/client/gui/BaseScreen.java index 075b2ad5..08a54def 100644 --- a/src/main/java/reliquary/client/gui/GuiBase.java +++ b/src/main/java/reliquary/client/gui/BaseScreen.java @@ -12,9 +12,9 @@ * * @author TheMike */ -abstract class GuiBase extends AbstractContainerScreen { +abstract class BaseScreen extends AbstractContainerScreen { - GuiBase(T container, Inventory playerInventory, Component title) { + BaseScreen(T container, Inventory playerInventory, Component title) { super(container, playerInventory, title); } @@ -32,7 +32,7 @@ void drawItemStack(GuiGraphics guiGraphics, ItemStack stack, int x, int y) { @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { - renderBackground(guiGraphics); + renderBackground(guiGraphics, mouseX, mouseY, partialTicks); super.render(guiGraphics, mouseX, mouseY, partialTicks); } } diff --git a/src/main/java/reliquary/client/gui/MobCharmBeltGui.java b/src/main/java/reliquary/client/gui/MobCharmBeltScreen.java similarity index 57% rename from src/main/java/reliquary/client/gui/MobCharmBeltGui.java rename to src/main/java/reliquary/client/gui/MobCharmBeltScreen.java index 0bf6b23d..ed7b244d 100644 --- a/src/main/java/reliquary/client/gui/MobCharmBeltGui.java +++ b/src/main/java/reliquary/client/gui/MobCharmBeltScreen.java @@ -6,27 +6,22 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; +import reliquary.Reliquary; import reliquary.common.gui.MobCharmBeltMenu; import reliquary.init.ModItems; import reliquary.items.MobCharmRegistry; -import reliquary.reference.Reference; -import reliquary.util.LogHelper; - -import java.lang.reflect.Field; @SuppressWarnings("squid:MaximumInheritanceDepth") -public class MobCharmBeltGui extends GuiBase { - private static final ResourceLocation BELT_TEX = new ResourceLocation(Reference.MOD_ID, "textures/gui/mob_charm_belt.png"); - private static final ResourceLocation BELT_ITEM_TEX = new ResourceLocation(Reference.MOD_ID, "textures/item/mob_charm_belt.png"); +public class MobCharmBeltScreen extends BaseScreen { + private static final ResourceLocation BELT_TEX = Reliquary.getRL("textures/gui/mob_charm_belt.png"); + private static final ResourceLocation BELT_ITEM_TEX = Reliquary.getRL("textures/item/mob_charm_belt.png"); private static final int WIDTH = 175; private static final int HEIGHT = 221; private final ItemStack belt; - public MobCharmBeltGui(MobCharmBeltMenu container, Inventory playerInventory, Component title) { + public MobCharmBeltScreen(MobCharmBeltMenu container, Inventory playerInventory, Component title) { super(container, playerInventory, title); belt = container.getBelt(); } @@ -77,38 +72,14 @@ private void updateMobCharmSlots(GuiGraphics guiGraphics, int centerX, int cente RenderSystem.disableBlend(); - setSlotXPos(menu.slots.get(i - 1), x - centerX + 88); - setSlotYPos(menu.slots.get(i - 1), y - centerY + 40); + menu.slots.get(i - 1).x = x - centerX + 88; + menu.slots.get(i - 1).y = y - centerY + 40; } - setSlotXPos(menu.slots.get(slots), 80); - setSlotYPos(menu.slots.get(slots), -12); + menu.slots.get(slots).x = 80; + menu.slots.get(slots).y = -12; for (int i = slots + 1; i < MobCharmRegistry.getRegisteredNames().size() + 1; i++) { - setSlotXPos(menu.slots.get(i), -999); - } - } - - private static final Field SLOT_X_POS = ObfuscationReflectionHelper.findField(Slot.class, "f_40220_"); - - @SuppressWarnings("java:S3011") //the use of reflection to bypass field invisiblity is intentional and necessary here - private static void setSlotXPos(Slot slot, int xPos) { - try { - SLOT_X_POS.set(slot, xPos); - } - catch (IllegalAccessException e) { - LogHelper.error("Error setting xPos of Slot: ", e); - } - } - - private static final Field SLOT_Y_POS = ObfuscationReflectionHelper.findField(Slot.class, "f_40221_"); - - @SuppressWarnings("java:S3011") //the use of reflection to bypass field invisiblity is intentional and necessary here - private static void setSlotYPos(Slot slot, int yPos) { - try { - SLOT_Y_POS.set(slot, yPos); - } - catch (IllegalAccessException e) { - LogHelper.error("Error setting yPos of Slot: ", e); + menu.slots.get(i).x = -999; } } diff --git a/src/main/java/reliquary/client/gui/components/Component.java b/src/main/java/reliquary/client/gui/components/Component.java index 1a786dcc..4a4b0f85 100644 --- a/src/main/java/reliquary/client/gui/components/Component.java +++ b/src/main/java/reliquary/client/gui/components/Component.java @@ -1,10 +1,8 @@ package reliquary.client.gui.components; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; +import com.mojang.blaze3d.vertex.*; import net.minecraft.client.gui.GuiGraphics; +import org.joml.Matrix4f; public abstract class Component { public int getPadding() { @@ -33,24 +31,19 @@ public boolean shouldRender() { public abstract void renderInternal(GuiGraphics guiGraphics, int x, int y); - protected void blit(int x, int y, int textureX, int textureY, int width, int height) { - blit(x, y, textureX, textureY, width, height, 256, 256); - } - @SuppressWarnings("java:S107") - protected void blit(int x, int y, int textureX, int textureY, int width, int height, float textureWidth, float textureHeight) { + protected void blit(GuiGraphics guiGraphics, int x, int y, int textureX, int textureY, int width, int height, float textureWidth, float textureHeight) { float minU = textureX / textureWidth; float maxU = (textureX + width) / textureWidth; float minV = textureY / textureHeight; float maxV = (textureY + height) / textureHeight; - Tesselator tessellator = Tesselator.getInstance(); - BufferBuilder buffer = tessellator.getBuilder(); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - buffer.vertex(x, (double) y + height, 0).uv(minU, maxV).endVertex(); - buffer.vertex((double) x + width, (double) y + height, 0).uv(maxU, maxV).endVertex(); - buffer.vertex((double) x + width, y, 0).uv(maxU, minV).endVertex(); - buffer.vertex(x, y, 0).uv(minU, minV).endVertex(); - tessellator.end(); + BufferBuilder buffer = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + Matrix4f matrix4f = guiGraphics.pose().last().pose(); + buffer.addVertex(matrix4f, x, y + height, 0).setUv(minU, maxV); + buffer.addVertex(matrix4f, x + width, y + height, 0).setUv(maxU, maxV); + buffer.addVertex(matrix4f, x + width, y, 0).setUv(maxU, minV); + buffer.addVertex(matrix4f, x, y, 0).setUv(minU, minV); + BufferUploader.drawWithShader(buffer.buildOrThrow()); } } diff --git a/src/main/java/reliquary/client/gui/components/XPBarPane.java b/src/main/java/reliquary/client/gui/components/XPBarPane.java index 182d5bae..21f1d8f3 100644 --- a/src/main/java/reliquary/client/gui/components/XPBarPane.java +++ b/src/main/java/reliquary/client/gui/components/XPBarPane.java @@ -4,10 +4,10 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.resources.ResourceLocation; -import reliquary.reference.Reference; +import reliquary.Reliquary; public class XPBarPane extends Component { - private static final ResourceLocation XP_BAR = new ResourceLocation(Reference.MOD_ID, "textures/gui/xp_bar.png"); + private static final ResourceLocation XP_BAR = Reliquary.getRL("textures/gui/xp_bar.png"); private float xpRatio; public void setXpRatio(float xpRatio) { @@ -33,11 +33,11 @@ public int getPadding() { public void renderInternal(GuiGraphics guiGraphics, int x, int y) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, XP_BAR); - blit(x, y, 0, 0, 11, 74, 22, 74); + blit(guiGraphics, x, y, 0, 0, 11, 74, 22, 74); if (xpRatio > 0) { int filledHeight = (int) (xpRatio * 74); - blit(x, y + (74 - filledHeight), 11, 74 - filledHeight, 11, filledHeight, 22, 74); + blit(guiGraphics, x, y + (74 - filledHeight), 11, 74 - filledHeight, 11, filledHeight, 22, 74); } } } diff --git a/src/main/java/reliquary/client/gui/hud/ChargeableItemInfoPane.java b/src/main/java/reliquary/client/gui/hud/ChargeableItemInfoPane.java index a04f2587..8d35f18f 100644 --- a/src/main/java/reliquary/client/gui/hud/ChargeableItemInfoPane.java +++ b/src/main/java/reliquary/client/gui/hud/ChargeableItemInfoPane.java @@ -66,11 +66,6 @@ public int getWidthInternal() { return mainPanel.getWidth(); } - @Override - public int getPadding() { - return 1; - } - @Override public boolean shouldRender() { return !InventoryHelper.getCorrectItemFromEitherHand(Minecraft.getInstance().player, mainItem.getItem()).isEmpty(); diff --git a/src/main/java/reliquary/client/gui/hud/CharmPane.java b/src/main/java/reliquary/client/gui/hud/CharmPane.java index 25f298cf..cd2c2f08 100644 --- a/src/main/java/reliquary/client/gui/hud/CharmPane.java +++ b/src/main/java/reliquary/client/gui/hud/CharmPane.java @@ -5,7 +5,7 @@ import reliquary.client.gui.components.Box; import reliquary.client.gui.components.Component; import reliquary.client.gui.components.ItemStackPane; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.HashMap; import java.util.Iterator; @@ -77,7 +77,7 @@ ItemStack getCharm() { } public static void addCharmToDraw(ItemStack charm, int slot) { - int maxMobCharmsToDisplay = Settings.COMMON.items.mobCharm.maxCharmsToDisplay.get(); + int maxMobCharmsToDisplay = Config.COMMON.items.mobCharm.maxCharmsToDisplay.get(); lock.lock(); if (charmsToDraw.size() == maxMobCharmsToDisplay) { charmsToDraw.remove(0); @@ -99,7 +99,7 @@ private static void removeExpiredMobCharms() { for (Iterator> iterator = charmsToDraw.entrySet().iterator(); iterator.hasNext(); ) { Map.Entry entry = iterator.next(); CharmToDraw charmToDraw = entry.getValue(); - if (Boolean.TRUE.equals(Settings.COMMON.items.mobCharm.keepAlmostDestroyedDisplayed.get()) && charmToDraw.getCharm().getDamageValue() >= (charmToDraw.getCharm().getMaxDamage() * 0.9)) { + if (Boolean.TRUE.equals(Config.COMMON.items.mobCharm.keepAlmostDestroyedDisplayed.get()) && charmToDraw.getCharm().getDamageValue() >= (charmToDraw.getCharm().getMaxDamage() * 0.9)) { continue; } diff --git a/src/main/java/reliquary/client/gui/hud/HeroMedallionPane.java b/src/main/java/reliquary/client/gui/hud/HeroMedallionPane.java index 76b143a6..eb4e2bea 100644 --- a/src/main/java/reliquary/client/gui/hud/HeroMedallionPane.java +++ b/src/main/java/reliquary/client/gui/hud/HeroMedallionPane.java @@ -3,11 +3,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.world.item.ItemStack; -import reliquary.client.gui.components.Box; -import reliquary.client.gui.components.Component; -import reliquary.client.gui.components.ItemStackPane; -import reliquary.client.gui.components.TextPane; -import reliquary.client.gui.components.XPBarPane; +import reliquary.client.gui.components.*; import reliquary.init.ModItems; import reliquary.reference.Colors; import reliquary.util.InventoryHelper; @@ -39,11 +35,6 @@ public boolean shouldRender() { return !InventoryHelper.getCorrectItemFromEitherHand(Minecraft.getInstance().player, ModItems.HERO_MEDALLION.get()).isEmpty(); } - @Override - public int getPadding() { - return 1; - } - @Override public void renderInternal(GuiGraphics guiGraphics, int x, int y) { ItemStack item = InventoryHelper.getCorrectItemFromEitherHand(Minecraft.getInstance().player, ModItems.HERO_MEDALLION.get()); diff --git a/src/main/java/reliquary/client/init/ItemModels.java b/src/main/java/reliquary/client/init/ItemModels.java index 4d302c57..773d5c56 100644 --- a/src/main/java/reliquary/client/init/ItemModels.java +++ b/src/main/java/reliquary/client/init/ItemModels.java @@ -1,7 +1,7 @@ package reliquary.client.init; import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraftforge.client.event.ModelEvent; +import net.neoforged.neoforge.client.event.ModelEvent; import reliquary.client.model.VoidTearModel; import reliquary.init.ModItems; import reliquary.util.RegistryHelper; diff --git a/src/main/java/reliquary/client/init/ModBlockColors.java b/src/main/java/reliquary/client/init/ModBlockColors.java index c1f4fd98..060dec9c 100644 --- a/src/main/java/reliquary/client/init/ModBlockColors.java +++ b/src/main/java/reliquary/client/init/ModBlockColors.java @@ -1,6 +1,6 @@ package reliquary.client.init; -import net.minecraftforge.client.event.RegisterColorHandlersEvent; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; import reliquary.blocks.tile.ApothecaryCauldronBlockEntity; import reliquary.init.ModBlocks; @@ -9,9 +9,9 @@ private ModBlockColors() { } public static void registerBlockColors(RegisterColorHandlersEvent.Block event) { - event.register((state, world, pos, tintIndex) -> { - if (world != null && pos != null) { - ApothecaryCauldronBlockEntity cauldron = (ApothecaryCauldronBlockEntity) world.getBlockEntity(pos); + event.register((state, level, pos, tintIndex) -> { + if (level != null && pos != null) { + ApothecaryCauldronBlockEntity cauldron = (ApothecaryCauldronBlockEntity) level.getBlockEntity(pos); if (cauldron != null && cauldron.getLiquidLevel() > 0) { return cauldron.getColorMultiplier(); } diff --git a/src/main/java/reliquary/client/init/ModItemColors.java b/src/main/java/reliquary/client/init/ModItemColors.java index 628985ea..834d692c 100644 --- a/src/main/java/reliquary/client/init/ModItemColors.java +++ b/src/main/java/reliquary/client/init/ModItemColors.java @@ -2,31 +2,26 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.util.FastColor; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.SpawnEggItem; -import net.minecraft.world.item.alchemy.PotionUtils; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.RegisterColorHandlersEvent; -import net.minecraftforge.common.ForgeSpawnEggItem; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.world.item.alchemy.PotionContents; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; import reliquary.items.BulletItem; import reliquary.items.MobCharmFragmentItem; import reliquary.items.MobCharmItem; import reliquary.items.VoidTearItem; -import reliquary.items.util.IPotionItem; -import reliquary.util.NBTHelper; -import java.util.List; import java.util.Optional; import static reliquary.init.ModItems.*; -@OnlyIn(Dist.CLIENT) public class ModItemColors { - private ModItemColors() {} + private ModItemColors() { + } public static void registerItemColors(RegisterColorHandlersEvent.Item event) { registerMobCharmItemColors(event); @@ -41,7 +36,7 @@ public static void registerItemColors(RegisterColorHandlersEvent.Item event) { private static void registerVoidTearItemColors(RegisterColorHandlersEvent.Item event) { event.register((stack, tintIndex) -> { if (Screen.hasShiftDown()) { - ItemStack containedStack = VoidTearItem.getTearContents(stack, true); + ItemStack containedStack = VoidTearItem.getTearContents(stack); if (!containedStack.isEmpty()) { return Minecraft.getInstance().getItemColors().getColor(containedStack, tintIndex); } @@ -55,24 +50,14 @@ private static void registerPotionItemColors(RegisterColorHandlersEvent.Item eve event.register((stack, tintIndex) -> { if (tintIndex == 1) { + return stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getColor(); - //used when rendering as thrown entity - if (NBTHelper.getInt("renderColor", stack) > 0) { - return NBTHelper.getInt("renderColor", stack); - } - - List effects = ((IPotionItem) stack.getItem()).getEffects(stack); - if (effects.isEmpty()) { - return -1; - } - - return PotionUtils.getColor(effects); } else { return -1; } }, POTION.get(), SPLASH_POTION.get(), LINGERING_POTION.get()); - event.register((stack, tintIndex) -> tintIndex == 0 ? PotionUtils.getColor(((IPotionItem) stack.getItem()).getEffects(stack)) : -1, TIPPED_ARROW.get()); + event.register((stack, tintIndex) -> tintIndex == 0 ? stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getColor() : -1, TIPPED_ARROW.get()); } private static void registerBulletItemColors(RegisterColorHandlersEvent.Item event) { @@ -82,7 +67,7 @@ private static void registerBulletItemColors(RegisterColorHandlersEvent.Item eve } else if (tintIndex == 1) { return ((BulletItem) stack.getItem()).getColor(); } else if (tintIndex == 2) { - return PotionUtils.getColor(((IPotionItem) stack.getItem()).getEffects(stack)); + return stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getColor(); } return -1; }, EMPTY_MAGAZINE.get(), NEUTRAL_MAGAZINE.get(), EXORCISM_MAGAZINE.get(), BLAZE_MAGAZINE.get(), ENDER_MAGAZINE.get(), CONCUSSIVE_MAGAZINE.get(), @@ -97,7 +82,7 @@ private static void registerMobCharmItemColors(RegisterColorHandlersEvent.Item e } ResourceLocation entityName = MobCharmItem.getEntityEggRegistryName(stack); - return getEgg(entityName).map(egg -> tintIndex == 1 ? egg.getColor(0) : egg.getColor(1)).orElse(-1); + return getEgg(entityName).map(egg -> tintIndex == 1 ? FastColor.ARGB32.opaque(egg.getColor(0)) : FastColor.ARGB32.opaque(egg.getColor(1))).orElse(-1); }, MOB_CHARM.get()); event.register((stack, tintIndex) -> { @@ -105,14 +90,16 @@ private static void registerMobCharmItemColors(RegisterColorHandlersEvent.Item e return -1; } - ResourceLocation entityName = MobCharmFragmentItem.getEntityEggRegistryName(stack); - return getEgg(entityName).map(egg -> tintIndex == 0 ? egg.getColor(0) : egg.getColor(1)).orElse(-1); + ResourceLocation entityName = MobCharmFragmentItem.getEntityRegistryName(stack); + return getEgg(entityName).map(egg -> tintIndex == 0 ? FastColor.ARGB32.opaque(egg.getColor(0)) : FastColor.ARGB32.opaque(egg.getColor(1))).orElse(-1); }, MOB_CHARM_FRAGMENT.get()); } private static Optional getEgg(ResourceLocation entityName) { - return Optional.ofNullable(ForgeSpawnEggItem.fromEntityType(ForgeRegistries.ENTITY_TYPES.getValue(entityName))); + return Optional.ofNullable(SpawnEggItem.byId(BuiltInRegistries.ENTITY_TYPE.get(entityName))); } - private static int getColor(ItemStack stack) {return PotionUtils.getColor(((IPotionItem) stack.getItem()).getEffects(stack));} + private static int getColor(ItemStack stack) { + return stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getColor(); + } } diff --git a/src/main/java/reliquary/client/init/ModParticles.java b/src/main/java/reliquary/client/init/ModParticles.java index 4b309114..f766e0de 100644 --- a/src/main/java/reliquary/client/init/ModParticles.java +++ b/src/main/java/reliquary/client/init/ModParticles.java @@ -1,26 +1,28 @@ package reliquary.client.init; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleType; -import net.minecraftforge.client.event.RegisterParticleProvidersEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; +import net.minecraft.core.registries.BuiltInRegistries; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent; +import net.neoforged.neoforge.registries.DeferredRegister; +import reliquary.Reliquary; import reliquary.client.particle.CauldronBubbleParticle; import reliquary.client.particle.CauldronBubbleParticleType; import reliquary.client.particle.CauldronSteamParticle; import reliquary.client.particle.CauldronSteamParticleType; -import reliquary.reference.Reference; + +import java.util.function.Supplier; public class ModParticles { private ModParticles() {} - private static final DeferredRegister> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, Reference.MOD_ID); - public static final RegistryObject CAULDRON_STEAM = PARTICLES.register("cauldron_steam", CauldronSteamParticleType::new); - public static final RegistryObject CAULDRON_BUBBLE = PARTICLES.register("cauldron_bubble", CauldronBubbleParticleType::new); + private static final DeferredRegister> PARTICLE_TYPES = DeferredRegister.create(BuiltInRegistries.PARTICLE_TYPE, Reliquary.MOD_ID); + public static final Supplier> CAULDRON_STEAM = PARTICLE_TYPES.register("cauldron_steam", CauldronSteamParticleType::new); + public static final Supplier> CAULDRON_BUBBLE = PARTICLE_TYPES.register("cauldron_bubble", CauldronBubbleParticleType::new); public static void registerListeners(IEventBus modBus) { - PARTICLES.register(modBus); + PARTICLE_TYPES.register(modBus); } public static class ProviderHandler { diff --git a/src/main/java/reliquary/client/model/MobCharmBeltModel.java b/src/main/java/reliquary/client/model/MobCharmBeltModel.java index 5ae680b6..b340560e 100644 --- a/src/main/java/reliquary/client/model/MobCharmBeltModel.java +++ b/src/main/java/reliquary/client/model/MobCharmBeltModel.java @@ -5,11 +5,7 @@ import net.minecraft.client.model.HumanoidModel; 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.model.geom.builders.*; import net.minecraft.world.entity.LivingEntity; public class MobCharmBeltModel extends HumanoidModel { @@ -31,9 +27,9 @@ public static LayerDefinition createBodyLayer() { } @Override - public void renderToBuffer(PoseStack pPoseStack, VertexConsumer pBuffer, int pPackedLight, int pPackedOverlay, float pRed, float pGreen, float pBlue, float pAlpha) { + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { setAllVisible(false); body.visible = true; - super.renderToBuffer(pPoseStack, pBuffer, pPackedLight, pPackedOverlay, pRed, pGreen, pBlue, pAlpha); + super.renderToBuffer(poseStack, buffer, packedLight, packedOverlay, color); } } diff --git a/src/main/java/reliquary/client/model/VoidTearModel.java b/src/main/java/reliquary/client/model/VoidTearModel.java index a59c7ddd..80523782 100644 --- a/src/main/java/reliquary/client/model/VoidTearModel.java +++ b/src/main/java/reliquary/client/model/VoidTearModel.java @@ -69,18 +69,18 @@ public ItemTransforms getTransforms() { public ItemOverrides getOverrides() { return new ItemOverrides() { @Override - public BakedModel resolve(BakedModel model, ItemStack stack, @Nullable ClientLevel world, @Nullable LivingEntity entity, int seed) { + public BakedModel resolve(BakedModel model, ItemStack stack, @Nullable ClientLevel level, @Nullable LivingEntity entity, int seed) { if (Screen.hasShiftDown()) { - ItemStack containedStack = VoidTearItem.getTearContents(stack, true); + ItemStack containedStack = VoidTearItem.getTearContents(stack); if (!containedStack.isEmpty()) { - BakedModel bakedModel = Minecraft.getInstance().getItemRenderer().getModel(containedStack, world, entity, seed); + BakedModel bakedModel = Minecraft.getInstance().getItemRenderer().getModel(containedStack, level, entity, seed); if (!bakedModel.isCustomRenderer()) { return bakedModel; } } } - return originalModel.getOverrides().resolve(model, stack, world, entity, seed); + return originalModel.getOverrides().resolve(model, stack, level, entity, seed); } }; } diff --git a/src/main/java/reliquary/client/model/WitchHatModel.java b/src/main/java/reliquary/client/model/WitchHatModel.java index 3464cb93..adf0d049 100644 --- a/src/main/java/reliquary/client/model/WitchHatModel.java +++ b/src/main/java/reliquary/client/model/WitchHatModel.java @@ -5,11 +5,7 @@ import net.minecraft.client.model.HumanoidModel; 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.model.geom.builders.*; import net.minecraft.world.entity.LivingEntity; public class WitchHatModel extends HumanoidModel { @@ -20,7 +16,7 @@ public WitchHatModel(ModelPart part) { public static LayerDefinition createBodyLayer() { MeshDefinition meshDefinition = createMesh(CubeDeformation.NONE, 3); PartDefinition root = meshDefinition.getRoot(); - PartDefinition head = root.addOrReplaceChild("head", CubeListBuilder.create(), PartPose.ZERO); + PartDefinition head = root.addOrReplaceChild("head", CubeListBuilder.create(), PartPose.ZERO); root.addOrReplaceChild("hat", CubeListBuilder.create(), PartPose.ZERO); root.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.ZERO); root.addOrReplaceChild("left_arm", CubeListBuilder.create(), PartPose.ZERO); @@ -41,9 +37,9 @@ public static LayerDefinition createBodyLayer() { } @Override - public void renderToBuffer(PoseStack ms, VertexConsumer buffer, int light, int overlay, float r, float g, float b, float a) { + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { setAllVisible(false); head.visible = true; - super.renderToBuffer(ms, buffer, light, overlay, r, g, b, a); + super.renderToBuffer(poseStack, buffer, packedLight, packedOverlay, color); } } diff --git a/src/main/java/reliquary/client/particle/BubbleColorParticleData.java b/src/main/java/reliquary/client/particle/BubbleColorParticleData.java deleted file mode 100644 index bffd69a6..00000000 --- a/src/main/java/reliquary/client/particle/BubbleColorParticleData.java +++ /dev/null @@ -1,39 +0,0 @@ -package reliquary.client.particle; - -import com.mojang.brigadier.StringReader; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.core.particles.ParticleType; -import net.minecraft.network.FriendlyByteBuf; -import reliquary.client.init.ModParticles; - -public class BubbleColorParticleData extends ColorParticleData { - public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Codec.FLOAT.fieldOf("r").forGetter(ColorParticleData::getRed), - Codec.FLOAT.fieldOf("g").forGetter(ColorParticleData::getGreen), - Codec.FLOAT.fieldOf("b").forGetter(ColorParticleData::getBlue) - ).apply(instance, BubbleColorParticleData::new)); - - public BubbleColorParticleData(float red, float green, float blue) { - super(red, green, blue); - } - - @Override - public ParticleType getType() { - return ModParticles.CAULDRON_BUBBLE.get(); - } - - @SuppressWarnings("deprecation") - public static final Deserializer DESERIALIZER = new Deserializer<>() { - @Override - public BubbleColorParticleData fromCommand(ParticleType particleTypeIn, StringReader reader) throws CommandSyntaxException { - return DeserializationHelper.deserialize(BubbleColorParticleData::new, reader); - } - - @Override - public BubbleColorParticleData fromNetwork(ParticleType particleTypeIn, FriendlyByteBuf buffer) { - return DeserializationHelper.read(BubbleColorParticleData::new, buffer); - } - }; -} diff --git a/src/main/java/reliquary/client/particle/CauldronBubbleParticle.java b/src/main/java/reliquary/client/particle/CauldronBubbleParticle.java index d25e339b..dc12612c 100644 --- a/src/main/java/reliquary/client/particle/CauldronBubbleParticle.java +++ b/src/main/java/reliquary/client/particle/CauldronBubbleParticle.java @@ -1,33 +1,27 @@ package reliquary.client.particle; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.particle.Particle; -import net.minecraft.client.particle.ParticleProvider; -import net.minecraft.client.particle.ParticleRenderType; -import net.minecraft.client.particle.SpriteSet; -import net.minecraft.client.particle.TextureSheetParticle; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.client.particle.*; +import net.minecraft.core.particles.ColorParticleOption; import javax.annotation.Nullable; -@OnlyIn(Dist.CLIENT) public class CauldronBubbleParticle extends TextureSheetParticle { private static final int FRAMES_OF_EACH_POP_STAGE = 2; private static final int POP_STAGES = 3; private final SpriteSet spriteSet; - private CauldronBubbleParticle(ClientLevel world, ColorParticleData particleData, double x, double y, double z, SpriteSet spriteSet) { - super(world, x, y, z, 0D, 0D, 0D); + private CauldronBubbleParticle(ClientLevel level, ColorParticleOption particleOption, double x, double y, double z, SpriteSet spriteSet) { + super(level, x, y, z, 0D, 0D, 0D); this.spriteSet = spriteSet; setSize(0.02F, 0.02F); - quadSize = 0.5F + (world.random.nextFloat() - 0.5F) * 0.4F; + quadSize = 0.5F + (level.random.nextFloat() - 0.5F) * 0.4F; xd = 0D; yd = 0D; zd = 0D; - rCol = particleData.getRed(); - gCol = particleData.getGreen(); - bCol = particleData.getBlue(); + rCol = particleOption.getRed(); + gCol = particleOption.getGreen(); + bCol = particleOption.getBlue(); lifetime = 20; age = 0; } @@ -66,8 +60,7 @@ public ParticleRenderType getRenderType() { return ParticleRenderType.PARTICLE_SHEET_OPAQUE; } - @OnlyIn(Dist.CLIENT) - public static class Provider implements ParticleProvider { + public static class Provider implements ParticleProvider { private final SpriteSet spriteSet; public Provider(SpriteSet spriteSet) { @@ -76,7 +69,7 @@ public Provider(SpriteSet spriteSet) { @Nullable @Override - public Particle createParticle(BubbleColorParticleData particleData, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { + public Particle createParticle(ColorParticleOption particleData, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { CauldronBubbleParticle particle = new CauldronBubbleParticle(level, particleData, x, y, z, spriteSet); particle.setSprite(spriteSet.get(particle.age, particle.lifetime)); return particle; diff --git a/src/main/java/reliquary/client/particle/CauldronBubbleParticleType.java b/src/main/java/reliquary/client/particle/CauldronBubbleParticleType.java index 8cee8eda..78c2c496 100644 --- a/src/main/java/reliquary/client/particle/CauldronBubbleParticleType.java +++ b/src/main/java/reliquary/client/particle/CauldronBubbleParticleType.java @@ -1,15 +1,24 @@ package reliquary.client.particle; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleType; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import reliquary.client.init.ModParticles; -public class CauldronBubbleParticleType extends ParticleType { +public class CauldronBubbleParticleType extends ParticleType { public CauldronBubbleParticleType() { - super(false, BubbleColorParticleData.DESERIALIZER); + super(false); } @Override - public Codec codec() { - return BubbleColorParticleData.CODEC; + public MapCodec codec() { + return ColorParticleOption.codec(ModParticles.CAULDRON_BUBBLE.get()); + } + + @Override + public StreamCodec streamCodec() { + return ColorParticleOption.streamCodec(ModParticles.CAULDRON_BUBBLE.get()); } } diff --git a/src/main/java/reliquary/client/particle/CauldronSteamParticle.java b/src/main/java/reliquary/client/particle/CauldronSteamParticle.java index 744ce5bb..4ee9ba00 100644 --- a/src/main/java/reliquary/client/particle/CauldronSteamParticle.java +++ b/src/main/java/reliquary/client/particle/CauldronSteamParticle.java @@ -1,31 +1,25 @@ package reliquary.client.particle; import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.client.particle.Particle; -import net.minecraft.client.particle.ParticleProvider; -import net.minecraft.client.particle.ParticleRenderType; -import net.minecraft.client.particle.SpriteSet; -import net.minecraft.client.particle.TextureSheetParticle; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.client.particle.*; +import net.minecraft.core.particles.ColorParticleOption; import javax.annotation.Nullable; -@OnlyIn(Dist.CLIENT) public class CauldronSteamParticle extends TextureSheetParticle { private final SpriteSet spriteSet; - private CauldronSteamParticle(ClientLevel world, ColorParticleData particleData, double x, double y, double z, double ySpeed, SpriteSet spriteSet) { - super(world, x, y, z, 0, 0, 0); - rCol = particleData.getRed(); - gCol = particleData.getGreen(); - bCol = particleData.getBlue(); + private CauldronSteamParticle(ClientLevel level, ColorParticleOption particleOption, double x, double y, double z, double ySpeed, SpriteSet spriteSet) { + super(level, x, y, z, 0, 0, 0); + rCol = particleOption.getRed(); + gCol = particleOption.getGreen(); + bCol = particleOption.getBlue(); xd *= 0.1F; yd *= 0.1F; zd *= 0.1F; yd += ySpeed; this.spriteSet = spriteSet; - lifetime = 8 + world.random.nextInt(32); + lifetime = 8 + level.random.nextInt(32); } @Override @@ -59,8 +53,7 @@ public ParticleRenderType getRenderType() { return ParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; } - @OnlyIn(Dist.CLIENT) - public static class Provider implements ParticleProvider { + public static class Provider implements ParticleProvider { private final SpriteSet spriteSet; public Provider(SpriteSet spriteSet) { @@ -69,8 +62,8 @@ public Provider(SpriteSet spriteSet) { @Nullable @Override - public Particle createParticle(SteamColorParticleData particleData, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { - CauldronSteamParticle particle = new CauldronSteamParticle(level, particleData, x, y, z, ySpeed, spriteSet); + public Particle createParticle(ColorParticleOption particleOption, ClientLevel level, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { + CauldronSteamParticle particle = new CauldronSteamParticle(level, particleOption, x, y, z, ySpeed, spriteSet); particle.setSprite(spriteSet.get(particle.age, particle.lifetime)); return particle; } diff --git a/src/main/java/reliquary/client/particle/CauldronSteamParticleType.java b/src/main/java/reliquary/client/particle/CauldronSteamParticleType.java index f6b7053a..2cdf8b0c 100644 --- a/src/main/java/reliquary/client/particle/CauldronSteamParticleType.java +++ b/src/main/java/reliquary/client/particle/CauldronSteamParticleType.java @@ -1,15 +1,24 @@ package reliquary.client.particle; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleType; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import reliquary.client.init.ModParticles; -public class CauldronSteamParticleType extends ParticleType { +public class CauldronSteamParticleType extends ParticleType { public CauldronSteamParticleType() { - super(false, SteamColorParticleData.DESERIALIZER); + super(false); } @Override - public Codec codec() { - return SteamColorParticleData.CODEC; + public MapCodec codec() { + return ColorParticleOption.codec(ModParticles.CAULDRON_STEAM.get()); + } + + @Override + public StreamCodec streamCodec() { + return ColorParticleOption.streamCodec(ModParticles.CAULDRON_STEAM.get()); } } diff --git a/src/main/java/reliquary/client/particle/ColorParticleData.java b/src/main/java/reliquary/client/particle/ColorParticleData.java deleted file mode 100644 index f5732be3..00000000 --- a/src/main/java/reliquary/client/particle/ColorParticleData.java +++ /dev/null @@ -1,69 +0,0 @@ -package reliquary.client.particle; - -import com.mojang.brigadier.StringReader; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.core.particles.ParticleOptions; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.registries.ForgeRegistries; - -import java.util.Locale; - -public abstract class ColorParticleData implements ParticleOptions { - private final float red; - private final float green; - private final float blue; - - protected ColorParticleData(float red, float green, float blue) { - this.red = red; - this.green = green; - this.blue = blue; - } - - @Override - public void writeToNetwork(FriendlyByteBuf packetBuffer) { - packetBuffer.writeFloat(red); - packetBuffer.writeFloat(green); - packetBuffer.writeFloat(blue); - } - - @Override - public String writeToString() { - return String.format(Locale.ROOT, "%s %.2f %.2f %.2f", ForgeRegistries.PARTICLE_TYPES.getKey(getType()), red, green, blue); - } - - public interface IColorParticleDataInitializer { - T initialize(float red, float green, float blue); - } - - public static class DeserializationHelper { - private DeserializationHelper() {} - - public static T deserialize(IColorParticleDataInitializer initializer, StringReader stringReader) - throws CommandSyntaxException { - stringReader.expect(' '); - float r = stringReader.readFloat(); - stringReader.expect(' '); - float g = stringReader.readFloat(); - stringReader.expect(' '); - float b = stringReader.readFloat(); - stringReader.expect(' '); - return initializer.initialize(r, g, b); - } - - public static T read(IColorParticleDataInitializer initializer, FriendlyByteBuf packetBuffer) { - return initializer.initialize(packetBuffer.readFloat(), packetBuffer.readFloat(), packetBuffer.readFloat()); - } - } - - public float getRed() { - return red; - } - - public float getGreen() { - return green; - } - - public float getBlue() { - return blue; - } -} diff --git a/src/main/java/reliquary/client/particle/SteamColorParticleData.java b/src/main/java/reliquary/client/particle/SteamColorParticleData.java deleted file mode 100644 index 5dc4123f..00000000 --- a/src/main/java/reliquary/client/particle/SteamColorParticleData.java +++ /dev/null @@ -1,39 +0,0 @@ -package reliquary.client.particle; - -import com.mojang.brigadier.StringReader; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.core.particles.ParticleType; -import net.minecraft.network.FriendlyByteBuf; -import reliquary.client.init.ModParticles; - -public class SteamColorParticleData extends ColorParticleData { - public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Codec.FLOAT.fieldOf("r").forGetter(ColorParticleData::getRed), - Codec.FLOAT.fieldOf("g").forGetter(ColorParticleData::getGreen), - Codec.FLOAT.fieldOf("b").forGetter(ColorParticleData::getBlue) - ).apply(instance, SteamColorParticleData::new)); - - public SteamColorParticleData(float red, float green, float blue) { - super(red, green, blue); - } - - @Override - public ParticleType getType() { - return ModParticles.CAULDRON_STEAM.get(); - } - - @SuppressWarnings("deprecation") - public static final Deserializer DESERIALIZER = new Deserializer<>() { - @Override - public SteamColorParticleData fromCommand(ParticleType particleTypeIn, StringReader reader) throws CommandSyntaxException { - return DeserializationHelper.deserialize(SteamColorParticleData::new, reader); - } - - @Override - public SteamColorParticleData fromNetwork(ParticleType particleTypeIn, FriendlyByteBuf buffer) { - return DeserializationHelper.read(SteamColorParticleData::new, buffer); - } - }; -} diff --git a/src/main/java/reliquary/client/render/ApothecaryMortarRenderer.java b/src/main/java/reliquary/client/render/ApothecaryMortarRenderer.java index 4657c522..c21c327a 100644 --- a/src/main/java/reliquary/client/render/ApothecaryMortarRenderer.java +++ b/src/main/java/reliquary/client/render/ApothecaryMortarRenderer.java @@ -14,42 +14,42 @@ public class ApothecaryMortarRenderer implements BlockEntityRenderer { @Override - public void render(ApothecaryMortarBlockEntity tile, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { + public void render(ApothecaryMortarBlockEntity tile, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { Direction direction = tile.getBlockState().getValue(ApothecaryMortarBlock.FACING); float horizontalRotation = direction == Direction.UP ? 0F : direction.get2DDataValue() * 90F; NonNullList mortarItems = tile.getItemStacks(); - matrixStack.pushPose(); - matrixStack.translate(0.5D, 0.3D, 0.5D); - matrixStack.mulPose(Axis.YN.rotationDegrees(horizontalRotation)); + poseStack.pushPose(); + poseStack.translate(0.5D, 0.3D, 0.5D); + poseStack.mulPose(Axis.YN.rotationDegrees(horizontalRotation)); - renderMortarItem(matrixStack, buffer, packedLight, () -> { - matrixStack.mulPose(Axis.ZP.rotationDegrees(40F)); - matrixStack.mulPose(Axis.YP.rotationDegrees(90F)); + renderMortarItem(poseStack, buffer, packedLight, () -> { + poseStack.mulPose(Axis.ZP.rotationDegrees(40F)); + poseStack.mulPose(Axis.YP.rotationDegrees(90F)); }, mortarItems.get(0), -0.09F, 0F, packedOverlay); - renderMortarItem(matrixStack, buffer, packedLight, () -> { - matrixStack.mulPose(Axis.XP.rotationDegrees(40F)); - matrixStack.mulPose(Axis.YP.rotationDegrees(180F)); + renderMortarItem(poseStack, buffer, packedLight, () -> { + poseStack.mulPose(Axis.XP.rotationDegrees(40F)); + poseStack.mulPose(Axis.YP.rotationDegrees(180F)); }, mortarItems.get(1), 0F, 0.09F, packedOverlay); - renderMortarItem(matrixStack, buffer, packedLight, () -> { - matrixStack.mulPose(Axis.ZN.rotationDegrees(40F)); - matrixStack.mulPose(Axis.YP.rotationDegrees(270F)); + renderMortarItem(poseStack, buffer, packedLight, () -> { + poseStack.mulPose(Axis.ZN.rotationDegrees(40F)); + poseStack.mulPose(Axis.YP.rotationDegrees(270F)); }, mortarItems.get(2), 0.09F, 0F, packedOverlay); - matrixStack.popPose(); + poseStack.popPose(); } - private void renderMortarItem(PoseStack matrixStack, MultiBufferSource buffer, int packedLight, Runnable processRotationTransforms, ItemStack itemToRender, float translateX, float translateZ, int packedOverlay) { + private void renderMortarItem(PoseStack poseStack, MultiBufferSource buffer, int packedLight, Runnable processRotationTransforms, ItemStack itemToRender, float translateX, float translateZ, int packedOverlay) { if (!itemToRender.isEmpty()) { - matrixStack.pushPose(); - matrixStack.translate(translateX, 0F, translateZ); + poseStack.pushPose(); + poseStack.translate(translateX, 0F, translateZ); processRotationTransforms.run(); - matrixStack.scale(0.60F, 0.60F, 0.60F); - Minecraft.getInstance().getItemRenderer().renderStatic(itemToRender, ItemDisplayContext.GROUND, packedLight, packedOverlay, matrixStack, buffer, null, 0); - matrixStack.popPose(); + poseStack.scale(0.60F, 0.60F, 0.60F); + Minecraft.getInstance().getItemRenderer().renderStatic(itemToRender, ItemDisplayContext.GROUND, packedLight, packedOverlay, poseStack, buffer, null, 0); + poseStack.popPose(); } } } diff --git a/src/main/java/reliquary/client/render/LyssaHookRenderer.java b/src/main/java/reliquary/client/render/LyssaHookRenderer.java deleted file mode 100644 index ef48ca13..00000000 --- a/src/main/java/reliquary/client/render/LyssaHookRenderer.java +++ /dev/null @@ -1,127 +0,0 @@ -package reliquary.client.render; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Axis; -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.OverlayTexture; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.HumanoidArm; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.phys.Vec3; -import org.joml.Matrix3f; -import org.joml.Matrix4f; -import reliquary.entities.LyssaHook; -import reliquary.init.ModItems; - -public class LyssaHookRenderer extends EntityRenderer { - private static final ResourceLocation FISH_PARTICLES = new ResourceLocation("textures/entity/fishing_hook.png"); - private static final RenderType ENTITY_CUTOUT = RenderType.entityCutout(FISH_PARTICLES); - - public LyssaHookRenderer(EntityRendererProvider.Context context) { - super(context); - } - - @Override - public void render(LyssaHook entity, float entityYaw, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight) { - entity.getFishingPlayerOptional().ifPresent(player -> { - matrixStack.pushPose(); - matrixStack.pushPose(); - matrixStack.scale(0.5F, 0.5F, 0.5F); - matrixStack.mulPose(entityRenderDispatcher.cameraOrientation()); - matrixStack.mulPose(Axis.YP.rotationDegrees(180.0F)); - PoseStack.Pose pose1 = matrixStack.last(); - Matrix4f matrix4f = pose1.pose(); - Matrix3f matrix3f = pose1.normal(); - VertexConsumer vertexconsumer = buffer.getBuffer(ENTITY_CUTOUT); - vertex(vertexconsumer, matrix4f, matrix3f, packedLight, 0.0F, 0, 0, 1); - vertex(vertexconsumer, matrix4f, matrix3f, packedLight, 1.0F, 0, 1, 1); - vertex(vertexconsumer, matrix4f, matrix3f, packedLight, 1.0F, 1, 1, 0); - vertex(vertexconsumer, matrix4f, matrix3f, packedLight, 0.0F, 1, 0, 0); - matrixStack.popPose(); - int i = player.getMainArm() == HumanoidArm.RIGHT ? 1 : -1; - ItemStack itemstack = player.getMainHandItem(); - if (!itemstack.is(ModItems.ROD_OF_LYSSA.get())) { - i = -i; - } - - float f = player.getAttackAnim(partialTicks); - float f1 = Mth.sin(Mth.sqrt(f) * (float) Math.PI); - float f2 = Mth.lerp(partialTicks, player.yBodyRotO, player.yBodyRot) * ((float) Math.PI / 180F); - double d0 = Mth.sin(f2); - double d1 = Mth.cos(f2); - double d2 = i * 0.35D; - double d4; - double d5; - double d6; - float f3; - if ((entityRenderDispatcher.options == null || entityRenderDispatcher.options.getCameraType().isFirstPerson()) && player == Minecraft.getInstance().player) { - double d7 = 960.0D / entityRenderDispatcher.options.fov().get(); - Vec3 vec3 = entityRenderDispatcher.camera.getNearPlane().getPointOnPlane(i * 0.525F, -0.1F); - vec3 = vec3.scale(d7); - vec3 = vec3.yRot(f1 * 0.5F); - vec3 = vec3.xRot(-f1 * 0.7F); - d4 = Mth.lerp(partialTicks, player.xo, player.getX()) + vec3.x; - d5 = Mth.lerp(partialTicks, player.yo, player.getY()) + vec3.y; - d6 = Mth.lerp(partialTicks, player.zo, player.getZ()) + vec3.z; - f3 = player.getEyeHeight(); - } else { - d4 = Mth.lerp(partialTicks, player.xo, player.getX()) - d1 * d2 - d0 * 0.8D; - d5 = player.yo + player.getEyeHeight() + (player.getY() - player.yo) * partialTicks - 0.45D; - d6 = Mth.lerp(partialTicks, player.zo, player.getZ()) - d0 * d2 + d1 * 0.8D; - f3 = player.isCrouching() ? -0.1875F : 0.0F; - } - - double d9 = Mth.lerp(partialTicks, entity.xo, entity.getX()); - double d10 = Mth.lerp(partialTicks, entity.yo, entity.getY()) + 0.25D; - double d8 = Mth.lerp(partialTicks, entity.zo, entity.getZ()); - float f4 = (float) (d4 - d9); - float f5 = (float) (d5 - d10) + f3; - float f6 = (float) (d6 - d8); - VertexConsumer vertexconsumer1 = buffer.getBuffer(RenderType.lineStrip()); - PoseStack.Pose pose2 = matrixStack.last(); - - for (int k = 0; k <= 16; ++k) { - stringVertex(f4, f5, f6, vertexconsumer1, pose2, sixteenthOf(k), sixteenthOf(k + 1)); - } - - matrixStack.popPose(); - super.render(entity, entityYaw, partialTicks, matrixStack, buffer, packedLight); - }); - } - - private static float sixteenthOf(int number) { - return (float) number / (float) 16; - } - - @SuppressWarnings("java:S107") - private static void vertex(VertexConsumer vertexConsumer, Matrix4f matrix4f, Matrix3f matrix3f, int packedLight, float x, int y, int u, int v) { - vertexConsumer.vertex(matrix4f, x - 0.5F, y - 0.5F, 0.0F).color(255, 255, 255, 255) - .uv(u, v).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(packedLight).normal(matrix3f, 0.0F, 1.0F, 0.0F) - .endVertex(); - } - - private static void stringVertex(float x, float y, float z, VertexConsumer vertexConsumer, PoseStack.Pose pose, float scale1, float scale2) { - float f = x * scale1; - float f1 = y * (scale1 * scale1 + scale1) * 0.5F + 0.25F; - float f2 = z * scale1; - float f3 = x * scale2 - f; - float f4 = y * (scale2 * scale2 + scale2) * 0.5F + 0.25F - f1; - float f5 = z * scale2 - f2; - float f6 = Mth.sqrt(f3 * f3 + f4 * f4 + f5 * f5); - f3 /= f6; - f4 /= f6; - f5 /= f6; - vertexConsumer.vertex(pose.pose(), f, f1, f2).color(0, 0, 0, 255).normal(pose.normal(), f3, f4, f5).endVertex(); - } - - @Override - public ResourceLocation getTextureLocation(LyssaHook entity) { - return FISH_PARTICLES; - } -} diff --git a/src/main/java/reliquary/client/render/PassivePedestalRenderer.java b/src/main/java/reliquary/client/render/PassivePedestalRenderer.java index 517258e7..4d948321 100644 --- a/src/main/java/reliquary/client/render/PassivePedestalRenderer.java +++ b/src/main/java/reliquary/client/render/PassivePedestalRenderer.java @@ -13,17 +13,17 @@ public class PassivePedestalRenderer implements BlockEntityRenderer { @Override - public void render(PassivePedestalBlockEntity te, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { + public void render(PassivePedestalBlockEntity te, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { if (!te.getItem().isEmpty()) { ItemStack stack = te.getItem(); - matrixStack.pushPose(); + poseStack.pushPose(); float yDiff = Mth.sin((System.currentTimeMillis() % 86400000) / 1000F) * 0.1F + 0.1F; - matrixStack.translate(0.5D, 0.9D + yDiff, 0.5D); + poseStack.translate(0.5D, 0.9D + yDiff, 0.5D); float f3 = ((System.currentTimeMillis() % 86400000) / 2000F) * (180F / (float) Math.PI); - matrixStack.mulPose(Axis.YP.rotationDegrees(f3)); - matrixStack.scale(0.75F, 0.75F, 0.75F); - Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, packedLight, OverlayTexture.NO_OVERLAY, matrixStack, buffer, null, 0); - matrixStack.popPose(); + poseStack.mulPose(Axis.YP.rotationDegrees(f3)); + poseStack.scale(0.75F, 0.75F, 0.75F); + Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, packedLight, OverlayTexture.NO_OVERLAY, poseStack, buffer, null, 0); + poseStack.popPose(); } } } diff --git a/src/main/java/reliquary/client/render/PedestalFishHookRenderer.java b/src/main/java/reliquary/client/render/PedestalFishHookRenderer.java index 39141733..8454b0f0 100644 --- a/src/main/java/reliquary/client/render/PedestalFishHookRenderer.java +++ b/src/main/java/reliquary/client/render/PedestalFishHookRenderer.java @@ -10,21 +10,19 @@ import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; -import org.joml.Matrix3f; -import org.joml.Matrix4f; import reliquary.api.client.IPedestalItemRenderer; import reliquary.blocks.tile.PedestalBlockEntity; public class PedestalFishHookRenderer implements IPedestalItemRenderer { - private static final ResourceLocation FISH_PARTICLES = new ResourceLocation("textures/entity/fishing_hook.png"); + private static final ResourceLocation FISH_PARTICLES = ResourceLocation.parse("textures/entity/fishing_hook.png"); private static final RenderType ENTITY_CUTOUT = RenderType.entityCutout(FISH_PARTICLES); @Override - public void doRender(PedestalBlockEntity te, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { - te.getItemData().ifPresent(itemData -> renderHook(te, matrixStack, buffer, packedLight, itemData)); + public void doRender(PedestalBlockEntity te, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { + te.getItemData().ifPresent(itemData -> renderHook(te, poseStack, buffer, packedLight, itemData)); } - private void renderHook(PedestalBlockEntity te, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, Object itemData) { + private void renderHook(PedestalBlockEntity te, PoseStack poseStack, MultiBufferSource buffer, int packedLight, Object itemData) { LocalPlayer player = Minecraft.getInstance().player; if (player == null || !(itemData instanceof HookRenderingData hookData)) { return; @@ -34,22 +32,20 @@ private void renderHook(PedestalBlockEntity te, PoseStack matrixStack, MultiBuff double translateY = hookData.hookY - te.getBlockPos().getY(); double translateZ = hookData.hookZ - te.getBlockPos().getZ(); - matrixStack.pushPose(); - matrixStack.translate(translateX, translateY, translateZ); - matrixStack.pushPose(); - matrixStack.scale(0.5F, 0.5F, 0.5F); - matrixStack.mulPose(Axis.YN.rotationDegrees(player.yHeadRot + 180F)); + poseStack.pushPose(); + poseStack.translate(translateX, translateY, translateZ); + poseStack.pushPose(); + poseStack.scale(0.5F, 0.5F, 0.5F); + poseStack.mulPose(Axis.YN.rotationDegrees(player.yHeadRot + 180F)); - PoseStack.Pose matrixStackEntry = matrixStack.last(); - Matrix4f matrix = matrixStackEntry.pose(); - Matrix3f normal = matrixStackEntry.normal(); + PoseStack.Pose pose = poseStack.last(); VertexConsumer vertexBuilder = buffer.getBuffer(ENTITY_CUTOUT); - addVertex(vertexBuilder, matrix, normal, packedLight, 0.0F, 0, 0, 1); - addVertex(vertexBuilder, matrix, normal, packedLight, 1.0F, 0, 1, 1); - addVertex(vertexBuilder, matrix, normal, packedLight, 1.0F, 1, 1, 0); - addVertex(vertexBuilder, matrix, normal, packedLight, 0.0F, 1, 0, 0); - matrixStack.popPose(); + addVertex(vertexBuilder, pose, packedLight, 0.0F, 0, 0, 1); + addVertex(vertexBuilder, pose, packedLight, 1.0F, 0, 1, 1); + addVertex(vertexBuilder, pose, packedLight, 1.0F, 1, 1, 0); + addVertex(vertexBuilder, pose, packedLight, 0.0F, 1, 0, 0); + poseStack.popPose(); double pedestalX = te.getBlockPos().getX() + 0.5D; double pedestalY = te.getBlockPos().getY() + 0.45D; @@ -64,25 +60,24 @@ private void renderHook(PedestalBlockEntity te, PoseStack matrixStack, MultiBuff float zDiff = (float) (pedestalZ - hookZ); VertexConsumer vertextConsumer2 = buffer.getBuffer(RenderType.lineStrip()); - PoseStack.Pose pose = matrixStack.last(); + pose = poseStack.last(); for (int k = 0; k < 16; ++k) { stringVertex(xDiff, yDiff, zDiff, vertextConsumer2, pose, (float) k / (float) 16, (float) (k + 1) / (float) 16); } - matrixStack.popPose(); + poseStack.popPose(); } @SuppressWarnings("java:S107") - private static void addVertex(VertexConsumer vertexBuilder, Matrix4f matrix, Matrix3f normal, int packedLight, float x, int y, int u, int v) { + private static void addVertex(VertexConsumer vertexBuilder, PoseStack.Pose pose, int packedLight, float x, int y, int u, int v) { vertexBuilder - .vertex(matrix, x - 0.5F, y - 0.5F, 0.0F) - .color(255, 255, 255, 255) - .uv(u, v) - .overlayCoords(OverlayTexture.NO_OVERLAY) - .uv2(packedLight) - .normal(normal, 0.0F, 1.0F, 0.0F) - .endVertex(); + .addVertex(pose, x - 0.5F, y - 0.5F, 0.0F) + .setColor(255, 255, 255, 255) + .setUv(u, v) + .setOverlay(OverlayTexture.NO_OVERLAY) + .setLight(packedLight) + .setNormal(pose, 0.0F, 1.0F, 0.0F); } private static void stringVertex(float xDiff, float yDiff, float zDiff, VertexConsumer vertexConsumer, PoseStack.Pose pose, float scale1, float scale2) { @@ -96,7 +91,7 @@ private static void stringVertex(float xDiff, float yDiff, float zDiff, VertexCo normalX /= f6; normalY /= f6; normalZ /= f6; - vertexConsumer.vertex(pose.pose(), x, y, z).color(0, 0, 0, 255).normal(pose.normal(), normalX, normalY, normalZ).endVertex(); + vertexConsumer.addVertex(pose.pose(), x, y, z).setColor(0, 0, 0, 255).setNormal(pose, normalX, normalY, normalZ); } public static class HookRenderingData { diff --git a/src/main/java/reliquary/client/render/PedestalRenderer.java b/src/main/java/reliquary/client/render/PedestalRenderer.java index a493c4c6..5ffa5e9e 100644 --- a/src/main/java/reliquary/client/render/PedestalRenderer.java +++ b/src/main/java/reliquary/client/render/PedestalRenderer.java @@ -6,26 +6,36 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.BlockPos; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.AABB; import reliquary.blocks.tile.PedestalBlockEntity; import reliquary.client.registry.PedestalClientRegistry; public class PedestalRenderer implements BlockEntityRenderer { @Override - public void render(PedestalBlockEntity te, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { + public void render(PedestalBlockEntity te, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay) { if (!te.getItem().isEmpty()) { ItemStack stack = te.getItem(); - matrixStack.pushPose(); + poseStack.pushPose(); float yDiff = Mth.sin((System.currentTimeMillis() % 86400000) / 1000F) * 0.1F + 0.1F; - matrixStack.translate(0.5D, 0.9D + yDiff, 0.5D); + poseStack.translate(0.5D, 0.9D + yDiff, 0.5D); float f3 = ((System.currentTimeMillis() % 86400000) / 2000F) * (180F / (float) Math.PI); - matrixStack.mulPose(Axis.YP.rotationDegrees(f3)); - matrixStack.scale(0.75F, 0.75F, 0.75F); - Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, packedLight, OverlayTexture.NO_OVERLAY, matrixStack, buffer, null, 0); - matrixStack.popPose(); - PedestalClientRegistry.getItemRenderer(stack).ifPresent(extraRenderer -> extraRenderer.doRender(te, partialTicks, matrixStack, buffer, packedLight, packedOverlay)); + poseStack.mulPose(Axis.YP.rotationDegrees(f3)); + poseStack.scale(0.75F, 0.75F, 0.75F); + Minecraft.getInstance().getItemRenderer().renderStatic(stack, ItemDisplayContext.GROUND, packedLight, OverlayTexture.NO_OVERLAY, poseStack, buffer, null, 0); + poseStack.popPose(); + PedestalClientRegistry.getItemRenderer(stack).ifPresent(extraRenderer -> extraRenderer.doRender(te, partialTicks, poseStack, buffer, packedLight, packedOverlay)); } } + + @Override + public AABB getRenderBoundingBox(PedestalBlockEntity blockEntity) { + BlockPos pos = blockEntity.getBlockPos(); + AABB aabb = new AABB(pos.getX() - 1, pos.getY(), pos.getZ() - 1, pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + blockEntity.executeOnActionItem(ai -> ai.getRenderBoundingBoxOuterPosition().ifPresent(aabb::expandTowards)); + return aabb; + } } diff --git a/src/main/java/reliquary/client/render/ShotRenderer.java b/src/main/java/reliquary/client/render/ShotRenderer.java index 3932d61e..653f7ec2 100644 --- a/src/main/java/reliquary/client/render/ShotRenderer.java +++ b/src/main/java/reliquary/client/render/ShotRenderer.java @@ -9,17 +9,12 @@ import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import org.joml.Matrix3f; -import org.joml.Matrix4f; -import reliquary.entities.shot.ShotEntityBase; +import reliquary.entities.shot.ShotBase; import java.util.HashMap; import java.util.Map; -@OnlyIn(Dist.CLIENT) -public class ShotRenderer extends EntityRenderer { +public class ShotRenderer extends EntityRenderer { private final Map, RenderType> entityCutOuts = new HashMap<>(); public ShotRenderer(EntityRendererProvider.Context context) { @@ -30,27 +25,25 @@ public ShotRenderer(EntityRendererProvider.Context context) { public void render(T entity, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight) { poseStack.pushPose(); poseStack.scale(0.1F, 0.1F, 0.1F); + poseStack.mulPose(this.entityRenderDispatcher.cameraOrientation()); PoseStack.Pose pose = poseStack.last(); - Matrix4f matrix = pose.pose(); - Matrix3f normal = pose.normal(); VertexConsumer vertexBuilder = buffer.getBuffer(getEntityCutOut(entity)); - addVertex(vertexBuilder, matrix, normal, packedLight, -0.5F, -0.25F, 0, 1); - addVertex(vertexBuilder, matrix, normal, packedLight, 0.5F, -0.25F, 1, 1); - addVertex(vertexBuilder, matrix, normal, packedLight, 0.5F, 0.75F, 1, 0); - addVertex(vertexBuilder, matrix, normal, packedLight, -0.5F, 0.75F, 0, 0); + addVertex(vertexBuilder, pose, packedLight, -0.5F, -0.25F, 0, 1); + addVertex(vertexBuilder, pose, packedLight, 0.5F, -0.25F, 1, 1); + addVertex(vertexBuilder, pose, packedLight, 0.5F, 0.75F, 1, 0); + addVertex(vertexBuilder, pose, packedLight, -0.5F, 0.75F, 0, 0); poseStack.popPose(); super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); } - private void addVertex(VertexConsumer vertexBuilder, Matrix4f matrix, Matrix3f normal, int packedLight, float x, float y, int u, int v) { - vertexBuilder.vertex(matrix, x, y, (float) 0.0) - .color(255, 255, 255, 255) - .uv(u, v) - .overlayCoords(OverlayTexture.NO_OVERLAY) - .uv2(packedLight) - .normal(normal, 0.0F, 1.0F, 0.0F) - .endVertex(); + private void addVertex(VertexConsumer vertexBuilder, PoseStack.Pose pose, int packedLight, float x, float y, int u, int v) { + vertexBuilder.addVertex(pose, x, y, (float) 0.0) + .setColor(255, 255, 255, 255) + .setUv(u, v) + .setOverlay(OverlayTexture.NO_OVERLAY) + .setLight(packedLight) + .setNormal(pose, 0.0F, 1.0F, 0.0F); } private RenderType getEntityCutOut(T entity) { diff --git a/src/main/java/reliquary/client/render/TippedArrowRenderer.java b/src/main/java/reliquary/client/render/TippedArrowRenderer.java new file mode 100644 index 00000000..b66e8cbc --- /dev/null +++ b/src/main/java/reliquary/client/render/TippedArrowRenderer.java @@ -0,0 +1,20 @@ +package reliquary.client.render; + +import net.minecraft.client.renderer.entity.ArrowRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; +import reliquary.entities.TippedArrow; + +public class TippedArrowRenderer extends ArrowRenderer { + private static final ResourceLocation RES_ARROW = ResourceLocation.parse("textures/entity/projectiles/arrow.png"); + private static final ResourceLocation RES_TIPPED_ARROW = ResourceLocation.parse("textures/entity/projectiles/tipped_arrow.png"); + + public TippedArrowRenderer(EntityRendererProvider.Context context) { + super(context); + } + + @Override + public ResourceLocation getTextureLocation(TippedArrow entity) { + return entity.getColor() > 0 ? RES_TIPPED_ARROW : RES_ARROW; + } +} diff --git a/src/main/java/reliquary/client/render/XRTippedArrowRenderer.java b/src/main/java/reliquary/client/render/XRTippedArrowRenderer.java deleted file mode 100644 index 2f740b5e..00000000 --- a/src/main/java/reliquary/client/render/XRTippedArrowRenderer.java +++ /dev/null @@ -1,20 +0,0 @@ -package reliquary.client.render; - -import net.minecraft.client.renderer.entity.ArrowRenderer; -import net.minecraft.client.renderer.entity.EntityRendererProvider; -import net.minecraft.resources.ResourceLocation; -import reliquary.entities.XRTippedArrowEntity; - -public class XRTippedArrowRenderer extends ArrowRenderer { - private static final ResourceLocation RES_ARROW = new ResourceLocation("textures/entity/projectiles/arrow.png"); - private static final ResourceLocation RES_TIPPED_ARROW = new ResourceLocation("textures/entity/projectiles/tipped_arrow.png"); - - public XRTippedArrowRenderer(EntityRendererProvider.Context context) { - super(context); - } - - @Override - public ResourceLocation getTextureLocation(XRTippedArrowEntity entity) { - return entity.getColor() > 0 ? RES_TIPPED_ARROW : RES_ARROW; - } -} diff --git a/src/main/java/reliquary/common/gui/MobCharmBeltMenu.java b/src/main/java/reliquary/common/gui/MobCharmBeltMenu.java index 4adcf74c..44f84451 100644 --- a/src/main/java/reliquary/common/gui/MobCharmBeltMenu.java +++ b/src/main/java/reliquary/common/gui/MobCharmBeltMenu.java @@ -69,7 +69,7 @@ public ItemStack quickMoveStack(Player playerIn, int index) { ItemStack copiedStack = ItemStack.EMPTY; Slot slot = slots.get(index); - if (slot != null && slot.hasItem()) { + if (slot.hasItem()) { ItemStack originalStack = slot.getItem(); copiedStack = originalStack.copy(); diff --git a/src/main/java/reliquary/common/gui/SlotMobCharm.java b/src/main/java/reliquary/common/gui/SlotMobCharm.java index 92ca45fb..a674ebc8 100644 --- a/src/main/java/reliquary/common/gui/SlotMobCharm.java +++ b/src/main/java/reliquary/common/gui/SlotMobCharm.java @@ -23,7 +23,7 @@ public ItemStack getItem() { } @Override - public void set( ItemStack stack) { + public void set(ItemStack stack) { ModItems.MOB_CHARM_BELT.get().putMobCharmInSlot(belt, getSlotIndex(), stack); } @@ -43,12 +43,7 @@ public ItemStack remove(int amount) { if(amount > 1) { return ItemStack.EMPTY; } - - ItemStack mobCharm = ModItems.MOB_CHARM_BELT.get().getMobCharmInSlot(belt, getSlotIndex()); - - ModItems.MOB_CHARM_BELT.get().removeMobCharmInSlot(belt, getSlotIndex()); - - return mobCharm; + return ModItems.MOB_CHARM_BELT.get().removeMobCharmInSlot(belt, getSlotIndex()); } @Override diff --git a/src/main/java/reliquary/compat/botania/BotaniaCompat.java b/src/main/java/reliquary/compat/botania/BotaniaCompat.java index 6f3ab9c9..f6693af6 100644 --- a/src/main/java/reliquary/compat/botania/BotaniaCompat.java +++ b/src/main/java/reliquary/compat/botania/BotaniaCompat.java @@ -1,6 +1,11 @@ package reliquary.compat.botania; +import net.neoforged.bus.api.IEventBus; + public class BotaniaCompat { + + public BotaniaCompat(IEventBus modBus) { + } public void setup() { //TODO readd when botania is ported //FortuneCoinItem.addFortuneCoinPickupChecker(itemEntity -> !BotaniaAPI.instance().hasSolegnoliaAround(itemEntity)); diff --git a/src/main/java/reliquary/compat/curios/CuriosBaubleItemWrapper.java b/src/main/java/reliquary/compat/curios/CuriosBaubleItemWrapper.java index 94c55c7b..7db46c2b 100644 --- a/src/main/java/reliquary/compat/curios/CuriosBaubleItemWrapper.java +++ b/src/main/java/reliquary/compat/curios/CuriosBaubleItemWrapper.java @@ -1,6 +1,5 @@ package reliquary.compat.curios; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import reliquary.items.util.ICuriosItem; import top.theillusivec4.curios.api.SlotContext; @@ -22,16 +21,16 @@ public ItemStack getStack() { @Override public void onEquip(SlotContext slotContext, ItemStack prevStack) { - curiosItem.onEquipped(slotContext.getIdentifier(), slotContext.getWearer()); + curiosItem.onEquipped(slotContext.identifier(), slotContext.entity()); } @Override - public void curioTick(String identifier, int index, LivingEntity livingEntity) { - CuriosCompat.getStackInSlot(livingEntity, identifier, index).ifPresent(stack -> curiosItem.onWornTick(stack, livingEntity)); + public void curioTick(SlotContext slotContext) { + CuriosCompat.getStackInSlot(slotContext.entity(), slotContext.identifier(), slotContext.index()).ifPresent(stack -> curiosItem.onWornTick(stack, slotContext.entity())); } @Override - public boolean canEquip(String identifier, LivingEntity livingEntity) { - return curiosItem.getCuriosType().getIdentifier().equals(identifier); + public boolean canEquip(SlotContext slotContext) { + return curiosItem.getCuriosType().getIdentifier().equals(slotContext.identifier()); } } diff --git a/src/main/java/reliquary/compat/curios/CuriosCharmInventoryHandler.java b/src/main/java/reliquary/compat/curios/CuriosCharmInventoryHandler.java index 2f821284..3eeac322 100644 --- a/src/main/java/reliquary/compat/curios/CuriosCharmInventoryHandler.java +++ b/src/main/java/reliquary/compat/curios/CuriosCharmInventoryHandler.java @@ -1,10 +1,10 @@ package reliquary.compat.curios; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import reliquary.init.ModItems; -import reliquary.items.MobCharmDefinition; import reliquary.items.MobCharmItem; import reliquary.items.util.ICuriosItem; import top.theillusivec4.curios.api.CuriosApi; @@ -13,9 +13,9 @@ public class CuriosCharmInventoryHandler extends MobCharmItem.CharmInventoryHandler { @Override - protected Set getCharmRegistryNames(Player player) { - Set ret = super.getCharmRegistryNames(player); - CuriosApi.getCuriosHelper().getCuriosHandler(player).resolve().flatMap(handler -> handler.getStacksHandler(ICuriosItem.Type.BELT.getIdentifier())).ifPresent(stackHandler -> { + protected Set getCharmRegistryNames(Player player) { + Set ret = super.getCharmRegistryNames(player); + CuriosApi.getCuriosInventory(player).flatMap(handler -> handler.getStacksHandler(ICuriosItem.Type.BELT.getIdentifier())).ifPresent(stackHandler -> { for (int slot = 0; slot < stackHandler.getSlots(); slot++) { ItemStack baubleStack = stackHandler.getStacks().getStackInSlot(slot); if (!baubleStack.isEmpty() && baubleStack.getItem() == ModItems.MOB_CHARM_BELT.get()) { @@ -27,11 +27,11 @@ protected Set getCharmRegistryNames(Player player) { } @Override - public boolean damagePlayersMobCharm(Player player, String entityRegistryName) { + public boolean damagePlayersMobCharm(ServerPlayer player, ResourceLocation entityRegistryName) { if (super.damagePlayersMobCharm(player, entityRegistryName)) { return true; } - return CuriosApi.getCuriosHelper().getCuriosHandler(player).map(handler -> handler.getStacksHandler(ICuriosItem.Type.BELT.getIdentifier()).map(stackHandler -> { + return CuriosApi.getCuriosInventory(player).map(handler -> handler.getStacksHandler(ICuriosItem.Type.BELT.getIdentifier()).map(stackHandler -> { for (int slot = 0; slot < stackHandler.getSlots(); slot++) { ItemStack baubleStack = stackHandler.getStacks().getStackInSlot(slot); @@ -39,7 +39,7 @@ public boolean damagePlayersMobCharm(Player player, String entityRegistryName) { continue; } - if (damageMobCharmInBelt((ServerPlayer) player, entityRegistryName, baubleStack)) { + if (damageMobCharmInBelt(player, entityRegistryName, baubleStack)) { return true; } } diff --git a/src/main/java/reliquary/compat/curios/CuriosCompat.java b/src/main/java/reliquary/compat/curios/CuriosCompat.java index f3ba24b8..b7c3118b 100644 --- a/src/main/java/reliquary/compat/curios/CuriosCompat.java +++ b/src/main/java/reliquary/compat/curios/CuriosCompat.java @@ -1,106 +1,73 @@ package reliquary.compat.curios; -import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.EntityRenderersEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.event.AttachCapabilitiesEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.fml.InterModComms; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.items.ItemStackHandler; -import reliquary.client.model.MobCharmBeltModel; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.fml.loading.FMLEnvironment; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; +import net.neoforged.neoforge.items.ItemStackHandler; import reliquary.init.ModItems; -import reliquary.items.util.ICuriosItem; import reliquary.reference.Compatibility; -import reliquary.reference.Reference; -import reliquary.util.InventoryHelper; -import reliquary.util.RegistryHelper; +import reliquary.util.PlayerInventoryProvider; import top.theillusivec4.curios.api.CuriosApi; import top.theillusivec4.curios.api.CuriosCapability; -import top.theillusivec4.curios.api.SlotTypeMessage; -import top.theillusivec4.curios.api.SlotTypePreset; -import top.theillusivec4.curios.api.client.CuriosRendererRegistry; import top.theillusivec4.curios.api.type.inventory.ICurioStacksHandler; import top.theillusivec4.curios.api.type.inventory.IDynamicStackHandler; import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.util.Optional; +import java.util.function.Function; public class CuriosCompat { private static final EmptyCuriosHandler EMPTY_HANDLER = new EmptyCuriosHandler(); - public CuriosCompat() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - modEventBus.addListener(this::sendImc); - modEventBus.addListener(this::setup); - IEventBus eventBus = MinecraftForge.EVENT_BUS; - eventBus.addGenericListener(ItemStack.class, this::onAttachCapabilities); - - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(this::registerLayerDefinitions)); + private void addPlayerInventoryHandlers() { + PlayerInventoryProvider.get().addPlayerInventoryHandler(Compatibility.ModIds.CURIOS, () -> CuriosApi.getSlots(false).keySet(), + (player, identifier) -> getFromCuriosSlotStackHandler(player, identifier, ICurioStacksHandler::getSlots, 0), + (player, identifier, slot) -> getFromCuriosSlotStackHandler(player, identifier, sh -> sh.getStacks().getStackInSlot(slot), ItemStack.EMPTY), + true); } - private void registerLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) { - event.registerLayerDefinition(MobCharmBeltRenderer.MOB_CHARM_BELT_LAYER, MobCharmBeltModel::createBodyLayer); - CuriosRendererRegistry.register(ModItems.MOB_CHARM_BELT.get(), MobCharmBeltRenderer::new); + public static T getFromCuriosSlotStackHandler(LivingEntity livingEntity, String identifier, Function getFromHandler, T defaultValue) { + return CuriosApi.getCuriosInventory(livingEntity) + .map(h -> h.getStacksHandler(identifier).map(getFromHandler).orElse(defaultValue)).orElse(defaultValue); } - private void sendImc(InterModEnqueueEvent evt) { - InterModComms.sendTo(Compatibility.ModIds.CURIOS, SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.NECKLACE.getMessageBuilder().build()); - InterModComms.sendTo(Compatibility.ModIds.CURIOS, SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.BODY.getMessageBuilder().build()); - InterModComms.sendTo(Compatibility.ModIds.CURIOS, SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.BELT.getMessageBuilder().build()); - } + public CuriosCompat(IEventBus modBus) { + modBus.addListener(this::setup); + modBus.addListener(this::onRegisterCapabilities); - public void onAttachCapabilities(AttachCapabilitiesEvent evt) { - ItemStack stack = evt.getObject(); - Item item = stack.getItem(); - if (isCuriosItem(item)) { - addCuriosCapability(evt, stack); + if (FMLEnvironment.dist.isClient()) { + CuriosCompatClient.registerLayerDefinitions(modBus); } - } - private boolean isCuriosItem(Item item) { - return RegistryHelper.getRegistryName(item).getNamespace().equals(Reference.MOD_ID) && item instanceof ICuriosItem; + addPlayerInventoryHandlers(); } - private void addCuriosCapability(AttachCapabilitiesEvent evt, ItemStack stack) { - //noinspection ConstantConditions - item.getRegistryName() isn't null at this point - that is checked in the other method - evt.addCapability(new ResourceLocation(Reference.MOD_ID, RegistryHelper.getRegistryName(stack.getItem()).getPath() + "_curios"), new ICapabilityProvider() { - @Nonnull - @Override - public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - return CuriosCapability.ITEM.orEmpty(cap, LazyOptional.of(() -> new CuriosBaubleItemWrapper(stack))); - } - }); + public void onRegisterCapabilities(RegisterCapabilitiesEvent evt) { + evt.registerItem( + CuriosCapability.ITEM, + (itemStack, unused) -> new CuriosBaubleItemWrapper(itemStack), + ModItems.FORTUNE_COIN.get(), ModItems.MOB_CHARM_BELT.get(), ModItems.TWILIGHT_CLOAK.get()); } @SuppressWarnings("unused") //event type parameter needed for addListener to know when to call this method private void setup(FMLCommonSetupEvent event) { - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> new CuriosFortuneCoinToggler().registerSelf()); + if (FMLEnvironment.dist.isClient()) { + CuriosCompatClient.registerFortuneCoinToggler(); + } ModItems.MOB_CHARM.get().setCharmInventoryHandler(new CuriosCharmInventoryHandler()); - InventoryHelper.addBaublesItemHandlerFactory((player, type) -> (CuriosApi.getCuriosHelper().getCuriosHandler(player) - .map(handler -> handler.getStacksHandler(type.getIdentifier()).map(ICurioStacksHandler::getStacks).orElse(EMPTY_HANDLER)).orElse(EMPTY_HANDLER))); } public static Optional getStackInSlot(LivingEntity entity, String slotName, int slot) { - return CuriosApi.getCuriosHelper().getCuriosHandler(entity).map(handler -> handler.getStacksHandler(slotName) - .map(sh -> sh.getStacks().getStackInSlot(slot))).orElse(Optional.empty()); + return CuriosApi.getCuriosInventory(entity).flatMap(handler -> handler.getStacksHandler(slotName) + .map(sh -> sh.getStacks().getStackInSlot(slot))); } public static void setStackInSlot(LivingEntity entity, String slotName, int slot, ItemStack stack) { - CuriosApi.getCuriosHelper().getCuriosHandler(entity).ifPresent(handler -> handler.getStacksHandler(slotName).ifPresent(sh -> sh.getStacks().setStackInSlot(slot, stack))); + CuriosApi.getCuriosInventory(entity).flatMap(handler -> handler.getStacksHandler(slotName)).ifPresent(sh -> sh.getStacks().setStackInSlot(slot, stack)); } private static class EmptyCuriosHandler extends ItemStackHandler implements IDynamicStackHandler { diff --git a/src/main/java/reliquary/compat/curios/CuriosCompatClient.java b/src/main/java/reliquary/compat/curios/CuriosCompatClient.java new file mode 100644 index 00000000..b52ca8e2 --- /dev/null +++ b/src/main/java/reliquary/compat/curios/CuriosCompatClient.java @@ -0,0 +1,20 @@ +package reliquary.compat.curios; + +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.client.event.EntityRenderersEvent; +import reliquary.client.model.MobCharmBeltModel; +import reliquary.init.ModItems; +import top.theillusivec4.curios.api.client.CuriosRendererRegistry; + +public class CuriosCompatClient { + public static void registerLayerDefinitions(IEventBus modEventBus) { + modEventBus.addListener(EntityRenderersEvent.RegisterLayerDefinitions.class, event -> { + event.registerLayerDefinition(MobCharmBeltRenderer.MOB_CHARM_BELT_LAYER, MobCharmBeltModel::createBodyLayer); + CuriosRendererRegistry.register(ModItems.MOB_CHARM_BELT.get(), MobCharmBeltRenderer::new); + }); + } + + public static void registerFortuneCoinToggler() { + new CuriosFortuneCoinToggler().registerSelf(); + } +} diff --git a/src/main/java/reliquary/compat/curios/CuriosFortuneCoinToggler.java b/src/main/java/reliquary/compat/curios/CuriosFortuneCoinToggler.java index 883a422f..ffaba0c8 100644 --- a/src/main/java/reliquary/compat/curios/CuriosFortuneCoinToggler.java +++ b/src/main/java/reliquary/compat/curios/CuriosFortuneCoinToggler.java @@ -2,24 +2,21 @@ import net.minecraft.client.Minecraft; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.neoforge.network.PacketDistributor; import reliquary.init.ModItems; import reliquary.items.FortuneCoinToggler; -import reliquary.network.PacketFortuneCoinTogglePressed; -import reliquary.network.PacketHandler; +import reliquary.network.FortuneCoinTogglePressedPayload; import top.theillusivec4.curios.api.CuriosApi; import java.util.concurrent.atomic.AtomicBoolean; -@OnlyIn(Dist.CLIENT) class CuriosFortuneCoinToggler extends FortuneCoinToggler { @Override public boolean findAndToggle() { if (super.findAndToggle()) { return true; } - return CuriosApi.getCuriosHelper().getCuriosHandler(Minecraft.getInstance().player).map(handler -> { + return CuriosApi.getCuriosInventory(Minecraft.getInstance().player).map(handler -> { AtomicBoolean result = new AtomicBoolean(false); handler.getCurios().forEach((identifier, stackHandler) -> { for (int slot = 0; slot < stackHandler.getSlots(); slot++) { @@ -28,7 +25,7 @@ public boolean findAndToggle() { if (baubleStack.getItem() == ModItems.FORTUNE_COIN.get()) { ModItems.FORTUNE_COIN.get().toggle(baubleStack); stackHandler.getStacks().setStackInSlot(slot, baubleStack); - PacketHandler.sendToServer(new PacketFortuneCoinTogglePressed(PacketFortuneCoinTogglePressed.InventoryType.CURIOS, identifier, slot)); + PacketDistributor.sendToServer(new FortuneCoinTogglePressedPayload(FortuneCoinTogglePressedPayload.InventoryType.CURIOS, slot, identifier)); result.set(true); return; } diff --git a/src/main/java/reliquary/compat/curios/MobCharmBeltRenderer.java b/src/main/java/reliquary/compat/curios/MobCharmBeltRenderer.java index 96ac8178..0e29131b 100644 --- a/src/main/java/reliquary/compat/curios/MobCharmBeltRenderer.java +++ b/src/main/java/reliquary/compat/curios/MobCharmBeltRenderer.java @@ -16,13 +16,13 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import reliquary.reference.Reference; +import reliquary.Reliquary; import top.theillusivec4.curios.api.SlotContext; import top.theillusivec4.curios.api.client.ICurioRenderer; public class MobCharmBeltRenderer implements ICurioRenderer { - public static final ModelLayerLocation MOB_CHARM_BELT_LAYER = new ModelLayerLocation(new ResourceLocation(Reference.MOD_ID, "mob_charm_belt"), "main"); - private static final ResourceLocation ON_BODY_TEXTURE = new ResourceLocation(Reference.MOD_ID, "textures/models/armor/mob_charm_belt.png"); + public static final ModelLayerLocation MOB_CHARM_BELT_LAYER = new ModelLayerLocation(Reliquary.getRL("mob_charm_belt"), "main"); + private static final ResourceLocation ON_BODY_TEXTURE = Reliquary.getRL("textures/models/armor/mob_charm_belt.png"); private final HumanoidModel model; public MobCharmBeltRenderer() { @@ -31,14 +31,14 @@ public MobCharmBeltRenderer() { } @Override - public > void render(ItemStack stack, SlotContext slotContext, PoseStack matrixStack, RenderLayerParent renderLayerParent, MultiBufferSource buffer, int light, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { + public > void render(ItemStack stack, SlotContext slotContext, PoseStack poseStack, RenderLayerParent renderLayerParent, MultiBufferSource buffer, int light, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { if (!stack.isEmpty()) { model.crouching = slotContext.entity().isCrouching(); if (slotContext.entity() instanceof Player player) { model.setupAnim(player, limbSwing,limbSwingAmount, ageInTicks, netHeadYaw, headPitch); } VertexConsumer vertexBuilder = ItemRenderer.getFoilBuffer(buffer, RenderType.entityCutoutNoCull(ON_BODY_TEXTURE), false, false); - model.body.render(matrixStack, vertexBuilder, light, OverlayTexture.NO_OVERLAY); + model.body.render(poseStack, vertexBuilder, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/src/main/java/reliquary/compat/jade/provider/CachedBodyDataProvider.java b/src/main/java/reliquary/compat/jade/provider/CachedBodyDataProvider.java index 56d4b5e1..70b1a39a 100644 --- a/src/main/java/reliquary/compat/jade/provider/CachedBodyDataProvider.java +++ b/src/main/java/reliquary/compat/jade/provider/CachedBodyDataProvider.java @@ -3,7 +3,7 @@ import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; -import reliquary.reference.Settings; +import reliquary.reference.Config; import snownee.jade.api.BlockAccessor; import snownee.jade.api.IBlockComponentProvider; import snownee.jade.api.ITooltip; @@ -20,7 +20,7 @@ public abstract class CachedBodyDataProvider implements IBlockComponentProvider @Override public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfig pluginConfig) { - if (Boolean.TRUE.equals(Settings.CLIENT.wailaShiftForInfo.get()) && !accessor.getPlayer().isCrouching()) { + if (Boolean.TRUE.equals(Config.CLIENT.wailaShiftForInfo.get()) && !accessor.getPlayer().isCrouching()) { tooltip.add(Component.translatable("waila.reliquary.shift_for_more").withStyle(ChatFormatting.ITALIC)); return; } @@ -28,11 +28,11 @@ public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfi IJadeDataChangeIndicator changeIndicator = (IJadeDataChangeIndicator) accessor.getBlockEntity(); if (changeIndicator == null || cachedBody == null || cachedPosition == null || !cachedPosition.equals(accessor.getPosition()) || changeIndicator.getDataChanged()) { - cachedBody = getWailaBodyToCache(tooltip.getElementHelper(), accessor, pluginConfig); + cachedBody = getWailaBodyToCache(IElementHelper.get(), accessor, pluginConfig); cachedPosition = accessor.getPosition(); } - cachedBody = updateCache(tooltip.getElementHelper(), accessor, cachedBody); + cachedBody = updateCache(IElementHelper.get(), accessor, cachedBody); for (List line : cachedBody) { tooltip.add(line); diff --git a/src/main/java/reliquary/compat/jade/provider/DataProviderAltar.java b/src/main/java/reliquary/compat/jade/provider/DataProviderAltar.java index f1f9f2d8..ac70f4e8 100644 --- a/src/main/java/reliquary/compat/jade/provider/DataProviderAltar.java +++ b/src/main/java/reliquary/compat/jade/provider/DataProviderAltar.java @@ -7,10 +7,10 @@ import net.minecraft.world.item.Items; import net.minecraft.world.phys.Vec2; import org.jetbrains.annotations.Nullable; +import reliquary.Reliquary; import reliquary.blocks.AlkahestryAltarBlock; import reliquary.blocks.tile.AlkahestryAltarBlockEntity; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import reliquary.reference.Config; import snownee.jade.api.BlockAccessor; import snownee.jade.api.IBlockComponentProvider; import snownee.jade.api.IServerDataProvider; @@ -24,7 +24,7 @@ public class DataProviderAltar implements IBlockComponentProvider, IServerDataProvider { - private static final ResourceLocation ALTAR_UID = new ResourceLocation(Reference.MOD_ID, "altar"); + private static final ResourceLocation ALTAR_UID = Reliquary.getRL("altar"); @Override public @Nullable IElement getIcon(BlockAccessor accessor, IPluginConfig config, IElement currentIcon) { @@ -33,7 +33,7 @@ public class DataProviderAltar implements IBlockComponentProvider, IServerDataPr @Override public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfig pluginConfig) { - if (Boolean.TRUE.equals(Settings.CLIENT.wailaShiftForInfo.get()) && !accessor.getPlayer().isCrouching()) { + if (Boolean.TRUE.equals(Config.CLIENT.wailaShiftForInfo.get()) && !accessor.getPlayer().isCrouching()) { tooltip.add(Component.translatable("waila.reliquary.shift_for_more").withStyle(ChatFormatting.ITALIC)); return; } @@ -42,13 +42,13 @@ public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfi return; } - IElementHelper helper = tooltip.getElementHelper(); + IElementHelper helper = IElementHelper.get(); if (!altar.isActive()) { tooltip.add(Component.translatable("waila.reliquary.altar.inactive").withStyle(ChatFormatting.RED)); Vec2 delta = new Vec2(0, -4); IElement redstoneIcon = helper.item(Items.REDSTONE.getDefaultInstance(), JadeHelper.ITEM_ICON_SCALE); - IElement requirementText = helper.text(Component.literal(String.format("%d / %d", altar.getRedstoneCount(), Settings.COMMON.blocks.altar.redstoneCost.get()))); + IElement requirementText = helper.text(Component.literal(String.format("%d / %d", altar.getRedstoneCount(), Config.COMMON.blocks.altar.redstoneCost.get()))); redstoneIcon.size(redstoneIcon.getSize().add(delta)).translate(delta); requirementText.size(requirementText.getSize().add(delta)).translate(delta.add(new Vec2(0, (redstoneIcon.getSize().y - requirementText.getSize().y) / 2))); diff --git a/src/main/java/reliquary/compat/jade/provider/DataProviderCauldron.java b/src/main/java/reliquary/compat/jade/provider/DataProviderCauldron.java index 2e13154c..0b78e48e 100644 --- a/src/main/java/reliquary/compat/jade/provider/DataProviderCauldron.java +++ b/src/main/java/reliquary/compat/jade/provider/DataProviderCauldron.java @@ -3,26 +3,25 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.material.Fluids; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidType; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidType; +import reliquary.Reliquary; import reliquary.blocks.ApothecaryCauldronBlock; import reliquary.blocks.tile.ApothecaryCauldronBlockEntity; -import reliquary.reference.Reference; import reliquary.util.TooltipBuilder; +import reliquary.util.potions.PotionHelper; import snownee.jade.api.BlockAccessor; import snownee.jade.api.config.IPluginConfig; import snownee.jade.api.fluid.JadeFluidObject; -import snownee.jade.api.ui.BoxStyle; -import snownee.jade.api.ui.IDisplayHelper; -import snownee.jade.api.ui.IElement; -import snownee.jade.api.ui.IElementHelper; -import snownee.jade.api.ui.IProgressStyle; +import snownee.jade.api.ui.*; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; public class DataProviderCauldron extends CachedBodyDataProvider { @Override @@ -34,7 +33,7 @@ public List> getWailaBodyToCache(IElementHelper helper, BlockAcce return List.of(); } - if (cauldron.getEffects().isEmpty()) { + if (!cauldron.getPotionContents().hasEffects()) { return List.of(); } @@ -79,16 +78,19 @@ public List> getWailaBodyToCache(IElementHelper helper, BlockAcce lines.add(createTank(helper, fluidPlaceHolder, FluidType.BUCKET_VOLUME, potionType)); List components = new ArrayList<>(); - TooltipBuilder.of(components).potionEffects(cauldron.getEffects()); - lines.add(components.stream().map(helper::text).toList()); + TooltipBuilder.of(components, Item.TooltipContext.of(cauldron.getLevel())).potionEffects(PotionHelper.augmentPotionContents(cauldron.getPotionContents(), cauldron.getRedstoneCount(), cauldron.getGlowstoneCount())); + + lines.add(components.stream().map(helper::text).collect(Collectors.toList())); return lines; } public static List createTank(IElementHelper helper, FluidStack fluidStack, int capacity, Component displayName) { if (displayName == FormattedText.EMPTY) { - displayName = fluidStack.getDisplayName(); + displayName = fluidStack.getHoverName(); + } + if (capacity <= 0) { + return List.of(); } - if (capacity <= 0) {return List.of();} Component text; if (fluidStack.isEmpty()) { text = Component.translatable("jade.fluid.empty"); @@ -96,15 +98,15 @@ public static List createTank(IElementHelper helper, FluidStack fluidS String amountText = IDisplayHelper.get().humanReadableNumber(fluidStack.getAmount(), "B", true); text = Component.translatable("jade.fluid", displayName, amountText); } - IProgressStyle progressStyle = helper.progressStyle(); + ProgressStyle progressStyle = helper.progressStyle(); progressStyle.overlay(helper.fluid(JadeFluidObject.of(fluidStack.getFluid()))); - IElement tank = helper.progress((float) fluidStack.getAmount() / capacity, text, progressStyle, BoxStyle.DEFAULT, false); + IElement tank = helper.progress((float) fluidStack.getAmount() / capacity, text, progressStyle, BoxStyle.getNestedBox(), false); return List.of(tank); } @Override public ResourceLocation getUid() { - return new ResourceLocation(Reference.MOD_ID, "cauldron"); + return Reliquary.getRL("cauldron"); } } diff --git a/src/main/java/reliquary/compat/jade/provider/DataProviderMortar.java b/src/main/java/reliquary/compat/jade/provider/DataProviderMortar.java index a071779e..7f944dc2 100644 --- a/src/main/java/reliquary/compat/jade/provider/DataProviderMortar.java +++ b/src/main/java/reliquary/compat/jade/provider/DataProviderMortar.java @@ -4,28 +4,28 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.alchemy.PotionContents; +import reliquary.Reliquary; import reliquary.blocks.ApothecaryMortarBlock; import reliquary.blocks.tile.ApothecaryMortarBlockEntity; import reliquary.init.ModItems; -import reliquary.reference.Reference; import reliquary.util.TooltipBuilder; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionIngredient; -import reliquary.util.potions.XRPotionHelper; import snownee.jade.api.BlockAccessor; import snownee.jade.api.IServerDataProvider; import snownee.jade.api.config.IPluginConfig; import snownee.jade.api.ui.IElement; import snownee.jade.api.ui.IElementHelper; -import snownee.jade.impl.ui.ProgressArrowElement; import java.util.ArrayList; import java.util.List; public class DataProviderMortar extends CachedBodyDataProvider implements IServerDataProvider { private static final String PESTLE_USED_COUNTER = "pestleUsedCounter"; - private List effects; + private PotionContents potionContents; @Override public List> getWailaBodyToCache(IElementHelper helper, BlockAccessor accessor, IPluginConfig config) { @@ -43,29 +43,29 @@ public List> getWailaBodyToCache(IElementHelper helper, BlockAcce continue; } ingredients.add(helper.item(ingredientStack)); - XRPotionHelper.getIngredient(ingredientStack).ifPresent(potionIngredients::add); + PotionHelper.getIngredient(ingredientStack).ifPresent(potionIngredients::add); } lines.add(ingredients); - effects = XRPotionHelper.combineIngredients(potionIngredients); + potionContents = PotionHelper.combineIngredients(potionIngredients); List effectTooltips = new ArrayList<>(); - if (!effects.isEmpty()) { + if (potionContents.hasEffects()) { int pestleUsedCounter = accessor.getServerData().getInt(PESTLE_USED_COUNTER); lines.add(createPestleProgress(helper, pestleUsedCounter)); - TooltipBuilder.of(effectTooltips).potionEffects(effects); - lines.addAll(effectTooltips.stream().map(text -> List.of(helper.text(text))).toList()); + TooltipBuilder.of(effectTooltips, Item.TooltipContext.of(mortar.getLevel())).potionEffects(potionContents); + lines.addAll(effectTooltips.stream().map(text -> List.of(helper.text(text))).toList()); } return lines; } public List createPestleProgress(IElementHelper helper, int pestleUsedCounter) { ItemStack stack = ModItems.POTION_ESSENCE.get().getDefaultInstance(); - XRPotionHelper.addPotionEffectsToStack(stack, effects); + PotionHelper.addPotionContentsToStack(stack, potionContents); return List.of( - new ProgressArrowElement((float) pestleUsedCounter / ApothecaryMortarBlockEntity.PESTLE_USAGE_MAX), + helper.progress((float) pestleUsedCounter / ApothecaryMortarBlockEntity.PESTLE_USAGE_MAX), helper.item(stack) ); } @@ -87,6 +87,6 @@ public void appendServerData(CompoundTag compoundTag, BlockAccessor blockAccesso @Override public ResourceLocation getUid() { - return new ResourceLocation(Reference.MOD_ID, "mortar"); + return Reliquary.getRL("mortar"); } } \ No newline at end of file diff --git a/src/main/java/reliquary/compat/jade/provider/DataProviderPedestal.java b/src/main/java/reliquary/compat/jade/provider/DataProviderPedestal.java index 29ac8944..51025f01 100644 --- a/src/main/java/reliquary/compat/jade/provider/DataProviderPedestal.java +++ b/src/main/java/reliquary/compat/jade/provider/DataProviderPedestal.java @@ -5,9 +5,9 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.state.BlockState; +import reliquary.Reliquary; import reliquary.blocks.PedestalBlock; import reliquary.blocks.tile.PedestalBlockEntity; -import reliquary.reference.Reference; import snownee.jade.api.BlockAccessor; import snownee.jade.api.IBlockComponentProvider; import snownee.jade.api.ITooltip; @@ -15,7 +15,7 @@ public class DataProviderPedestal implements IBlockComponentProvider { - private static final ResourceLocation PEDESTAL_UID = new ResourceLocation(Reference.MOD_ID, "pedestal"); + private static final ResourceLocation PEDESTAL_UID = Reliquary.getRL("pedestal"); @Override public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfig pluginConfig) { diff --git a/src/main/java/reliquary/compat/jei/ComponentSubtypeInterpreter.java b/src/main/java/reliquary/compat/jei/ComponentSubtypeInterpreter.java new file mode 100644 index 00000000..7b1be52c --- /dev/null +++ b/src/main/java/reliquary/compat/jei/ComponentSubtypeInterpreter.java @@ -0,0 +1,58 @@ +package reliquary.compat.jei; + +import mezz.jei.api.ingredients.subtypes.ISubtypeInterpreter; +import mezz.jei.api.ingredients.subtypes.UidContext; +import net.minecraft.core.component.DataComponentPatch; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.nbt.StringTag; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +import java.util.*; +import java.util.regex.Pattern; + +class ComponentSubtypeInterpreter implements ISubtypeInterpreter { + private final Set> componentsToConsider; + + ComponentSubtypeInterpreter(DataComponentType... componentsToConsider) { + this.componentsToConsider = new HashSet<>(Arrays.asList(componentsToConsider)); + } + + @Override + public String getLegacyStringSubtypeInfo(ItemStack itemStack, UidContext context) { + DataComponentPatch componentsPatch = itemStack.getComponentsPatch(); + return componentsPatch.isEmpty() ? "" : getComponentsString(componentsPatch); + } + + private static final Pattern SIMPLE_VALUE = Pattern.compile("[A-Za-z0-9._+-]+"); + + private String handleEscape(String keyName) { + return SIMPLE_VALUE.matcher(keyName).matches() ? keyName : StringTag.quoteAndEscape(keyName); + } + + private String getComponentsString(DataComponentPatch componentsPatch) { + StringBuilder stringbuilder = new StringBuilder("{"); + componentsPatch.entrySet().stream() + .filter(entry -> componentsToConsider.contains(entry.getKey())) + .forEach(entry -> { + if (stringbuilder.length() != 1) { + stringbuilder.append(','); + } + stringbuilder.append(handleEscape(entry.getKey().toString())).append(':').append(entry.getValue().toString()); + }); + return stringbuilder.append('}').toString(); + } + + @Override + public @Nullable Object getSubtypeData(ItemStack ingredient, UidContext context) { + boolean allNulls = true; + List<@Nullable Object> results = new ArrayList<>(componentsToConsider.size()); + for (Map.Entry, Optional> entry : ingredient.getComponentsPatch().entrySet()) { + if (componentsToConsider.contains(entry.getKey())) { + allNulls = false; + results.add(entry.getValue()); + } + } + return allNulls ? null : results; + } +} diff --git a/src/main/java/reliquary/compat/jei/ItemDescriptionBuilder.java b/src/main/java/reliquary/compat/jei/ItemDescriptionBuilder.java index 7b5a3444..f9f5cbd9 100644 --- a/src/main/java/reliquary/compat/jei/ItemDescriptionBuilder.java +++ b/src/main/java/reliquary/compat/jei/ItemDescriptionBuilder.java @@ -3,20 +3,20 @@ import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.registration.IRecipeRegistration; import net.minecraft.core.NonNullList; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.registries.ForgeRegistries; +import reliquary.Reliquary; import reliquary.init.ModBlocks; import reliquary.init.ModItems; import reliquary.items.ICreativeTabItemGenerator; import reliquary.items.MobCharmFragmentItem; import reliquary.items.MobCharmItem; -import reliquary.reference.Reference; import reliquary.util.RegistryHelper; -import reliquary.util.potions.XRPotionHelper; import java.util.List; import java.util.function.Function; @@ -154,7 +154,7 @@ private static void addStacksIngredientInfo(IRecipeRegistration registration, Li private static Component[] getTranslationKeys(String... langKeys) { Component[] components = new Component[langKeys.length]; for (int i = 0; i < langKeys.length; i++) { - components[i] = Component.translatable(String.format("jei.%s.description.%s", Reference.MOD_ID, langKeys[i].replace('/', '.'))); + components[i] = Component.translatable(String.format("jei.%s.description.%s", Reliquary.MOD_ID, langKeys[i].replace('/', '.'))); } return components; @@ -162,7 +162,7 @@ private static Component[] getTranslationKeys(String... langKeys) { private static void registerCharmFragmentItemsDescription(IRecipeRegistration registration) { MobCharmFragmentItem item = ModItems.MOB_CHARM_FRAGMENT.get(); - registerCharmBasedItems(registration, item, MobCharmFragmentItem::getEntityEggRegistryName); + registerCharmBasedItems(registration, item, MobCharmFragmentItem::getEntityRegistryName); } private static void registerCharmItemsDescription(IRecipeRegistration registration) { @@ -174,12 +174,9 @@ private static void registerCharmBa NonNullList subItems = NonNullList.create(); item.addCreativeTabItems(subItems::add); for (ItemStack subItem : subItems) { - EntityType entityType = ForgeRegistries.ENTITY_TYPES.getValue(getEntityRegistryName.apply(subItem)); - if (entityType == null) { - continue; - } + EntityType entityType = BuiltInRegistries.ENTITY_TYPE.get(getEntityRegistryName.apply(subItem)); String path = RegistryHelper.getRegistryName(item).getPath(); - String itemDescriptionKey = String.format("jei.%s.description.%s", Reference.MOD_ID, path.replace('/', '.')); + String itemDescriptionKey = String.format("jei.%s.description.%s", Reliquary.MOD_ID, path.replace('/', '.')); String entityName = entityType.getDescription().getString(); registration.addIngredientInfo(subItem, VanillaTypes.ITEM_STACK, Component.translatable(itemDescriptionKey, entityName, entityName)); } @@ -190,7 +187,7 @@ private static void registerPotionA NonNullList potionItems = NonNullList.create(); item.addCreativeTabItems(subItems::add); for (ItemStack subItem : subItems) { - if (!XRPotionHelper.getPotionEffectsFromStack(subItem).isEmpty()) { + if (subItem.has(DataComponents.POTION_CONTENTS)) { potionItems.add(subItem); } } @@ -202,7 +199,7 @@ private static void registerPotionA NonNullList nonPotionItems = NonNullList.create(); item.addCreativeTabItems(subItems::add); for (ItemStack subItem : subItems) { - if (XRPotionHelper.getPotionEffectsFromStack(subItem).isEmpty()) { + if (!subItem.has(DataComponents.POTION_CONTENTS)) { nonPotionItems.add(subItem); } } diff --git a/src/main/java/reliquary/compat/jei/MobCharmRecipeMaker.java b/src/main/java/reliquary/compat/jei/MobCharmRecipeMaker.java index d969ebea..909fa073 100644 --- a/src/main/java/reliquary/compat/jei/MobCharmRecipeMaker.java +++ b/src/main/java/reliquary/compat/jei/MobCharmRecipeMaker.java @@ -3,33 +3,31 @@ import net.minecraft.core.NonNullList; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.ShapedRecipe; +import net.minecraft.world.item.crafting.*; +import reliquary.Reliquary; import reliquary.crafting.MobCharmRecipe; import reliquary.init.ModItems; import reliquary.items.MobCharmFragmentItem; import reliquary.items.MobCharmRegistry; -import reliquary.reference.Reference; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Optional; public class MobCharmRecipeMaker { private MobCharmRecipeMaker() { } - public static List getRecipes() { - List recipes = new ArrayList<>(); + public static List> getRecipes() { + List> recipes = new ArrayList<>(); MobCharmRecipe.REGISTERED_RECIPES.forEach(baseRecipe -> addMobCharmRecipes(recipes, baseRecipe)); return recipes; } - private static void addMobCharmRecipes(List recipes, MobCharmRecipe baseRecipe) { + private static void addMobCharmRecipes(List> recipes, MobCharmRecipe baseRecipe) { - for (String regName : MobCharmRegistry.getRegisteredNames()) { + for (ResourceLocation regName : MobCharmRegistry.getRegisteredNames()) { NonNullList inputs = NonNullList.create(); baseRecipe.getIngredients().forEach(i -> { if (Arrays.stream(i.getItems()).anyMatch(stack -> stack.getItem() instanceof MobCharmFragmentItem)) { @@ -50,8 +48,9 @@ private static void addMobCharmRecipes(List recipes, MobCharmRec }); ItemStack output = ModItems.MOB_CHARM.get().getStackFor(regName); - ResourceLocation id = new ResourceLocation(Reference.MOD_ID, "mob_charm_" + regName.replace(':', '_')); - recipes.add(new ShapedRecipe(id, "reliquary.mob_charm", CraftingBookCategory.MISC, 3, 3, inputs, output)); + ShapedRecipePattern pattern = new ShapedRecipePattern(3, 3, inputs, Optional.empty()); + ResourceLocation id = Reliquary.getRL("mob_charm_" + regName.toString().replace(':', '_')); + recipes.add(new RecipeHolder<>(id, new ShapedRecipe("reliquary.mob_charm", CraftingBookCategory.MISC, pattern, output))); } } } diff --git a/src/main/java/reliquary/compat/jei/ReliquaryPlugin.java b/src/main/java/reliquary/compat/jei/ReliquaryPlugin.java index 47fd10fe..eaec67a7 100644 --- a/src/main/java/reliquary/compat/jei/ReliquaryPlugin.java +++ b/src/main/java/reliquary/compat/jei/ReliquaryPlugin.java @@ -9,14 +9,15 @@ import mezz.jei.api.registration.IRecipeRegistration; import mezz.jei.api.registration.ISubtypeRegistration; import net.minecraft.core.NonNullList; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.component.DataComponents; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.ShapedRecipe; +import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.block.Blocks; +import reliquary.Reliquary; import reliquary.compat.jei.alkahestry.AlkahestryChargingRecipeCategory; import reliquary.compat.jei.alkahestry.AlkahestryCraftingRecipeCategory; import reliquary.compat.jei.cauldron.CauldronRecipeCategory; @@ -29,11 +30,12 @@ import reliquary.compat.jei.mortar.MortarRecipeMaker; import reliquary.crafting.AlkahestryRecipeRegistry; import reliquary.init.ModBlocks; +import reliquary.init.ModDataComponents; import reliquary.init.ModItems; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.Collections; +import java.util.Optional; @SuppressWarnings("unused") //plugin class is used by JEI's reflection @JeiPlugin @@ -42,16 +44,16 @@ public class ReliquaryPlugin implements IModPlugin { @Override public void registerItemSubtypes(ISubtypeRegistration registration) { - registerNbtSubtypeInterpreter(registration, ModItems.MOB_CHARM_FRAGMENT.get(), "entity"); - registerNbtSubtypeInterpreter(registration, ModItems.MOB_CHARM.get(), "entity"); - if (Boolean.FALSE.equals(Settings.COMMON.disable.disablePotions.get())) { - registerNbtSubtypeInterpreter(registration, ModItems.POTION_ESSENCE.get(), EFFECTS_TAG); - registerNbtSubtypeInterpreter(registration, ModItems.POTION.get(), EFFECTS_TAG); - registerNbtSubtypeInterpreter(registration, ModItems.SPLASH_POTION.get(), EFFECTS_TAG); - registerNbtSubtypeInterpreter(registration, ModItems.LINGERING_POTION.get(), EFFECTS_TAG); - registerNbtSubtypeInterpreter(registration, ModItems.TIPPED_ARROW.get(), EFFECTS_TAG); - registerNbtSubtypeInterpreter(registration, ModItems.NEUTRAL_BULLET.get(), EFFECTS_TAG); - registerNbtSubtypeInterpreter(registration, ModItems.NEUTRAL_MAGAZINE.get(), EFFECTS_TAG); + registerNbtSubtypeInterpreter(registration, ModItems.MOB_CHARM_FRAGMENT.get(), ModDataComponents.ENTITY_NAME.get()); + registerNbtSubtypeInterpreter(registration, ModItems.MOB_CHARM.get(), ModDataComponents.ENTITY_NAME.get()); + if (Boolean.FALSE.equals(Config.COMMON.disable.disablePotions.get())) { + registerNbtSubtypeInterpreter(registration, ModItems.POTION_ESSENCE.get(), DataComponents.POTION_CONTENTS); + registerNbtSubtypeInterpreter(registration, ModItems.POTION.get(), DataComponents.POTION_CONTENTS); + registerNbtSubtypeInterpreter(registration, ModItems.SPLASH_POTION.get(), DataComponents.POTION_CONTENTS); + registerNbtSubtypeInterpreter(registration, ModItems.LINGERING_POTION.get(), DataComponents.POTION_CONTENTS); + registerNbtSubtypeInterpreter(registration, ModItems.TIPPED_ARROW.get(), DataComponents.POTION_CONTENTS); + registerNbtSubtypeInterpreter(registration, ModItems.NEUTRAL_BULLET.get(), DataComponents.POTION_CONTENTS); + registerNbtSubtypeInterpreter(registration, ModItems.NEUTRAL_MAGAZINE.get(), DataComponents.POTION_CONTENTS); } } @@ -59,12 +61,12 @@ public void registerItemSubtypes(ISubtypeRegistration registration) { public void registerCategories(IRecipeCategoryRegistration registration) { IGuiHelper guiHelper = registration.getJeiHelpers().getGuiHelper(); - if (Boolean.FALSE.equals(Settings.COMMON.disable.disableAlkahestry.get())) { + if (Boolean.FALSE.equals(Config.COMMON.disable.disableAlkahestry.get())) { registration.addRecipeCategories(new AlkahestryCraftingRecipeCategory(guiHelper)); registration.addRecipeCategories(new AlkahestryChargingRecipeCategory(guiHelper)); } - if (Boolean.FALSE.equals(Settings.COMMON.disable.disablePotions.get())) { + if (Boolean.FALSE.equals(Config.COMMON.disable.disablePotions.get())) { registration.addRecipeCategories(new MortarRecipeCategory(guiHelper)); registration.addRecipeCategories(new CauldronRecipeCategory(guiHelper)); } @@ -82,21 +84,21 @@ public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { @Override public void registerRecipes(IRecipeRegistration registration) { - if (Boolean.FALSE.equals(Settings.COMMON.disable.disableAlkahestry.get())) { + if (Boolean.FALSE.equals(Config.COMMON.disable.disableAlkahestry.get())) { registration.addRecipes(AlkahestryCraftingRecipeCategory.TYPE, AlkahestryRecipeRegistry.getCraftingRecipes()); registration.addRecipes(AlkahestryChargingRecipeCategory.TYPE, AlkahestryRecipeRegistry.getChargingRecipes()); } - if (Boolean.FALSE.equals(Settings.COMMON.disable.disablePotions.get())) { + if (Boolean.FALSE.equals(Config.COMMON.disable.disablePotions.get())) { registration.addRecipes(MortarRecipeCategory.TYPE, MortarRecipeMaker.getRecipes()); registration.addRecipes(CauldronRecipeCategory.TYPE, CauldronRecipeMaker.getRecipes()); registration.addRecipes(RecipeTypes.CRAFTING, ArrowShotRecipeMaker.getRecipes(new ItemStack(ModItems.TIPPED_ARROW.get()), new ItemStack(Items.ARROW), 0.125F, "arrow")); registration.addRecipes(RecipeTypes.CRAFTING, ArrowShotRecipeMaker.getRecipes(new ItemStack(ModItems.NEUTRAL_BULLET.get()), "bullet")); } - if (Boolean.FALSE.equals(Settings.COMMON.disable.disableHandgun.get())) { + if (Boolean.FALSE.equals(Config.COMMON.disable.disableHandgun.get())) { registration.addRecipes(RecipeTypes.CRAFTING, MagazineRecipeMaker.getRecipes()); } registration.addRecipes(RecipeTypes.CRAFTING, MobCharmRecipeMaker.getRecipes()); - if (Boolean.FALSE.equals(Settings.COMMON.disable.disableSpawnEggRecipes.get())) { + if (Boolean.FALSE.equals(Config.COMMON.disable.disableSpawnEggRecipes.get())) { registration.addRecipes(RecipeTypes.CRAFTING, SpawnEggRecipeMaker.getRecipes()); } registration.addRecipes(InfernalTearRecipeCategory.TYPE, InfernalTearRecipeMaker.getRecipes()); @@ -110,26 +112,28 @@ private void registerMobCharmBeltRecipe(IRecipeRegistration registration) { ModItems.MOB_CHARM_FRAGMENT.get().addCreativeTabItems(fragments::add); ItemStack[] fragmentStacks = fragments.toArray(new ItemStack[0]); - registration.addRecipes(RecipeTypes.CRAFTING, Collections.singletonList(new ShapedRecipe(new ResourceLocation(Reference.MOD_ID, "items/mob_charm_belt"), "", CraftingBookCategory.MISC, 3, 3, - NonNullList.of(Ingredient.EMPTY, - Ingredient.of(() -> Items.LEATHER), - Ingredient.of(() -> Items.LEATHER), - Ingredient.of(() -> Items.LEATHER), - Ingredient.of(fragmentStacks), - Ingredient.EMPTY, - Ingredient.of(fragmentStacks), - Ingredient.of(fragmentStacks), - Ingredient.of(fragmentStacks), - Ingredient.of(fragmentStacks) - ), new ItemStack(ModItems.MOB_CHARM_BELT.get())))); + ShapedRecipePattern pattern = new ShapedRecipePattern(3, 3, NonNullList.of(Ingredient.EMPTY, + Ingredient.of(() -> Items.LEATHER), + Ingredient.of(() -> Items.LEATHER), + Ingredient.of(() -> Items.LEATHER), + Ingredient.of(fragmentStacks), + Ingredient.EMPTY, + Ingredient.of(fragmentStacks), + Ingredient.of(fragmentStacks), + Ingredient.of(fragmentStacks), + Ingredient.of(fragmentStacks) + ), Optional.empty()); + + registration.addRecipes(RecipeTypes.CRAFTING, Collections.singletonList(new RecipeHolder<>(Reliquary.getRL("items/mob_charm_belt"), + new ShapedRecipe("", CraftingBookCategory.MISC, pattern, new ItemStack(ModItems.MOB_CHARM_BELT.get()))))); } - private void registerNbtSubtypeInterpreter(ISubtypeRegistration registration, Item item, String... keys) { - registration.registerSubtypeInterpreter(item, new SortedNbtSubtypeInterpreter(keys)); + private void registerNbtSubtypeInterpreter(ISubtypeRegistration registration, Item item, DataComponentType component) { + registration.registerSubtypeInterpreter(item, new ComponentSubtypeInterpreter(component)); } @Override public ResourceLocation getPluginUid() { - return new ResourceLocation(Reference.MOD_ID, "default"); + return Reliquary.getRL("default"); } } diff --git a/src/main/java/reliquary/compat/jei/SortedNbtSubtypeInterpreter.java b/src/main/java/reliquary/compat/jei/SortedNbtSubtypeInterpreter.java deleted file mode 100644 index 31f1584d..00000000 --- a/src/main/java/reliquary/compat/jei/SortedNbtSubtypeInterpreter.java +++ /dev/null @@ -1,76 +0,0 @@ -package reliquary.compat.jei; - -import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter; -import mezz.jei.api.ingredients.subtypes.UidContext; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.StringTag; -import net.minecraft.nbt.Tag; -import net.minecraft.world.item.ItemStack; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.function.Predicate; -import java.util.regex.Pattern; - -class SortedNbtSubtypeInterpreter implements IIngredientSubtypeInterpreter { - private final Set keysToConsider; - - SortedNbtSubtypeInterpreter(String... keysToConsider) { - this.keysToConsider = new HashSet<>(Arrays.asList(keysToConsider)); - } - - @Override - public String apply(ItemStack itemStack, UidContext context) { - CompoundTag nbtTagCompound = itemStack.getTag(); - return nbtTagCompound != null && !nbtTagCompound.isEmpty() ? getSortedCompoundString(nbtTagCompound, keysToConsider::contains) : ""; - } - - private static final Pattern SIMPLE_VALUE = Pattern.compile("[A-Za-z0-9._+-]+"); - - private String handleEscape(String keyName) { - return SIMPLE_VALUE.matcher(keyName).matches() ? keyName : StringTag.quoteAndEscape(keyName); - } - - private String getSortedCompoundString(CompoundTag nbtTagCompound, Predicate addKey) { - StringBuilder stringbuilder = new StringBuilder("{"); - List sortedKeys = nbtTagCompound.getAllKeys().stream().filter(addKey).sorted().toList(); - for (String s : sortedKeys) { - if (stringbuilder.length() != 1) { - stringbuilder.append(','); - } - - Tag nbtValue = nbtTagCompound.get(s); - //noinspection ConstantConditions - only iterating through keys that exist so nbtValue can't be null - stringbuilder.append(handleEscape(s)).append(':').append(getNbtString(nbtValue)); - } - - return stringbuilder.append('}').toString(); - } - - private String getNbtString(Tag nbtValue) { - if (nbtValue instanceof ListTag listTag) { - return getNbtListString(listTag); - } else if (nbtValue instanceof CompoundTag compoundTag) { - return getSortedCompoundString(compoundTag, k -> true); - } else { - return nbtValue.toString(); - } - } - - private String getNbtListString(ListTag listNBT) { - StringBuilder stringbuilder = new StringBuilder("["); - - for (int i = 0; i < listNBT.size(); ++i) { - if (i != 0) { - stringbuilder.append(','); - } - - stringbuilder.append(getNbtString(listNBT.get(i))); - } - - return stringbuilder.append(']').toString(); - } -} diff --git a/src/main/java/reliquary/compat/jei/SpawnEggRecipeMaker.java b/src/main/java/reliquary/compat/jei/SpawnEggRecipeMaker.java index dad9174f..5260e589 100644 --- a/src/main/java/reliquary/compat/jei/SpawnEggRecipeMaker.java +++ b/src/main/java/reliquary/compat/jei/SpawnEggRecipeMaker.java @@ -4,14 +4,11 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.ShapelessRecipe; +import net.minecraft.world.item.crafting.*; +import reliquary.Reliquary; import reliquary.crafting.FragmentRecipeHelper; import reliquary.init.ModItems; import reliquary.items.MobCharmRegistry; -import reliquary.reference.Reference; import java.util.ArrayList; import java.util.List; @@ -20,10 +17,10 @@ public class SpawnEggRecipeMaker { private SpawnEggRecipeMaker() { } - public static List getRecipes() { - List recipes = new ArrayList<>(); + public static List> getRecipes() { + List> recipes = new ArrayList<>(); - for (String regName : MobCharmRegistry.getRegisteredNames()) { + for (ResourceLocation regName : MobCharmRegistry.getRegisteredNames()) { Ingredient fragmentIngredient = Ingredient.of(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(regName)); Ingredient eggIngredient = Ingredient.of(Items.EGG); @@ -34,8 +31,8 @@ public static List getRecipes() { ItemStack output = FragmentRecipeHelper.getSpawnEggStack(regName); - ResourceLocation id = new ResourceLocation(Reference.MOD_ID, "reliquary.fragment_to_spawn_egg." + output.getDescriptionId()); - recipes.add(new ShapelessRecipe(id, "reliquary.fragment_to_spawn_egg", CraftingBookCategory.MISC, output, inputs)); + ResourceLocation id = Reliquary.getRL("reliquary.fragment_to_spawn_egg." + output.getDescriptionId()); + recipes.add(new RecipeHolder<>(id, new ShapelessRecipe("reliquary.fragment_to_spawn_egg", CraftingBookCategory.MISC, output, inputs))); } return recipes; diff --git a/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryChargingRecipeCategory.java b/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryChargingRecipeCategory.java index f64f3966..a60d7da3 100644 --- a/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryChargingRecipeCategory.java +++ b/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryChargingRecipeCategory.java @@ -12,21 +12,20 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; +import reliquary.Reliquary; import reliquary.crafting.AlkahestryChargingRecipe; -import reliquary.reference.Reference; public class AlkahestryChargingRecipeCategory extends AlkahestryRecipeCategory { - public static final RecipeType TYPE = RecipeType.create(Reference.MOD_ID, "alkahestry_charging", AlkahestryChargingRecipe.class); + public static final RecipeType TYPE = RecipeType.create(Reliquary.MOD_ID, "alkahestry_charging", AlkahestryChargingRecipe.class); private final IDrawable background; private final Component localizedName; public AlkahestryChargingRecipeCategory(IGuiHelper guiHelper) { super(guiHelper); - background = guiHelper.createDrawable(new ResourceLocation(Reference.DOMAIN + "textures/gui/jei/backgrounds.png"), 0, 0, 95, 36); - localizedName = Component.translatable("jei." + Reference.MOD_ID + ".recipe.alkahest_charging"); + background = guiHelper.createDrawable(Reliquary.getRL("textures/gui/jei/backgrounds.png"), 0, 0, 95, 36); + localizedName = Component.translatable("jei." + Reliquary.MOD_ID + ".recipe.alkahest_charging"); } @Override diff --git a/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryCraftingRecipeCategory.java b/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryCraftingRecipeCategory.java index e0624afc..6580b9e2 100644 --- a/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryCraftingRecipeCategory.java +++ b/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryCraftingRecipeCategory.java @@ -12,24 +12,22 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; +import reliquary.Reliquary; import reliquary.crafting.AlkahestryCraftingRecipe; import reliquary.init.ModItems; import reliquary.items.AlkahestryTomeItem; -import reliquary.reference.Reference; -import reliquary.reference.Settings; public class AlkahestryCraftingRecipeCategory extends AlkahestryRecipeCategory { - public static final RecipeType TYPE = RecipeType.create(Reference.MOD_ID, "alkahestry_crafting", AlkahestryCraftingRecipe.class); + public static final RecipeType TYPE = RecipeType.create(Reliquary.MOD_ID, "alkahestry_crafting", AlkahestryCraftingRecipe.class); private final IDrawable background; private final Component localizedName; public AlkahestryCraftingRecipeCategory(IGuiHelper guiHelper) { super(guiHelper); - background = guiHelper.createDrawable(new ResourceLocation(Reference.DOMAIN + "textures/gui/jei/backgrounds.png"), 0, 0, 95, 76); - localizedName = Component.translatable("jei." + Reference.MOD_ID + ".recipe.alkahest_crafting"); + background = guiHelper.createDrawable(Reliquary.getRL("textures/gui/jei/backgrounds.png"), 0, 0, 95, 76); + localizedName = Component.translatable("jei." + Reliquary.MOD_ID + ".recipe.alkahest_crafting"); } @Override @@ -54,7 +52,7 @@ public void setRecipe(IRecipeLayoutBuilder builder, AlkahestryCraftingRecipe rec ItemStack tome = ingredientsInputs.get(1).getItems()[0]; ItemStack output = recipe.getResult(); ItemStack tomeOutput = AlkahestryTomeItem.setCharge(new ItemStack(ModItems.ALKAHESTRY_TOME.get()), - Settings.COMMON.items.alkahestryTome.chargeLimit.get() - recipe.getChargeNeeded()); + AlkahestryTomeItem.getChargeLimit() - recipe.getChargeNeeded()); builder.addSlot(RecipeIngredientRole.INPUT, 1, 1).addItemStack(input); builder.addSlot(RecipeIngredientRole.INPUT, 19, 1).addItemStack(tome); diff --git a/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryRecipeCategory.java b/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryRecipeCategory.java index ed4f331a..e633b45f 100644 --- a/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryRecipeCategory.java +++ b/src/main/java/reliquary/compat/jei/alkahestry/AlkahestryRecipeCategory.java @@ -2,14 +2,13 @@ import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.helpers.IGuiHelper; -import net.minecraft.resources.ResourceLocation; -import reliquary.reference.Reference; +import reliquary.Reliquary; public abstract class AlkahestryRecipeCategory implements mezz.jei.api.recipe.category.IRecipeCategory { private final IDrawable icon; AlkahestryRecipeCategory(IGuiHelper guiHelper) { - icon = guiHelper.drawableBuilder(new ResourceLocation(Reference.MOD_ID, "textures/item/alkahest_tome.png"), 0, 0, 16, 16).setTextureSize(16, 16).build(); + icon = guiHelper.drawableBuilder(Reliquary.getRL("textures/item/alkahest_tome.png"), 0, 0, 16, 16).setTextureSize(16, 16).build(); } @Override diff --git a/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeCategory.java b/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeCategory.java index a2a6f017..c65acc6d 100644 --- a/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeCategory.java +++ b/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeCategory.java @@ -7,23 +7,22 @@ import mezz.jei.api.recipe.RecipeIngredientRole; import mezz.jei.api.recipe.RecipeType; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import reliquary.Reliquary; import reliquary.init.ModBlocks; -import reliquary.reference.Reference; import java.util.List; public class CauldronRecipeCategory implements mezz.jei.api.recipe.category.IRecipeCategory { - public static final RecipeType TYPE = RecipeType.create(Reference.MOD_ID, "cauldron", CauldronRecipeJEI.class); + public static final RecipeType TYPE = RecipeType.create(Reliquary.MOD_ID, "cauldron", CauldronRecipeJEI.class); private final IDrawable background; private final Component localizedName; private final IDrawable icon; public CauldronRecipeCategory(IGuiHelper guiHelper) { - background = guiHelper.createDrawable(new ResourceLocation(Reference.DOMAIN + "textures/gui/jei/backgrounds.png"), 96, 0, 107, 51); - localizedName = Component.translatable("jei." + Reference.MOD_ID + ".recipe.cauldron"); + background = guiHelper.createDrawable(Reliquary.getRL("textures/gui/jei/backgrounds.png"), 96, 0, 107, 51); + localizedName = Component.translatable("jei." + Reliquary.MOD_ID + ".recipe.cauldron"); icon = guiHelper.createDrawableItemStack(new ItemStack(ModBlocks.APOTHECARY_CAULDRON.get())); } @@ -51,7 +50,7 @@ public IDrawable getIcon() { public void setRecipe(IRecipeLayoutBuilder builder, CauldronRecipeJEI recipe, IFocusGroup focuses) { List ingredientsInputs = recipe.getInputs(); - builder.addSlot(RecipeIngredientRole.INPUT, 0, 33).addItemStack(ingredientsInputs.get(0)); + builder.addSlot(RecipeIngredientRole.INPUT, 0, 33).addItemStack(ingredientsInputs.getFirst()); setAdditionalSlotContents(builder, ingredientsInputs); builder.addSlot(RecipeIngredientRole.OUTPUT, 90, 33).addItemStack(recipe.getOutput()); builder.addSlot(RecipeIngredientRole.CATALYST, 44, 33).addItemStack(new ItemStack(ModBlocks.APOTHECARY_CAULDRON.get())); diff --git a/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeJEI.java b/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeJEI.java index 19a675a1..a55948ca 100644 --- a/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeJEI.java +++ b/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeJEI.java @@ -4,7 +4,7 @@ import java.util.List; -class CauldronRecipeJEI { +public class CauldronRecipeJEI { private final List inputs; private final ItemStack output; diff --git a/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeMaker.java b/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeMaker.java index 86edcb19..3f726ae7 100644 --- a/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeMaker.java +++ b/src/main/java/reliquary/compat/jei/cauldron/CauldronRecipeMaker.java @@ -4,8 +4,8 @@ import net.minecraft.world.item.Items; import reliquary.init.ModItems; import reliquary.util.potions.PotionEssence; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionMap; -import reliquary.util.potions.XRPotionHelper; import java.util.ArrayList; import java.util.List; @@ -21,7 +21,7 @@ public static List getRecipes() { List inputs = new ArrayList<>(); ItemStack potionEssence = new ItemStack(ModItems.POTION_ESSENCE.get(), 1); - XRPotionHelper.addPotionEffectsToStack(potionEssence, essence.getEffects()); + PotionHelper.addPotionContentsToStack(potionEssence, essence.getPotionContents()); inputs.add(potionEssence); @@ -50,13 +50,13 @@ public static List getRecipes() { lingeringInputs.add(new ItemStack(ModItems.EMPTY_POTION_VIAL.get(), 3)); ItemStack output = new ItemStack(ModItems.POTION.get(), 3); - XRPotionHelper.addPotionEffectsToStack(output, essence.getEffects()); + PotionHelper.addPotionContentsToStack(output, essence.getPotionContents()); ItemStack outputSplash = new ItemStack(ModItems.SPLASH_POTION.get(), 3); - XRPotionHelper.addPotionEffectsToStack(outputSplash, essence.getEffects()); + PotionHelper.addPotionContentsToStack(outputSplash, essence.getPotionContents()); ItemStack outputLingering = new ItemStack(ModItems.LINGERING_POTION.get(), 3); - XRPotionHelper.addPotionEffectsToStack(outputLingering, essence.getEffects()); + PotionHelper.addPotionContentsToStack(outputLingering, essence.getPotionContents()); recipes.add(new CauldronRecipeJEI(inputs, output)); recipes.add(new CauldronRecipeJEI(splashInputs, outputSplash)); diff --git a/src/main/java/reliquary/compat/jei/infernaltear/InfernalTearRecipeCategory.java b/src/main/java/reliquary/compat/jei/infernaltear/InfernalTearRecipeCategory.java index 161cbba5..753c393b 100644 --- a/src/main/java/reliquary/compat/jei/infernaltear/InfernalTearRecipeCategory.java +++ b/src/main/java/reliquary/compat/jei/infernaltear/InfernalTearRecipeCategory.java @@ -1,10 +1,7 @@ package reliquary.compat.jei.infernaltear; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; +import com.mojang.blaze3d.vertex.*; import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.ingredient.IRecipeSlotsView; @@ -21,15 +18,14 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import org.joml.Matrix4f; +import reliquary.Reliquary; import reliquary.init.ModItems; import reliquary.items.InfernalTearItem; -import reliquary.reference.Reference; import reliquary.util.XpHelper; public class InfernalTearRecipeCategory implements mezz.jei.api.recipe.category.IRecipeCategory { - public static final RecipeType TYPE = RecipeType.create(Reference.MOD_ID, "infernal_tear", InfernalTearRecipe.class); - private static final ResourceLocation BACKGROUNDS_TEXTURE = new ResourceLocation(Reference.DOMAIN + "textures/gui/jei/backgrounds.png"); + public static final RecipeType TYPE = RecipeType.create(Reliquary.MOD_ID, "infernal_tear", InfernalTearRecipe.class); + private static final ResourceLocation BACKGROUNDS_TEXTURE = Reliquary.getRL("textures/gui/jei/backgrounds.png"); private final IDrawable background; private final Component localizedName; @@ -37,7 +33,7 @@ public class InfernalTearRecipeCategory implements mezz.jei.api.recipe.category. public InfernalTearRecipeCategory(IGuiHelper guiHelper) { background = guiHelper.createDrawable(BACKGROUNDS_TEXTURE, 0, 76, 110, 25); - localizedName = Component.translatable("jei." + Reference.MOD_ID + ".recipe.infernal_tear"); + localizedName = Component.translatable("jei." + Reliquary.MOD_ID + ".recipe.infernal_tear"); ItemStack iconTear = new ItemStack(ModItems.INFERNAL_TEAR.get()); InfernalTearItem.setTearTarget(iconTear, new ItemStack(Items.IRON_INGOT)); icon = guiHelper.createDrawableItemStack(iconTear); @@ -74,7 +70,7 @@ public void draw(InfernalTearRecipe recipe, IRecipeSlotsView recipeSlotsView, Gu String points = experiencePoints + " " + Language.getInstance().getOrDefault("jei.reliquary.recipe.infernal_tear.xp"); Font fontRenderer = Minecraft.getInstance().font; int stringWidth = fontRenderer.width(points); - guiGraphics.drawString(fontRenderer, points, (int) ((double) background.getWidth() / 2 + (((double) background.getWidth() / 2 + 16 - stringWidth) / 2)), 5, -8355712); + guiGraphics.drawString(fontRenderer, points, (int) ((double) background.getWidth() / 2 + (((double) background.getWidth() / 2 + 16 - stringWidth) / 2)), 5, 8453920); drawLevels(guiGraphics, experiencePoints, fontRenderer); } @@ -120,16 +116,13 @@ private void drawXpBar(GuiGraphics guiGraphics, int experiencePoints, int level) float height = maxV - minV; float x = 0; float y = (float) background.getHeight() - 5; - Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder bufferBuilder = tesselator.getBuilder(); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - Matrix4f matrix = guiGraphics.pose().last().pose(); - bufferBuilder.vertex(matrix, x, y + height, 0.0F).uv(minU / textureWidth, maxV / textureHeight).endVertex(); - bufferBuilder.vertex(matrix, x + width, y + height, 0.0F).uv(maxU / textureWidth, maxV / textureHeight).endVertex(); - bufferBuilder.vertex(matrix, x + width, y, 0.0F).uv(maxU / textureWidth, minV / textureHeight).endVertex(); - bufferBuilder.vertex(matrix, x, y, 0.0F).uv(minU / textureWidth, minV / textureHeight).endVertex(); - tesselator.end(); - + BufferBuilder buffer = RenderSystem.renderThreadTesselator().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + PoseStack.Pose pose = guiGraphics.pose().last(); + buffer.addVertex(pose, x, y + height, 0.0F).setUv(minU / textureWidth, maxV / textureHeight); + buffer.addVertex(pose, x + width, y + height, 0.0F).setUv(maxU / textureWidth, maxV / textureHeight); + buffer.addVertex(pose, x + width, y, 0.0F).setUv(maxU / textureWidth, minV / textureHeight); + buffer.addVertex(pose, x, y, 0.0F).setUv(minU / textureWidth, minV / textureHeight); + BufferUploader.drawWithShader(buffer.buildOrThrow()); RenderSystem.disableBlend(); } } diff --git a/src/main/java/reliquary/compat/jei/infernaltear/InfernalTearRecipeMaker.java b/src/main/java/reliquary/compat/jei/infernaltear/InfernalTearRecipeMaker.java index 47aa2154..2c27bf8e 100644 --- a/src/main/java/reliquary/compat/jei/infernaltear/InfernalTearRecipeMaker.java +++ b/src/main/java/reliquary/compat/jei/infernaltear/InfernalTearRecipeMaker.java @@ -1,10 +1,11 @@ package reliquary.compat.jei.infernaltear; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.registries.ForgeRegistries; -import reliquary.reference.Settings; +import net.minecraft.world.item.Items; +import reliquary.reference.Config; import java.util.ArrayList; import java.util.List; @@ -16,10 +17,10 @@ private InfernalTearRecipeMaker() {} public static List getRecipes() { ArrayList recipes = new ArrayList<>(); - for (Map.Entry entry : Settings.COMMON.items.infernalTear.getItemExperiences().entrySet()) { - Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(entry.getKey())); + for (Map.Entry entry : Config.COMMON.items.infernalTear.getItemExperiences().entrySet()) { + Item item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(entry.getKey())); - if (item != null) { + if (item != Items.AIR) { recipes.add(new InfernalTearRecipe(new ItemStack(item), entry.getValue())); } } diff --git a/src/main/java/reliquary/compat/jei/lingering/ArrowShotRecipeMaker.java b/src/main/java/reliquary/compat/jei/lingering/ArrowShotRecipeMaker.java index aaa745b5..347df1cb 100644 --- a/src/main/java/reliquary/compat/jei/lingering/ArrowShotRecipeMaker.java +++ b/src/main/java/reliquary/compat/jei/lingering/ArrowShotRecipeMaker.java @@ -2,47 +2,46 @@ import net.minecraft.core.NonNullList; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.ShapedRecipe; +import net.minecraft.world.item.crafting.*; import reliquary.init.ModItems; import reliquary.util.RegistryHelper; import reliquary.util.potions.PotionEssence; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionMap; -import reliquary.util.potions.XRPotionHelper; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Optional; public class ArrowShotRecipeMaker { private ArrowShotRecipeMaker() { } - public static List getRecipes(ItemStack output, String itemName) { + public static List> getRecipes(ItemStack output, String itemName) { return getRecipes(output, output, 0.2F, itemName); } - public static List getRecipes(ItemStack output, ItemStack itemStack, float durationFactor, String itemName) { - ArrayList recipes = new ArrayList<>(); + public static List> getRecipes(ItemStack output, ItemStack itemStack, float durationFactor, String itemName) { + ArrayList> recipes = new ArrayList<>(); String group = "reliquary.potion." + itemName; for (PotionEssence essence : PotionMap.uniquePotions) { ItemStack potion = new ItemStack(ModItems.LINGERING_POTION.get()); - XRPotionHelper.addPotionEffectsToStack(potion, essence.getEffects()); + PotionHelper.addPotionContentsToStack(potion, essence.getPotionContents()); ItemStack outputCopy = output.copy(); outputCopy.setCount(8); - XRPotionHelper.addPotionEffectsToStack(outputCopy, XRPotionHelper.changePotionEffectsDuration(essence.getEffects(), durationFactor)); + PotionHelper.addPotionContentsToStack(outputCopy, PotionHelper.changePotionEffectsDuration(essence.getPotionContents(), durationFactor)); NonNullList ingredients = NonNullList.create(); ingredients.addAll(Collections.nCopies(4, Ingredient.of(itemStack))); ingredients.add(Ingredient.of(potion)); ingredients.addAll(Collections.nCopies(4, Ingredient.of(itemStack))); - recipes.add(new ShapedRecipe(RegistryHelper.getRegistryName(output.getItem()), group, CraftingBookCategory.MISC, 3, 3, ingredients, outputCopy)); + ShapedRecipePattern pattern = new ShapedRecipePattern(3, 3, ingredients, Optional.empty()); + recipes.add(new RecipeHolder<>(RegistryHelper.getRegistryName(output.getItem()), new ShapedRecipe(group, CraftingBookCategory.MISC, pattern, outputCopy))); } return recipes; diff --git a/src/main/java/reliquary/compat/jei/magazines/MagazineRecipeMaker.java b/src/main/java/reliquary/compat/jei/magazines/MagazineRecipeMaker.java index 6fb144bd..acfce805 100644 --- a/src/main/java/reliquary/compat/jei/magazines/MagazineRecipeMaker.java +++ b/src/main/java/reliquary/compat/jei/magazines/MagazineRecipeMaker.java @@ -2,24 +2,21 @@ import com.google.common.collect.ImmutableMap; import net.minecraft.core.NonNullList; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.ShapedRecipe; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.crafting.*; import reliquary.items.BulletItem; import reliquary.items.MagazineItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.RegistryHelper; import reliquary.util.potions.PotionEssence; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionMap; -import reliquary.util.potions.XRPotionHelper; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Optional; import static reliquary.init.ModItems.*; @@ -28,18 +25,18 @@ public class MagazineRecipeMaker { private MagazineRecipeMaker() { } - public static List getRecipes() { - ArrayList recipes = new ArrayList<>(); + public static List> getRecipes() { + List> recipes = new ArrayList<>(); addRegularMagazines(recipes); - if (Boolean.FALSE.equals(Settings.COMMON.disable.disablePotions.get())) { + if (Boolean.FALSE.equals(Config.COMMON.disable.disablePotions.get())) { addPotionMagazines(recipes); } return recipes; } - private static void addRegularMagazines(ArrayList recipes) { + private static void addRegularMagazines(List> recipes) { Map bulletMagazines = new ImmutableMap.Builder() .put(NEUTRAL_BULLET.get(), NEUTRAL_MAGAZINE.get()) .put(EXORCISM_BULLET.get(), EXORCISM_MAGAZINE.get()) @@ -60,38 +57,42 @@ private static void addRegularMagazines(ArrayList recipes) { ItemStack output = new ItemStack(bulletMagazine.getValue()); - recipes.add(new ShapedRecipe(RegistryHelper.getRegistryName(output.getItem()), "reliquary.magazine", CraftingBookCategory.MISC, 3, 3, inputs, output)); + ShapedRecipePattern pattern = new ShapedRecipePattern(3, 3, inputs, Optional.empty()); + + recipes.add(new RecipeHolder<>(RegistryHelper.getRegistryName(output.getItem()), new ShapedRecipe("reliquary.magazine", CraftingBookCategory.MISC, pattern, output))); } } - private static void addPotionMagazines(ArrayList recipes) { + private static void addPotionMagazines(List> recipes) { for (PotionEssence essence : PotionMap.uniquePotions) { - List effects = XRPotionHelper.changePotionEffectsDuration(essence.getEffects(), 0.2F); + PotionContents potionContents = PotionHelper.changePotionEffectsDuration(essence.getPotionContents(), 0.2F); NonNullList inputs = NonNullList.create(); - addShots(inputs, effects); + addShots(inputs, potionContents); inputs.add(Ingredient.of(new ItemStack(EMPTY_MAGAZINE.get()))); - addShots(inputs, effects); + addShots(inputs, potionContents); ItemStack output = new ItemStack(NEUTRAL_MAGAZINE.get()); - XRPotionHelper.addPotionEffectsToStack(output, effects); + PotionHelper.addPotionContentsToStack(output, potionContents); + + ShapedRecipePattern pattern = new ShapedRecipePattern(3, 3, inputs, Optional.empty()); - recipes.add(new ShapedRecipe(RegistryHelper.getRegistryName(output.getItem()), "reliquary.potion.magazine", CraftingBookCategory.MISC, 3, 3, inputs, output)); + recipes.add(new RecipeHolder<>(RegistryHelper.getRegistryName(output.getItem()), new ShapedRecipe("reliquary.potion.magazine", CraftingBookCategory.MISC, pattern, output))); } } - private static void addShots(List inputs, List effects) { - addShots(inputs, effects, NEUTRAL_BULLET.get()); + private static void addShots(List inputs, PotionContents potionContents) { + addShots(inputs, potionContents, NEUTRAL_BULLET.get()); } private static void addShots(List inputs, BulletItem shotType) { - addShots(inputs, Collections.emptyList(), shotType); + addShots(inputs, PotionContents.EMPTY, shotType); } - private static void addShots(List inputs, List effects, BulletItem shotType) { + private static void addShots(List inputs, PotionContents potionContents, BulletItem shotType) { ItemStack shot = new ItemStack(shotType); - if (!effects.isEmpty()) { - XRPotionHelper.addPotionEffectsToStack(shot, effects); + if (potionContents.hasEffects()) { + PotionHelper.addPotionContentsToStack(shot, potionContents); } for (int i = 0; i < 4; i++) { inputs.add(Ingredient.of(shot)); diff --git a/src/main/java/reliquary/compat/jei/mortar/MortarRecipeCategory.java b/src/main/java/reliquary/compat/jei/mortar/MortarRecipeCategory.java index e9fa6531..c000922a 100644 --- a/src/main/java/reliquary/compat/jei/mortar/MortarRecipeCategory.java +++ b/src/main/java/reliquary/compat/jei/mortar/MortarRecipeCategory.java @@ -8,25 +8,24 @@ import mezz.jei.api.recipe.RecipeIngredientRole; import mezz.jei.api.recipe.RecipeType; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import reliquary.Reliquary; import reliquary.init.ModBlocks; -import reliquary.reference.Reference; import java.util.List; public class MortarRecipeCategory implements mezz.jei.api.recipe.category.IRecipeCategory { - public static final RecipeType TYPE = RecipeType.create(Reference.MOD_ID, "mortar", MortarRecipeJEI.class); + public static final RecipeType TYPE = RecipeType.create(Reliquary.MOD_ID, "mortar", MortarRecipeJEI.class); private final IDrawable background; private final Component localizedName; private final IDrawable icon; public MortarRecipeCategory(IGuiHelper guiHelper) { - background = guiHelper.drawableBuilder(new ResourceLocation(Reference.DOMAIN + "textures/gui/jei/backgrounds.png"), 137, 0, 66, 51) + background = guiHelper.drawableBuilder(Reliquary.getRL("textures/gui/jei/backgrounds.png"), 137, 0, 66, 51) .addPadding(0, 0, 13, 0) .build(); - localizedName = Component.translatable("jei." + Reference.MOD_ID + ".recipe.mortar"); + localizedName = Component.translatable("jei." + Reliquary.MOD_ID + ".recipe.mortar"); icon = guiHelper.createDrawableItemStack(new ItemStack(ModBlocks.APOTHECARY_MORTAR.get())); } diff --git a/src/main/java/reliquary/compat/jei/mortar/MortarRecipeJEI.java b/src/main/java/reliquary/compat/jei/mortar/MortarRecipeJEI.java index 82270c43..8755a252 100644 --- a/src/main/java/reliquary/compat/jei/mortar/MortarRecipeJEI.java +++ b/src/main/java/reliquary/compat/jei/mortar/MortarRecipeJEI.java @@ -4,5 +4,5 @@ import java.util.List; -record MortarRecipeJEI(List inputs, ItemStack output) { +public record MortarRecipeJEI(List inputs, ItemStack output) { } diff --git a/src/main/java/reliquary/compat/jei/mortar/MortarRecipeMaker.java b/src/main/java/reliquary/compat/jei/mortar/MortarRecipeMaker.java index 170ed421..38f06dea 100644 --- a/src/main/java/reliquary/compat/jei/mortar/MortarRecipeMaker.java +++ b/src/main/java/reliquary/compat/jei/mortar/MortarRecipeMaker.java @@ -3,15 +3,16 @@ import net.minecraft.world.item.ItemStack; import reliquary.init.ModItems; import reliquary.util.potions.PotionEssence; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionIngredient; import reliquary.util.potions.PotionMap; -import reliquary.util.potions.XRPotionHelper; import java.util.ArrayList; import java.util.List; public class MortarRecipeMaker { - private MortarRecipeMaker() {} + private MortarRecipeMaker() { + } public static List getRecipes() { ArrayList recipes = new ArrayList<>(); @@ -21,7 +22,7 @@ public static List getRecipes() { List inputs = essence.getIngredients().stream().map(PotionIngredient::getItem).toList(); ItemStack output = new ItemStack(ModItems.POTION_ESSENCE.get(), 1); - XRPotionHelper.addPotionEffectsToStack(output, essence.getEffects()); + PotionHelper.addPotionContentsToStack(output, essence.getPotionContents()); recipes.add(new MortarRecipeJEI(inputs, output)); } diff --git a/src/main/java/reliquary/compat/tconstruct/TConstructCompat.java b/src/main/java/reliquary/compat/tconstruct/TConstructCompat.java index 85352714..92a1a0c1 100644 --- a/src/main/java/reliquary/compat/tconstruct/TConstructCompat.java +++ b/src/main/java/reliquary/compat/tconstruct/TConstructCompat.java @@ -1,7 +1,13 @@ package reliquary.compat.tconstruct; +import net.neoforged.bus.api.IEventBus; + public class TConstructCompat { - public void setup() { + public TConstructCompat(IEventBus iEventBus) { + + } + + public void setup() { /* PedestalRegistry.registerItemWrapper(SwordTool.class, PedestalMeleeWeaponWrapper::new); PedestalRegistry.registerItemWrapper(ScytheTool.class, PedestalMeleeWeaponWrapper::new); diff --git a/src/main/java/reliquary/crafting/AlkahestryChargingRecipe.java b/src/main/java/reliquary/crafting/AlkahestryChargingRecipe.java index d170f256..1d31dfc8 100644 --- a/src/main/java/reliquary/crafting/AlkahestryChargingRecipe.java +++ b/src/main/java/reliquary/crafting/AlkahestryChargingRecipe.java @@ -1,38 +1,33 @@ package reliquary.crafting; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.RegistryAccess; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; -import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.Level; -import net.minecraftforge.common.crafting.CraftingHelper; +import net.neoforged.neoforge.common.crafting.ICustomIngredient; +import net.neoforged.neoforge.common.crafting.IngredientType; import reliquary.init.ModItems; import reliquary.items.AlkahestryTomeItem; -import javax.annotation.Nullable; import java.util.stream.Stream; public class AlkahestryChargingRecipe implements CraftingRecipe { private final Ingredient chargingIngredient; private final int chargeToAdd; private final ItemStack recipeOutput; - private final ResourceLocation id; private final Ingredient tomeIngredient; - private AlkahestryChargingRecipe(ResourceLocation id, Ingredient chargingIngredient, int chargeToAdd) { - this.id = id; + public AlkahestryChargingRecipe(Ingredient chargingIngredient, int chargeToAdd) { this.chargingIngredient = chargingIngredient; this.chargeToAdd = chargeToAdd; - tomeIngredient = new TomeIngredient(chargeToAdd); + tomeIngredient = new TomeIngredient(chargeToAdd).toVanilla(); recipeOutput = new ItemStack(ModItems.ALKAHESTRY_TOME.get()); AlkahestryTomeItem.addCharge(recipeOutput, chargeToAdd); @@ -41,11 +36,11 @@ private AlkahestryChargingRecipe(ResourceLocation id, Ingredient chargingIngredi } @Override - public boolean matches(CraftingContainer inv, Level worldIn) { + public boolean matches(CraftingInput inv, Level level) { ItemStack tome = ItemStack.EMPTY; int numberOfIngredients = 0; - for (int x = 0; x < inv.getContainerSize(); x++) { + for (int x = 0; x < inv.size(); x++) { ItemStack slotStack = inv.getItem(x); if (!slotStack.isEmpty()) { @@ -73,10 +68,10 @@ public boolean isSpecial() { } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { int numberOfIngredients = 0; ItemStack tome = ItemStack.EMPTY; - for (int slot = 0; slot < inv.getContainerSize(); slot++) { + for (int slot = 0; slot < inv.size(); slot++) { ItemStack stack = inv.getItem(slot); if (chargingIngredient.test(stack)) { numberOfIngredients++; @@ -105,15 +100,10 @@ public ItemStack getRecipeOutput() { } @Override - public ItemStack getResultItem(RegistryAccess registryAccess) { + public ItemStack getResultItem(HolderLookup.Provider registries) { return recipeOutput; } - @Override - public ResourceLocation getId() { - return id; - } - @Override public RecipeSerializer getSerializer() { return ModItems.ALKAHESTRY_CHARGING_SERIALIZER.get(); @@ -133,38 +123,39 @@ public CraftingBookCategory category() { } public static class Serializer implements RecipeSerializer { - @Override - public AlkahestryChargingRecipe fromJson(ResourceLocation recipeId, JsonObject json) { - if (!json.has("ingredient")) { - throw new JsonParseException("No ingredient for alkahestry charging recipe"); - } - - Ingredient ingredient = CraftingHelper.getIngredient(json.get("ingredient"), false); - - int chargeToAdd = GsonHelper.getAsInt(json, "charge"); - - return new AlkahestryChargingRecipe(recipeId, ingredient, chargeToAdd); - } + private static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.chargingIngredient), + Codec.INT.fieldOf("charge").forGetter(recipe -> recipe.chargeToAdd) + ) + .apply(instance, AlkahestryChargingRecipe::new)); + private static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Ingredient.CONTENTS_STREAM_CODEC, + AlkahestryChargingRecipe::getChargingIngredient, + ByteBufCodecs.INT, + AlkahestryChargingRecipe::getChargeToAdd, + AlkahestryChargingRecipe::new); - @Nullable @Override - public AlkahestryChargingRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { - return new AlkahestryChargingRecipe(recipeId, Ingredient.fromNetwork(buffer), buffer.readInt()); + public MapCodec codec() { + return CODEC; } @Override - public void toNetwork(FriendlyByteBuf buffer, AlkahestryChargingRecipe recipe) { - recipe.chargingIngredient.toNetwork(buffer); - buffer.writeInt(recipe.chargeToAdd); + public StreamCodec streamCodec() { + return STREAM_CODEC; } } - private static class TomeIngredient extends Ingredient { + private static class TomeIngredient implements ICustomIngredient { private final int chargeToAdd; + private final ItemStack tome; + private TomeIngredient(int chargeToAdd) { - super(Stream.of(new Ingredient.ItemValue(new ItemStack(ModItems.ALKAHESTRY_TOME.get())))); + super(); this.chargeToAdd = chargeToAdd; + this.tome = new ItemStack(ModItems.ALKAHESTRY_TOME.get()); } @Override @@ -172,9 +163,20 @@ public boolean test(ItemStack stack) { return stack.is(ModItems.ALKAHESTRY_TOME.get()) && AlkahestryTomeItem.getCharge(stack) + chargeToAdd <= AlkahestryTomeItem.getChargeLimit(); } + @Override + public Stream getItems() { + return Stream.of(tome); + } + @Override public boolean isSimple() { return false; } + + @Override + public IngredientType getType() { + //noinspection DataFlowIssue - the ingredient only exists to be returned in the list of ingredients, it is never serialized / deserialized + return null; + } } } diff --git a/src/main/java/reliquary/crafting/AlkahestryCraftingRecipe.java b/src/main/java/reliquary/crafting/AlkahestryCraftingRecipe.java index 74ffdfee..ccad311f 100644 --- a/src/main/java/reliquary/crafting/AlkahestryCraftingRecipe.java +++ b/src/main/java/reliquary/crafting/AlkahestryCraftingRecipe.java @@ -1,20 +1,18 @@ package reliquary.crafting; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.RegistryAccess; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; -import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.Level; -import net.minecraftforge.common.crafting.CraftingHelper; +import net.neoforged.neoforge.common.crafting.ICustomIngredient; +import net.neoforged.neoforge.common.crafting.IngredientType; import reliquary.init.ModItems; import reliquary.items.AlkahestryTomeItem; @@ -26,24 +24,22 @@ public class AlkahestryCraftingRecipe implements CraftingRecipe { private final int chargeNeeded; private final int resultCount; private ItemStack result = ItemStack.EMPTY; - private final ResourceLocation id; private final Ingredient tomeIngredient; - private AlkahestryCraftingRecipe(ResourceLocation id, Ingredient craftingIngredient, int chargeNeeded, int resultCount) { - this.id = id; + public AlkahestryCraftingRecipe(Ingredient craftingIngredient, int chargeNeeded, int resultCount) { this.craftingIngredient = craftingIngredient; this.chargeNeeded = chargeNeeded; - tomeIngredient = new TomeIngredient(chargeNeeded); + tomeIngredient = new TomeIngredient(chargeNeeded).toVanilla(); this.resultCount = resultCount; AlkahestryRecipeRegistry.registerCraftingRecipe(this); } @Override - public boolean matches(CraftingContainer inv, Level worldIn) { + public boolean matches(CraftingInput inv, Level level) { boolean hasIngredient = false; boolean hasTome = false; - for (int x = 0; x < inv.getContainerSize(); x++) { + for (int x = 0; x < inv.size(); x++) { ItemStack slotStack = inv.getItem(x); if (!slotStack.isEmpty()) { @@ -72,8 +68,8 @@ public NonNullList getIngredients() { } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { - for (int slot = 0; slot < inv.getContainerSize(); slot++) { + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { + for (int slot = 0; slot < inv.size(); slot++) { ItemStack stack = inv.getItem(slot); if (!stack.isEmpty() && stack.getItem() != ModItems.ALKAHESTRY_TOME.get()) { @@ -104,22 +100,17 @@ public ItemStack getResult() { } @Override - public ItemStack getResultItem(RegistryAccess registryAccess) { + public ItemStack getResultItem(HolderLookup.Provider registries) { return getResult(); } - @Override - public ResourceLocation getId() { - return id; - } - @Override public RecipeSerializer getSerializer() { return ModItems.ALKAHESTRY_CRAFTING_SERIALIZER.get(); } @Override - public NonNullList getRemainingItems(CraftingContainer inv) { + public NonNullList getRemainingItems(CraftingInput inv) { NonNullList remainingItems = CraftingRecipe.super.getRemainingItems(inv); addTomeWithUsedCharge(remainingItems, inv); @@ -127,7 +118,7 @@ public NonNullList getRemainingItems(CraftingContainer inv) { return remainingItems; } - private void addTomeWithUsedCharge(NonNullList remainingItems, CraftingContainer inv) { + private void addTomeWithUsedCharge(NonNullList remainingItems, CraftingInput inv) { for (int slot = 0; slot < remainingItems.size(); slot++) { ItemStack stack = inv.getItem(slot); @@ -150,44 +141,55 @@ public int getChargeNeeded() { return chargeNeeded; } + public Ingredient getCraftingIngredient() { + return craftingIngredient; + } + + public int getResultCount() { + return resultCount; + } + @Override public CraftingBookCategory category() { return CraftingBookCategory.MISC; } public static class Serializer implements RecipeSerializer { - @Override - public AlkahestryCraftingRecipe fromJson(ResourceLocation recipeId, JsonObject json) { - if (!json.has("ingredient")) { - throw new JsonParseException("No ingredient for alkahestry crafting recipe"); - } - - Ingredient ingredient = CraftingHelper.getIngredient(json.get("ingredient"), false); - int resultCount = GsonHelper.getAsInt(json, "result_count"); - int chargeNeeded = GsonHelper.getAsInt(json, "charge"); - return new AlkahestryCraftingRecipe(recipeId, ingredient, chargeNeeded, resultCount); - } + private static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Ingredient.CODEC_NONEMPTY.fieldOf("ingredient").forGetter(recipe -> recipe.craftingIngredient), + Codec.INT.fieldOf("charge").forGetter(recipe -> recipe.chargeNeeded), + Codec.INT.fieldOf("result_count").forGetter(recipe -> recipe.resultCount) + ) + .apply(instance, AlkahestryCraftingRecipe::new)); + private static final StreamCodec STREAM_CODEC = StreamCodec.composite( + Ingredient.CONTENTS_STREAM_CODEC, + AlkahestryCraftingRecipe::getCraftingIngredient, + ByteBufCodecs.INT, + AlkahestryCraftingRecipe::getChargeNeeded, + ByteBufCodecs.INT, + AlkahestryCraftingRecipe::getResultCount, + AlkahestryCraftingRecipe::new + ); - @Nullable @Override - public AlkahestryCraftingRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { - return new AlkahestryCraftingRecipe(recipeId, Ingredient.fromNetwork(buffer), buffer.readInt(), buffer.readInt()); + public MapCodec codec() { + return CODEC; } @Override - public void toNetwork(FriendlyByteBuf buffer, AlkahestryCraftingRecipe recipe) { - recipe.craftingIngredient.toNetwork(buffer); - buffer.writeInt(recipe.chargeNeeded); - buffer.writeInt(recipe.resultCount); + public StreamCodec streamCodec() { + return STREAM_CODEC; } } - private static class TomeIngredient extends Ingredient { + private static class TomeIngredient implements ICustomIngredient { private final int chargeNeeded; + private final ItemStack tomeStack; private TomeIngredient(int chargeNeeded) { - super(Stream.of(new Ingredient.ItemValue(AlkahestryTomeItem.setCharge(new ItemStack(ModItems.ALKAHESTRY_TOME.get()), chargeNeeded)))); + this.tomeStack = AlkahestryTomeItem.setCharge(new ItemStack(ModItems.ALKAHESTRY_TOME.get()), chargeNeeded); this.chargeNeeded = chargeNeeded; } @@ -195,5 +197,21 @@ private TomeIngredient(int chargeNeeded) { public boolean test(@Nullable ItemStack stack) { return stack != null && stack.is(ModItems.ALKAHESTRY_TOME.get()) && AlkahestryTomeItem.getCharge(stack) >= chargeNeeded; } + + @Override + public Stream getItems() { + return Stream.of(tomeStack); + } + + @Override + public boolean isSimple() { + return false; + } + + @Override + public IngredientType getType() { + //noinspection DataFlowIssue - the ingredient only exists to be returned in the list of ingredients, it is never serialized / deserialized + return null; + } } } diff --git a/src/main/java/reliquary/crafting/AlkahestryDrainRecipe.java b/src/main/java/reliquary/crafting/AlkahestryDrainRecipe.java index 8e8915c0..a17275c6 100644 --- a/src/main/java/reliquary/crafting/AlkahestryDrainRecipe.java +++ b/src/main/java/reliquary/crafting/AlkahestryDrainRecipe.java @@ -1,36 +1,28 @@ package reliquary.crafting; -import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.RegistryAccess; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; -import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.Level; -import net.minecraftforge.common.crafting.CraftingHelper; import reliquary.init.ModItems; import reliquary.items.AlkahestryTomeItem; -import reliquary.reference.Settings; - -import javax.annotation.Nullable; public class AlkahestryDrainRecipe implements CraftingRecipe { private final int chargeToDrain; private final ItemStack result; - private final ResourceLocation id; private final Ingredient tomeIngredient; - private AlkahestryDrainRecipe(ResourceLocation id, int chargeToDrain, ItemStack result) { + public AlkahestryDrainRecipe(int chargeToDrain, ItemStack result) { this.chargeToDrain = chargeToDrain; this.result = result; - this.id = id; - tomeIngredient = Ingredient.of(AlkahestryTomeItem.setCharge(new ItemStack(ModItems.ALKAHESTRY_TOME.get()), Settings.COMMON.items.alkahestryTome.chargeLimit.get())); + tomeIngredient = Ingredient.of(AlkahestryTomeItem.setCharge(new ItemStack(ModItems.ALKAHESTRY_TOME.get()), AlkahestryTomeItem.getChargeLimit())); AlkahestryRecipeRegistry.setDrainRecipe(this); } @@ -40,10 +32,10 @@ public boolean isSpecial() { } @Override - public boolean matches(CraftingContainer inv, Level worldIn) { + public boolean matches(CraftingInput inv, Level level) { boolean hasTome = false; ItemStack tome = ItemStack.EMPTY; - for (int slot = 0; slot < inv.getContainerSize(); slot++) { + for (int slot = 0; slot < inv.size(); slot++) { ItemStack stack = inv.getItem(slot); if (stack.isEmpty()) { continue; @@ -65,7 +57,7 @@ public NonNullList getIngredients() { } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { ItemStack tome = getTome(inv).copy(); int charge = AlkahestryTomeItem.getCharge(tome); @@ -75,8 +67,8 @@ public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) return ret; } - private ItemStack getTome(CraftingContainer inv) { - for (int slot = 0; slot < inv.getContainerSize(); slot++) { + private ItemStack getTome(CraftingInput inv) { + for (int slot = 0; slot < inv.size(); slot++) { ItemStack stack = inv.getItem(slot); if (stack.getItem() == ModItems.ALKAHESTRY_TOME.get()) { return stack; @@ -92,19 +84,14 @@ public boolean canCraftInDimensions(int width, int height) { } @Override - public ItemStack getResultItem(RegistryAccess registryAccess) { + public ItemStack getResultItem(HolderLookup.Provider registries) { return result; } @Override - public ResourceLocation getId() { - return id; - } - - @Override - public NonNullList getRemainingItems(CraftingContainer inv) { + public NonNullList getRemainingItems(CraftingInput inv) { NonNullList ret = CraftingRecipe.super.getRemainingItems(inv); - for (int slot = 0; slot < inv.getContainerSize(); slot++) { + for (int slot = 0; slot < inv.size(); slot++) { ItemStack stack = inv.getItem(slot); if (stack.getItem() == ModItems.ALKAHESTRY_TOME.get()) { ItemStack tome = stack.copy(); @@ -128,25 +115,39 @@ public CraftingBookCategory category() { return CraftingBookCategory.MISC; } - public static class Serializer implements RecipeSerializer { - @Override - public AlkahestryDrainRecipe fromJson(ResourceLocation recipeId, JsonObject json) { - int chargeToDrain = GsonHelper.getAsInt(json, "charge"); - ItemStack result = CraftingHelper.getItemStack(GsonHelper.getAsJsonObject(json, "result"), true); + private ItemStack getResult() { + return result; + } - return new AlkahestryDrainRecipe(recipeId, chargeToDrain, result); - } + private Integer getChargeToDrain() { + return chargeToDrain; + } + + public static class Serializer implements RecipeSerializer { + private static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Codec.INT.fieldOf("charge").forGetter(recipe -> recipe.chargeToDrain), + ItemStack.CODEC.fieldOf("result").forGetter(recipe -> recipe.result) + ) + .apply(instance, AlkahestryDrainRecipe::new)); + + private static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.INT, + AlkahestryDrainRecipe::getChargeToDrain, + ItemStack.STREAM_CODEC, + AlkahestryDrainRecipe::getResult, + AlkahestryDrainRecipe::new + ); - @Nullable @Override - public AlkahestryDrainRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { - return new AlkahestryDrainRecipe(recipeId, buffer.readInt(), buffer.readItem()); + public MapCodec codec() { + return CODEC; } @Override - public void toNetwork(FriendlyByteBuf buffer, AlkahestryDrainRecipe recipe) { - buffer.writeInt(recipe.chargeToDrain); - buffer.writeItem(recipe.result); + public StreamCodec streamCodec() { + return STREAM_CODEC; } + } } diff --git a/src/main/java/reliquary/crafting/AlkahestryRecipeRegistry.java b/src/main/java/reliquary/crafting/AlkahestryRecipeRegistry.java index 51e833fc..7ee39644 100644 --- a/src/main/java/reliquary/crafting/AlkahestryRecipeRegistry.java +++ b/src/main/java/reliquary/crafting/AlkahestryRecipeRegistry.java @@ -1,6 +1,6 @@ package reliquary.crafting; -import net.minecraftforge.event.AddReloadListenerEvent; +import net.neoforged.neoforge.event.AddReloadListenerEvent; import javax.annotation.Nullable; import java.util.ArrayList; diff --git a/src/main/java/reliquary/crafting/FragmentRecipeHelper.java b/src/main/java/reliquary/crafting/FragmentRecipeHelper.java index d56beb8e..ad3192e5 100644 --- a/src/main/java/reliquary/crafting/FragmentRecipeHelper.java +++ b/src/main/java/reliquary/crafting/FragmentRecipeHelper.java @@ -1,26 +1,26 @@ package reliquary.crafting; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.SpawnEggItem; -import net.minecraftforge.common.ForgeSpawnEggItem; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.world.item.crafting.CraftingInput; import reliquary.init.ModItems; import reliquary.items.MobCharmFragmentItem; import java.util.Optional; public class FragmentRecipeHelper { - private FragmentRecipeHelper() {} + private FragmentRecipeHelper() { + } public static final Item FALL_BACK_SPAWN_EGG = Items.CHICKEN_SPAWN_EGG; - public static boolean hasOnlyOneFragmentType(CraftingContainer inv) { - String regName = null; - for (int slot = 0; slot < inv.getContainerSize(); slot++) { + public static boolean hasOnlyOneFragmentType(CraftingInput inv) { + ResourceLocation regName = null; + for (int slot = 0; slot < inv.size(); slot++) { ItemStack slotStack = inv.getItem(slot); if (slotStack.getItem() != ModItems.MOB_CHARM_FRAGMENT.get()) { continue; @@ -37,8 +37,8 @@ public static boolean hasOnlyOneFragmentType(CraftingContainer inv) { return true; } - public static Optional getRegistryName(CraftingContainer inv) { - for (int slot = 0; slot < inv.getContainerSize(); slot++) { + public static Optional getRegistryName(CraftingInput inv) { + for (int slot = 0; slot < inv.size(); slot++) { ItemStack slotStack = inv.getItem(slot); if (slotStack.getItem() != ModItems.MOB_CHARM_FRAGMENT.get()) { continue; @@ -48,8 +48,8 @@ public static Optional getRegistryName(CraftingContainer inv) { return Optional.empty(); } - public static ItemStack getSpawnEggStack(String regName) { - SpawnEggItem spawnEggItem = ForgeSpawnEggItem.fromEntityType(ForgeRegistries.ENTITY_TYPES.getValue(new ResourceLocation(regName))); + public static ItemStack getSpawnEggStack(ResourceLocation regName) { + SpawnEggItem spawnEggItem = SpawnEggItem.byId(BuiltInRegistries.ENTITY_TYPE.get(regName)); return new ItemStack(spawnEggItem == null ? FALL_BACK_SPAWN_EGG : spawnEggItem); } } diff --git a/src/main/java/reliquary/crafting/FragmentToSpawnEggRecipe.java b/src/main/java/reliquary/crafting/FragmentToSpawnEggRecipe.java index b312106b..7c093dc6 100644 --- a/src/main/java/reliquary/crafting/FragmentToSpawnEggRecipe.java +++ b/src/main/java/reliquary/crafting/FragmentToSpawnEggRecipe.java @@ -1,60 +1,60 @@ package reliquary.crafting; -import com.google.gson.JsonObject; -import net.minecraft.core.RegistryAccess; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.CraftingContainer; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.HolderLookup; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.ShapelessRecipe; import net.minecraft.world.level.Level; - -import javax.annotation.Nullable; +import reliquary.init.ModItems; public class FragmentToSpawnEggRecipe extends ShapelessRecipe { - public static final Serializer SERIALIZER = new Serializer(); private final ShapelessRecipe recipeDelegate; public FragmentToSpawnEggRecipe(ShapelessRecipe recipeDelegate) { - super(recipeDelegate.getId(), recipeDelegate.getGroup(), CraftingBookCategory.MISC, recipeDelegate.result, recipeDelegate.getIngredients()); + super(recipeDelegate.getGroup(), CraftingBookCategory.MISC, recipeDelegate.result, recipeDelegate.getIngredients()); this.recipeDelegate = recipeDelegate; } @Override - public boolean matches(CraftingContainer inv, Level worldIn) { - return super.matches(inv, worldIn) && FragmentRecipeHelper.hasOnlyOneFragmentType(inv); + public boolean matches(CraftingInput inv, Level level) { + return super.matches(inv, level) && FragmentRecipeHelper.hasOnlyOneFragmentType(inv); } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { return FragmentRecipeHelper.getRegistryName(inv).map(FragmentRecipeHelper::getSpawnEggStack) .orElse(new ItemStack(FragmentRecipeHelper.FALL_BACK_SPAWN_EGG)); } + @Override + public RecipeSerializer getSerializer() { + return ModItems.FRAGMENT_TO_SPAWN_EGG_SERIALIZER.get(); + } + @Override public boolean isSpecial() { return true; } public static class Serializer implements RecipeSerializer { + private static final MapCodec CODEC = RecipeSerializer.SHAPELESS_RECIPE.codec() + .xmap(FragmentToSpawnEggRecipe::new, recipe -> recipe.recipeDelegate); + private static final StreamCodec STREAM_CODEC = RecipeSerializer.SHAPELESS_RECIPE.streamCodec() + .map(FragmentToSpawnEggRecipe::new, recipe -> recipe.recipeDelegate); @Override - public FragmentToSpawnEggRecipe fromJson(ResourceLocation recipeId, JsonObject json) { - return new FragmentToSpawnEggRecipe(RecipeSerializer.SHAPELESS_RECIPE.fromJson(recipeId, json)); - } - - @Nullable - @Override - public FragmentToSpawnEggRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { - //noinspection ConstantConditions - shapeless crafting recipe serializer always returns an instance here so no need to check for null - return new FragmentToSpawnEggRecipe(RecipeSerializer.SHAPELESS_RECIPE.fromNetwork(recipeId, buffer)); + public MapCodec codec() { + return CODEC; } @Override - public void toNetwork(FriendlyByteBuf buffer, FragmentToSpawnEggRecipe recipe) { - RecipeSerializer.SHAPELESS_RECIPE.toNetwork(buffer, recipe.recipeDelegate); + public StreamCodec streamCodec() { + return STREAM_CODEC; } } } diff --git a/src/main/java/reliquary/crafting/MobCharmRecipe.java b/src/main/java/reliquary/crafting/MobCharmRecipe.java index ed2a6b3e..d2f0cc50 100644 --- a/src/main/java/reliquary/crafting/MobCharmRecipe.java +++ b/src/main/java/reliquary/crafting/MobCharmRecipe.java @@ -1,19 +1,18 @@ package reliquary.crafting; -import com.google.gson.JsonObject; -import net.minecraft.core.RegistryAccess; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.CraftingContainer; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.HolderLookup; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.level.Level; import reliquary.init.ModItems; import reliquary.items.MobCharmItem; -import javax.annotation.Nullable; import java.util.HashSet; import java.util.Set; @@ -23,23 +22,19 @@ public class MobCharmRecipe extends ShapedRecipe { private final ShapedRecipe compose; public MobCharmRecipe(ShapedRecipe compose) { - super(compose.getId(), compose.getGroup(), CraftingBookCategory.MISC, compose.getRecipeWidth(), compose.getRecipeHeight(), compose.getIngredients(), compose.result); + super(compose.getGroup(), CraftingBookCategory.MISC, compose.pattern, compose.result); this.compose = compose; REGISTERED_RECIPES.add(this); } - public ShapedRecipe getCompose() { - return compose; - } - @Override - public boolean matches(CraftingContainer inv, Level worldIn) { - return super.matches(inv, worldIn) && FragmentRecipeHelper.hasOnlyOneFragmentType(inv); + public boolean matches(CraftingInput inv, Level level) { + return super.matches(inv, level) && FragmentRecipeHelper.hasOnlyOneFragmentType(inv); } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { - ItemStack ret = super.assemble(inv, registryAccess); + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { + ItemStack ret = super.assemble(inv, registries); FragmentRecipeHelper.getRegistryName(inv).ifPresent(regName -> MobCharmItem.setEntityRegistryName(ret, regName)); return ret; } @@ -55,21 +50,19 @@ public RecipeSerializer getSerializer() { } public static class Serializer implements RecipeSerializer { - @Override - public MobCharmRecipe fromJson(ResourceLocation recipeId, JsonObject json) { - return new MobCharmRecipe(RecipeSerializer.SHAPED_RECIPE.fromJson(recipeId, json)); - } + private static final MapCodec CODEC = RecipeSerializer.SHAPED_RECIPE.codec() + .xmap(MobCharmRecipe::new, recipe -> recipe.compose); + private static final StreamCodec STREAM_CODEC = RecipeSerializer.SHAPED_RECIPE.streamCodec() + .map(MobCharmRecipe::new, recipe -> recipe.compose); - @Nullable @Override - public MobCharmRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { - //noinspection ConstantConditions - shaped recipe serializer always returns an instance of recipe despite RecipeSerializer's null allowing contract - return new MobCharmRecipe(RecipeSerializer.SHAPED_RECIPE.fromNetwork(recipeId, buffer)); + public MapCodec codec() { + return CODEC; } @Override - public void toNetwork(FriendlyByteBuf buffer, MobCharmRecipe recipe) { - RecipeSerializer.SHAPED_RECIPE.toNetwork(buffer, recipe.compose); + public StreamCodec streamCodec() { + return STREAM_CODEC; } } } diff --git a/src/main/java/reliquary/crafting/MobCharmRecipeBuilder.java b/src/main/java/reliquary/crafting/MobCharmRecipeBuilder.java index 34983d3a..68caa086 100644 --- a/src/main/java/reliquary/crafting/MobCharmRecipeBuilder.java +++ b/src/main/java/reliquary/crafting/MobCharmRecipeBuilder.java @@ -2,74 +2,71 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementRewards; -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.advancements.RequirementsStrategy; +import net.minecraft.advancements.Criterion; import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.data.recipes.FinishedRecipe; +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.CraftingBookCategory; import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.ShapedRecipe; +import net.minecraft.world.item.crafting.ShapedRecipePattern; import net.minecraft.world.level.ItemLike; +import reliquary.Reliquary; import reliquary.init.ModItems; -import reliquary.reference.Reference; -import reliquary.util.RegistryHelper; -import javax.annotation.Nullable; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.function.Consumer; public class MobCharmRecipeBuilder { - private final List pattern = Lists.newArrayList(); + private final List rows = Lists.newArrayList(); private final Map key = Maps.newLinkedHashMap(); - private final Advancement.Builder advancementBuilder = Advancement.Builder.advancement(); + private final Map> criteria = new LinkedHashMap<>(); private String group; - private MobCharmRecipeBuilder() {} + private MobCharmRecipeBuilder() { + } public static MobCharmRecipeBuilder charmRecipe() { return new MobCharmRecipeBuilder(); } - public MobCharmRecipeBuilder key(Character symbol, TagKey tagIn) { - return key(symbol, Ingredient.of(tagIn)); + public MobCharmRecipeBuilder define(Character symbol, TagKey tag) { + return define(symbol, Ingredient.of(tag)); } - public MobCharmRecipeBuilder key(Character symbol, ItemLike itemIn) { - return key(symbol, Ingredient.of(itemIn)); + public MobCharmRecipeBuilder define(Character symbol, ItemLike item) { + return define(symbol, Ingredient.of(item)); } - public MobCharmRecipeBuilder key(Character symbol, Ingredient ingredientIn) { + public MobCharmRecipeBuilder define(Character symbol, Ingredient ingredient) { if (key.containsKey(symbol)) { throw new IllegalArgumentException("Symbol '" + symbol + "' is already defined!"); } else if (symbol == ' ') { throw new IllegalArgumentException("Symbol ' ' (whitespace) is reserved and cannot be defined"); } else { - key.put(symbol, ingredientIn); + key.put(symbol, ingredient); return this; } } - public MobCharmRecipeBuilder patternLine(String patternIn) { - if (!pattern.isEmpty() && patternIn.length() != pattern.get(0).length()) { + public MobCharmRecipeBuilder pattern(String pattern) { + if (!rows.isEmpty() && pattern.length() != rows.getFirst().length()) { throw new IllegalArgumentException("Pattern must be the same width on every line!"); } else { - pattern.add(patternIn); + rows.add(pattern); return this; } } - public MobCharmRecipeBuilder addCriterion(String name, CriterionTriggerInstance criterionIn) { - advancementBuilder.addCriterion(name, criterionIn); + public MobCharmRecipeBuilder unlockedBy(String name, Criterion criterion) { + criteria.put(name, criterion); return this; } @@ -78,98 +75,21 @@ public MobCharmRecipeBuilder setGroup(String groupIn) { return this; } - public void build(Consumer consumerIn) { - ResourceLocation id = new ResourceLocation(Reference.MOD_ID, "mob_charm"); - validate(id); - advancementBuilder.parent(new ResourceLocation("recipes/root")).addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)).rewards(AdvancementRewards.Builder.recipe(id)).requirements(RequirementsStrategy.OR); - consumerIn.accept(new Result(id, group == null ? "" : group, pattern, key, advancementBuilder, new ResourceLocation(id.getNamespace(), "recipes/" + id.getPath()))); + public void save(RecipeOutput recipeOutput) { + ResourceLocation id = Reliquary.getRL("mob_charm"); + Advancement.Builder advancementBuilder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) + .rewards(AdvancementRewards.Builder.recipe(id)) + .requirements(AdvancementRequirements.Strategy.OR); + criteria.forEach(advancementBuilder::addCriterion); + recipeOutput.accept(id, new MobCharmRecipe(new ShapedRecipe(group == null ? "" : group, CraftingBookCategory.MISC, ensureValid(id), new ItemStack(ModItems.MOB_CHARM.get()))), null); } - private void validate(ResourceLocation id) { - if (pattern.isEmpty()) { - throw new IllegalStateException("No pattern is defined for shaped recipe " + id + "!"); + private ShapedRecipePattern ensureValid(ResourceLocation id) { + if (criteria.isEmpty()) { + throw new IllegalStateException("No way of obtaining recipe " + id); } else { - Set set = Sets.newHashSet(key.keySet()); - set.remove(' '); - - for (String s : pattern) { - for (int i = 0; i < s.length(); ++i) { - char c0 = s.charAt(i); - if (!key.containsKey(c0) && c0 != ' ') { - throw new IllegalStateException("Pattern in recipe " + id + " uses undefined symbol '" + c0 + "'"); - } - - set.remove(c0); - } - } - - if (!set.isEmpty()) { - throw new IllegalStateException("Ingredients are defined but not used in pattern for recipe " + id); - } else if (pattern.size() == 1 && pattern.get(0).length() == 1) { - throw new IllegalStateException("Shaped recipe " + id + " only takes in a single item - should it be a shapeless recipe instead?"); - } else if (advancementBuilder.getCriteria().isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + id); - } - } - } - - public static class Result implements FinishedRecipe { - private final ResourceLocation id; - private final String group; - private final List pattern; - private final Map key; - private final Advancement.Builder advancementBuilder; - private final ResourceLocation advancementId; - - public Result(ResourceLocation idIn, String groupIn, List patternIn, Map keyIn, Advancement.Builder advancementBuilderIn, ResourceLocation advancementIdIn) { - id = idIn; - group = groupIn; - pattern = patternIn; - key = keyIn; - advancementBuilder = advancementBuilderIn; - advancementId = advancementIdIn; - } - - public void serializeRecipeData(JsonObject json) { - if (!group.isEmpty()) { - json.addProperty("group", group); - } - - JsonArray jsonarray = new JsonArray(); - - for (String s : pattern) { - jsonarray.add(s); - } - - json.add("pattern", jsonarray); - JsonObject jsonobject = new JsonObject(); - - for (Entry entry : key.entrySet()) { - jsonobject.add(String.valueOf(entry.getKey()), entry.getValue().toJson()); - } - - json.add("key", jsonobject); - JsonObject jsonobject1 = new JsonObject(); - jsonobject1.addProperty("item", RegistryHelper.getRegistryName(ModItems.MOB_CHARM.get()).toString()); - json.add("result", jsonobject1); - } - - public RecipeSerializer getType() { - return ModItems.MOB_CHARM_RECIPE_SERIALIZER.get(); - } - - public ResourceLocation getId() { - return id; - } - - @Nullable - public JsonObject serializeAdvancement() { - return advancementBuilder.serializeToJson(); - } - - @Nullable - public ResourceLocation getAdvancementId() { - return advancementId; + return ShapedRecipePattern.of(key, rows); } } } diff --git a/src/main/java/reliquary/crafting/MobCharmRepairRecipe.java b/src/main/java/reliquary/crafting/MobCharmRepairRecipe.java index ea76a3b3..52c0c778 100644 --- a/src/main/java/reliquary/crafting/MobCharmRepairRecipe.java +++ b/src/main/java/reliquary/crafting/MobCharmRepairRecipe.java @@ -1,35 +1,34 @@ package reliquary.crafting; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.RegistryAccess; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingBookCategory; +import net.minecraft.world.item.crafting.CraftingInput; import net.minecraft.world.item.crafting.CustomRecipe; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.Level; import reliquary.init.ModItems; import reliquary.items.MobCharmDefinition; import reliquary.items.MobCharmRegistry; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.Optional; public class MobCharmRepairRecipe extends CustomRecipe { private static final int PER_FRAGMENT_MULTIPLIER = 6; - public MobCharmRepairRecipe(ResourceLocation registryName, CraftingBookCategory category) { - super(registryName, category); + public MobCharmRepairRecipe(CraftingBookCategory category) { + super(category); } @Override - public boolean matches(CraftingContainer inv, Level worldIn) { + public boolean matches(CraftingInput inv, Level level) { ItemStack ingredient = ItemStack.EMPTY; int numberIngredients = 0; ItemStack mobCharm = ItemStack.EMPTY; - for (int i = 0; i < inv.getContainerSize(); i++) { + for (int i = 0; i < inv.size(); i++) { ItemStack currentStack = inv.getItem(i); if (!currentStack.isEmpty()) { if (currentStack.getItem() == ModItems.MOB_CHARM.get()) { @@ -63,17 +62,17 @@ public boolean matches(CraftingContainer inv, Level worldIn) { MobCharmDefinition charmDefinition = cd.get(); int repairMultiplier = charmDefinition.isDynamicallyCreated() ? PER_FRAGMENT_MULTIPLIER : 1; - int durabilityRepaired = Settings.COMMON.items.mobCharm.dropDurabilityRepair.get() * repairMultiplier; + int durabilityRepaired = Config.COMMON.items.mobCharm.dropDurabilityRepair.get() * repairMultiplier; return mobCharm.getDamageValue() >= durabilityRepaired * (numberIngredients - 1) && charmDefinition.isRepairItem(finalIngredient); } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { ItemStack ingredient = ItemStack.EMPTY; int numberIngredients = 0; ItemStack mobCharm = ItemStack.EMPTY; - for (int i = 0; i < inv.getContainerSize(); i++) { + for (int i = 0; i < inv.size(); i++) { ItemStack currentStack = inv.getItem(i); if (!currentStack.isEmpty()) { if (currentStack.getItem() == ModItems.MOB_CHARM.get()) { @@ -89,7 +88,7 @@ public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) ItemStack resultingMobCharm = mobCharm.copy(); - resultingMobCharm.setDamageValue(Math.max(resultingMobCharm.getDamageValue() - (Settings.COMMON.items.mobCharm.dropDurabilityRepair.get() * numberIngredients), 0)); + resultingMobCharm.setDamageValue(Math.max(resultingMobCharm.getDamageValue() - (Config.COMMON.items.mobCharm.dropDurabilityRepair.get() * numberIngredients), 0)); return resultingMobCharm; } @@ -100,8 +99,8 @@ public boolean canCraftInDimensions(int width, int height) { } @Override - public NonNullList getRemainingItems(CraftingContainer inv) { - return NonNullList.withSize(inv.getContainerSize(), ItemStack.EMPTY); + public NonNullList getRemainingItems(CraftingInput inv) { + return NonNullList.withSize(inv.size(), ItemStack.EMPTY); } @Override diff --git a/src/main/java/reliquary/crafting/NbtShapedRecipeBuilder.java b/src/main/java/reliquary/crafting/NbtShapedRecipeBuilder.java deleted file mode 100644 index f1bd7210..00000000 --- a/src/main/java/reliquary/crafting/NbtShapedRecipeBuilder.java +++ /dev/null @@ -1,223 +0,0 @@ -package reliquary.crafting; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import net.minecraft.advancements.Advancement; -import net.minecraft.advancements.AdvancementRewards; -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.advancements.RequirementsStrategy; -import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.data.recipes.RecipeCategory; -import net.minecraft.nbt.CompoundTag; -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.item.crafting.RecipeSerializer; -import net.minecraft.world.level.ItemLike; -import reliquary.util.RegistryHelper; - -import javax.annotation.Nullable; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Consumer; - -public class NbtShapedRecipeBuilder { - private final Item result; - private final int count; - private final List pattern = Lists.newArrayList(); - private final Map key = Maps.newLinkedHashMap(); - private final Advancement.Builder advancementBuilder = Advancement.Builder.advancement(); - private String group; - @Nullable - private final CompoundTag nbt; - - public NbtShapedRecipeBuilder(ItemLike result, int count, @Nullable CompoundTag nbt) { - this.result = result.asItem(); - this.count = count; - this.nbt = nbt; - } - - public static NbtShapedRecipeBuilder shapedRecipe(ItemStack stack) { - return shapedRecipe(stack.getItem(), stack.getCount(), stack.getTag()); - } - - public static NbtShapedRecipeBuilder shapedRecipe(ItemLike resultIn, @Nullable CompoundTag nbt) { - return shapedRecipe(resultIn, 1, nbt); - } - - public static NbtShapedRecipeBuilder shapedRecipe(ItemLike resultIn, int countIn, @Nullable CompoundTag nbt) { - return new NbtShapedRecipeBuilder(resultIn, countIn, nbt); - } - - public NbtShapedRecipeBuilder key(Character symbol, TagKey tagIn) { - return key(symbol, Ingredient.of(tagIn)); - } - - public NbtShapedRecipeBuilder key(Character symbol, ItemLike itemIn) { - return key(symbol, Ingredient.of(itemIn)); - } - - public NbtShapedRecipeBuilder key(Character symbol, Ingredient ingredientIn) { - if (key.containsKey(symbol)) { - throw new IllegalArgumentException("Symbol '" + symbol + "' is already defined!"); - } else if (symbol == ' ') { - throw new IllegalArgumentException("Symbol ' ' (whitespace) is reserved and cannot be defined"); - } else { - key.put(symbol, ingredientIn); - return this; - } - } - - public NbtShapedRecipeBuilder patternLine(String patternIn) { - if (!pattern.isEmpty() && patternIn.length() != pattern.get(0).length()) { - throw new IllegalArgumentException("Pattern must be the same width on every line!"); - } else { - pattern.add(patternIn); - return this; - } - } - - public NbtShapedRecipeBuilder addCriterion(String name, CriterionTriggerInstance criterionIn) { - advancementBuilder.addCriterion(name, criterionIn); - return this; - } - - public NbtShapedRecipeBuilder setGroup(String groupIn) { - group = groupIn; - return this; - } - - public void build(Consumer consumerIn) { - build(consumerIn, RegistryHelper.getRegistryName(result)); - } - - public void build(Consumer consumerIn, String save) { - ResourceLocation resourcelocation = RegistryHelper.getRegistryName(result); - if ((new ResourceLocation(save)).equals(resourcelocation)) { - throw new IllegalStateException("Shaped Recipe " + save + " should remove its 'save' argument"); - } else { - build(consumerIn, new ResourceLocation(save)); - } - } - - public void build(Consumer consumerIn, ResourceLocation id) { - validate(id); - advancementBuilder.parent(new ResourceLocation("recipes/root")).addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)).rewards(AdvancementRewards.Builder.recipe(id)).requirements(RequirementsStrategy.OR); - consumerIn.accept(new Result(id, result, count, nbt, group == null ? "" : group, pattern, key, advancementBuilder, new ResourceLocation(id.getNamespace(), "recipes/" + RecipeCategory.MISC.getFolderName() + "/" + id.getPath()))); - } - - private void validate(ResourceLocation id) { - if (pattern.isEmpty()) { - throw new IllegalStateException("No pattern is defined for shaped recipe " + id + "!"); - } else { - Set set = Sets.newHashSet(key.keySet()); - set.remove(' '); - - matchPatternIngredients(id, set); - - if (!set.isEmpty()) { - throw new IllegalStateException("Ingredients are defined but not used in pattern for recipe " + id); - } else if (pattern.size() == 1 && pattern.get(0).length() == 1) { - throw new IllegalStateException("Shaped recipe " + id + " only takes in a single item - should it be a shapeless recipe instead?"); - } else if (advancementBuilder.getCriteria().isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + id); - } - } - } - - private void matchPatternIngredients(ResourceLocation id, Set set) { - for (String s : pattern) { - for (int i = 0; i < s.length(); ++i) { - char c0 = s.charAt(i); - if (!key.containsKey(c0) && c0 != ' ') { - throw new IllegalStateException("Pattern in recipe " + id + " uses undefined symbol '" + c0 + "'"); - } - - set.remove(c0); - } - } - } - - public static class Result implements FinishedRecipe { - private final ResourceLocation id; - private final Item resultItem; - private final int resultCount; - @Nullable - private final CompoundTag resultNbt; - private final String group; - private final List pattern; - private final Map key; - private final Advancement.Builder advancementBuilder; - private final ResourceLocation advancementId; - - @SuppressWarnings("java:S107") - public Result(ResourceLocation idIn, Item resultIn, int countIn, @Nullable - CompoundTag resultNbt, String groupIn, List patternIn, Map keyIn, Advancement.Builder advancementBuilderIn, ResourceLocation advancementIdIn) { - id = idIn; - resultItem = resultIn; - resultCount = countIn; - this.resultNbt = resultNbt; - group = groupIn; - pattern = patternIn; - key = keyIn; - advancementBuilder = advancementBuilderIn; - advancementId = advancementIdIn; - } - - public void serializeRecipeData(JsonObject json) { - if (!group.isEmpty()) { - json.addProperty("group", group); - } - - JsonArray jsonarray = new JsonArray(); - - for (String s : pattern) { - jsonarray.add(s); - } - - json.add("pattern", jsonarray); - JsonObject jsonobject = new JsonObject(); - - for (Map.Entry entry : key.entrySet()) { - jsonobject.add(String.valueOf(entry.getKey()), entry.getValue().toJson()); - } - - json.add("key", jsonobject); - JsonObject resultObject = new JsonObject(); - resultObject.addProperty("item", RegistryHelper.getRegistryName(resultItem).toString()); - if (resultCount > 1) { - resultObject.addProperty("count", resultCount); - } - if (resultNbt != null) { - resultObject.addProperty("nbt", resultNbt.toString()); - } - - json.add("result", resultObject); - } - - public RecipeSerializer getType() { - return RecipeSerializer.SHAPED_RECIPE; - } - - public ResourceLocation getId() { - return id; - } - - @Nullable - public JsonObject serializeAdvancement() { - return advancementBuilder.serializeToJson(); - } - - @Nullable - public ResourceLocation getAdvancementId() { - return advancementId; - } - } -} diff --git a/src/main/java/reliquary/crafting/PotionEffectsRecipe.java b/src/main/java/reliquary/crafting/PotionEffectsRecipe.java index dd2359d6..40f9b131 100644 --- a/src/main/java/reliquary/crafting/PotionEffectsRecipe.java +++ b/src/main/java/reliquary/crafting/PotionEffectsRecipe.java @@ -1,91 +1,91 @@ package reliquary.crafting; -import com.google.gson.JsonObject; +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.core.RegistryAccess; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.inventory.CraftingContainer; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.Tuple; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.item.crafting.ShapedRecipe; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.Level; import reliquary.init.ModItems; import reliquary.items.util.IPotionItem; -import reliquary.util.potions.XRPotionHelper; +import reliquary.util.potions.PotionHelper; -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; import java.util.Optional; public class PotionEffectsRecipe implements CraftingRecipe { - private final ShapedRecipe compose; + private final ShapedRecipePattern pattern; + private final ItemStack result; + private final String group; private final float potionDurationFactor; - private PotionEffectsRecipe(ShapedRecipe compose, float potionDurationFactor) { - this.compose = compose; + public PotionEffectsRecipe(String group, ShapedRecipePattern pattern, ItemStack result, float potionDurationFactor) { + this.group = group; + this.pattern = pattern; + this.result = result; this.potionDurationFactor = potionDurationFactor; } @Override - public ItemStack assemble(CraftingContainer inv, RegistryAccess registryAccess) { - ItemStack newOutput = compose.getResultItem(registryAccess).copy(); + public ItemStack assemble(CraftingInput inv, HolderLookup.Provider registries) { + ItemStack newOutput = result.copy(); - findMatchAndUpdateEffects(inv).ifPresent(targetEffects -> XRPotionHelper.addPotionEffectsToStack(newOutput, targetEffects)); + findMatchAndUpdatePotionContents(inv).ifPresent(potionContents -> PotionHelper.addPotionContentsToStack(newOutput, potionContents)); return newOutput; } @Override public boolean canCraftInDimensions(int width, int height) { - return width >= compose.getRecipeWidth() && height >= compose.getRecipeHeight(); + return width >= pattern.width() && height >= pattern.height(); } - private Optional> findMatchAndUpdateEffects(CraftingContainer inv) { - List targetEffects; - for (int startX = 0; startX <= inv.getWidth() - compose.getRecipeWidth(); startX++) { - for (int startY = 0; startY <= inv.getHeight() - compose.getRecipeHeight(); ++startY) { - targetEffects = new ArrayList<>(); - if (checkMatchAndUpdateEffects(inv, targetEffects, startX, startY, false)) { - return Optional.of(targetEffects); + private Optional findMatchAndUpdatePotionContents(CraftingInput inv) { + for (int startX = 0; startX <= inv.width() - pattern.width(); startX++) { + for (int startY = 0; startY <= inv.width() - pattern.height(); ++startY) { + Optional ret = checkMatchAndUpdatePotionContents(inv, startX, startY, false); + if (ret.isPresent()) { + return ret; } - targetEffects = new ArrayList<>(); - if (checkMatchAndUpdateEffects(inv, targetEffects, startX, startY, true)) { - return Optional.of(targetEffects); + ret = checkMatchAndUpdatePotionContents(inv, startX, startY, true); + if (ret.isPresent()) { + return ret; } } } return Optional.empty(); } - private boolean checkMatchAndUpdateEffects(CraftingContainer inv, List targetEffects, int startX, int startY, boolean mirror) { - for (int x = 0; x < compose.getRecipeWidth(); x++) { - for (int y = 0; y < compose.getRecipeHeight(); y++) { + private Optional checkMatchAndUpdatePotionContents(CraftingInput inv, int startX, int startY, boolean mirror) { + PotionContents targetPotionContents = PotionContents.EMPTY; + for (int x = 0; x < pattern.width(); x++) { + for (int y = 0; y < pattern.height(); y++) { int subX = x - startX; int subY = y - startY; Ingredient target = getTarget(subX, subY, mirror); - if (target.test(inv.getItem(x + y * inv.getWidth()))) { - updateTargetEffects(inv, targetEffects, x, y); + ItemStack stack = inv.getItem(x + y * inv.width()); + if (target.test(stack)) { + targetPotionContents = updateTargetEffects(stack, targetPotionContents).getB(); } else { - return false; + return Optional.empty(); } } } - return true; + return Optional.of(targetPotionContents); } @Override - public boolean matches(CraftingContainer inv, Level world) { - for (int x = 0; x <= inv.getWidth() - compose.getRecipeWidth(); x++) { - for (int y = 0; y <= inv.getHeight() - compose.getRecipeHeight(); ++y) { + public boolean matches(CraftingInput inv, Level level) { + for (int x = 0; x <= inv.width() - pattern.width(); x++) { + for (int y = 0; y <= inv.height() - pattern.height(); ++y) { if (checkMatch(inv, x, y, false)) { return true; } @@ -99,68 +99,64 @@ public boolean matches(CraftingContainer inv, Level world) { return false; } - private boolean checkMatch(CraftingContainer inv, int startX, int startY, boolean mirror) { - List targetEffects = new ArrayList<>(); - for (int x = 0; x < inv.getWidth(); x++) { - for (int y = 0; y < inv.getHeight(); y++) { + private boolean checkMatch(CraftingInput inv, int startX, int startY, boolean mirror) { + PotionContents targetPotionContents = PotionContents.EMPTY; + for (int x = 0; x < inv.width(); x++) { + for (int y = 0; y < inv.height(); y++) { int subX = x - startX; int subY = y - startY; Ingredient target = getTarget(subX, subY, mirror); - if (!target.test(inv.getItem(x + y * inv.getWidth()))) { + ItemStack stack = inv.getItem(x + y * inv.width()); + if (!target.test(stack)) { return false; } - if (!updateTargetEffects(inv, targetEffects, x, y)) { + Tuple result = updateTargetEffects(stack, targetPotionContents); + if (!result.getA()) { return false; } - + targetPotionContents = result.getB(); } } return true; } @Override - public ItemStack getResultItem(RegistryAccess registryAccess) { - return compose.getResultItem(registryAccess); + public ItemStack getResultItem(HolderLookup.Provider registries) { + return result; } @Override public NonNullList getIngredients() { - return compose.getIngredients(); - } - - @Override - public ResourceLocation getId() { - return compose.getId(); + return pattern.ingredients(); } private Ingredient getTarget(int subX, int subY, boolean mirror) { - if (subX >= 0 && subY >= 0 && subX < compose.getRecipeWidth() && subY < compose.getRecipeHeight()) { + if (subX >= 0 && subY >= 0 && subX < pattern.width() && subY < pattern.height()) { if (mirror) { - return compose.getIngredients().get(compose.getRecipeWidth() - subX - 1 + subY * compose.getRecipeWidth()); + return pattern.ingredients().get(pattern.width() - subX - 1 + subY * pattern.width()); } else { - return compose.getIngredients().get(subX + subY * compose.getRecipeWidth()); + return pattern.ingredients().get(subX + subY * pattern.width()); } } return Ingredient.EMPTY; } - private boolean updateTargetEffects(CraftingContainer inv, List targetEffects, int x, int y) { - ItemStack invStack = inv.getItem(x + y * inv.getWidth()); - if (invStack.getItem() instanceof IPotionItem potionItem) { - List effects = potionItem.getEffects(invStack); - if (effects.isEmpty()) { - return true; + private Tuple updateTargetEffects(ItemStack stack, PotionContents targetPotionContents) { + if (stack.getItem() instanceof IPotionItem potionItem) { + PotionContents potionContents = potionItem.getPotionContents(stack); + if (!potionContents.hasEffects()) { + return new Tuple<>(true, targetPotionContents); } - if (targetEffects.isEmpty()) { - targetEffects.addAll(XRPotionHelper.changePotionEffectsDuration(effects, potionDurationFactor)); + if (!targetPotionContents.hasEffects()) { + targetPotionContents = PotionHelper.changePotionEffectsDuration(potionContents, potionDurationFactor); } else { - return XRPotionHelper.changePotionEffectsDuration(effects, potionDurationFactor).equals(targetEffects); // Two items with different MobEffects marked as to be copied + return new Tuple<>(PotionHelper.changePotionEffectsDuration(potionContents, potionDurationFactor).equals(targetPotionContents), targetPotionContents); // Two items with different MobEffects marked as to be copied } } - return true; + return new Tuple<>(true, targetPotionContents); } @Override @@ -178,23 +174,48 @@ public CraftingBookCategory category() { return CraftingBookCategory.MISC; } + public ShapedRecipePattern getPattern() { + return pattern; + } + + public ItemStack getResult() { + return result; + } + + public float getPotionDurationFactor() { + return potionDurationFactor; + } + public static class Serializer implements RecipeSerializer { - @Override - public PotionEffectsRecipe fromJson(ResourceLocation recipeId, JsonObject json) { - return new PotionEffectsRecipe(RecipeSerializer.SHAPED_RECIPE.fromJson(recipeId, json), GsonHelper.getAsFloat(json, "duration_factor", 1.0f)); - } + private static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + Codec.STRING.optionalFieldOf("group", "").forGetter(recipe -> recipe.group), + ShapedRecipePattern.MAP_CODEC.forGetter(recipe -> recipe.pattern), + ItemStack.STRICT_CODEC.fieldOf("result").forGetter(recipe -> recipe.result), + Codec.FLOAT.fieldOf("duration_factor").forGetter(recipe -> recipe.potionDurationFactor) + ) + .apply(instance, PotionEffectsRecipe::new)); + + private static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.STRING_UTF8, + PotionEffectsRecipe::getGroup, + ShapedRecipePattern.STREAM_CODEC, + PotionEffectsRecipe::getPattern, + ItemStack.STREAM_CODEC, + PotionEffectsRecipe::getResult, + ByteBufCodecs.FLOAT, + PotionEffectsRecipe::getPotionDurationFactor, + PotionEffectsRecipe::new + ); - @Nullable @Override - public PotionEffectsRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer) { - //noinspection ConstantConditions - shaped recipe serializer always returns an instance of recipe despite RecipeSerializer's null allowing contract - return new PotionEffectsRecipe(RecipeSerializer.SHAPED_RECIPE.fromNetwork(recipeId, buffer), buffer.readFloat()); + public MapCodec codec() { + return CODEC; } @Override - public void toNetwork(FriendlyByteBuf buffer, PotionEffectsRecipe recipe) { - RecipeSerializer.SHAPED_RECIPE.toNetwork(buffer, recipe.compose); - buffer.writeFloat(recipe.potionDurationFactor); + public StreamCodec streamCodec() { + return STREAM_CODEC; } } } diff --git a/src/main/java/reliquary/crafting/PotionEffectsRecipeBuilder.java b/src/main/java/reliquary/crafting/PotionEffectsRecipeBuilder.java index a28f47ce..96e0ce8a 100644 --- a/src/main/java/reliquary/crafting/PotionEffectsRecipeBuilder.java +++ b/src/main/java/reliquary/crafting/PotionEffectsRecipeBuilder.java @@ -1,33 +1,40 @@ package reliquary.crafting; -import com.google.gson.JsonObject; -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.data.recipes.RecipeCategory; -import net.minecraft.data.recipes.ShapedRecipeBuilder; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +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.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.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.ShapedRecipePattern; import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.crafting.ConditionalRecipe; -import net.minecraftforge.common.crafting.conditions.ICondition; import reliquary.crafting.conditions.PotionsEnabledCondition; -import reliquary.init.ModItems; import javax.annotation.Nullable; -import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; -import java.util.function.Consumer; +import java.util.Map; +import java.util.Objects; public class PotionEffectsRecipeBuilder { - private final ShapedRecipeBuilder shapedRecipeBuilder; - private final List additionalConditions = new ArrayList<>(); + private final Item result; + private final int count; + private final List rows = Lists.newArrayList(); + private final Map key = Maps.newLinkedHashMap(); + private final Map> criteria = new LinkedHashMap<>(); + @Nullable + private String group; private final float durationFactor; - private PotionEffectsRecipeBuilder(ItemLike item, int count, float durationFactor) { - shapedRecipeBuilder = ShapedRecipeBuilder.shaped(RecipeCategory.MISC, item, count); + private PotionEffectsRecipeBuilder(ItemLike result, int count, float durationFactor) { + this.result = result.asItem(); + this.count = count; this.durationFactor = durationFactor; } @@ -35,79 +42,60 @@ public static PotionEffectsRecipeBuilder potionEffectsRecipe(ItemLike item, int return new PotionEffectsRecipeBuilder(item, count, durationFactor); } - public PotionEffectsRecipeBuilder addCondition(ICondition condition) { - additionalConditions.add(condition); - return this; - } - - public PotionEffectsRecipeBuilder key(Character symbol, TagKey tagIn) { - return key(symbol, Ingredient.of(tagIn)); + public PotionEffectsRecipeBuilder define(Character symbol, ItemLike item) { + return define(symbol, Ingredient.of(item)); } - public PotionEffectsRecipeBuilder key(Character symbol, ItemLike itemIn) { - return key(symbol, Ingredient.of(itemIn)); + public PotionEffectsRecipeBuilder define(Character symbol, Ingredient ingredient) { + if (key.containsKey(symbol)) { + throw new IllegalArgumentException("Symbol '" + symbol + "' is already defined!"); + } else if (symbol == ' ') { + throw new IllegalArgumentException("Symbol ' ' (whitespace) is reserved and cannot be defined"); + } else { + key.put(symbol, ingredient); + return this; + } } - public PotionEffectsRecipeBuilder key(Character symbol, Ingredient ingredient) { - shapedRecipeBuilder.define(symbol, ingredient); + public PotionEffectsRecipeBuilder unlockedBy(String name, Criterion criterion) { + criteria.put(name, criterion); return this; } - public PotionEffectsRecipeBuilder patternLine(String pattern) { - shapedRecipeBuilder.pattern(pattern); - return this; + public PotionEffectsRecipeBuilder pattern(String pattern) { + if (!rows.isEmpty() && pattern.length() != rows.getFirst().length()) { + throw new IllegalArgumentException("Pattern must be the same width on every line!"); + } else { + rows.add(pattern); + return this; + } } - public PotionEffectsRecipeBuilder addCriterion(String name, CriterionTriggerInstance criterion) { - shapedRecipeBuilder.unlockedBy(name, criterion); + public PotionEffectsRecipeBuilder group(@Nullable String groupName) { + group = groupName; return this; } - public void build(Consumer consumer, ResourceLocation id) { - ConditionalRecipe.Builder builder = ConditionalRecipe.builder() - .addCondition(new PotionsEnabledCondition()); - additionalConditions.forEach(builder::addCondition); - shapedRecipeBuilder.save(shapedResult -> builder.addRecipe(conditionalConsumer -> conditionalConsumer.accept(new Result(id, shapedResult, durationFactor)))); - builder.build(consumer, id); + public void save(RecipeOutput recipeOutput, ResourceLocation id) { + Advancement.Builder advancementBuilder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) + .rewards(AdvancementRewards.Builder.recipe(id)) + .requirements(AdvancementRequirements.Strategy.OR); + criteria.forEach(advancementBuilder::addCriterion); + recipeOutput.withConditions(new PotionsEnabledCondition()).accept(id, + new PotionEffectsRecipe( + Objects.requireNonNullElse(group, ""), + ensureValid(id), + new ItemStack(result, count), + durationFactor + ), null); } - public static class Result implements FinishedRecipe { - private final ResourceLocation id; - private final FinishedRecipe shapedResult; - private final float durationFactor; - - public Result(ResourceLocation id, FinishedRecipe shapedResult, float durationFactor) { - this.id = id; - this.shapedResult = shapedResult; - this.durationFactor = durationFactor; - } - - @Override - public void serializeRecipeData(JsonObject json) { - shapedResult.serializeRecipeData(json); - json.addProperty("duration_factor", durationFactor); - } - - @Override - public ResourceLocation getId() { - return id; - } - - @Override - public RecipeSerializer getType() { - return ModItems.POTION_EFFECTS_SERIALIZER.get(); - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return null; - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return null; + private ShapedRecipePattern ensureValid(ResourceLocation id) { + if (criteria.isEmpty()) { + throw new IllegalStateException("No way of obtaining recipe " + id); + } else { + return ShapedRecipePattern.of(key, rows); } } } diff --git a/src/main/java/reliquary/crafting/SpawnEggRecipeBuilder.java b/src/main/java/reliquary/crafting/SpawnEggRecipeBuilder.java index 699bf898..915f69b6 100644 --- a/src/main/java/reliquary/crafting/SpawnEggRecipeBuilder.java +++ b/src/main/java/reliquary/crafting/SpawnEggRecipeBuilder.java @@ -1,29 +1,29 @@ package reliquary.crafting; -import com.google.common.collect.Lists; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRequirements; import net.minecraft.advancements.AdvancementRewards; -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.advancements.RequirementsStrategy; +import net.minecraft.advancements.Criterion; import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.core.NonNullList; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.CraftingBookCategory; import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.ShapelessRecipe; import net.minecraft.world.level.ItemLike; -import reliquary.init.ModItems; -import javax.annotation.Nullable; -import java.util.List; -import java.util.function.Consumer; +import java.util.LinkedHashMap; +import java.util.Map; public class SpawnEggRecipeBuilder { - private final List ingredients = Lists.newArrayList(); - private final Advancement.Builder advancementBuilder = Advancement.Builder.advancement(); + private final NonNullList ingredients = NonNullList.create(); + private final Map> criteria = new LinkedHashMap<>(); - private SpawnEggRecipeBuilder() {} + private SpawnEggRecipeBuilder() { + } public static SpawnEggRecipeBuilder spawnEggRecipe() { return new SpawnEggRecipeBuilder(); @@ -34,67 +34,24 @@ public SpawnEggRecipeBuilder addIngredient(ItemLike itemProvider) { return this; } - public SpawnEggRecipeBuilder addCriterion(String name, CriterionTriggerInstance criterionIn) { - advancementBuilder.addCriterion(name, criterionIn); + public SpawnEggRecipeBuilder unlockedBy(String name, Criterion criterionIn) { + criteria.put(name, criterionIn); return this; } - public void build(Consumer consumerIn, ResourceLocation id) { - if (advancementBuilder.getCriteria().isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + id); - } - advancementBuilder.parent(new ResourceLocation("recipes/root")).addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)).rewards(AdvancementRewards.Builder.recipe(id)).requirements(RequirementsStrategy.OR); - consumerIn.accept(new Result(id, ingredients, advancementBuilder, new ResourceLocation(id.getNamespace(), "recipes/" + id.getPath()))); - + public void build(RecipeOutput recipeOutput, ResourceLocation id) { + ensureValid(id); + Advancement.Builder advancementBuilder = recipeOutput.advancement() + .addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(id)) + .rewards(AdvancementRewards.Builder.recipe(id)) + .requirements(AdvancementRequirements.Strategy.OR); + criteria.forEach(advancementBuilder::addCriterion); + recipeOutput.accept(id, new FragmentToSpawnEggRecipe(new ShapelessRecipe("", CraftingBookCategory.MISC, new ItemStack(Items.CHICKEN_SPAWN_EGG), ingredients)), advancementBuilder.build(id.withPrefix("recipes/"))); } - public static class Result implements FinishedRecipe { - private final List ingredients; - private final Advancement.Builder advancementBuilder; - private final ResourceLocation advancementId; - private final ResourceLocation id; - - public Result(ResourceLocation id, List ingredients, Advancement.Builder advancementBuilder, ResourceLocation advancementId) { - this.id = id; - this.ingredients = ingredients; - this.advancementBuilder = advancementBuilder; - this.advancementId = advancementId; - } - - @Override - public void serializeRecipeData(JsonObject json) { - JsonArray jsonarray = new JsonArray(); - - for (Ingredient ingredient : ingredients) { - jsonarray.add(ingredient.toJson()); - } - - json.add("ingredients", jsonarray); - JsonObject jsonobject = new JsonObject(); - jsonobject.addProperty("item", "minecraft:chicken_spawn_egg"); - json.add("result", jsonobject); - } - - @Override - public ResourceLocation getId() { - return id; - } - - @Override - public RecipeSerializer getType() { - return ModItems.FRAGMENT_TO_SPAWN_EGG_SERIALIZER.get(); - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return advancementBuilder.serializeToJson(); - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return advancementId; + private void ensureValid(ResourceLocation id) { + if (criteria.isEmpty()) { + throw new IllegalStateException("No way of obtaining recipe " + id); } } } diff --git a/src/main/java/reliquary/crafting/alkahestry/ChargingRecipeBuilder.java b/src/main/java/reliquary/crafting/alkahestry/ChargingRecipeBuilder.java index 83c15b55..0c84a9b1 100644 --- a/src/main/java/reliquary/crafting/alkahestry/ChargingRecipeBuilder.java +++ b/src/main/java/reliquary/crafting/alkahestry/ChargingRecipeBuilder.java @@ -1,18 +1,12 @@ package reliquary.crafting.alkahestry; -import com.google.gson.JsonObject; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.crafting.ConditionalRecipe; +import reliquary.Reliquary; +import reliquary.crafting.AlkahestryChargingRecipe; import reliquary.crafting.conditions.AlkahestryEnabledCondition; -import reliquary.init.ModItems; -import reliquary.reference.Reference; - -import javax.annotation.Nullable; -import java.util.function.Consumer; public class ChargingRecipeBuilder { private final Ingredient ingredient; @@ -27,52 +21,9 @@ public static ChargingRecipeBuilder chargingRecipe(ItemLike result, int charge) return new ChargingRecipeBuilder(result, charge); } - public void build(Consumer consumer, ResourceLocation id) { - ResourceLocation fullId = new ResourceLocation(Reference.MOD_ID, "alkahestry/charging/" + id.getPath()); - ConditionalRecipe.builder() - .addCondition(new AlkahestryEnabledCondition()) - .addRecipe(conditionalConsumer -> conditionalConsumer.accept(new Result(fullId, ingredient, charge))) - .build(consumer, fullId); - } - - public static class Result implements FinishedRecipe { - private final Ingredient ingredient; - private final int charge; - private final ResourceLocation id; - - public Result(ResourceLocation id, Ingredient ingredient, int charge) { - this.id = id; - this.ingredient = ingredient; - this.charge = charge; - } - - @Override - public void serializeRecipeData(JsonObject json) { - json.addProperty("charge", charge); - json.add("ingredient", ingredient.toJson()); - } - - @Override - public ResourceLocation getId() { - return id; - } - - @Override - public RecipeSerializer getType() { - return ModItems.ALKAHESTRY_CHARGING_SERIALIZER.get(); - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return null; - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return null; - } + public void build(RecipeOutput recipeOutput, ResourceLocation id) { + ResourceLocation fullId = Reliquary.getRL("alkahestry/charging/" + id.getPath()); + recipeOutput.withConditions(new AlkahestryEnabledCondition()) + .accept(fullId, new AlkahestryChargingRecipe(ingredient, charge), null); } - } diff --git a/src/main/java/reliquary/crafting/alkahestry/CraftingRecipeBuilder.java b/src/main/java/reliquary/crafting/alkahestry/CraftingRecipeBuilder.java index cd46d1d2..01f744e8 100644 --- a/src/main/java/reliquary/crafting/alkahestry/CraftingRecipeBuilder.java +++ b/src/main/java/reliquary/crafting/alkahestry/CraftingRecipeBuilder.java @@ -1,32 +1,22 @@ package reliquary.crafting.alkahestry; -import com.google.gson.JsonObject; -import net.minecraft.data.recipes.FinishedRecipe; +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.crafting.RecipeSerializer; import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.crafting.ConditionalRecipe; -import net.minecraftforge.common.crafting.conditions.ICondition; +import reliquary.Reliquary; +import reliquary.crafting.AlkahestryCraftingRecipe; import reliquary.crafting.conditions.AlkahestryEnabledCondition; -import reliquary.init.ModItems; -import reliquary.reference.Reference; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Consumer; public class CraftingRecipeBuilder { - private final Ingredient item; + private final Ingredient ingredient; private final int charge; private final int resultCount; - private final List additionalConditions = new ArrayList<>(); - private CraftingRecipeBuilder(Ingredient item, int charge, int resultCount) { - this.item = item; + private CraftingRecipeBuilder(Ingredient ingredient, int charge, int resultCount) { + this.ingredient = ingredient; this.charge = charge; this.resultCount = resultCount; } @@ -39,60 +29,9 @@ public static CraftingRecipeBuilder craftingRecipe(TagKey tag, int charge, return new CraftingRecipeBuilder(Ingredient.of(tag), charge, resultCount); } - public CraftingRecipeBuilder addCondition(ICondition condition) { - additionalConditions.add(condition); - return this; - } - - public void build(Consumer consumer, ResourceLocation id) { - ResourceLocation fullId = new ResourceLocation(Reference.MOD_ID, "alkahestry/crafting/" + id.getPath()); - ConditionalRecipe.Builder builder = ConditionalRecipe.builder() - .addCondition(new AlkahestryEnabledCondition()); - additionalConditions.forEach(builder::addCondition); - builder.addRecipe(conditionalConsumer -> conditionalConsumer.accept(new Result(fullId, item, charge, resultCount))); - builder.build(consumer, fullId); - } - - public static class Result implements FinishedRecipe { - private final Ingredient item; - private final int charge; - private final int resultCount; - private final ResourceLocation id; - - public Result(ResourceLocation id, Ingredient item, int charge, int resultCount) { - this.id = id; - this.item = item; - this.charge = charge; - this.resultCount = resultCount; - } - - @Override - public void serializeRecipeData(JsonObject json) { - json.addProperty("charge", charge); - json.add("ingredient", item.toJson()); - json.addProperty("result_count", resultCount); - } - - @Override - public ResourceLocation getId() { - return id; - } - - @Override - public RecipeSerializer getType() { - return ModItems.ALKAHESTRY_CRAFTING_SERIALIZER.get(); - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return null; - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return null; - } + public void save(RecipeOutput recipeOutput, ResourceLocation id) { + ResourceLocation fullId = Reliquary.getRL("alkahestry/crafting/" + id.getPath()); + recipeOutput.withConditions(new AlkahestryEnabledCondition()) + .accept(fullId, new AlkahestryCraftingRecipe(ingredient, charge, resultCount), null); } } diff --git a/src/main/java/reliquary/crafting/alkahestry/DrainRecipeBuilder.java b/src/main/java/reliquary/crafting/alkahestry/DrainRecipeBuilder.java index 5622ba87..ef771cbc 100644 --- a/src/main/java/reliquary/crafting/alkahestry/DrainRecipeBuilder.java +++ b/src/main/java/reliquary/crafting/alkahestry/DrainRecipeBuilder.java @@ -1,19 +1,13 @@ package reliquary.crafting.alkahestry; -import com.google.gson.JsonObject; -import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeOutput; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; -import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; -import net.minecraftforge.common.crafting.ConditionalRecipe; +import reliquary.Reliquary; +import reliquary.crafting.AlkahestryDrainRecipe; import reliquary.crafting.conditions.AlkahestryEnabledCondition; -import reliquary.init.ModItems; -import reliquary.reference.Reference; -import reliquary.util.RegistryHelper; - -import javax.annotation.Nullable; -import java.util.function.Consumer; public class DrainRecipeBuilder { private final Item itemResult; @@ -28,53 +22,9 @@ public static DrainRecipeBuilder drainRecipe(ItemLike result, int charge) { return new DrainRecipeBuilder(result, charge); } - public void build(Consumer consumer, ResourceLocation id) { - ResourceLocation fullId = new ResourceLocation(Reference.MOD_ID, "alkahestry/drain/" + id.getPath()); - ConditionalRecipe.builder() - .addCondition(new AlkahestryEnabledCondition()) - .addRecipe(conditionalConsumer -> conditionalConsumer.accept(new DrainRecipeBuilder.Result(fullId, itemResult, charge))) - .build(consumer, fullId); - } - - public static class Result implements FinishedRecipe { - private final Item itemResult; - private final int charge; - private final ResourceLocation id; - - public Result(ResourceLocation id, Item itemResult, int charge) { - this.id = id; - this.itemResult = itemResult; - this.charge = charge; - } - - @Override - public void serializeRecipeData(JsonObject json) { - json.addProperty("charge", charge); - JsonObject resultObject = new JsonObject(); - resultObject.addProperty("item", RegistryHelper.getItemRegistryName(itemResult)); - json.add("result", resultObject); - } - - @Override - public ResourceLocation getId() { - return id; - } - - @Override - public RecipeSerializer getType() { - return ModItems.ALKAHESTRY_DRAIN_SERIALIZER.get(); - } - - @Nullable - @Override - public JsonObject serializeAdvancement() { - return null; - } - - @Nullable - @Override - public ResourceLocation getAdvancementId() { - return null; - } + public void build(RecipeOutput recipeOutput, ResourceLocation id) { + ResourceLocation fullId = Reliquary.getRL("alkahestry/drain/" + id.getPath()); + recipeOutput.withConditions(new AlkahestryEnabledCondition()) + .accept(fullId, new AlkahestryDrainRecipe(charge, new ItemStack(itemResult)), null); } } diff --git a/src/main/java/reliquary/crafting/conditions/AlkahestryEnabledCondition.java b/src/main/java/reliquary/crafting/conditions/AlkahestryEnabledCondition.java index a41f621f..2fdba994 100644 --- a/src/main/java/reliquary/crafting/conditions/AlkahestryEnabledCondition.java +++ b/src/main/java/reliquary/crafting/conditions/AlkahestryEnabledCondition.java @@ -1,21 +1,25 @@ package reliquary.crafting.conditions; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.crafting.conditions.ICondition; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import com.mojang.serialization.MapCodec; +import net.neoforged.neoforge.common.conditions.ICondition; +import reliquary.reference.Config; public class AlkahestryEnabledCondition implements ICondition { - private static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "alkahestry_enabled"); - public static final SimpleConditionSerializer SERIALIZER = new SimpleConditionSerializer<>(ID, AlkahestryEnabledCondition::new); + private static final AlkahestryEnabledCondition INSTANCE = new AlkahestryEnabledCondition(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); @Override - public ResourceLocation getID() { - return ID; + public boolean test(IContext context) { + return !Config.COMMON.disable.disableAlkahestry.get(); } @Override - public boolean test(IContext context) { - return !Settings.COMMON.disable.disableAlkahestry.get(); + public MapCodec codec() { + return CODEC; + } + + @Override + public String toString() { + return "alkahestry_enabled"; } } diff --git a/src/main/java/reliquary/crafting/conditions/HandgunEnabledCondition.java b/src/main/java/reliquary/crafting/conditions/HandgunEnabledCondition.java index 16edc8d1..2a3cb74e 100644 --- a/src/main/java/reliquary/crafting/conditions/HandgunEnabledCondition.java +++ b/src/main/java/reliquary/crafting/conditions/HandgunEnabledCondition.java @@ -1,21 +1,25 @@ package reliquary.crafting.conditions; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.crafting.conditions.ICondition; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import com.mojang.serialization.MapCodec; +import net.neoforged.neoforge.common.conditions.ICondition; +import reliquary.reference.Config; public class HandgunEnabledCondition implements ICondition { - private static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "handgun_enabled"); - public static final SimpleConditionSerializer SERIALIZER = new SimpleConditionSerializer<>(ID, HandgunEnabledCondition::new); + private static final HandgunEnabledCondition INSTANCE = new HandgunEnabledCondition(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); @Override - public ResourceLocation getID() { - return ID; + public boolean test(IContext context) { + return !Config.COMMON.disable.disableHandgun.get(); } @Override - public boolean test(IContext context) { - return !Settings.COMMON.disable.disableHandgun.get(); + public MapCodec codec() { + return CODEC; + } + + @Override + public String toString() { + return "handgun_enabled"; } } diff --git a/src/main/java/reliquary/crafting/conditions/MobDropsCraftableCondition.java b/src/main/java/reliquary/crafting/conditions/MobDropsCraftableCondition.java index 70b9307a..03b68186 100644 --- a/src/main/java/reliquary/crafting/conditions/MobDropsCraftableCondition.java +++ b/src/main/java/reliquary/crafting/conditions/MobDropsCraftableCondition.java @@ -1,21 +1,20 @@ package reliquary.crafting.conditions; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.crafting.conditions.ICondition; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import com.mojang.serialization.MapCodec; +import net.neoforged.neoforge.common.conditions.ICondition; +import reliquary.reference.Config; public class MobDropsCraftableCondition implements ICondition { - private static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "mob_drops_craftable"); - public static final SimpleConditionSerializer SERIALIZER = new SimpleConditionSerializer<>(ID, MobDropsCraftableCondition::new); + private static final MobDropsCraftableCondition INSTANCE = new MobDropsCraftableCondition(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); @Override - public ResourceLocation getID() { - return ID; + public boolean test(IContext context) { + return Config.COMMON.dropCraftingRecipesEnabled.get(); } @Override - public boolean test(IContext context) { - return Settings.COMMON.dropCraftingRecipesEnabled.get(); + public MapCodec codec() { + return CODEC; } } diff --git a/src/main/java/reliquary/crafting/conditions/PassivePedestalEnabledCondition.java b/src/main/java/reliquary/crafting/conditions/PassivePedestalEnabledCondition.java index 29d08b48..f77c9251 100644 --- a/src/main/java/reliquary/crafting/conditions/PassivePedestalEnabledCondition.java +++ b/src/main/java/reliquary/crafting/conditions/PassivePedestalEnabledCondition.java @@ -1,21 +1,20 @@ package reliquary.crafting.conditions; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.crafting.conditions.ICondition; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import com.mojang.serialization.MapCodec; +import net.neoforged.neoforge.common.conditions.ICondition; +import reliquary.reference.Config; public class PassivePedestalEnabledCondition implements ICondition { - private static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "passive_pedestal_enabled"); - public static final SimpleConditionSerializer SERIALIZER = new SimpleConditionSerializer<>(ID, PassivePedestalEnabledCondition::new); + private static final PassivePedestalEnabledCondition INSTANCE = new PassivePedestalEnabledCondition(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); @Override - public ResourceLocation getID() { - return ID; + public boolean test(IContext context) { + return !Config.COMMON.disable.disablePassivePedestal.get(); } @Override - public boolean test(IContext context) { - return !Settings.COMMON.disable.disablePassivePedestal.get(); + public MapCodec codec() { + return CODEC; } } diff --git a/src/main/java/reliquary/crafting/conditions/PedestalEnabledCondition.java b/src/main/java/reliquary/crafting/conditions/PedestalEnabledCondition.java index 42cf7da4..e73fe25e 100644 --- a/src/main/java/reliquary/crafting/conditions/PedestalEnabledCondition.java +++ b/src/main/java/reliquary/crafting/conditions/PedestalEnabledCondition.java @@ -1,21 +1,20 @@ package reliquary.crafting.conditions; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.crafting.conditions.ICondition; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import com.mojang.serialization.MapCodec; +import net.neoforged.neoforge.common.conditions.ICondition; +import reliquary.reference.Config; public class PedestalEnabledCondition implements ICondition { - private static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "pedestal_enabled"); - public static final SimpleConditionSerializer SERIALIZER = new SimpleConditionSerializer<>(ID, PedestalEnabledCondition::new); + private static final PedestalEnabledCondition INSTANCE = new PedestalEnabledCondition(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); @Override - public ResourceLocation getID() { - return ID; + public boolean test(IContext context) { + return !Config.COMMON.disable.disablePedestal.get(); } @Override - public boolean test(IContext context) { - return !Settings.COMMON.disable.disablePedestal.get(); + public MapCodec codec() { + return CODEC; } } diff --git a/src/main/java/reliquary/crafting/conditions/PotionsEnabledCondition.java b/src/main/java/reliquary/crafting/conditions/PotionsEnabledCondition.java index 0ee20dbb..70d6cbc7 100644 --- a/src/main/java/reliquary/crafting/conditions/PotionsEnabledCondition.java +++ b/src/main/java/reliquary/crafting/conditions/PotionsEnabledCondition.java @@ -1,21 +1,20 @@ package reliquary.crafting.conditions; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.crafting.conditions.ICondition; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import com.mojang.serialization.MapCodec; +import net.neoforged.neoforge.common.conditions.ICondition; +import reliquary.reference.Config; public class PotionsEnabledCondition implements ICondition { - private static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "potions_enabled"); - public static final SimpleConditionSerializer SERIALIZER = new SimpleConditionSerializer<>(ID, PotionsEnabledCondition::new); + private static final PotionsEnabledCondition INSTANCE = new PotionsEnabledCondition(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); @Override - public ResourceLocation getID() { - return ID; + public boolean test(IContext context) { + return !Config.COMMON.disable.disablePotions.get(); } @Override - public boolean test(IContext context) { - return !Settings.COMMON.disable.disablePotions.get(); + public MapCodec codec() { + return CODEC; } } diff --git a/src/main/java/reliquary/crafting/conditions/SimpleConditionSerializer.java b/src/main/java/reliquary/crafting/conditions/SimpleConditionSerializer.java deleted file mode 100644 index d9272c59..00000000 --- a/src/main/java/reliquary/crafting/conditions/SimpleConditionSerializer.java +++ /dev/null @@ -1,33 +0,0 @@ -package reliquary.crafting.conditions; - -import com.google.gson.JsonObject; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.crafting.conditions.ICondition; -import net.minecraftforge.common.crafting.conditions.IConditionSerializer; - -import java.util.function.Supplier; - -public class SimpleConditionSerializer implements IConditionSerializer { - private final ResourceLocation id; - private final Supplier instantiate; - - public SimpleConditionSerializer(ResourceLocation id, Supplier instantiate) { - this.id = id; - this.instantiate = instantiate; - } - - @Override - public void write(JsonObject json, T value) { - //noop - } - - @Override - public T read(JsonObject json) { - return instantiate.get(); - } - - @Override - public ResourceLocation getID() { - return id; - } -} diff --git a/src/main/java/reliquary/crafting/conditions/SpawnEggEnabledCondition.java b/src/main/java/reliquary/crafting/conditions/SpawnEggEnabledCondition.java index dd61bfb0..59de60da 100644 --- a/src/main/java/reliquary/crafting/conditions/SpawnEggEnabledCondition.java +++ b/src/main/java/reliquary/crafting/conditions/SpawnEggEnabledCondition.java @@ -1,21 +1,20 @@ package reliquary.crafting.conditions; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.crafting.conditions.ICondition; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import com.mojang.serialization.MapCodec; +import net.neoforged.neoforge.common.conditions.ICondition; +import reliquary.reference.Config; public class SpawnEggEnabledCondition implements ICondition { - private static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "spawn_egg_enabled"); - public static final SimpleConditionSerializer SERIALIZER = new SimpleConditionSerializer<>(ID, SpawnEggEnabledCondition::new); + private static final SpawnEggEnabledCondition INSTANCE = new SpawnEggEnabledCondition(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE).stable(); @Override - public ResourceLocation getID() { - return ID; + public boolean test(IContext context) { + return !Config.COMMON.disable.disableSpawnEggRecipes.get(); } @Override - public boolean test(IContext context) { - return !Settings.COMMON.disable.disableSpawnEggRecipes.get(); + public MapCodec codec() { + return CODEC; } } diff --git a/src/main/java/reliquary/data/BlockLootSubProvider.java b/src/main/java/reliquary/data/BlockLootSubProvider.java index ffec9471..97c9b4d6 100644 --- a/src/main/java/reliquary/data/BlockLootSubProvider.java +++ b/src/main/java/reliquary/data/BlockLootSubProvider.java @@ -1,29 +1,30 @@ package reliquary.data; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.flag.FeatureFlags; import net.minecraft.world.level.block.Block; -import net.minecraftforge.registries.ForgeRegistries; -import reliquary.reference.Reference; +import reliquary.Reliquary; import java.util.Map; import java.util.Set; class BlockLootSubProvider extends net.minecraft.data.loot.BlockLootSubProvider { - protected BlockLootSubProvider() { - super(Set.of(), FeatureFlags.REGISTRY.allFlags()); + protected BlockLootSubProvider(HolderLookup.Provider registries) { + super(Set.of(), FeatureFlags.REGISTRY.allFlags(), registries); } @Override public void generate() { - ForgeRegistries.BLOCKS.getEntries().stream() - .filter(e -> e.getKey().location().getNamespace().equals(Reference.MOD_ID)) + BuiltInRegistries.BLOCK.entrySet().stream() + .filter(e -> e.getKey().location().getNamespace().equals(Reliquary.MOD_ID)) .map(Map.Entry::getValue).forEach(this::dropSelf); } @Override protected Iterable getKnownBlocks() { - return ForgeRegistries.BLOCKS.getEntries().stream() - .filter(e -> e.getKey().location().getNamespace().equals(Reference.MOD_ID)) + return BuiltInRegistries.BLOCK.entrySet().stream() + .filter(e -> e.getKey().location().getNamespace().equals(Reliquary.MOD_ID)) .map(Map.Entry::getValue) .toList(); } diff --git a/src/main/java/reliquary/data/BlockTagProvider.java b/src/main/java/reliquary/data/BlockTagProvider.java index f8b528c8..f7d6fcc2 100644 --- a/src/main/java/reliquary/data/BlockTagProvider.java +++ b/src/main/java/reliquary/data/BlockTagProvider.java @@ -3,26 +3,27 @@ import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.tags.BlockTags; -import net.minecraftforge.common.data.BlockTagsProvider; -import net.minecraftforge.common.data.ExistingFileHelper; -import net.minecraftforge.registries.RegistryObject; +import net.neoforged.neoforge.common.data.BlockTagsProvider; +import net.neoforged.neoforge.common.data.ExistingFileHelper; +import reliquary.Reliquary; import reliquary.blocks.PassivePedestalBlock; import reliquary.blocks.PedestalBlock; import reliquary.init.ModBlocks; -import reliquary.reference.Reference; import javax.annotation.Nullable; import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; public class BlockTagProvider extends BlockTagsProvider { public BlockTagProvider(PackOutput output, CompletableFuture lookupProvider, @Nullable ExistingFileHelper existingFileHelper) { - super(output, lookupProvider, Reference.MOD_ID, existingFileHelper); + super(output, lookupProvider, Reliquary.MOD_ID, existingFileHelper); } @Override protected void addTags(HolderLookup.Provider provider) { - tag(BlockTags.MINEABLE_WITH_PICKAXE).add(ModBlocks.PEDESTALS.values().stream().map(RegistryObject::get).toArray(PedestalBlock[]::new)); - tag(BlockTags.MINEABLE_WITH_PICKAXE).add(ModBlocks.PASSIVE_PEDESTALS.values().stream().map(RegistryObject::get).toArray(PassivePedestalBlock[]::new)); + tag(BlockTags.MINEABLE_WITH_PICKAXE).add(ModBlocks.PEDESTALS.values().stream().map(Supplier::get).toArray(PedestalBlock[]::new)); + tag(BlockTags.MINEABLE_WITH_PICKAXE).add(ModBlocks.PASSIVE_PEDESTALS.values().stream().map(Supplier::get).toArray(PassivePedestalBlock[]::new)); tag(BlockTags.MINEABLE_WITH_PICKAXE).add(ModBlocks.ALKAHESTRY_ALTAR.get(), ModBlocks.APOTHECARY_CAULDRON.get(), ModBlocks.APOTHECARY_MORTAR.get(), ModBlocks.WRAITH_NODE.get()); + tag(BlockTags.WALL_POST_OVERRIDE).add(ModBlocks.INTERDICTION_TORCH.get()); } } diff --git a/src/main/java/reliquary/data/ChestLootEnabledCondition.java b/src/main/java/reliquary/data/ChestLootEnabledCondition.java index cc8c0eec..0415036e 100644 --- a/src/main/java/reliquary/data/ChestLootEnabledCondition.java +++ b/src/main/java/reliquary/data/ChestLootEnabledCondition.java @@ -1,15 +1,15 @@ package reliquary.data; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; -import com.google.gson.JsonSerializationContext; +import com.mojang.serialization.MapCodec; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; public class ChestLootEnabledCondition implements LootItemCondition { + private static final ChestLootEnabledCondition INSTANCE = new ChestLootEnabledCondition(); + public static final MapCodec CODEC = MapCodec.unit(INSTANCE); private ChestLootEnabledCondition() { } @@ -21,7 +21,7 @@ public LootItemConditionType getType() { @Override public boolean test(LootContext lootContext) { - return Boolean.TRUE.equals(Settings.COMMON.chestLootEnabled.get()); + return Boolean.TRUE.equals(Config.COMMON.chestLootEnabled.get()); } public static Builder builder() { @@ -34,16 +34,4 @@ public LootItemCondition build() { return new ChestLootEnabledCondition(); } } - - public static class Serializer implements net.minecraft.world.level.storage.loot.Serializer { - @Override - public void serialize(JsonObject object, ChestLootEnabledCondition instance, JsonSerializationContext ctx) { - //nothing to serialize - } - - @Override - public ChestLootEnabledCondition deserialize(JsonObject object, JsonDeserializationContext ctx) { - return new ChestLootEnabledCondition(); - } - } } diff --git a/src/main/java/reliquary/data/ChestLootInjectSubProvider.java b/src/main/java/reliquary/data/ChestLootInjectSubProvider.java index 50c5cd1a..d66e353f 100644 --- a/src/main/java/reliquary/data/ChestLootInjectSubProvider.java +++ b/src/main/java/reliquary/data/ChestLootInjectSubProvider.java @@ -1,6 +1,9 @@ package reliquary.data; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.loot.LootTableSubProvider; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; import net.minecraft.world.level.storage.loot.BuiltInLootTables; @@ -11,9 +14,9 @@ import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; +import reliquary.Reliquary; import reliquary.init.ModBlocks; import reliquary.init.ModItems; -import reliquary.reference.Reference; import java.util.HashMap; import java.util.Map; @@ -21,27 +24,33 @@ public class ChestLootInjectSubProvider implements LootTableSubProvider { - protected static final Map LOOT_INJECTS = new HashMap<>(); + protected static final Map, ResourceKey> LOOT_INJECTS = new HashMap<>(); - private static ResourceLocation registerLootInject(ResourceLocation vanillaLootTable) { - return LOOT_INJECTS.computeIfAbsent(vanillaLootTable, k -> new ResourceLocation(Reference.MOD_ID, INJECT_FOLDER + vanillaLootTable.getPath())); + private static final String INJECT_FOLDER = "inject/"; + public static final ResourceKey ABANDONED_MINESHAFT = createInjectLootTableRegistryKey(BuiltInLootTables.ABANDONED_MINESHAFT); + public static final ResourceKey DESERT_PYRAMID = createInjectLootTableRegistryKey(BuiltInLootTables.DESERT_PYRAMID); + public static final ResourceKey END_CITY_TREASURE = createInjectLootTableRegistryKey(BuiltInLootTables.END_CITY_TREASURE); + public static final ResourceKey IGLOO_CHEST = createInjectLootTableRegistryKey(BuiltInLootTables.IGLOO_CHEST); + public static final ResourceKey JUNGLE_TEMPLE = createInjectLootTableRegistryKey(BuiltInLootTables.JUNGLE_TEMPLE); + public static final ResourceKey NETHER_BRIDGE = createInjectLootTableRegistryKey(BuiltInLootTables.NETHER_BRIDGE); + public static final ResourceKey SIMPLE_DUNGEON = createInjectLootTableRegistryKey(BuiltInLootTables.SIMPLE_DUNGEON); + public static final ResourceKey STRONGHOLD_CORRIDOR = createInjectLootTableRegistryKey(BuiltInLootTables.STRONGHOLD_CORRIDOR); + public static final ResourceKey STRONGHOLD_CROSSING = createInjectLootTableRegistryKey(BuiltInLootTables.STRONGHOLD_CROSSING); + public static final ResourceKey STRONGHOLD_LIBRARY = createInjectLootTableRegistryKey(BuiltInLootTables.STRONGHOLD_LIBRARY); + public static final ResourceKey VILLAGE_WEAPONSMITH = createInjectLootTableRegistryKey(BuiltInLootTables.VILLAGE_WEAPONSMITH); + + private static ResourceKey createInjectLootTableRegistryKey(ResourceKey vanillaLootTable) { + ResourceLocation location = Reliquary.getRL(INJECT_FOLDER + vanillaLootTable.location().getPath()); + ResourceKey injectLootTable = ResourceKey.create(Registries.LOOT_TABLE, location); + LOOT_INJECTS.put(vanillaLootTable, injectLootTable); + return injectLootTable; } - private static final String INJECT_FOLDER = "inject/"; - public static final ResourceLocation ABANDONED_MINESHAFT = registerLootInject(BuiltInLootTables.ABANDONED_MINESHAFT); - public static final ResourceLocation DESERT_PYRAMID = registerLootInject(BuiltInLootTables.DESERT_PYRAMID); - public static final ResourceLocation END_CITY_TREASURE = registerLootInject(BuiltInLootTables.END_CITY_TREASURE); - public static final ResourceLocation IGLOO_CHEST = registerLootInject(BuiltInLootTables.IGLOO_CHEST); - public static final ResourceLocation JUNGLE_TEMPLE = registerLootInject(BuiltInLootTables.JUNGLE_TEMPLE); - public static final ResourceLocation NETHER_BRIDGE = registerLootInject(BuiltInLootTables.NETHER_BRIDGE); - public static final ResourceLocation SIMPLE_DUNGEON = registerLootInject(BuiltInLootTables.SIMPLE_DUNGEON); - public static final ResourceLocation STRONGHOLD_CORRIDOR = registerLootInject(BuiltInLootTables.STRONGHOLD_CORRIDOR); - public static final ResourceLocation STRONGHOLD_CROSSING = registerLootInject(BuiltInLootTables.STRONGHOLD_CROSSING); - public static final ResourceLocation STRONGHOLD_LIBRARY = registerLootInject(BuiltInLootTables.STRONGHOLD_LIBRARY); - public static final ResourceLocation VILLAGE_WEAPONSMITH = registerLootInject(BuiltInLootTables.VILLAGE_WEAPONSMITH); + public ChestLootInjectSubProvider(HolderLookup.Provider registries) { + } @Override - public void generate(BiConsumer tables) { + public void generate(BiConsumer, LootTable.Builder> tables) { tables.accept(ABANDONED_MINESHAFT, getLootTable(61, getItemLootEntry(ModItems.RIB_BONE.get(), 10, 2), getItemLootEntry(ModItems.SLIME_PEARL.get(), 8, 3), diff --git a/src/main/java/reliquary/data/DataGenerators.java b/src/main/java/reliquary/data/DataGenerators.java index 832e68ec..dc2d568a 100644 --- a/src/main/java/reliquary/data/DataGenerators.java +++ b/src/main/java/reliquary/data/DataGenerators.java @@ -1,22 +1,36 @@ package reliquary.data; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.core.registries.Registries; import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; -import net.minecraftforge.data.event.GatherDataEvent; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.neoforged.neoforge.data.event.GatherDataEvent; +import reliquary.Reliquary; + +import java.util.Set; +import java.util.concurrent.CompletableFuture; public class DataGenerators { - private DataGenerators() {} + private DataGenerators() { + } public static void gatherData(GatherDataEvent evt) { DataGenerator generator = evt.getGenerator(); PackOutput packOutput = generator.getPackOutput(); + CompletableFuture registries = evt.getLookupProvider(); + + DatapackBuiltinEntriesProvider builtinEntriesProvider = new DatapackBuiltinEntriesProvider(packOutput, evt.getLookupProvider(), + new RegistrySetBuilder().add(Registries.ENCHANTMENT, ReliquaryEnchantmentProvider::bootstrap), Set.of(Reliquary.MOD_ID)); + generator.addProvider(evt.includeServer(), builtinEntriesProvider); - generator.addProvider(evt.includeServer(), new ReliquaryLootProvider(packOutput)); - BlockTagProvider blockTagProvider = new BlockTagProvider(packOutput, evt.getLookupProvider(), evt.getExistingFileHelper()); + generator.addProvider(evt.includeServer(), new ReliquaryLootTableProvider(packOutput, builtinEntriesProvider.getRegistryProvider())); + BlockTagProvider blockTagProvider = new BlockTagProvider(packOutput, registries, evt.getExistingFileHelper()); generator.addProvider(evt.includeServer(), blockTagProvider); - generator.addProvider(evt.includeServer(), new ItemTagProvider(packOutput, evt.getLookupProvider(), blockTagProvider.contentsGetter(), evt.getExistingFileHelper())); - generator.addProvider(evt.includeServer(), new ModRecipeProvider(packOutput)); - generator.addProvider(evt.includeServer(), new ModFluidTagsProvider(packOutput, evt.getLookupProvider(), evt.getExistingFileHelper())); - generator.addProvider(evt.includeServer(), new ReliquaryLootModifierProvider(packOutput)); + generator.addProvider(evt.includeServer(), new ItemTagProvider(packOutput, registries, blockTagProvider.contentsGetter(), evt.getExistingFileHelper())); + generator.addProvider(evt.includeServer(), new ModRecipeProvider(packOutput, registries)); + generator.addProvider(evt.includeServer(), new ModFluidTagsProvider(packOutput, registries, evt.getExistingFileHelper())); + generator.addProvider(evt.includeServer(), new ReliquaryLootModifierProvider(packOutput, registries)); } } diff --git a/src/main/java/reliquary/data/EntityLootEnabledCondition.java b/src/main/java/reliquary/data/EntityLootEnabledCondition.java index 7d087a6d..2cb0c904 100644 --- a/src/main/java/reliquary/data/EntityLootEnabledCondition.java +++ b/src/main/java/reliquary/data/EntityLootEnabledCondition.java @@ -1,15 +1,15 @@ package reliquary.data; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; -import com.google.gson.JsonSerializationContext; +import com.mojang.serialization.MapCodec; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; public class EntityLootEnabledCondition implements LootItemCondition { + private static final EntityLootEnabledCondition INSTANCE = new EntityLootEnabledCondition(); + public static final MapCodec CODEC = MapCodec.unit(() -> INSTANCE); private EntityLootEnabledCondition() { } @@ -21,7 +21,7 @@ public LootItemConditionType getType() { @Override public boolean test(LootContext lootContext) { - return Boolean.TRUE.equals(Settings.COMMON.mobDropsEnabled.get()); + return Boolean.TRUE.equals(Config.COMMON.mobDropsEnabled.get()); } public static Builder builder() { @@ -34,16 +34,4 @@ public LootItemCondition build() { return new EntityLootEnabledCondition(); } } - - public static class Serializer implements net.minecraft.world.level.storage.loot.Serializer { - @Override - public void serialize(JsonObject object, EntityLootEnabledCondition instance, JsonSerializationContext ctx) { - //nothing to serialize - } - - @Override - public EntityLootEnabledCondition deserialize(JsonObject object, JsonDeserializationContext ctx) { - return new EntityLootEnabledCondition(); - } - } } diff --git a/src/main/java/reliquary/data/EntityLootInjectSubProvider.java b/src/main/java/reliquary/data/EntityLootInjectSubProvider.java index a095c176..e4cc8450 100644 --- a/src/main/java/reliquary/data/EntityLootInjectSubProvider.java +++ b/src/main/java/reliquary/data/EntityLootInjectSubProvider.java @@ -2,8 +2,11 @@ import net.minecraft.advancements.critereon.EntityPredicate; import net.minecraft.advancements.critereon.NbtPredicate; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.loot.LootTableSubProvider; import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; @@ -12,10 +15,12 @@ import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemEntityPropertyCondition; import net.minecraft.world.level.storage.loot.predicates.LootItemKilledByPlayerCondition; +import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceWithEnchantedBonusCondition; +import reliquary.Reliquary; import reliquary.init.ModItems; -import reliquary.reference.Reference; import java.util.HashMap; import java.util.Map; @@ -24,34 +29,44 @@ public class EntityLootInjectSubProvider implements LootTableSubProvider { private static final String INJECT_FOLDER = "inject/"; - protected static final Map LOOT_INJECTS = new HashMap<>(); - private static ResourceLocation registerLootInject(ResourceLocation vanillaLootTable) { - return LOOT_INJECTS.computeIfAbsent(vanillaLootTable, k -> new ResourceLocation(Reference.MOD_ID, INJECT_FOLDER + vanillaLootTable.getPath())); + protected static final Map, ResourceKey> LOOT_INJECTS = new HashMap<>(); + + public static final ResourceKey BAT = createInjectLootTableRegistryKey(EntityType.BAT.getDefaultLootTable()); + public static final ResourceKey BLAZE = createInjectLootTableRegistryKey(EntityType.BLAZE.getDefaultLootTable()); + public static final ResourceKey CAVE_SPIDER = createInjectLootTableRegistryKey(EntityType.CAVE_SPIDER.getDefaultLootTable()); + public static final ResourceKey CREEPER = createInjectLootTableRegistryKey(EntityType.CREEPER.getDefaultLootTable()); + public static final ResourceKey ENDERMAN = createInjectLootTableRegistryKey(EntityType.ENDERMAN.getDefaultLootTable()); + public static final ResourceKey GHAST = createInjectLootTableRegistryKey(EntityType.GHAST.getDefaultLootTable()); + public static final ResourceKey GUARDIAN = createInjectLootTableRegistryKey(EntityType.GUARDIAN.getDefaultLootTable()); + public static final ResourceKey HUSK = createInjectLootTableRegistryKey(EntityType.HUSK.getDefaultLootTable()); + public static final ResourceKey MAGMA_CUBE = createInjectLootTableRegistryKey(EntityType.MAGMA_CUBE.getDefaultLootTable()); + public static final ResourceKey SKELETON = createInjectLootTableRegistryKey(EntityType.SKELETON.getDefaultLootTable()); + public static final ResourceKey SNOW_GOLEM = createInjectLootTableRegistryKey(EntityType.SNOW_GOLEM.getDefaultLootTable()); + public static final ResourceKey SLIME = createInjectLootTableRegistryKey(EntityType.SLIME.getDefaultLootTable()); + public static final ResourceKey SPIDER = createInjectLootTableRegistryKey(EntityType.SPIDER.getDefaultLootTable()); + public static final ResourceKey SQUID = createInjectLootTableRegistryKey(EntityType.SQUID.getDefaultLootTable()); + public static final ResourceKey STRAY = createInjectLootTableRegistryKey(EntityType.STRAY.getDefaultLootTable()); + public static final ResourceKey WITCH = createInjectLootTableRegistryKey(EntityType.WITCH.getDefaultLootTable()); + public static final ResourceKey WITHER_SKELETON = createInjectLootTableRegistryKey(EntityType.WITHER_SKELETON.getDefaultLootTable()); + public static final ResourceKey ZOMBIE = createInjectLootTableRegistryKey(EntityType.ZOMBIE.getDefaultLootTable()); + public static final ResourceKey ZOMBIE_VILLAGER = createInjectLootTableRegistryKey(EntityType.ZOMBIE_VILLAGER.getDefaultLootTable()); + public static final ResourceKey ZOMBIFIED_PIGLIN = createInjectLootTableRegistryKey(EntityType.ZOMBIFIED_PIGLIN.getDefaultLootTable()); + private final HolderLookup.Provider registries; + + private static ResourceKey createInjectLootTableRegistryKey(ResourceKey vanillaLootTable) { + ResourceLocation location = Reliquary.getRL(INJECT_FOLDER + vanillaLootTable.location().getPath()); + ResourceKey injectLootTable = ResourceKey.create(Registries.LOOT_TABLE, location); + LOOT_INJECTS.put(vanillaLootTable, injectLootTable); + return injectLootTable; } - public static final ResourceLocation BAT = registerLootInject(EntityType.BAT.getDefaultLootTable()); - public static final ResourceLocation BLAZE = registerLootInject(EntityType.BLAZE.getDefaultLootTable()); - public static final ResourceLocation CAVE_SPIDER = registerLootInject(EntityType.CAVE_SPIDER.getDefaultLootTable()); - public static final ResourceLocation CREEPER = registerLootInject(EntityType.CREEPER.getDefaultLootTable()); - public static final ResourceLocation ENDERMAN = registerLootInject(EntityType.ENDERMAN.getDefaultLootTable()); - public static final ResourceLocation GHAST = registerLootInject(EntityType.GHAST.getDefaultLootTable()); - public static final ResourceLocation GUARDIAN = registerLootInject(EntityType.GUARDIAN.getDefaultLootTable()); - public static final ResourceLocation HUSK = registerLootInject(EntityType.HUSK.getDefaultLootTable()); - public static final ResourceLocation MAGMA_CUBE = registerLootInject(EntityType.MAGMA_CUBE.getDefaultLootTable()); - public static final ResourceLocation SKELETON = registerLootInject(EntityType.SKELETON.getDefaultLootTable()); - public static final ResourceLocation SNOW_GOLEM = registerLootInject(EntityType.SNOW_GOLEM.getDefaultLootTable()); - public static final ResourceLocation SLIME = registerLootInject(EntityType.SLIME.getDefaultLootTable()); - public static final ResourceLocation SPIDER = registerLootInject(EntityType.SPIDER.getDefaultLootTable()); - public static final ResourceLocation SQUID = registerLootInject(EntityType.SQUID.getDefaultLootTable()); - public static final ResourceLocation STRAY = registerLootInject(EntityType.STRAY.getDefaultLootTable()); - public static final ResourceLocation WITCH = registerLootInject(EntityType.WITCH.getDefaultLootTable()); - public static final ResourceLocation WITHER_SKELETON = registerLootInject(EntityType.WITHER_SKELETON.getDefaultLootTable()); - public static final ResourceLocation ZOMBIE = registerLootInject(EntityType.ZOMBIE.getDefaultLootTable()); - public static final ResourceLocation ZOMBIE_VILLAGER = registerLootInject(EntityType.ZOMBIE_VILLAGER.getDefaultLootTable()); - public static final ResourceLocation ZOMBIFIED_PIGLIN = registerLootInject(EntityType.ZOMBIFIED_PIGLIN.getDefaultLootTable()); + public EntityLootInjectSubProvider(HolderLookup.Provider registries) { + this.registries = registries; + } @Override - public void generate(BiConsumer tables) { + public void generate(BiConsumer, LootTable.Builder> tables) { + tables.accept(BAT, getEntityLootTable(0.02f, 0.03f, 0.1f, getItemLootEntry(ModItems.BAT_WING.get(), 1))); @@ -63,13 +78,13 @@ public void generate(BiConsumer tables) { CompoundTag poweredTag = new CompoundTag(); poweredTag.putBoolean("powered", true); - tables.accept(CREEPER, getEntityLootTable(0.02f, 0.03f, 0.1f, - getItemLootEntry(ModItems.CATALYZING_GLAND.get(), 1)) - .withPool(LootPool.lootPool().name("powered_creeper").add(LootItem.lootTableItem(ModItems.EYE_OF_THE_STORM.get())) - .when(LootItemKilledByPlayerCondition.killedByPlayer()) - .when(LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, new EntityPredicate.Builder().nbt(new NbtPredicate(poweredTag)))) - .when(RandomChanceLootingSeveringCondition.randomChanceLootingSevering(0.03f, 0.05f, 0.15f)) - )); + tables.accept(CREEPER, addLootPools( + getEntityLootTable(0.02f, 0.03f, 0.1f, getItemLootEntry(ModItems.CATALYZING_GLAND.get(), 1)), + "reliquary_powered_creeper_", 0.03f, 0.05f, 0.15f, + getItemLootEntry(ModItems.EYE_OF_THE_STORM.get(), 1), + LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, new EntityPredicate.Builder().nbt(new NbtPredicate(poweredTag))) + ) + ); tables.accept(ENDERMAN, getEntityLootTable(0.02f, 0.03f, 0.1f, getItemLootEntry(ModItems.NEBULOUS_HEART.get(), 1))); @@ -124,13 +139,29 @@ private LootPoolEntryContainer.Builder getItemLootEntry(Item item, int weight return LootItem.lootTableItem(item).setWeight(weight); } - private static LootTable.Builder getEntityLootTable(float baseChance, float lootingMultiplier, float severingMultiplier, LootPoolEntryContainer.Builder... entries) { - LootPool.Builder pool = LootPool.lootPool().name("main"); - for (LootPoolEntryContainer.Builder entry : entries) { - pool.add(entry); + private LootTable.Builder getEntityLootTable(float baseChance, float perLevelLooting, float perLevelSevering, LootPoolEntryContainer.Builder entry, LootItemCondition.Builder... extraConditions) { + LootTable.Builder lootTableBuilder = LootTable.lootTable(); + + return addLootPools(lootTableBuilder, "reliquary_", baseChance, perLevelLooting, perLevelSevering, entry, extraConditions); + } + + private LootTable.Builder addLootPools(LootTable.Builder lootTableBuilder, String lootPoolPrefix, float baseChance, float perLevelLooting, float perLevelSevering, LootPoolEntryContainer.Builder entry, LootItemCondition.Builder... extraConditions) { + LootPool.Builder lootingPool = LootPool.lootPool().name(lootPoolPrefix + "looting"); + lootingPool.add(entry); + lootingPool.when(LootItemKilledByPlayerCondition.killedByPlayer()); + lootingPool.when(LootItemRandomChanceWithEnchantedBonusCondition.randomChanceAndLootingBoost(registries, baseChance, perLevelLooting)); + for (LootItemCondition.Builder extraCondition : extraConditions) { + lootingPool.when(extraCondition); + } + + LootPool.Builder severingPool = LootPool.lootPool().name(lootPoolPrefix + "severing"); + severingPool.add(entry); + severingPool.when(LootItemKilledByPlayerCondition.killedByPlayer()); + severingPool.when(LootItemRandomChanceWithSeveringBonusCondition.randomChanceAndSeveringBoost(registries, baseChance, perLevelSevering)); + for (LootItemCondition.Builder extraCondition : extraConditions) { + severingPool.when(extraCondition); } - pool.when(LootItemKilledByPlayerCondition.killedByPlayer()); - pool.when(RandomChanceLootingSeveringCondition.randomChanceLootingSevering(baseChance, lootingMultiplier, severingMultiplier)); - return LootTable.lootTable().withPool(pool); + + return lootTableBuilder.withPool(lootingPool).withPool(severingPool); } } diff --git a/src/main/java/reliquary/data/ItemTagProvider.java b/src/main/java/reliquary/data/ItemTagProvider.java index aa2345e7..518682dc 100644 --- a/src/main/java/reliquary/data/ItemTagProvider.java +++ b/src/main/java/reliquary/data/ItemTagProvider.java @@ -5,25 +5,27 @@ import net.minecraft.data.tags.ItemTagsProvider; import net.minecraft.tags.ItemTags; import net.minecraft.world.level.block.Block; -import net.minecraftforge.common.data.ExistingFileHelper; +import net.neoforged.neoforge.common.data.ExistingFileHelper; +import reliquary.Reliquary; import reliquary.init.ModItems; -import reliquary.reference.Reference; import javax.annotation.Nullable; import java.util.concurrent.CompletableFuture; public class ItemTagProvider extends ItemTagsProvider { ItemTagProvider(PackOutput packOutput, CompletableFuture lookupProvider, CompletableFuture> blockTagProvider, @Nullable ExistingFileHelper existingFileHelper) { - super(packOutput, lookupProvider, blockTagProvider, Reference.MOD_ID, existingFileHelper); + super(packOutput, lookupProvider, blockTagProvider, Reliquary.MOD_ID, existingFileHelper); } @Override protected void addTags(HolderLookup.Provider provider) { tag(ItemTags.ARROWS).add(ModItems.TIPPED_ARROW.get()); + tag(ItemTags.SWORDS).add(ModItems.MAGICBANE.get(), ModItems.MERCY_CROSS.get()); + tag(ItemTags.MINING_ENCHANTABLE).add(ModItems.SHEARS_OF_WINTER.get()); } @Override public String getName() { - return Reference.MOD_ID + " item tags"; + return Reliquary.MOD_ID + " item tags"; } } diff --git a/src/main/java/reliquary/data/LootItemRandomChanceWithSeveringBonusCondition.java b/src/main/java/reliquary/data/LootItemRandomChanceWithSeveringBonusCondition.java new file mode 100644 index 00000000..a6e0dbf0 --- /dev/null +++ b/src/main/java/reliquary/data/LootItemRandomChanceWithSeveringBonusCondition.java @@ -0,0 +1,15 @@ +package reliquary.data; + +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.world.item.enchantment.LevelBasedValue; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceWithEnchantedBonusCondition; + +public class LootItemRandomChanceWithSeveringBonusCondition { + public static LootItemCondition.Builder randomChanceAndSeveringBoost(HolderLookup.Provider registries, float baseChance, float perLevelBoost) { + return () -> new LootItemRandomChanceWithEnchantedBonusCondition( + baseChance, new LevelBasedValue.Linear(baseChance + perLevelBoost, perLevelBoost), registries.lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(ReliquaryEnchantmentProvider.SEVERING) + ); + } +} diff --git a/src/main/java/reliquary/data/ModFluidTagsProvider.java b/src/main/java/reliquary/data/ModFluidTagsProvider.java index 0e65fb46..16601e25 100644 --- a/src/main/java/reliquary/data/ModFluidTagsProvider.java +++ b/src/main/java/reliquary/data/ModFluidTagsProvider.java @@ -3,20 +3,20 @@ import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.FluidTagsProvider; -import net.minecraftforge.common.data.ExistingFileHelper; +import net.neoforged.neoforge.common.data.ExistingFileHelper; +import reliquary.Reliquary; import reliquary.init.ModFluids; -import reliquary.reference.Reference; import javax.annotation.Nullable; import java.util.concurrent.CompletableFuture; public class ModFluidTagsProvider extends FluidTagsProvider { public ModFluidTagsProvider(PackOutput output, CompletableFuture provider, @Nullable ExistingFileHelper existingFileHelper) { - super(output, provider, Reference.MOD_ID, existingFileHelper); + super(output, provider, Reliquary.MOD_ID, existingFileHelper); } @Override - protected void addTags(HolderLookup.Provider pProvider) { - tag(ModFluids.EXPERIENCE_TAG).add(ModFluids.XP_JUICE_STILL.get()); + protected void addTags(HolderLookup.Provider provider) { + tag(ModFluids.EXPERIENCE_TAG).add(ModFluids.XP_STILL.get()); } } diff --git a/src/main/java/reliquary/data/ModRecipeProvider.java b/src/main/java/reliquary/data/ModRecipeProvider.java index 793945d9..7bef7372 100644 --- a/src/main/java/reliquary/data/ModRecipeProvider.java +++ b/src/main/java/reliquary/data/ModRecipeProvider.java @@ -1,57 +1,43 @@ package reliquary.data; -import net.minecraft.advancements.critereon.InventoryChangeTrigger; +import net.minecraft.advancements.Criterion; import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.PackOutput; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.data.recipes.RecipeCategory; -import net.minecraft.data.recipes.RecipeProvider; -import net.minecraft.data.recipes.ShapedRecipeBuilder; -import net.minecraft.data.recipes.ShapelessRecipeBuilder; +import net.minecraft.data.recipes.*; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.*; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.item.alchemy.Potions; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.crafting.ConditionalRecipe; -import net.minecraftforge.common.crafting.StrictNBTIngredient; -import net.minecraftforge.common.crafting.conditions.NotCondition; -import net.minecraftforge.common.crafting.conditions.TagEmptyCondition; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.conditions.NotCondition; +import net.neoforged.neoforge.common.conditions.TagEmptyCondition; +import net.neoforged.neoforge.common.crafting.DataComponentIngredient; +import reliquary.Reliquary; import reliquary.crafting.MobCharmRecipeBuilder; -import reliquary.crafting.NbtShapedRecipeBuilder; import reliquary.crafting.PotionEffectsRecipeBuilder; import reliquary.crafting.SpawnEggRecipeBuilder; import reliquary.crafting.alkahestry.ChargingRecipeBuilder; import reliquary.crafting.alkahestry.CraftingRecipeBuilder; import reliquary.crafting.alkahestry.DrainRecipeBuilder; -import reliquary.crafting.conditions.AlkahestryEnabledCondition; -import reliquary.crafting.conditions.HandgunEnabledCondition; -import reliquary.crafting.conditions.MobDropsCraftableCondition; -import reliquary.crafting.conditions.PassivePedestalEnabledCondition; -import reliquary.crafting.conditions.PedestalEnabledCondition; -import reliquary.crafting.conditions.PotionsEnabledCondition; -import reliquary.crafting.conditions.SpawnEggEnabledCondition; +import reliquary.crafting.conditions.*; import reliquary.init.ModBlocks; import reliquary.init.ModItems; import reliquary.items.BulletItem; -import reliquary.items.ItemBase; import reliquary.items.MagazineItem; -import reliquary.reference.Reference; import reliquary.util.RegistryHelper; +import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; public class ModRecipeProvider extends RecipeProvider { - private static final TagKey INGOTS_COPPER = TagKey.create(ForgeRegistries.Keys.ITEMS, new ResourceLocation("forge:ingots/copper")); - private static final TagKey INGOTS_STEEL = TagKey.create(ForgeRegistries.Keys.ITEMS, new ResourceLocation("forge:ingots/steel")); - private static final TagKey INGOTS_SILVER = TagKey.create(ForgeRegistries.Keys.ITEMS, new ResourceLocation("forge:ingots/silver")); - private static final TagKey INGOTS_TIN = TagKey.create(ForgeRegistries.Keys.ITEMS, new ResourceLocation("forge:ingots/tin")); + private static final TagKey INGOTS_COPPER = TagKey.create(Registries.ITEM, ResourceLocation.parse("forge:ingots/copper")); + private static final TagKey INGOTS_STEEL = TagKey.create(Registries.ITEM, ResourceLocation.parse("forge:ingots/steel")); + private static final TagKey INGOTS_SILVER = TagKey.create(Registries.ITEM, ResourceLocation.parse("forge:ingots/silver")); + private static final TagKey INGOTS_TIN = TagKey.create(Registries.ITEM, ResourceLocation.parse("forge:ingots/tin")); private static final String HAS_GUNPOWDER_CRITERION = "has_gunpowder"; private static final String HAS_NEBULOUS_HEART_CRITERION = "has_nebulous_heart"; private static final String HAS_FERTILE_ESSENCE_CRITERION = "has_fertile_essence"; @@ -70,24 +56,24 @@ public class ModRecipeProvider extends RecipeProvider { private static final String HAS_MOB_CHARM_FRAGMENT_CRITERION = "has_mob_charm_fragment"; private static final String HAS_INFERNAL_CLAW_CRITERION = "has_infernal_claw"; - public ModRecipeProvider(PackOutput packOutput) { - super(packOutput); + public ModRecipeProvider(PackOutput packOutput, CompletableFuture registries) { + super(packOutput, registries); } @Override - protected void buildRecipes(Consumer consumer) { - registerHandgunRecipes(consumer); - registerAlkahestryRecipes(consumer); - registerPotionRecipes(consumer); - registerPedestalRecipes(consumer); + protected void buildRecipes(RecipeOutput recipeOutput) { + registerHandgunRecipes(recipeOutput); + registerAlkahestryRecipes(recipeOutput); + registerPotionRecipes(recipeOutput); + registerPedestalRecipes(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModBlocks.ALKAHESTRY_ALTAR_ITEM.get()) - .requires(Tags.Items.OBSIDIAN) + .requires(Tags.Items.OBSIDIANS) .requires(Items.REDSTONE_LAMP) .requires(ModItems.NEBULOUS_HEART.get()) .requires(ModItems.CATALYZING_GLAND.get()) .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModBlocks.FERTILE_LILY_PAD_ITEM.get()) .requires(ModItems.FERTILE_ESSENCE.get()) @@ -95,7 +81,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.FERTILE_ESSENCE.get()) .requires(Items.LILY_PAD) .unlockedBy(HAS_FERTILE_ESSENCE_CRITERION, has(ModItems.FERTILE_ESSENCE.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModBlocks.INTERDICTION_TORCH_ITEM.get()) .requires(ModItems.BAT_WING.get()) @@ -103,18 +89,18 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.MOLTEN_CORE.get()) .requires(ModItems.NEBULOUS_HEART.get()) .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModBlocks.WRAITH_NODE_ITEM.get()) .requires(ModItems.NEBULOUS_HEART.get()) .requires(Tags.Items.GEMS_EMERALD) .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(consumer); + .save(recipeOutput); - registerCraftableMobDropRecipes(consumer); - registerCharmFragmentRecipes(consumer); - registerIngredientRecipes(consumer); - registerUncraftingRecipes(consumer); + registerCraftableMobDropRecipes(recipeOutput); + registerCharmFragmentRecipes(recipeOutput); + registerIngredientRecipes(recipeOutput); + registerUncraftingRecipes(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.ANGELHEART_VIAL.get()) .pattern("GBG") @@ -125,7 +111,7 @@ protected void buildRecipes(Consumer consumer) { .define('C', ModItems.INFERNAL_CLAW.get()) .define('F', ModItems.FERTILE_ESSENCE.get()) .unlockedBy(HAS_FERTILE_ESSENCE_CRITERION, has(ModItems.FERTILE_ESSENCE.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.ANGELIC_FEATHER.get()) .requires(Tags.Items.FEATHERS) @@ -133,7 +119,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.BAT_WING.get()) .requires(ModItems.FERTILE_ESSENCE.get()) .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.DESTRUCTION_CATALYST.get()) .requires(Items.FLINT_AND_STEEL) @@ -141,15 +127,15 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.CATALYZING_GLAND.get()) .requires(ModItems.INFERNAL_TEAR.get()) .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.EMPEROR_CHALICE.get()) .requires(Tags.Items.GEMS_EMERALD) .requires(Tags.Items.INGOTS_GOLD) .requires(Items.BUCKET) - .requires(instantiateNBTIngredient(new ItemStack(ModItems.VOID_TEAR.get()))) + .requires(DataComponentIngredient.of(true, new ItemStack(ModItems.VOID_TEAR.get()))) .unlockedBy(HAS_VOID_TEAR_CRITERION, has(ModItems.VOID_TEAR.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.ENDER_STAFF.get()) .pattern(" BE") @@ -158,10 +144,10 @@ protected void buildRecipes(Consumer consumer) { .define('B', ModItems.BAT_WING.get()) .define('S', Items.STICK) .define('E', Items.ENDER_EYE) - .define('V', instantiateNBTIngredient(new ItemStack(ModItems.VOID_TEAR.get()))) + .define('V', DataComponentIngredient.of(true, new ItemStack(ModItems.VOID_TEAR.get()))) .define('N', ModItems.NEBULOUS_HEART.get()) .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.FORTUNE_COIN.get()) .requires(ModItems.NEBULOUS_HEART.get()) @@ -169,15 +155,15 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.SLIME_PEARL.get()) .requires(ModItems.BAT_WING.get()) .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.GLACIAL_STAFF.get()) .requires(ModItems.ICE_MAGUS_ROD.get()) - .requires(instantiateNBTIngredient(new ItemStack(ModItems.VOID_TEAR.get()))) + .requires(DataComponentIngredient.of(true, new ItemStack(ModItems.VOID_TEAR.get()))) .requires(ModItems.FROZEN_CORE.get()) .requires(ModItems.SHEARS_OF_WINTER.get()) .unlockedBy(HAS_VOID_TEAR_CRITERION, has(ModItems.VOID_TEAR.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.GLOWING_BREAD.get(), 3) .requires(Items.BREAD) @@ -185,7 +171,7 @@ protected void buildRecipes(Consumer consumer) { .requires(Items.BREAD) .requires(ModItems.GLOWING_WATER.get()) .unlockedBy("has_glowing_water", has(ModItems.GLOWING_WATER.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.GLOWING_WATER.get()) .pattern("GBG") @@ -194,19 +180,19 @@ protected void buildRecipes(Consumer consumer) { .define('G', Tags.Items.GLASS_PANES) .define('B', Items.WATER_BUCKET) .define('D', Tags.Items.DUSTS_GLOWSTONE) - .define('P', Tags.Items.GUNPOWDER) + .define('P', Tags.Items.GUNPOWDERS) .define('N', Tags.Items.CROPS_NETHER_WART) .unlockedBy("has_nether_wart", hasTag(Tags.Items.CROPS_NETHER_WART)) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.GLOWING_WATER.get()) .requires(ModItems.EMPTY_POTION_VIAL.get()) .requires(Items.WATER_BUCKET) .requires(Tags.Items.DUSTS_GLOWSTONE) - .requires(Tags.Items.GUNPOWDER) + .requires(Tags.Items.GUNPOWDERS) .requires(Tags.Items.CROPS_NETHER_WART) .unlockedBy("has_empty_potion_vial", has(ModItems.EMPTY_POTION_VIAL.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, "glowing_water_from_potion_vial")); + .save(recipeOutput, Reliquary.getRL("glowing_water_from_potion_vial")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.GOLD_NUGGET) .requires(ModItems.EMPTY_BULLET.get()) @@ -214,7 +200,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.EMPTY_BULLET.get()) .requires(ModItems.EMPTY_BULLET.get()) .unlockedBy("has_empty_bullet", has(ModItems.EMPTY_BULLET.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, "gold_nugget")); + .save(recipeOutput, Reliquary.getRL("gold_nugget")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.HARVEST_ROD.get()) .pattern(" RF") @@ -223,10 +209,10 @@ protected void buildRecipes(Consumer consumer) { .define('R', Items.ROSE_BUSH) .define('F', ModItems.FERTILE_ESSENCE.get()) .define('V', Items.VINE) - .define('T', instantiateNBTIngredient(new ItemStack(ModItems.VOID_TEAR.get()))) + .define('T', DataComponentIngredient.of(true, new ItemStack(ModItems.VOID_TEAR.get()))) .define('S', Items.STICK) .unlockedBy(HAS_VOID_TEAR_CRITERION, has(ModItems.VOID_TEAR.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.HERO_MEDALLION.get()) .requires(ModItems.NEBULOUS_HEART.get()) @@ -234,7 +220,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.WITCH_HAT.get()) .requires(ModItems.INFERNAL_TEAR.get()) .unlockedBy("has_infernal_tear", has(ModItems.INFERNAL_TEAR.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.HOLY_HAND_GRENADE.get(), 4) .requires(ModItems.GLOWING_WATER.get()) @@ -242,7 +228,7 @@ protected void buildRecipes(Consumer consumer) { .requires(Items.TNT) .requires(ModItems.CATALYZING_GLAND.get()) .unlockedBy("has_glowing_water", has(ModItems.GLOWING_WATER.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.ICE_MAGUS_ROD.get()) .pattern(" DF") @@ -250,10 +236,10 @@ protected void buildRecipes(Consumer consumer) { .pattern("I ") .define('D', Tags.Items.GEMS_DIAMOND) .define('F', ModItems.FROZEN_CORE.get()) - .define('V', instantiateNBTIngredient(new ItemStack(ModItems.VOID_TEAR.get()))) + .define('V', DataComponentIngredient.of(true, new ItemStack(ModItems.VOID_TEAR.get()))) .define('I', Tags.Items.INGOTS_IRON) .unlockedBy(HAS_FROZEN_CORE_CRITERION, has(ModItems.FROZEN_CORE.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.INFERNAL_CHALICE.get()) .requires(ModItems.INFERNAL_CLAWS.get()) @@ -261,7 +247,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.INFERNAL_TEAR.get()) .requires(ModItems.MOLTEN_CORE.get()) .unlockedBy("has_emperor_chalice", has(ModItems.EMPEROR_CHALICE.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.INFERNAL_CLAWS.get()) .requires(ModItems.INFERNAL_CLAW.get()) @@ -269,15 +255,15 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.INFERNAL_CLAW.get()) .requires(ModItems.SLIME_PEARL.get()) .unlockedBy(HAS_INFERNAL_CLAW_CRITERION, has(ModItems.INFERNAL_CLAW.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.INFERNAL_TEAR.get()) - .requires(instantiateNBTIngredient(new ItemStack(ModItems.VOID_TEAR.get()))) + .requires(DataComponentIngredient.of(true, new ItemStack(ModItems.VOID_TEAR.get()))) .requires(ModItems.WITCH_HAT.get()) .requires(ModItems.MOLTEN_CORE.get()) .requires(ModItems.INFERNAL_CLAW.get()) .unlockedBy(HAS_INFERNAL_CLAW_CRITERION, has(ModItems.INFERNAL_CLAW.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.KRAKEN_SHELL.get()) .requires(ModItems.KRAKEN_SHELL_FRAGMENT.get()) @@ -285,18 +271,18 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.KRAKEN_SHELL_FRAGMENT.get()) .requires(ModItems.NEBULOUS_HEART.get()) .unlockedBy("has_kraken_shell_fragment", has(ModItems.KRAKEN_SHELL_FRAGMENT.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.LANTERN_OF_PARANOIA.get()) .pattern("ISI") .pattern("GMG") .pattern(" I ") .define('S', ModItems.SLIME_PEARL.get()) - .define('G', Tags.Items.GLASS) + .define('G', Tags.Items.GLASS_BLOCKS) .define('I', Tags.Items.INGOTS_IRON) .define('M', ModItems.MOLTEN_CORE.get()) .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MAGICBANE.get()) .pattern("NG") @@ -305,7 +291,7 @@ protected void buildRecipes(Consumer consumer) { .define('I', Tags.Items.INGOTS_IRON) .define('N', ModItems.NEBULOUS_HEART.get()) .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MERCY_CROSS.get()) .pattern("WGR") @@ -314,11 +300,11 @@ protected void buildRecipes(Consumer consumer) { .define('W', ModItems.WITHERED_RIB.get()) .define('G', Tags.Items.INGOTS_GOLD) .define('R', ModItems.RIB_BONE.get()) - .define('L', Tags.Items.LEATHER) + .define('L', Tags.Items.LEATHERS) .define('S', Items.WITHER_SKELETON_SKULL) .define('Z', ModItems.ZOMBIE_HEART.get()) .unlockedBy(HAS_WITHERED_RIB_CRITERION, has(ModItems.WITHERED_RIB.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.MIDAS_TOUCHSTONE.get()) .requires(Items.ANVIL) @@ -329,28 +315,28 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.MOLTEN_CORE.get()) .requires(ModItems.CATALYZING_GLAND.get()) .requires(ModItems.CATALYZING_GLAND.get()) - .requires(instantiateNBTIngredient(new ItemStack(ModItems.VOID_TEAR.get()))) + .requires(DataComponentIngredient.of(true, new ItemStack(ModItems.VOID_TEAR.get()))) .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .save(consumer); + .save(recipeOutput); MobCharmRecipeBuilder.charmRecipe() - .patternLine("FLF") - .patternLine("FSF") - .patternLine("F F") - .key('F', ModItems.MOB_CHARM_FRAGMENT.get()) - .key('L', Tags.Items.LEATHER) - .key('S', Tags.Items.STRING) - .addCriterion(HAS_MOB_CHARM_FRAGMENT_CRITERION, has(ModItems.MOB_CHARM_FRAGMENT.get())) - .build(consumer); + .pattern("FLF") + .pattern("FSF") + .pattern("F F") + .define('F', ModItems.MOB_CHARM_FRAGMENT.get()) + .define('L', Tags.Items.LEATHERS) + .define('S', Tags.Items.STRINGS) + .unlockedBy(HAS_MOB_CHARM_FRAGMENT_CRITERION, has(ModItems.MOB_CHARM_FRAGMENT.get())) + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_BELT.get()) .pattern("LLL") .pattern("F F") .pattern("FFF") - .define('L', Tags.Items.LEATHER) + .define('L', Tags.Items.LEATHERS) .define('F', ModItems.MOB_CHARM_FRAGMENT.get()) .unlockedBy(HAS_MOB_CHARM_FRAGMENT_CRITERION, has(ModItems.MOB_CHARM_FRAGMENT.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.PHOENIX_DOWN.get()) .requires(ModItems.ANGELHEART_VIAL.get()) @@ -358,7 +344,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.ANGELHEART_VIAL.get()) .requires(ModItems.ANGELIC_FEATHER.get()) .unlockedBy("has_angelic_feather", has(ModItems.ANGELIC_FEATHER.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.PYROMANCER_STAFF.get()) .requires(ModItems.INFERNAL_CLAWS.get()) @@ -366,7 +352,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.INFERNAL_TEAR.get()) .requires(ModItems.SALAMANDER_EYE.get()) .unlockedBy("has_infernal_claws", has(ModItems.INFERNAL_CLAWS.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.RENDING_GALE.get()) .pattern(" BE") @@ -375,10 +361,10 @@ protected void buildRecipes(Consumer consumer) { .define('B', ModItems.BAT_WING.get()) .define('S', Items.STICK) .define('E', ModItems.EYE_OF_THE_STORM.get()) - .define('V', instantiateNBTIngredient(new ItemStack(ModItems.VOID_TEAR.get()))) + .define('V', DataComponentIngredient.of(true, new ItemStack(ModItems.VOID_TEAR.get()))) .define('G', Tags.Items.INGOTS_GOLD) .unlockedBy("has_eye_of_the_storm", has(ModItems.EYE_OF_THE_STORM.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.ROD_OF_LYSSA.get()) .requires(ModItems.INFERNAL_CLAW.get()) @@ -386,7 +372,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.NEBULOUS_HEART.get()) .requires(Items.FISHING_ROD) .unlockedBy(HAS_INFERNAL_CLAW_CRITERION, has(ModItems.INFERNAL_CLAW.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.SALAMANDER_EYE.get()) .requires(Items.ENDER_EYE) @@ -394,7 +380,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.FROZEN_CORE.get()) .requires(ModItems.NEBULOUS_HEART.get()) .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.SERPENT_STAFF.get()) .pattern(" CE") @@ -405,7 +391,7 @@ protected void buildRecipes(Consumer consumer) { .define('E', Items.ENDER_EYE) .define('K', ModItems.KRAKEN_SHELL_FRAGMENT.get()) .unlockedBy("has_kraken_shell_fragment", has(ModItems.KRAKEN_SHELL_FRAGMENT.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.SHEARS_OF_WINTER.get()) .requires(ModItems.FROZEN_CORE.get()) @@ -413,15 +399,15 @@ protected void buildRecipes(Consumer consumer) { .requires(Tags.Items.GEMS_DIAMOND) .requires(Tags.Items.GEMS_DIAMOND) .unlockedBy(HAS_FROZEN_CORE_CRITERION, has(ModItems.FROZEN_CORE.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.SOJOURNER_STAFF.get()) .requires(ModItems.MOLTEN_CORE.get()) .requires(Tags.Items.INGOTS_GOLD) .requires(Tags.Items.RODS_BLAZE) - .requires(instantiateNBTIngredient(new ItemStack(ModItems.VOID_TEAR.get()))) + .requires(DataComponentIngredient.of(true, new ItemStack(ModItems.VOID_TEAR.get()))) .unlockedBy(HAS_VOID_TEAR_CRITERION, has(ModItems.VOID_TEAR.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.TWILIGHT_CLOAK.get()) .pattern("ICI") @@ -431,7 +417,7 @@ protected void buildRecipes(Consumer consumer) { .define('B', Items.BLACK_WOOL) .define('C', ModItems.CRIMSON_CLOTH.get()) .unlockedBy("has_crimson_cloth", has(ModItems.CRIMSON_CLOTH.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.VOID_TEAR.get()) .requires(Items.GHAST_TEAR) @@ -439,7 +425,7 @@ protected void buildRecipes(Consumer consumer) { .requires(ModItems.SLIME_PEARL.get()) .requires(Tags.Items.GEMS_LAPIS) .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(consumer); + .save(recipeOutput); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.WITHERLESS_ROSE.get()) .pattern("FNF") @@ -449,39 +435,39 @@ protected void buildRecipes(Consumer consumer) { .define('N', Tags.Items.NETHER_STARS) .define('R', Items.ROSE_BUSH) .unlockedBy(HAS_FERTILE_ESSENCE_CRITERION, has(ModItems.FERTILE_ESSENCE.get())) - .save(consumer); + .save(recipeOutput); } - private void registerUncraftingRecipes(Consumer consumer) { + private void registerUncraftingRecipes(RecipeOutput recipeOutput) { ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.BLAZE_ROD, 4) .requires(ModItems.MOLTEN_CORE.get()) .requires(ModItems.MOLTEN_CORE.get()) .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "blaze_rod")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "blaze_rod")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.BONE, 5) .requires(ModItems.RIB_BONE.get()) .unlockedBy("has_rib_bone", has(ModItems.RIB_BONE.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "bone")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "bone")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.ENDER_PEARL, 3) .requires(ModItems.NEBULOUS_HEART.get()) .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "ender_pearl")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "ender_pearl")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.GHAST_TEAR) .requires(ModItems.CATALYZING_GLAND.get()) .requires(ModItems.CATALYZING_GLAND.get()) .requires(ModItems.CATALYZING_GLAND.get()) .unlockedBy(HAS_CATALYZING_GLAND_CRITERIION, has(ModItems.CATALYZING_GLAND.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "ghast_tear")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "ghast_tear")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.GLASS_BOTTLE, 6) .pattern("W W") .pattern(" W ") .define('W', ModItems.WITCH_HAT.get()) .unlockedBy(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "glass_bottle")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "glass_bottle")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.GLOWSTONE_DUST, 6) .pattern("W ") @@ -489,23 +475,23 @@ private void registerUncraftingRecipes(Consumer consumer) { .pattern(" W ") .define('W', ModItems.WITCH_HAT.get()) .unlockedBy(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "glowstone_dust")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "glowstone_dust")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.GOLD_NUGGET, 6) .requires(ModItems.ZOMBIE_HEART.get()) .requires(ModItems.ZOMBIE_HEART.get()) .unlockedBy(HAS_ZOMBIE_HEART_CRITERION, has(ModItems.ZOMBIE_HEART.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "gold_nugget")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "gold_nugget")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.GUNPOWDER, 6) .requires(ModItems.CATALYZING_GLAND.get()) .unlockedBy(HAS_CATALYZING_GLAND_CRITERIION, has(ModItems.CATALYZING_GLAND.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "gunpowder_creeper_gland")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "gunpowder_creeper_gland")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.GUNPOWDER, 10) .requires(ModItems.EYE_OF_THE_STORM.get()) .unlockedBy("has_eye_of_the_storm", has(ModItems.EYE_OF_THE_STORM.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "gunpowder_storm_eye")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "gunpowder_storm_eye")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.GUNPOWDER, 6) .pattern("W ") @@ -513,17 +499,17 @@ private void registerUncraftingRecipes(Consumer consumer) { .pattern(" W") .define('W', ModItems.WITCH_HAT.get()) .unlockedBy(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "gunpowder_witch_hat")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "gunpowder_witch_hat")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.INK_SAC, 6) .requires(ModItems.SQUID_BEAK.get()) .unlockedBy("has_squid_beak", has(ModItems.SQUID_BEAK.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "ink_sac")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "ink_sac")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.MAGMA_CREAM, 3) .requires(ModItems.MOLTEN_CORE.get()) .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "magma_cream")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "magma_cream")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.PACKED_ICE) .pattern("III") @@ -532,18 +518,18 @@ private void registerUncraftingRecipes(Consumer consumer) { .define('I', Items.ICE) .define('C', ModItems.FROZEN_CORE.get()) .unlockedBy(HAS_FROZEN_CORE_CRITERION, has(ModItems.FROZEN_CORE.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "packed_ice")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "packed_ice")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.PRISMARINE_CRYSTALS, 10) .requires(ModItems.GUARDIAN_SPIKE.get()) .requires(ModItems.GUARDIAN_SPIKE.get()) .unlockedBy(HAS_GUARDIAN_SPIKE_CRITERION, has(ModItems.GUARDIAN_SPIKE.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "prismarine_crystals")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "prismarine_crystals")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.PRISMARINE_SHARD, 5) .requires(ModItems.GUARDIAN_SPIKE.get()) .unlockedBy(HAS_GUARDIAN_SPIKE_CRITERION, has(ModItems.GUARDIAN_SPIKE.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "prismarine_shard")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "prismarine_shard")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.REDSTONE, 6) .pattern("W") @@ -551,44 +537,44 @@ private void registerUncraftingRecipes(Consumer consumer) { .pattern("W") .define('W', ModItems.WITCH_HAT.get()) .unlockedBy(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "redstone")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "redstone")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.ROTTEN_FLESH, 6) .requires(ModItems.ZOMBIE_HEART.get()) .unlockedBy(HAS_ZOMBIE_HEART_CRITERION, has(ModItems.ZOMBIE_HEART.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "rotten_flesh")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "rotten_flesh")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.SLIME_BALL, 6) .requires(ModItems.SLIME_PEARL.get()) .unlockedBy(HAS_SLIME_PEARL_CRITERION, has(ModItems.SLIME_PEARL.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "slime_ball")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "slime_ball")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.SNOWBALL, 5) .requires(ModItems.FROZEN_CORE.get()) .unlockedBy(HAS_FROZEN_CORE_CRITERION, has(ModItems.FROZEN_CORE.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "snowball")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "snowball")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.SPIDER_EYE, 2) .requires(ModItems.CHELICERAE.get()) .requires(ModItems.CHELICERAE.get()) .unlockedBy(HAS_CHELICERAE_CRITERION, has(ModItems.CHELICERAE.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "spider_eye")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "spider_eye")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.STICK, 4) .requires(ModItems.WITCH_HAT.get()) .unlockedBy(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "stick")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "stick")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.STRING, 6) .requires(ModItems.CHELICERAE.get()) .unlockedBy(HAS_CHELICERAE_CRITERION, has(ModItems.CHELICERAE.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "string")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "string")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.SUGAR, 6) .pattern("WWW") .define('W', ModItems.WITCH_HAT.get()) .unlockedBy(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "sugar")); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "sugar")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, Items.WITHER_SKELETON_SKULL) .requires(ModItems.WITHERED_RIB.get()) @@ -596,407 +582,322 @@ private void registerUncraftingRecipes(Consumer consumer) { .requires(ModItems.WITHERED_RIB.get()) .requires(Items.SKELETON_SKULL) .unlockedBy(HAS_WITHERED_RIB_CRITERION, has(ModItems.WITHERED_RIB.get())) - .save(consumer, new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "wither_skeleton_skull")); - - ResourceLocation spawnEggId = new ResourceLocation(Reference.MOD_ID, UNCRAFTING_FOLDER + "spawn_egg"); - ConditionalRecipe.builder() - .addCondition(new SpawnEggEnabledCondition()) - .addRecipe(conditionalConsumer -> - SpawnEggRecipeBuilder.spawnEggRecipe() - .addIngredient(ModItems.MOB_CHARM_FRAGMENT.get()) - .addIngredient(ModItems.MOB_CHARM_FRAGMENT.get()) - .addIngredient(Items.EGG) - .addCriterion(HAS_MOB_CHARM_FRAGMENT_CRITERION, has(ModItems.MOB_CHARM_FRAGMENT.get())) - .build(conditionalConsumer, spawnEggId)) - .build(consumer, spawnEggId); + .save(recipeOutput, Reliquary.getRL(UNCRAFTING_FOLDER + "wither_skeleton_skull")); + + ResourceLocation spawnEggId = Reliquary.getRL(UNCRAFTING_FOLDER + "spawn_egg"); + SpawnEggRecipeBuilder.spawnEggRecipe() + .addIngredient(ModItems.MOB_CHARM_FRAGMENT.get()) + .addIngredient(ModItems.MOB_CHARM_FRAGMENT.get()) + .addIngredient(Items.EGG) + .unlockedBy(HAS_MOB_CHARM_FRAGMENT_CRITERION, has(ModItems.MOB_CHARM_FRAGMENT.get())) + .build(recipeOutput.withConditions(new SpawnEggEnabledCondition()), spawnEggId); } - private void registerHandgunRecipes(Consumer consumer) { - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.HANDGUN.get()) - .pattern("BIM") - .pattern("ISI") - .pattern("IGI") - .define('I', Tags.Items.INGOTS_IRON) - .define('B', ModItems.BARREL_ASSEMBLY.get()) - .define('M', ModItems.HAMMER_ASSEMBLY.get()) - .define('G', ModItems.GRIP_ASSEMBLY.get()) - .define('S', ModItems.SLIME_PEARL.get()) - .unlockedBy("has_barrel_assembly", has(ModItems.BARREL_ASSEMBLY.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.HANDGUN.get())); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.BARREL_ASSEMBLY.get()) - .pattern("III") - .pattern("EME") - .pattern("III") - .define('I', Tags.Items.INGOTS_IRON) - .define('E', ModItems.NEBULOUS_HEART.get()) - .define('M', Items.MAGMA_CREAM) - .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.BARREL_ASSEMBLY.get())); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.GRIP_ASSEMBLY.get()) - .pattern("III") - .pattern("IMI") - .pattern("ICI") - .define('I', Tags.Items.INGOTS_IRON) - .define('C', ModItems.EMPTY_MAGAZINE.get()) - .define('M', Items.MAGMA_CREAM) - .unlockedBy("has_magma_cream", has(Items.MAGMA_CREAM)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.GRIP_ASSEMBLY.get())); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.EMPTY_MAGAZINE.get()) - .pattern("I I") - .pattern("IGI") - .pattern("SIS") - .define('S', Tags.Items.STONE) - .define('I', Tags.Items.INGOTS_IRON) - .define('G', Tags.Items.GLASS) - .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.EMPTY_MAGAZINE.get())); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.HAMMER_ASSEMBLY.get()) - .pattern("IIB") - .pattern("RMI") - .pattern("III") - .define('I', Tags.Items.INGOTS_IRON) - .define('B', Items.STONE_BUTTON) - .define('R', Tags.Items.RODS_BLAZE) - .define('M', ModItems.MOLTEN_CORE.get()) - .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.HAMMER_ASSEMBLY.get())); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.BLAZE_BULLET.get(), 8) - .requires(Items.BLAZE_POWDER) - .requires(Tags.Items.RODS_BLAZE) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.NUGGETS_GOLD) - .unlockedBy("has_blaze_rod", has(Items.BLAZE_ROD)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.BLAZE_BULLET.get())); - - addBulletPotionRecipe(consumer, ModItems.BLAZE_BULLET.get()); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.BUSTER_BULLET.get(), 8) - .requires(ModItems.CONCUSSIVE_BULLET.get()) - .requires(ModItems.CONCUSSIVE_BULLET.get()) - .requires(ModItems.CONCUSSIVE_BULLET.get()) - .requires(ModItems.CONCUSSIVE_BULLET.get()) - .requires(ModItems.CONCUSSIVE_BULLET.get()) - .requires(ModItems.CONCUSSIVE_BULLET.get()) - .requires(ModItems.CONCUSSIVE_BULLET.get()) - .requires(ModItems.CONCUSSIVE_BULLET.get()) - .requires(ModItems.CATALYZING_GLAND.get()) - .unlockedBy("has_concussive_bullet", has(ModItems.CONCUSSIVE_BULLET.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.BUSTER_BULLET.get())); - - addBulletPotionRecipe(consumer, ModItems.BUSTER_BULLET.get()); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.CONCUSSIVE_BULLET.get(), 8) - .requires(Tags.Items.SLIMEBALLS) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.GUNPOWDER) - .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.CONCUSSIVE_BULLET.get())); - - addBulletPotionRecipe(consumer, ModItems.CONCUSSIVE_BULLET.get()); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.ENDER_BULLET.get(), 8) - .requires(ModItems.SEEKER_BULLET.get()) - .requires(ModItems.SEEKER_BULLET.get()) - .requires(ModItems.SEEKER_BULLET.get()) - .requires(ModItems.SEEKER_BULLET.get()) - .requires(ModItems.SEEKER_BULLET.get()) - .requires(ModItems.SEEKER_BULLET.get()) - .requires(ModItems.SEEKER_BULLET.get()) - .requires(ModItems.SEEKER_BULLET.get()) - .requires(ModItems.NEBULOUS_HEART.get()) - .unlockedBy("has_seeker_bullet", has(ModItems.SEEKER_BULLET.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.ENDER_BULLET.get())); - - addBulletPotionRecipe(consumer, ModItems.ENDER_BULLET.get()); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.EXORCISM_BULLET.get(), 8) - .requires(ModItems.NEUTRAL_BULLET.get()) - .requires(ModItems.NEUTRAL_BULLET.get()) - .requires(ModItems.NEUTRAL_BULLET.get()) - .requires(ModItems.NEUTRAL_BULLET.get()) - .requires(ModItems.NEUTRAL_BULLET.get()) - .requires(ModItems.NEUTRAL_BULLET.get()) - .requires(ModItems.NEUTRAL_BULLET.get()) - .requires(ModItems.NEUTRAL_BULLET.get()) - .requires(ModItems.ZOMBIE_HEART.get()) - .unlockedBy("has_neutral_bullet", has(ModItems.NEUTRAL_BULLET.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.EXORCISM_BULLET.get())); - - addBulletPotionRecipe(consumer, ModItems.EXORCISM_BULLET.get()); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.NEUTRAL_BULLET.get(), 8) - .requires(Items.FLINT) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.GUNPOWDER) - .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.NEUTRAL_BULLET.get())); - - addBulletPotionRecipe(consumer, ModItems.NEUTRAL_BULLET.get()); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.SAND_BULLET.get(), 8) - .requires(Tags.Items.SANDSTONE) - .requires(Tags.Items.SLIMEBALLS) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.GUNPOWDER) - .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.SAND_BULLET.get())); - - addBulletPotionRecipe(consumer, ModItems.SAND_BULLET.get()); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.SEEKER_BULLET.get(), 8) - .requires(Tags.Items.GEMS_LAPIS) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.GUNPOWDER) - .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.SEEKER_BULLET.get())); - - addBulletPotionRecipe(consumer, ModItems.SEEKER_BULLET.get()); - - ConditionalRecipe.builder() - .addCondition(new HandgunEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.STORM_BULLET.get(), 8) - .requires(ModItems.CATALYZING_GLAND.get()) - .requires(ModItems.CATALYZING_GLAND.get()) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.NUGGETS_GOLD) - .requires(Tags.Items.GUNPOWDER) - .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.STORM_BULLET.get())); - - addBulletPotionRecipe(consumer, ModItems.STORM_BULLET.get()); - - addMagazineRecipe(consumer, ModItems.BLAZE_BULLET.get(), ModItems.BLAZE_MAGAZINE.get()); - addMagazineRecipe(consumer, ModItems.BUSTER_BULLET.get(), ModItems.BUSTER_MAGAZINE.get()); - addMagazineRecipe(consumer, ModItems.CONCUSSIVE_BULLET.get(), ModItems.CONCUSSIVE_MAGAZINE.get()); - addMagazineRecipe(consumer, ModItems.ENDER_BULLET.get(), ModItems.ENDER_MAGAZINE.get()); - addMagazineRecipe(consumer, ModItems.EXORCISM_BULLET.get(), ModItems.EXORCISM_MAGAZINE.get()); - addMagazineRecipe(consumer, ModItems.NEUTRAL_BULLET.get(), ModItems.NEUTRAL_MAGAZINE.get()); - addMagazineRecipe(consumer, ModItems.SAND_BULLET.get(), ModItems.SAND_MAGAZINE.get()); - addMagazineRecipe(consumer, ModItems.SEEKER_BULLET.get(), ModItems.SEEKER_MAGAZINE.get()); - addMagazineRecipe(consumer, ModItems.STORM_BULLET.get(), ModItems.STORM_MAGAZINE.get()); + private void registerHandgunRecipes(RecipeOutput recipeOutput) { + RecipeOutput conditionalHandgunRecipeOutput = recipeOutput.withConditions(new HandgunEnabledCondition()); + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.HANDGUN.get()) + .pattern("BIM") + .pattern("ISI") + .pattern("IGI") + .define('I', Tags.Items.INGOTS_IRON) + .define('B', ModItems.BARREL_ASSEMBLY.get()) + .define('M', ModItems.HAMMER_ASSEMBLY.get()) + .define('G', ModItems.GRIP_ASSEMBLY.get()) + .define('S', ModItems.SLIME_PEARL.get()) + .unlockedBy("has_barrel_assembly", has(ModItems.BARREL_ASSEMBLY.get())) + .save(conditionalHandgunRecipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.BARREL_ASSEMBLY.get()) + .pattern("III") + .pattern("EME") + .pattern("III") + .define('I', Tags.Items.INGOTS_IRON) + .define('E', ModItems.NEBULOUS_HEART.get()) + .define('M', Items.MAGMA_CREAM) + .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) + .save(conditionalHandgunRecipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.GRIP_ASSEMBLY.get()) + .pattern("III") + .pattern("IMI") + .pattern("ICI") + .define('I', Tags.Items.INGOTS_IRON) + .define('C', ModItems.EMPTY_MAGAZINE.get()) + .define('M', Items.MAGMA_CREAM) + .unlockedBy("has_magma_cream", has(Items.MAGMA_CREAM)) + .save(conditionalHandgunRecipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.EMPTY_MAGAZINE.get()) + .pattern("I I") + .pattern("IGI") + .pattern("SIS") + .define('S', Tags.Items.STONES) + .define('I', Tags.Items.INGOTS_IRON) + .define('G', Tags.Items.GLASS_BLOCKS) + .unlockedBy("has_iron_ingot", has(Items.IRON_INGOT)) + .save(conditionalHandgunRecipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.HAMMER_ASSEMBLY.get()) + .pattern("IIB") + .pattern("RMI") + .pattern("III") + .define('I', Tags.Items.INGOTS_IRON) + .define('B', Items.STONE_BUTTON) + .define('R', Tags.Items.RODS_BLAZE) + .define('M', ModItems.MOLTEN_CORE.get()) + .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) + .save(conditionalHandgunRecipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.BLAZE_BULLET.get(), 8) + .requires(Items.BLAZE_POWDER) + .requires(Tags.Items.RODS_BLAZE) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.NUGGETS_GOLD) + .unlockedBy("has_blaze_rod", has(Items.BLAZE_ROD)) + .save(conditionalHandgunRecipeOutput); + + addBulletPotionRecipe(conditionalHandgunRecipeOutput, ModItems.BLAZE_BULLET.get()); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.BUSTER_BULLET.get(), 8) + .requires(ModItems.CONCUSSIVE_BULLET.get()) + .requires(ModItems.CONCUSSIVE_BULLET.get()) + .requires(ModItems.CONCUSSIVE_BULLET.get()) + .requires(ModItems.CONCUSSIVE_BULLET.get()) + .requires(ModItems.CONCUSSIVE_BULLET.get()) + .requires(ModItems.CONCUSSIVE_BULLET.get()) + .requires(ModItems.CONCUSSIVE_BULLET.get()) + .requires(ModItems.CONCUSSIVE_BULLET.get()) + .requires(ModItems.CATALYZING_GLAND.get()) + .unlockedBy("has_concussive_bullet", has(ModItems.CONCUSSIVE_BULLET.get())) + .save(conditionalHandgunRecipeOutput); + + addBulletPotionRecipe(recipeOutput, ModItems.BUSTER_BULLET.get()); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.CONCUSSIVE_BULLET.get(), 8) + .requires(Tags.Items.SLIMEBALLS) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.GUNPOWDERS) + .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) + .save(conditionalHandgunRecipeOutput); + + addBulletPotionRecipe(recipeOutput, ModItems.CONCUSSIVE_BULLET.get()); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.ENDER_BULLET.get(), 8) + .requires(ModItems.SEEKER_BULLET.get()) + .requires(ModItems.SEEKER_BULLET.get()) + .requires(ModItems.SEEKER_BULLET.get()) + .requires(ModItems.SEEKER_BULLET.get()) + .requires(ModItems.SEEKER_BULLET.get()) + .requires(ModItems.SEEKER_BULLET.get()) + .requires(ModItems.SEEKER_BULLET.get()) + .requires(ModItems.SEEKER_BULLET.get()) + .requires(ModItems.NEBULOUS_HEART.get()) + .unlockedBy("has_seeker_bullet", has(ModItems.SEEKER_BULLET.get())) + .save(conditionalHandgunRecipeOutput); + + addBulletPotionRecipe(recipeOutput, ModItems.ENDER_BULLET.get()); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.EXORCISM_BULLET.get(), 8) + .requires(ModItems.NEUTRAL_BULLET.get()) + .requires(ModItems.NEUTRAL_BULLET.get()) + .requires(ModItems.NEUTRAL_BULLET.get()) + .requires(ModItems.NEUTRAL_BULLET.get()) + .requires(ModItems.NEUTRAL_BULLET.get()) + .requires(ModItems.NEUTRAL_BULLET.get()) + .requires(ModItems.NEUTRAL_BULLET.get()) + .requires(ModItems.NEUTRAL_BULLET.get()) + .requires(ModItems.ZOMBIE_HEART.get()) + .unlockedBy("has_neutral_bullet", has(ModItems.NEUTRAL_BULLET.get())) + .save(conditionalHandgunRecipeOutput); + + addBulletPotionRecipe(recipeOutput, ModItems.EXORCISM_BULLET.get()); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.NEUTRAL_BULLET.get(), 8) + .requires(Items.FLINT) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.GUNPOWDERS) + .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) + .save(conditionalHandgunRecipeOutput); + + addBulletPotionRecipe(conditionalHandgunRecipeOutput, ModItems.NEUTRAL_BULLET.get()); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.SAND_BULLET.get(), 8) + .requires(Tags.Items.SANDSTONE_BLOCKS) + .requires(Tags.Items.SLIMEBALLS) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.GUNPOWDERS) + .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) + .save(conditionalHandgunRecipeOutput); + + addBulletPotionRecipe(recipeOutput, ModItems.SAND_BULLET.get()); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.SEEKER_BULLET.get(), 8) + .requires(Tags.Items.GEMS_LAPIS) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.GUNPOWDERS) + .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) + .save(conditionalHandgunRecipeOutput); + + addBulletPotionRecipe(conditionalHandgunRecipeOutput, ModItems.SEEKER_BULLET.get()); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.STORM_BULLET.get(), 8) + .requires(ModItems.CATALYZING_GLAND.get()) + .requires(ModItems.CATALYZING_GLAND.get()) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.NUGGETS_GOLD) + .requires(Tags.Items.GUNPOWDERS) + .unlockedBy(HAS_GUNPOWDER_CRITERION, has(Items.GUNPOWDER)) + .save(conditionalHandgunRecipeOutput); + + addBulletPotionRecipe(recipeOutput, ModItems.STORM_BULLET.get()); + + addMagazineRecipe(recipeOutput, ModItems.BLAZE_BULLET.get(), ModItems.BLAZE_MAGAZINE.get()); + addMagazineRecipe(recipeOutput, ModItems.BUSTER_BULLET.get(), ModItems.BUSTER_MAGAZINE.get()); + addMagazineRecipe(recipeOutput, ModItems.CONCUSSIVE_BULLET.get(), ModItems.CONCUSSIVE_MAGAZINE.get()); + addMagazineRecipe(recipeOutput, ModItems.ENDER_BULLET.get(), ModItems.ENDER_MAGAZINE.get()); + addMagazineRecipe(recipeOutput, ModItems.EXORCISM_BULLET.get(), ModItems.EXORCISM_MAGAZINE.get()); + addMagazineRecipe(recipeOutput, ModItems.NEUTRAL_BULLET.get(), ModItems.NEUTRAL_MAGAZINE.get()); + addMagazineRecipe(recipeOutput, ModItems.SAND_BULLET.get(), ModItems.SAND_MAGAZINE.get()); + addMagazineRecipe(recipeOutput, ModItems.SEEKER_BULLET.get(), ModItems.SEEKER_MAGAZINE.get()); + addMagazineRecipe(recipeOutput, ModItems.STORM_BULLET.get(), ModItems.STORM_MAGAZINE.get()); } - private void registerAlkahestryRecipes(Consumer consumer) { - ConditionalRecipe.builder() - .addCondition(new AlkahestryEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.ALKAHESTRY_TOME.get()) - .requires(ModItems.MOLTEN_CORE.get()) - .requires(ModItems.WITCH_HAT.get()) - .requires(ModItems.EYE_OF_THE_STORM.get()) - .requires(ModItems.CATALYZING_GLAND.get()) - .requires(Items.BOOK) - .requires(ModItems.SLIME_PEARL.get()) - .requires(ModItems.CHELICERAE.get()) - .requires(Items.WITHER_SKELETON_SKULL) - .requires(ModItems.NEBULOUS_HEART.get()) - .unlockedBy(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.ALKAHESTRY_TOME.get())); - - ChargingRecipeBuilder.chargingRecipe(Items.GLOWSTONE_DUST, 1).build(consumer, RegistryHelper.getRegistryName(Items.GLOWSTONE_DUST)); - ChargingRecipeBuilder.chargingRecipe(Items.GLOWSTONE, 4).build(consumer, RegistryHelper.getRegistryName(Items.GLOWSTONE)); - ChargingRecipeBuilder.chargingRecipe(Items.REDSTONE, 1).build(consumer, RegistryHelper.getRegistryName(Items.REDSTONE)); - ChargingRecipeBuilder.chargingRecipe(Items.REDSTONE_BLOCK, 9).build(consumer, RegistryHelper.getRegistryName(Items.REDSTONE_BLOCK)); - - DrainRecipeBuilder.drainRecipe(Items.REDSTONE, 1).build(consumer, RegistryHelper.getRegistryName(Items.REDSTONE)); - - CraftingRecipeBuilder.craftingRecipe(Items.CHARCOAL, 4, 5).build(consumer, RegistryHelper.getRegistryName(Items.CHARCOAL)); - CraftingRecipeBuilder.craftingRecipe(Items.CLAY, 4, 3).build(consumer, RegistryHelper.getRegistryName(Items.CLAY)); + private void registerAlkahestryRecipes(RecipeOutput recipeOutput) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.ALKAHESTRY_TOME.get()) + .requires(ModItems.MOLTEN_CORE.get()) + .requires(ModItems.WITCH_HAT.get()) + .requires(ModItems.EYE_OF_THE_STORM.get()) + .requires(ModItems.CATALYZING_GLAND.get()) + .requires(Items.BOOK) + .requires(ModItems.SLIME_PEARL.get()) + .requires(ModItems.CHELICERAE.get()) + .requires(Items.WITHER_SKELETON_SKULL) + .requires(ModItems.NEBULOUS_HEART.get()) + .unlockedBy(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) + .save(recipeOutput.withConditions(new AlkahestryEnabledCondition())); + + ChargingRecipeBuilder.chargingRecipe(Items.GLOWSTONE_DUST, 1).build(recipeOutput, RegistryHelper.getRegistryName(Items.GLOWSTONE_DUST)); + ChargingRecipeBuilder.chargingRecipe(Items.GLOWSTONE, 4).build(recipeOutput, RegistryHelper.getRegistryName(Items.GLOWSTONE)); + ChargingRecipeBuilder.chargingRecipe(Items.REDSTONE, 1).build(recipeOutput, RegistryHelper.getRegistryName(Items.REDSTONE)); + ChargingRecipeBuilder.chargingRecipe(Items.REDSTONE_BLOCK, 9).build(recipeOutput, RegistryHelper.getRegistryName(Items.REDSTONE_BLOCK)); + + DrainRecipeBuilder.drainRecipe(Items.REDSTONE, 1).build(recipeOutput, RegistryHelper.getRegistryName(Items.REDSTONE)); + + CraftingRecipeBuilder.craftingRecipe(Items.CHARCOAL, 4, 5).save(recipeOutput, RegistryHelper.getRegistryName(Items.CHARCOAL)); + CraftingRecipeBuilder.craftingRecipe(Items.CLAY, 4, 3).save(recipeOutput, RegistryHelper.getRegistryName(Items.CLAY)); CraftingRecipeBuilder.craftingRecipe(INGOTS_COPPER, 8, 5) - .addCondition(new NotCondition(new TagEmptyCondition(INGOTS_COPPER.location()))) - .build(consumer, new ResourceLocation("copper_ingot")); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.GEMS_DIAMOND, 64, 2).build(consumer, RegistryHelper.getRegistryName(Items.DIAMOND)); - CraftingRecipeBuilder.craftingRecipe(Items.DIRT, 4, 33).build(consumer, RegistryHelper.getRegistryName(Items.DIRT)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.GEMS_EMERALD, 32, 2).build(consumer, RegistryHelper.getRegistryName(Items.EMERALD)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.END_STONES, 8, 17).build(consumer, RegistryHelper.getRegistryName(Items.END_STONE)); - CraftingRecipeBuilder.craftingRecipe(Items.FLINT, 8, 9).build(consumer, RegistryHelper.getRegistryName(Items.FLINT)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.INGOTS_GOLD, 32, 2).build(consumer, RegistryHelper.getRegistryName(Items.GOLD_INGOT)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.GRAVEL, 4, 17).build(consumer, RegistryHelper.getRegistryName(Items.GRAVEL)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.GUNPOWDER, 8, 3).build(consumer, RegistryHelper.getRegistryName(Items.GUNPOWDER)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.INGOTS_IRON, 32, 2).build(consumer, RegistryHelper.getRegistryName(Items.IRON_INGOT)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.GEMS_LAPIS, 4, 2).build(consumer, RegistryHelper.getRegistryName(Items.LAPIS_LAZULI)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.NETHER_STARS, 256, 2).build(consumer, RegistryHelper.getRegistryName(Items.NETHER_STAR)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.NETHERRACK, 4, 9).build(consumer, RegistryHelper.getRegistryName(Items.NETHERRACK)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.OBSIDIAN, 8, 5).build(consumer, RegistryHelper.getRegistryName(Items.OBSIDIAN)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.SAND, 4, 33).build(consumer, RegistryHelper.getRegistryName(Items.SAND)); - CraftingRecipeBuilder.craftingRecipe(Tags.Items.SANDSTONE, 4, 9).build(consumer, RegistryHelper.getRegistryName(Items.SANDSTONE)); + .save(recipeOutput.withConditions(new NotCondition(new TagEmptyCondition(INGOTS_COPPER.location()))), ResourceLocation.parse("copper_ingot")); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.GEMS_DIAMOND, 64, 2).save(recipeOutput, RegistryHelper.getRegistryName(Items.DIAMOND)); + CraftingRecipeBuilder.craftingRecipe(Items.DIRT, 4, 33).save(recipeOutput, RegistryHelper.getRegistryName(Items.DIRT)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.GEMS_EMERALD, 32, 2).save(recipeOutput, RegistryHelper.getRegistryName(Items.EMERALD)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.END_STONES, 8, 17).save(recipeOutput, RegistryHelper.getRegistryName(Items.END_STONE)); + CraftingRecipeBuilder.craftingRecipe(Items.FLINT, 8, 9).save(recipeOutput, RegistryHelper.getRegistryName(Items.FLINT)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.INGOTS_GOLD, 32, 2).save(recipeOutput, RegistryHelper.getRegistryName(Items.GOLD_INGOT)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.GRAVELS, 4, 17).save(recipeOutput, RegistryHelper.getRegistryName(Items.GRAVEL)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.GUNPOWDERS, 8, 3).save(recipeOutput, RegistryHelper.getRegistryName(Items.GUNPOWDER)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.INGOTS_IRON, 32, 2).save(recipeOutput, RegistryHelper.getRegistryName(Items.IRON_INGOT)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.GEMS_LAPIS, 4, 2).save(recipeOutput, RegistryHelper.getRegistryName(Items.LAPIS_LAZULI)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.NETHER_STARS, 256, 2).save(recipeOutput, RegistryHelper.getRegistryName(Items.NETHER_STAR)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.NETHERRACKS, 4, 9).save(recipeOutput, RegistryHelper.getRegistryName(Items.NETHERRACK)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.OBSIDIANS, 8, 5).save(recipeOutput, RegistryHelper.getRegistryName(Items.OBSIDIAN)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.SANDS, 4, 33).save(recipeOutput, RegistryHelper.getRegistryName(Items.SAND)); + CraftingRecipeBuilder.craftingRecipe(Tags.Items.SANDSTONE_BLOCKS, 4, 9).save(recipeOutput, RegistryHelper.getRegistryName(Items.SANDSTONE)); CraftingRecipeBuilder.craftingRecipe(INGOTS_SILVER, 32, 2) - .addCondition(new NotCondition(new TagEmptyCondition(INGOTS_SILVER.location()))) - .build(consumer, new ResourceLocation("silver_ingot")); - CraftingRecipeBuilder.craftingRecipe(Items.SOUL_SAND, 8, 9).build(consumer, RegistryHelper.getRegistryName(Items.SOUL_SAND)); + .save(recipeOutput.withConditions(new NotCondition(new TagEmptyCondition(INGOTS_SILVER.location()))), ResourceLocation.parse("silver_ingot")); + CraftingRecipeBuilder.craftingRecipe(Items.SOUL_SAND, 8, 9).save(recipeOutput, RegistryHelper.getRegistryName(Items.SOUL_SAND)); CraftingRecipeBuilder.craftingRecipe(INGOTS_STEEL, 32, 2) - .addCondition(new NotCondition(new TagEmptyCondition(INGOTS_STEEL.location()))) - .build(consumer, new ResourceLocation("steel_ingot")); + .save(recipeOutput.withConditions(new NotCondition(new TagEmptyCondition(INGOTS_STEEL.location()))), ResourceLocation.parse("steel_ingot")); CraftingRecipeBuilder.craftingRecipe(INGOTS_TIN, 32, 2) - .addCondition(new NotCondition(new TagEmptyCondition(INGOTS_TIN.location()))) - .build(consumer, new ResourceLocation("tin_ingot")); + .save(recipeOutput.withConditions(new NotCondition(new TagEmptyCondition(INGOTS_TIN.location()))), ResourceLocation.parse("tin_ingot")); } - private void registerPotionRecipes(Consumer consumer) { - ConditionalRecipe.builder() - .addCondition(new PotionsEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.EMPTY_POTION_VIAL.get()) - .pattern("G G") - .pattern("G G") - .pattern(" G ") - .define('G', Tags.Items.GLASS_PANES) - .unlockedBy("has_glass_pane", has(Items.GLASS_PANE)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.EMPTY_POTION_VIAL.get())); - - ConditionalRecipe.builder() - .addCondition(new PotionsEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.APHRODITE_POTION.get()) - .pattern("GBG") - .pattern("GFG") - .pattern("RGC") - .define('G', Tags.Items.GLASS_PANES) - .define('B', Items.WATER_BUCKET) - .define('F', ModItems.FERTILE_ESSENCE.get()) - .define('R', Tags.Items.DYES_RED) - .define('C', Items.COCOA_BEANS) - .unlockedBy(HAS_FERTILE_ESSENCE_CRITERION, has(ModItems.FERTILE_ESSENCE.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.APHRODITE_POTION.get())); - - ConditionalRecipe.builder() - .addCondition(new PotionsEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.FERTILE_POTION.get()) - .pattern("GBG") - .pattern("GFG") - .pattern("CGY") - .define('G', Tags.Items.GLASS_PANES) - .define('B', Items.WATER_BUCKET) - .define('F', ModItems.FERTILE_ESSENCE.get()) - .define('C', Tags.Items.DYES_GREEN) - .define('Y', Tags.Items.DYES_YELLOW) - .unlockedBy(HAS_FERTILE_ESSENCE_CRITERION, has(ModItems.FERTILE_ESSENCE.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModItems.FERTILE_POTION.get())); - - addItemPotionRecipe(consumer, Items.ARROW, ModItems.TIPPED_ARROW.get(), 0.125f, 'A', false); - - ConditionalRecipe.builder() - .addCondition(new PotionsEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.APOTHECARY_CAULDRON_ITEM.get()) - .pattern("GNG") - .pattern("ICI") - .pattern("NMN") - .define('G', ModItems.CATALYZING_GLAND.get()) - .define('N', ModItems.NEBULOUS_HEART.get()) - .define('I', ModItems.INFERNAL_CLAW.get()) - .define('C', Items.CAULDRON) - .define('M', ModItems.MOLTEN_CORE.get()) - .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModBlocks.APOTHECARY_CAULDRON_ITEM.get())); - - ConditionalRecipe.builder() - .addCondition(new PotionsEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.APOTHECARY_MORTAR_ITEM.get()) - .pattern("GNG") - .pattern("NGN") - .pattern("NNN") - .define('G', ModItems.CATALYZING_GLAND.get()) - .define('N', Tags.Items.STORAGE_BLOCKS_QUARTZ) - .unlockedBy(HAS_CATALYZING_GLAND_CRITERIION, has(ModItems.CATALYZING_GLAND.get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(ModBlocks.APOTHECARY_MORTAR_ITEM.get())); + private void registerPotionRecipes(RecipeOutput recipeOutput) { + RecipeOutput potionsEnabledRecipeOutput = recipeOutput.withConditions(new PotionsEnabledCondition()); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.EMPTY_POTION_VIAL.get()) + .pattern("G G") + .pattern("G G") + .pattern(" G ") + .define('G', Tags.Items.GLASS_PANES) + .unlockedBy("has_glass_pane", has(Items.GLASS_PANE)) + .save(potionsEnabledRecipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.APHRODITE_POTION.get()) + .pattern("GBG") + .pattern("GFG") + .pattern("RGC") + .define('G', Tags.Items.GLASS_PANES) + .define('B', Items.WATER_BUCKET) + .define('F', ModItems.FERTILE_ESSENCE.get()) + .define('R', Tags.Items.DYES_RED) + .define('C', Items.COCOA_BEANS) + .unlockedBy(HAS_FERTILE_ESSENCE_CRITERION, has(ModItems.FERTILE_ESSENCE.get())) + .save(potionsEnabledRecipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.FERTILE_POTION.get()) + .pattern("GBG") + .pattern("GFG") + .pattern("CGY") + .define('G', Tags.Items.GLASS_PANES) + .define('B', Items.WATER_BUCKET) + .define('F', ModItems.FERTILE_ESSENCE.get()) + .define('C', Tags.Items.DYES_GREEN) + .define('Y', Tags.Items.DYES_YELLOW) + .unlockedBy(HAS_FERTILE_ESSENCE_CRITERION, has(ModItems.FERTILE_ESSENCE.get())) + .save(potionsEnabledRecipeOutput); + + addItemPotionRecipe(potionsEnabledRecipeOutput, Items.ARROW, ModItems.TIPPED_ARROW.get(), 0.125f, 'A', false); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.APOTHECARY_CAULDRON_ITEM.get()) + .pattern("GNG") + .pattern("ICI") + .pattern("NMN") + .define('G', ModItems.CATALYZING_GLAND.get()) + .define('N', ModItems.NEBULOUS_HEART.get()) + .define('I', ModItems.INFERNAL_CLAW.get()) + .define('C', Items.CAULDRON) + .define('M', ModItems.MOLTEN_CORE.get()) + .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) + .save(potionsEnabledRecipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.APOTHECARY_MORTAR_ITEM.get()) + .pattern("GNG") + .pattern("NGN") + .pattern("NNN") + .define('G', ModItems.CATALYZING_GLAND.get()) + .define('N', Items.QUARTZ_BLOCK) + .unlockedBy(HAS_CATALYZING_GLAND_CRITERIION, has(ModItems.CATALYZING_GLAND.get())) + .save(potionsEnabledRecipeOutput); } - private void registerPedestalRecipes(Consumer consumer) { - addPassivePedestalRecipe(consumer, Items.WHITE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.WHITE).get()); - addPassivePedestalRecipe(consumer, Items.ORANGE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.ORANGE).get()); - addPassivePedestalRecipe(consumer, Items.MAGENTA_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.MAGENTA).get()); - addPassivePedestalRecipe(consumer, Items.LIGHT_BLUE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.LIGHT_BLUE).get()); - addPassivePedestalRecipe(consumer, Items.YELLOW_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.YELLOW).get()); - addPassivePedestalRecipe(consumer, Items.LIME_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.LIME).get()); - addPassivePedestalRecipe(consumer, Items.PINK_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.PINK).get()); - addPassivePedestalRecipe(consumer, Items.GRAY_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.GRAY).get()); - addPassivePedestalRecipe(consumer, Items.LIGHT_GRAY_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.LIGHT_GRAY).get()); - addPassivePedestalRecipe(consumer, Items.CYAN_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.CYAN).get()); - addPassivePedestalRecipe(consumer, Items.PURPLE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.PURPLE).get()); - addPassivePedestalRecipe(consumer, Items.BLUE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.BLUE).get()); - addPassivePedestalRecipe(consumer, Items.BROWN_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.BROWN).get()); - addPassivePedestalRecipe(consumer, Items.GREEN_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.GREEN).get()); - addPassivePedestalRecipe(consumer, Items.RED_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.RED).get()); - addPassivePedestalRecipe(consumer, Items.BLACK_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.BLACK).get()); + private void registerPedestalRecipes(RecipeOutput recipeOutput) { + addPassivePedestalRecipe(recipeOutput, Items.WHITE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.WHITE).get()); + addPassivePedestalRecipe(recipeOutput, Items.ORANGE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.ORANGE).get()); + addPassivePedestalRecipe(recipeOutput, Items.MAGENTA_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.MAGENTA).get()); + addPassivePedestalRecipe(recipeOutput, Items.LIGHT_BLUE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.LIGHT_BLUE).get()); + addPassivePedestalRecipe(recipeOutput, Items.YELLOW_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.YELLOW).get()); + addPassivePedestalRecipe(recipeOutput, Items.LIME_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.LIME).get()); + addPassivePedestalRecipe(recipeOutput, Items.PINK_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.PINK).get()); + addPassivePedestalRecipe(recipeOutput, Items.GRAY_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.GRAY).get()); + addPassivePedestalRecipe(recipeOutput, Items.LIGHT_GRAY_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.LIGHT_GRAY).get()); + addPassivePedestalRecipe(recipeOutput, Items.CYAN_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.CYAN).get()); + addPassivePedestalRecipe(recipeOutput, Items.PURPLE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.PURPLE).get()); + addPassivePedestalRecipe(recipeOutput, Items.BLUE_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.BLUE).get()); + addPassivePedestalRecipe(recipeOutput, Items.BROWN_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.BROWN).get()); + addPassivePedestalRecipe(recipeOutput, Items.GREEN_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.GREEN).get()); + addPassivePedestalRecipe(recipeOutput, Items.RED_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.RED).get()); + addPassivePedestalRecipe(recipeOutput, Items.BLACK_CARPET, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.BLACK).get()); for (DyeColor color : DyeColor.values()) { - addPedestalRecipe(consumer, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(color).get(), ModBlocks.PEDESTAL_ITEMS.get(color).get()); + addPedestalRecipe(recipeOutput, ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(color).get(), ModBlocks.PEDESTAL_ITEMS.get(color).get()); } } - private void registerCraftableMobDropRecipes(Consumer consumer) { - addCraftableMobDropRecipe(consumer, ModItems.BAT_WING.get(), builder -> + private void registerCraftableMobDropRecipes(RecipeOutput recipeOutput) { + addCraftableMobDropRecipe(recipeOutput, ModItems.BAT_WING.get(), builder -> builder .pattern("GGG") .pattern("GFG") @@ -1006,27 +907,27 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .unlockedBy("has_feather", hasTag(Tags.Items.FEATHERS)) ); - addCraftableMobDropRecipe(consumer, ModItems.CATALYZING_GLAND.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.CATALYZING_GLAND.get(), builder -> builder .pattern("GGG") .pattern("GPG") .pattern("GGG") - .define('P', Tags.Items.GUNPOWDER) + .define('P', Tags.Items.GUNPOWDERS) .define('G', Tags.Items.INGOTS_GOLD) - .unlockedBy(HAS_GUNPOWDER_CRITERION, hasTag(Tags.Items.GUNPOWDER)) + .unlockedBy(HAS_GUNPOWDER_CRITERION, hasTag(Tags.Items.GUNPOWDERS)) ); - addCraftableMobDropRecipe(consumer, ModItems.CHELICERAE.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.CHELICERAE.get(), builder -> builder .pattern("GGG") .pattern("GSG") .pattern("GGG") - .define('S', Tags.Items.STRING) + .define('S', Tags.Items.STRINGS) .define('G', Tags.Items.INGOTS_GOLD) - .unlockedBy("has_string", hasTag(Tags.Items.STRING)) + .unlockedBy("has_string", hasTag(Tags.Items.STRINGS)) ); - addCraftableMobDropRecipe(consumer, ModItems.FROZEN_CORE.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.FROZEN_CORE.get(), builder -> builder .pattern("GPG") .pattern("GSG") @@ -1037,17 +938,17 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .unlockedBy("has_snow", has(Items.SNOW)) ); - addCraftableMobDropRecipe(consumer, ModItems.GUARDIAN_SPIKE.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.GUARDIAN_SPIKE.get(), builder -> builder .pattern("GGG") .pattern("GPG") .pattern("GGG") - .define('P', Tags.Items.DUSTS_PRISMARINE) + .define('P', Items.PRISMARINE_SHARD) .define('G', Tags.Items.INGOTS_GOLD) - .unlockedBy("has_prismarine", hasTag(Tags.Items.DUSTS_PRISMARINE)) + .unlockedBy("has_prismarine", has(Items.PRISMARINE_SHARD)) ); - addCraftableMobDropRecipe(consumer, ModItems.MOLTEN_CORE.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.MOLTEN_CORE.get(), builder -> builder .pattern("GGG") .pattern("GMG") @@ -1057,7 +958,7 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .unlockedBy("has_magma_cream", has(Items.MAGMA_CREAM)) ); - addCraftableMobDropRecipe(consumer, ModItems.NEBULOUS_HEART.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.NEBULOUS_HEART.get(), builder -> builder .pattern("GGG") .pattern("GEG") @@ -1067,7 +968,7 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .unlockedBy("has_ender_pearl", hasTag(Tags.Items.ENDER_PEARLS)) ); - addCraftableMobDropRecipe(consumer, ModItems.RIB_BONE.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.RIB_BONE.get(), builder -> builder .pattern("III") .pattern("IBI") @@ -1077,7 +978,7 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .unlockedBy("has_bone", hasTag(Tags.Items.BONES)) ); - addCraftableMobDropRecipe(consumer, ModItems.SLIME_PEARL.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.SLIME_PEARL.get(), builder -> builder .pattern("III") .pattern("ISI") @@ -1087,7 +988,7 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .unlockedBy("has_slimeball", hasTag(Tags.Items.SLIMEBALLS)) ); - addCraftableMobDropRecipe(consumer, ModItems.SQUID_BEAK.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.SQUID_BEAK.get(), builder -> builder .pattern("GGG") .pattern("GIG") @@ -1097,7 +998,7 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .unlockedBy("has_ink_sac", has(Items.INK_SAC)) ); - addCraftableMobDropRecipe(consumer, ModItems.EYE_OF_THE_STORM.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.EYE_OF_THE_STORM.get(), builder -> builder .pattern("GGG") .pattern("GCG") @@ -1107,7 +1008,7 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .unlockedBy(HAS_CATALYZING_GLAND_CRITERIION, has(ModItems.CATALYZING_GLAND.get())) ); - addCraftableMobDropRecipe(consumer, ModItems.WITHERED_RIB.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.WITHERED_RIB.get(), builder -> builder .pattern("D D") .pattern(" S ") @@ -1117,7 +1018,7 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .unlockedBy("has_skeleton_skull", has(Items.SKELETON_SKULL)) ); - addCraftableMobDropRecipe(consumer, ModItems.ZOMBIE_HEART.get(), builder -> + addCraftableMobDropRecipe(recipeOutput, ModItems.ZOMBIE_HEART.get(), builder -> builder .pattern("III") .pattern("IFI") @@ -1126,16 +1027,29 @@ private void registerCraftableMobDropRecipes(Consumer consumer) .define('I', Tags.Items.INGOTS_IRON) .unlockedBy("has_rotten_flesh", has(Items.ROTTEN_FLESH)) ); + + addCraftableMobDropRecipe(recipeOutput, ModItems.WITCH_HAT.get(), builder -> + builder + .pattern("SLS") + .pattern("RGR") + .pattern("TLT") + .define('S', Items.SUGAR) + .define('L', Tags.Items.DUSTS_GLOWSTONE) + .define('R', Tags.Items.DUSTS_REDSTONE) + .define('T', Items.STICK) + .define('G', Tags.Items.INGOTS_GOLD) + .unlockedBy("has_glowstone", has(Tags.Items.DUSTS_GLOWSTONE)) + ); } - private void registerIngredientRecipes(Consumer consumer) { + private void registerIngredientRecipes(RecipeOutput recipeOutput) { ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.CRIMSON_CLOTH.get()) .requires(Items.RED_WOOL) .requires(Items.BLACK_WOOL) .requires(ModItems.NEBULOUS_HEART.get()) .requires(ModItems.NEBULOUS_HEART.get()) .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.FERTILE_ESSENCE.get()) .requires(ModItems.RIB_BONE.get()) @@ -1143,15 +1057,15 @@ private void registerIngredientRecipes(Consumer consumer) { .requires(Tags.Items.DYES_GREEN) .requires(ModItems.SLIME_PEARL.get()) .unlockedBy(HAS_SLIME_PEARL_CRITERION, has(ModItems.SLIME_PEARL.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.INFERNAL_CLAW.get()) - .requires(Tags.Items.LEATHER) + .requires(Tags.Items.LEATHERS) .requires(ModItems.MOLTEN_CORE.get()) .requires(ModItems.RIB_BONE.get()) .requires(ModItems.SLIME_PEARL.get()) .unlockedBy(HAS_SLIME_PEARL_CRITERION, has(ModItems.SLIME_PEARL.get())) - .save(consumer); + .save(recipeOutput); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.KRAKEN_SHELL_FRAGMENT.get()) .requires(ModItems.SQUID_BEAK.get()) @@ -1159,227 +1073,209 @@ private void registerIngredientRecipes(Consumer consumer) { .requires(ModItems.SQUID_BEAK.get()) .requires(ModItems.SLIME_PEARL.get()) .unlockedBy("has_squid_beak", has(ModItems.SQUID_BEAK.get())) - .save(consumer); + .save(recipeOutput); } - private void registerCharmFragmentRecipes(Consumer consumer) { - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:blaze")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.MOLTEN_CORE.get()) - .key('S', Tags.Items.RODS_BLAZE) - .key('T', Items.BLAZE_POWDER) - .addCriterion(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "blaze")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:cave_spider")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.CHELICERAE.get()) - .key('S', Tags.Items.STRING) - .key('T', instantiateNBTIngredient(PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.POISON))) - .addCriterion(HAS_CHELICERAE_CRITERION, has(ModItems.CHELICERAE.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "cave_spider")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:creeper")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.CATALYZING_GLAND.get()) - .key('S', Tags.Items.GUNPOWDER) - .key('T', Items.BONE) - .addCriterion(HAS_CATALYZING_GLAND_CRITERIION, has(ModItems.CATALYZING_GLAND.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "creeper")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:enderman")) - .patternLine("PPP") - .patternLine("SPS") - .patternLine("PPP") - .key('P', ModItems.NEBULOUS_HEART.get()) - .key('S', Tags.Items.ENDER_PEARLS) - .addCriterion(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "enderman")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:ghast")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', Items.GHAST_TEAR) - .key('S', Tags.Items.GUNPOWDER) - .key('T', ModItems.CATALYZING_GLAND.get()) - .addCriterion(HAS_CATALYZING_GLAND_CRITERIION, has(ModItems.CATALYZING_GLAND.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "ghast")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:guardian")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.GUARDIAN_SPIKE.get()) - .key('S', Tags.Items.DUSTS_PRISMARINE) - .key('T', Items.COD) - .addCriterion(HAS_GUARDIAN_SPIKE_CRITERION, has(ModItems.GUARDIAN_SPIKE.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "guardian")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:magma_cube")) - .patternLine("PPP") - .patternLine("SSS") - .patternLine("PPP") - .key('P', ModItems.MOLTEN_CORE.get()) - .key('S', Items.MAGMA_CREAM) - .addCriterion(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "magma_cube")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:skeleton")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.RIB_BONE.get()) - .key('S', Items.BONE) - .key('T', Items.FLINT) - .addCriterion("has_rib_bone", has(ModItems.RIB_BONE.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "skeleton")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:slime")) - .patternLine("PPP") - .patternLine("SSS") - .patternLine("PPP") - .key('P', ModItems.SLIME_PEARL.get()) - .key('S', Tags.Items.SLIMEBALLS) - .addCriterion(HAS_SLIME_PEARL_CRITERION, has(ModItems.SLIME_PEARL.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "slime")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:spider")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.CHELICERAE.get()) - .key('S', Tags.Items.STRING) - .key('T', Items.SPIDER_EYE) - .addCriterion(HAS_CHELICERAE_CRITERION, has(ModItems.CHELICERAE.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "spider")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:witch")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.WITCH_HAT.get()) - .key('S', Items.GLASS_BOTTLE) - .key('T', Items.SPIDER_EYE) - .addCriterion(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "witch")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:wither_skeleton")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.WITHERED_RIB.get()) - .key('S', Items.BONE) - .key('T', Items.WITHER_SKELETON_SKULL) - .addCriterion(HAS_WITHERED_RIB_CRITERION, has(ModItems.WITHERED_RIB.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "wither_skeleton")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:zombie")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.ZOMBIE_HEART.get()) - .key('S', Items.ROTTEN_FLESH) - .key('T', Items.BONE) - .addCriterion(HAS_ZOMBIE_HEART_CRITERION, has(ModItems.ZOMBIE_HEART.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "zombie")); - - NbtShapedRecipeBuilder.shapedRecipe(ModItems.MOB_CHARM_FRAGMENT.get().getStackFor("minecraft:zombified_piglin")) - .patternLine("PPP") - .patternLine("STS") - .patternLine("PPP") - .key('P', ModItems.ZOMBIE_HEART.get()) - .key('S', Items.ROTTEN_FLESH) - .key('T', Items.GOLDEN_SWORD) - .addCriterion(HAS_ZOMBIE_HEART_CRITERION, has(ModItems.ZOMBIE_HEART.get())) - .build(consumer, new ResourceLocation(Reference.MOD_ID, MOB_CHARM_FRAGMENTS_FOLDER + "zombified_piglin")); + private void registerCharmFragmentRecipes(RecipeOutput recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.BLAZE)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.MOLTEN_CORE.get()) + .define('S', Tags.Items.RODS_BLAZE) + .define('T', Items.BLAZE_POWDER) + .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "blaze")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.CAVE_SPIDER)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.CHELICERAE.get()) + .define('S', Tags.Items.STRINGS) + .define('T', DataComponentIngredient.of(true, PotionContents.createItemStack(Items.POTION, Potions.POISON))) + .unlockedBy(HAS_CHELICERAE_CRITERION, has(ModItems.CHELICERAE.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "cave_spider")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.CREEPER)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.CATALYZING_GLAND.get()) + .define('S', Tags.Items.GUNPOWDERS) + .define('T', Items.BONE) + .unlockedBy(HAS_CATALYZING_GLAND_CRITERIION, has(ModItems.CATALYZING_GLAND.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "creeper")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.ENDERMAN)) + .pattern("PPP") + .pattern("SPS") + .pattern("PPP") + .define('P', ModItems.NEBULOUS_HEART.get()) + .define('S', Tags.Items.ENDER_PEARLS) + .unlockedBy(HAS_NEBULOUS_HEART_CRITERION, has(ModItems.NEBULOUS_HEART.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "enderman")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.GHAST)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', Items.GHAST_TEAR) + .define('S', Tags.Items.GUNPOWDERS) + .define('T', ModItems.CATALYZING_GLAND.get()) + .unlockedBy(HAS_CATALYZING_GLAND_CRITERIION, has(ModItems.CATALYZING_GLAND.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "ghast")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.GUARDIAN)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.GUARDIAN_SPIKE.get()) + .define('S', Items.PRISMARINE_SHARD) + .define('T', Items.COD) + .unlockedBy(HAS_GUARDIAN_SPIKE_CRITERION, has(ModItems.GUARDIAN_SPIKE.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "guardian")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.MAGMA_CUBE)) + .pattern("PPP") + .pattern("SSS") + .pattern("PPP") + .define('P', ModItems.MOLTEN_CORE.get()) + .define('S', Items.MAGMA_CREAM) + .unlockedBy(HAS_MOLTEN_CORE_CRITERION, has(ModItems.MOLTEN_CORE.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "magma_cube")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.SKELETON)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.RIB_BONE.get()) + .define('S', Items.BONE) + .define('T', Items.FLINT) + .unlockedBy("has_rib_bone", has(ModItems.RIB_BONE.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "skeleton")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.SLIME)) + .pattern("PPP") + .pattern("SSS") + .pattern("PPP") + .define('P', ModItems.SLIME_PEARL.get()) + .define('S', Tags.Items.SLIMEBALLS) + .unlockedBy(HAS_SLIME_PEARL_CRITERION, has(ModItems.SLIME_PEARL.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "slime")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.SPIDER)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.CHELICERAE.get()) + .define('S', Tags.Items.STRINGS) + .define('T', Items.SPIDER_EYE) + .unlockedBy(HAS_CHELICERAE_CRITERION, has(ModItems.CHELICERAE.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "spider")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.WITCH)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.WITCH_HAT.get()) + .define('S', Items.GLASS_BOTTLE) + .define('T', Items.SPIDER_EYE) + .unlockedBy(HAS_WITCH_HAT_CRITERION, has(ModItems.WITCH_HAT.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "witch")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.WITHER_SKELETON)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.WITHERED_RIB.get()) + .define('S', Items.BONE) + .define('T', Items.WITHER_SKELETON_SKULL) + .unlockedBy(HAS_WITHERED_RIB_CRITERION, has(ModItems.WITHERED_RIB.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "wither_skeleton")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.ZOMBIE)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.ZOMBIE_HEART.get()) + .define('S', Items.ROTTEN_FLESH) + .define('T', Items.BONE) + .unlockedBy(HAS_ZOMBIE_HEART_CRITERION, has(ModItems.ZOMBIE_HEART.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "zombie")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(EntityType.ZOMBIFIED_PIGLIN)) + .pattern("PPP") + .pattern("STS") + .pattern("PPP") + .define('P', ModItems.ZOMBIE_HEART.get()) + .define('S', Items.ROTTEN_FLESH) + .define('T', Items.GOLDEN_SWORD) + .unlockedBy(HAS_ZOMBIE_HEART_CRITERION, has(ModItems.ZOMBIE_HEART.get())) + .save(recipeOutput, Reliquary.getRL(MOB_CHARM_FRAGMENTS_FOLDER + "zombified_piglin")); } - private InventoryChangeTrigger.TriggerInstance hasTag(TagKey tag) { + private Criterion hasTag(TagKey tag) { return inventoryTrigger(ItemPredicate.Builder.item().of(tag).build()); } - private StrictNBTIngredient instantiateNBTIngredient(ItemStack stack) { - return StrictNBTIngredient.of(stack); - } - - private void addCraftableMobDropRecipe(Consumer consumer, ItemBase item, Consumer setRecipe) { + private void addCraftableMobDropRecipe(RecipeOutput recipeOutput, Item item, Consumer setRecipe) { ShapedRecipeBuilder builder = ShapedRecipeBuilder.shaped(RecipeCategory.MISC, item); setRecipe.accept(builder); - - ConditionalRecipe.builder() - .addCondition(new MobDropsCraftableCondition()) - .addRecipe(builder::save) - .build(consumer, RegistryHelper.getRegistryName(item)); + builder.save(recipeOutput.withConditions(new MobDropsCraftableCondition()), RegistryHelper.getRegistryName(item)); } - private void addPedestalRecipe(Consumer consumer, BlockItem passivePedestalItem, BlockItem pedestalItem) { - ConditionalRecipe.builder() - .addCondition(new PedestalEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, pedestalItem) - .pattern("D D") - .pattern(" P ") - .pattern("D D") - .define('D', Tags.Items.GEMS_DIAMOND) - .define('P', passivePedestalItem) - .unlockedBy("has_passive_pedestal", has(ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.WHITE).get())) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(pedestalItem)); + private void addPedestalRecipe(RecipeOutput recipeOutput, BlockItem passivePedestalItem, BlockItem pedestalItem) { + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, pedestalItem) + .pattern("D D") + .pattern(" P ") + .pattern("D D") + .define('D', Tags.Items.GEMS_DIAMOND) + .define('P', passivePedestalItem) + .unlockedBy("has_passive_pedestal", has(ModBlocks.PASSIVE_PEDESTAL_ITEMS.get(DyeColor.WHITE).get())) + .save(recipeOutput.withConditions(new PedestalEnabledCondition())); } - private void addPassivePedestalRecipe(Consumer consumer, Item carpetItem, BlockItem pedestalItem) { - ConditionalRecipe.builder() - .addCondition(new PassivePedestalEnabledCondition()) - .addRecipe(conditionalConsumer -> - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, pedestalItem) - .pattern(" C ") - .pattern("GQG") - .pattern("SSS") - .define('C', carpetItem) - .define('G', Tags.Items.NUGGETS_GOLD) - .define('Q', Tags.Items.STORAGE_BLOCKS_QUARTZ) - .define('S', Items.QUARTZ_SLAB) - .unlockedBy("has_quartz_block", has(Items.QUARTZ_BLOCK)) - .save(conditionalConsumer)) - .build(consumer, RegistryHelper.getRegistryName(pedestalItem)); + private void addPassivePedestalRecipe(RecipeOutput recipeOutput, Item carpetItem, BlockItem pedestalItem) { + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, pedestalItem) + .pattern(" C ") + .pattern("GQG") + .pattern("SSS") + .define('C', carpetItem) + .define('G', Tags.Items.NUGGETS_GOLD) + .define('Q', Items.QUARTZ_BLOCK) + .define('S', Items.QUARTZ_SLAB) + .unlockedBy("has_quartz_block", has(Items.QUARTZ_BLOCK)) + .save(recipeOutput.withConditions(new PassivePedestalEnabledCondition())); } - private void addBulletPotionRecipe(Consumer consumer, Item item) { - addItemPotionRecipe(consumer, item, item, (float) 0.2, 'B', true); + private void addBulletPotionRecipe(RecipeOutput recipeOutput, Item item) { + addItemPotionRecipe(recipeOutput, item, item, (float) 0.2, 'B', true); } - private void addItemPotionRecipe(Consumer consumer, Item itemIngredient, Item item, float durationFactor, char itemKey, boolean includeSuffix) { + private void addItemPotionRecipe(RecipeOutput recipeOutput, Item itemIngredient, Item item, float durationFactor, char itemKey, boolean includeSuffix) { ResourceLocation registryName = RegistryHelper.getRegistryName(item); String path = registryName.getPath(); - ResourceLocation id = includeSuffix ? new ResourceLocation(registryName.getNamespace(), registryName.getPath() + "_potion") : registryName; + ResourceLocation id = includeSuffix ? ResourceLocation.fromNamespaceAndPath(registryName.getNamespace(), registryName.getPath() + "_potion") : registryName; PotionEffectsRecipeBuilder.potionEffectsRecipe(item, 8, durationFactor) - .addCondition(new HandgunEnabledCondition()) - .patternLine(String.valueOf(itemKey) + itemKey + itemKey) - .patternLine(itemKey + "P" + itemKey) - .patternLine(String.valueOf(itemKey) + itemKey + itemKey) - .key(itemKey, itemIngredient) - .key('P', ModItems.LINGERING_POTION.get()) - .addCriterion("has_" + (path.lastIndexOf('/') > -1 ? path.substring(path.indexOf('/') + 1) : path), has(item)) - .build(consumer, id); + .pattern(String.valueOf(itemKey) + itemKey + itemKey) + .pattern(itemKey + "P" + itemKey) + .pattern(String.valueOf(itemKey) + itemKey + itemKey) + .define(itemKey, itemIngredient) + .define('P', ModItems.LINGERING_POTION.get()) + .unlockedBy("has_" + (path.lastIndexOf('/') > -1 ? path.substring(path.indexOf('/') + 1) : path), has(item)) + .save(recipeOutput, id); } - private void addMagazineRecipe(Consumer consumer, BulletItem bulletItem, MagazineItem magazineItem) { + private void addMagazineRecipe(RecipeOutput recipeOutput, BulletItem bulletItem, MagazineItem magazineItem) { String path = RegistryHelper.getRegistryName(bulletItem).getPath(); PotionEffectsRecipeBuilder.potionEffectsRecipe(magazineItem, 1, 1) - .addCondition(new HandgunEnabledCondition()) - .patternLine("BBB") - .patternLine("BMB") - .patternLine("BBB") - .key('B', bulletItem) - .key('M', ModItems.EMPTY_MAGAZINE.get()) - .addCriterion("has_" + (path.lastIndexOf('/') > -1 ? path.substring(path.indexOf('/') + 1) : path), has(bulletItem)) - .build(consumer, RegistryHelper.getRegistryName(magazineItem)); + .pattern("BBB") + .pattern("BMB") + .pattern("BBB") + .define('B', bulletItem) + .define('M', ModItems.EMPTY_MAGAZINE.get()) + .unlockedBy("has_" + (path.lastIndexOf('/') > -1 ? path.substring(path.indexOf('/') + 1) : path), has(bulletItem)) + .save(recipeOutput, RegistryHelper.getRegistryName(magazineItem)); } } diff --git a/src/main/java/reliquary/data/RandomChanceLootingSeveringCondition.java b/src/main/java/reliquary/data/RandomChanceLootingSeveringCondition.java deleted file mode 100644 index 565657d4..00000000 --- a/src/main/java/reliquary/data/RandomChanceLootingSeveringCondition.java +++ /dev/null @@ -1,86 +0,0 @@ -package reliquary.data; - -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; -import com.google.gson.JsonSerializationContext; -import net.minecraft.util.GsonHelper; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -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.storage.loot.LootContext; -import net.minecraft.world.level.storage.loot.parameters.LootContextParam; -import net.minecraft.world.level.storage.loot.parameters.LootContextParams; -import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; -import reliquary.init.ModEnchantments; -import reliquary.init.ModItems; - -import java.util.Set; - -public class RandomChanceLootingSeveringCondition implements LootItemCondition { - final float percent; - final float lootingMultiplier; - private final float severingMultiplier; - - RandomChanceLootingSeveringCondition(float percent, float lootingMultiplier, float severingMultiplier) { - this.percent = percent; - this.lootingMultiplier = lootingMultiplier; - this.severingMultiplier = severingMultiplier; - } - - public LootItemConditionType getType() { - return ModItems.RANDOM_CHANCE_LOOTING_SEVERING.get(); - } - - @Override - public Set> getReferencedContextParams() { - return Set.of(LootContextParams.KILLER_ENTITY); - } - - public boolean test(LootContext lootContext) { - int i = lootContext.getLootingModifier(); - return lootContext.getRandom().nextFloat() < percent + i * lootingMultiplier + getSeveringModifier(lootContext) * severingMultiplier; - } - - private int getSeveringModifier(LootContext lootContext) { - Entity killer = lootContext.getParamOrNull(LootContextParams.KILLER_ENTITY); - if (!(killer instanceof LivingEntity livingEntity)) { - return 0; - } - Enchantment severingEnchantment = ModEnchantments.SEVERING.get(); - Iterable iterable = severingEnchantment.getSlotItems(livingEntity).values(); - int severingLevel = 0; - - for (ItemStack itemstack : iterable) { - int j = EnchantmentHelper.getItemEnchantmentLevel(severingEnchantment, itemstack); - if (itemstack.getItem() == ModItems.MAGICBANE.get()) { - j += 2; - } - - if (j > severingLevel) { - severingLevel = j; - } - } - - return severingLevel; - } - - public static Builder randomChanceLootingSevering(float percent, float lootingMultiplier, float severingMultiplier) { - return () -> new RandomChanceLootingSeveringCondition(percent, lootingMultiplier, severingMultiplier); - } - - public static class Serializer implements net.minecraft.world.level.storage.loot.Serializer { - public void serialize(JsonObject jsonObject, RandomChanceLootingSeveringCondition condition, JsonSerializationContext context) { - jsonObject.addProperty("chance", condition.percent); - jsonObject.addProperty("looting_multiplier", condition.lootingMultiplier); - jsonObject.addProperty("severing_multiplier", condition.severingMultiplier); - } - - public RandomChanceLootingSeveringCondition deserialize(JsonObject jsonObject, JsonDeserializationContext context) { - return new RandomChanceLootingSeveringCondition(GsonHelper.getAsFloat(jsonObject, "chance"), GsonHelper.getAsFloat(jsonObject, "looting_multiplier") - , GsonHelper.getAsFloat(jsonObject, "severing_multiplier")); - } - } -} diff --git a/src/main/java/reliquary/data/ReliquaryEnchantmentProvider.java b/src/main/java/reliquary/data/ReliquaryEnchantmentProvider.java new file mode 100644 index 00000000..7db365b5 --- /dev/null +++ b/src/main/java/reliquary/data/ReliquaryEnchantmentProvider.java @@ -0,0 +1,29 @@ +package reliquary.data; + +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.BootstrapContext; +import net.minecraft.resources.ResourceKey; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EquipmentSlotGroup; +import net.minecraft.world.item.enchantment.Enchantment; +import reliquary.Reliquary; + +public class ReliquaryEnchantmentProvider { + + public static final ResourceKey SEVERING = ResourceKey.create(Registries.ENCHANTMENT, Reliquary.getRL("severing")); + + public static void bootstrap(BootstrapContext context) { + context.register(SEVERING, + Enchantment.enchantment( + Enchantment.definition( + context.lookup(Registries.ITEM).getOrThrow(ItemTags.SWORD_ENCHANTABLE), + 1, //weight + 5, // max level + Enchantment.dynamicCost(15, 9), + Enchantment.dynamicCost(65, 9), + 6, // anvil cost + EquipmentSlotGroup.MAINHAND) + ).build(SEVERING.location()) + ); + } +} diff --git a/src/main/java/reliquary/data/ReliquaryLootModifierProvider.java b/src/main/java/reliquary/data/ReliquaryLootModifierProvider.java index d024a1b1..d8aa1460 100644 --- a/src/main/java/reliquary/data/ReliquaryLootModifierProvider.java +++ b/src/main/java/reliquary/data/ReliquaryLootModifierProvider.java @@ -1,71 +1,78 @@ package reliquary.data; -import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.data.PackOutput; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import net.minecraftforge.common.data.GlobalLootModifierProvider; -import net.minecraftforge.common.loot.IGlobalLootModifier; -import net.minecraftforge.common.loot.LootModifier; -import net.minecraftforge.common.loot.LootTableIdCondition; +import net.neoforged.neoforge.common.data.GlobalLootModifierProvider; +import net.neoforged.neoforge.common.loot.IGlobalLootModifier; +import net.neoforged.neoforge.common.loot.LootModifier; +import net.neoforged.neoforge.common.loot.LootTableIdCondition; +import reliquary.Reliquary; import reliquary.init.ModItems; -import reliquary.reference.Reference; + +import java.util.concurrent.CompletableFuture; public class ReliquaryLootModifierProvider extends GlobalLootModifierProvider { - ReliquaryLootModifierProvider(PackOutput packOutput) { - super(packOutput, Reference.MOD_ID); + ReliquaryLootModifierProvider(PackOutput packOutput, CompletableFuture registries) { + super(packOutput, registries, Reliquary.MOD_ID); } @Override protected void start() { ChestLootInjectSubProvider.LOOT_INJECTS.forEach((vanillaLootTable, injectLootTable) -> - add(vanillaLootTable.getPath(), InjectLootModifier.chest(injectLootTable, vanillaLootTable))); + add(vanillaLootTable.location().getPath(), InjectLootModifier.chest(injectLootTable, vanillaLootTable))); EntityLootInjectSubProvider.LOOT_INJECTS.forEach((vanillaLootTable, injectLootTable) -> - add(vanillaLootTable.getPath(), InjectLootModifier.entity(injectLootTable, vanillaLootTable))); + add(vanillaLootTable.location().getPath(), InjectLootModifier.entity(injectLootTable, vanillaLootTable))); } public static class InjectLootModifier extends LootModifier { - public static final Codec CODEC = RecordCodecBuilder.create(inst -> LootModifier.codecStart(inst).and( + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(inst -> LootModifier.codecStart(inst).and( inst.group( - ResourceLocation.CODEC.fieldOf("loot_table").forGetter(m -> m.lootTable), - ResourceLocation.CODEC.fieldOf("loot_table_to_inject_into").forGetter(m -> m.lootTableToInjectInto) + ResourceKey.codec(Registries.LOOT_TABLE).fieldOf("loot_table").forGetter(m -> m.lootTable), + ResourceKey.codec(Registries.LOOT_TABLE).fieldOf("loot_table_to_inject_into").forGetter(m -> m.lootTableToInjectInto) ) ).apply(inst, InjectLootModifier::new)); - private final ResourceLocation lootTable; - private final ResourceLocation lootTableToInjectInto; + private final ResourceKey lootTable; + private final ResourceKey lootTableToInjectInto; - protected InjectLootModifier(LootItemCondition[] conditions, ResourceLocation lootTable, ResourceLocation lootTableToInjectInto) { + protected InjectLootModifier(LootItemCondition[] conditions, ResourceKey lootTable, ResourceKey lootTableToInjectInto) { super(conditions); this.lootTable = lootTable; this.lootTableToInjectInto = lootTableToInjectInto; } - protected static InjectLootModifier chest(ResourceLocation lootTable, ResourceLocation lootTableToInjectInto) { - return new InjectLootModifier(new LootItemCondition[] {ChestLootEnabledCondition.builder().build(), - LootTableIdCondition.builder(lootTableToInjectInto).build()}, lootTable, lootTableToInjectInto); + protected static InjectLootModifier chest(ResourceKey lootTable, ResourceKey lootTableToInjectInto) { + return new InjectLootModifier(new LootItemCondition[]{ChestLootEnabledCondition.builder().build(), + LootTableIdCondition.builder(lootTableToInjectInto.location()).build()}, lootTable, lootTableToInjectInto); } - protected static InjectLootModifier entity(ResourceLocation lootTable, ResourceLocation lootTableToInjectInto) { - return new InjectLootModifier(new LootItemCondition[] {EntityLootEnabledCondition.builder().build(), - LootTableIdCondition.builder(lootTableToInjectInto).build()}, lootTable, lootTableToInjectInto); + protected static InjectLootModifier entity(ResourceKey lootTable, ResourceKey lootTableToInjectInto) { + return new InjectLootModifier(new LootItemCondition[]{EntityLootEnabledCondition.builder().build(), + LootTableIdCondition.builder(lootTableToInjectInto.location()).build()}, lootTable, lootTableToInjectInto); } + @SuppressWarnings({"deprecation", "java:S1874"}) + // Need to call getRandomItemsRaw to skip neo calling modifyLoot event and causing infinite loop @Override protected ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { - LootTable table = context.getResolver().getLootTable(lootTable); - table.getRandomItemsRaw(context, generatedLoot::add); + context.getResolver().get(Registries.LOOT_TABLE, lootTable).ifPresent(extraTable -> { + extraTable.value().getRandomItemsRaw(context, LootTable.createStackSplitter(context.getLevel(), generatedLoot::add)); + }); return generatedLoot; } @Override - public Codec codec() { + public MapCodec codec() { return ModItems.INJECT_LOOT.get(); } } diff --git a/src/main/java/reliquary/data/ReliquaryLootProvider.java b/src/main/java/reliquary/data/ReliquaryLootTableProvider.java similarity index 61% rename from src/main/java/reliquary/data/ReliquaryLootProvider.java rename to src/main/java/reliquary/data/ReliquaryLootTableProvider.java index 303ea516..2e3fca5b 100644 --- a/src/main/java/reliquary/data/ReliquaryLootProvider.java +++ b/src/main/java/reliquary/data/ReliquaryLootTableProvider.java @@ -1,27 +1,30 @@ package reliquary.data; +import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.loot.LootTableProvider; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.concurrent.CompletableFuture; -public class ReliquaryLootProvider extends LootTableProvider { - ReliquaryLootProvider(PackOutput packOutput) { +public class ReliquaryLootTableProvider extends LootTableProvider { + ReliquaryLootTableProvider(PackOutput packOutput, CompletableFuture registries) { super(packOutput, getAllInjectLootTables(), List.of( new LootTableProvider.SubProviderEntry(BlockLootSubProvider::new, LootContextParamSets.BLOCK), new LootTableProvider.SubProviderEntry(ChestLootInjectSubProvider::new, LootContextParamSets.BLOCK), new LootTableProvider.SubProviderEntry(EntityLootInjectSubProvider::new, LootContextParamSets.ENTITY) - ) + ), registries ); } - private static Set getAllInjectLootTables() { - Set injectLootTables = new HashSet<>(); + private static Set> getAllInjectLootTables() { + Set> injectLootTables = new HashSet<>(); injectLootTables.addAll(ChestLootInjectSubProvider.LOOT_INJECTS.values()); injectLootTables.addAll(EntityLootInjectSubProvider.LOOT_INJECTS.values()); return injectLootTables; diff --git a/src/main/java/reliquary/entities/ConcussiveExplosion.java b/src/main/java/reliquary/entities/ConcussiveExplosion.java index b9a81411..811edbad 100644 --- a/src/main/java/reliquary/entities/ConcussiveExplosion.java +++ b/src/main/java/reliquary/entities/ConcussiveExplosion.java @@ -12,9 +12,8 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.network.PacketDistributor; -import reliquary.network.PacketFXConcussiveExplosion; -import reliquary.network.PacketHandler; +import net.neoforged.neoforge.network.PacketDistributor; +import reliquary.network.SpawnConcussiveExplosionParticlesPayload; import reliquary.util.RandHelper; import javax.annotation.Nullable; @@ -22,7 +21,7 @@ import java.util.Map; public class ConcussiveExplosion extends Explosion { - private final Level world; + private final Level level; private final Vec3 pos; protected final Entity exploder; private float explosionSize; @@ -30,8 +29,9 @@ public class ConcussiveExplosion extends Explosion { private final Player shootingEntity; public ConcussiveExplosion(Level level, @Nullable Entity entity, @Nullable Player player, Vec3 pos, float size, boolean isFlaming) { - super(level, entity, null, null, pos.x(), pos.y(), pos.z(), size, isFlaming, BlockInteraction.DESTROY); - this.world = level; + super(level, entity, null, null, pos.x(), pos.y(), pos.z(), size, isFlaming, + BlockInteraction.DESTROY, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE); + this.level = level; exploder = entity; shootingEntity = player; this.pos = pos; @@ -47,7 +47,7 @@ public void explode() { float var1 = explosionSize; explosionSize *= 2.0F; - List var9 = world.getEntities(exploder, + List var9 = level.getEntities(exploder, new AABB(pos.add(-explosionSize - 1.0D, -explosionSize - 1.0D, -explosionSize - 1.0D), pos.add(explosionSize + 1.0D, explosionSize + 1.0D, explosionSize + 1.0D))); @@ -92,12 +92,12 @@ protected boolean affectEntity(Entity entity) { */ @Override public void finalizeExplosion(boolean spawnParticles) { - world.playSound(null, BlockPos.containing(pos.x(), pos.y(), pos.z()), SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS, 4.0F, (1.0F + RandHelper.getRandomMinusOneToOne(world.random) * 0.2F) * 0.7F); + level.playSound(null, BlockPos.containing(pos.x(), pos.y(), pos.z()), SoundEvents.GENERIC_EXPLODE.value(), SoundSource.BLOCKS, 4.0F, (1.0F + RandHelper.getRandomMinusOneToOne(level.random) * 0.2F) * 0.7F); if (explosionSize >= 2.0F) { - world.addParticle(ParticleTypes.EXPLOSION_EMITTER, pos.x(), pos.y(), pos.z(), 1.0D, 0.0D, 0.0D); + level.addParticle(ParticleTypes.EXPLOSION_EMITTER, pos.x(), pos.y(), pos.z(), 1.0D, 0.0D, 0.0D); } else { - world.addParticle(ParticleTypes.EXPLOSION, pos.x(), pos.y(), pos.z(), 1.0D, 0.0D, 0.0D); + level.addParticle(ParticleTypes.EXPLOSION, pos.x(), pos.y(), pos.z(), 1.0D, 0.0D, 0.0D); } } @@ -108,14 +108,14 @@ public Map getHitPlayers() { public static class GrenadeConcussiveExplosion extends ConcussiveExplosion { - GrenadeConcussiveExplosion(Level world, Entity entity, Player par3Entity, Vec3 pos) { - super(world, entity, par3Entity, pos, (float) 4.0, false); + GrenadeConcussiveExplosion(Level level, Entity entity, Player par3Entity, Vec3 pos) { + super(level, entity, par3Entity, pos, (float) 4.0, false); } @Override protected boolean affectEntity(Entity entity) { return (super.affectEntity(entity) && !(entity instanceof Player)) - || (entity instanceof Player player && exploder.getCustomName() != null && exploder.getCustomName().getString().contains((player).getGameProfile().getName())); + || (entity instanceof Player player && exploder != null && exploder.getCustomName() != null && exploder.getCustomName().getString().contains((player).getGameProfile().getName())); } } @@ -131,8 +131,7 @@ public static void customConcussiveExplosion(Entity entity, Player player, Vec3 var11.explode(); var11.finalizeExplosion(false); - PacketHandler.sendToAllAround(new PacketFXConcussiveExplosion(size, pos), new PacketDistributor.TargetPoint(entity.getX(), entity.getY(), entity.getZ(), 96.0D, entity.getCommandSenderWorld().dimension())); - + PacketDistributor.sendToPlayersTrackingEntity(entity, new SpawnConcussiveExplosionParticlesPayload(size, pos)); } static void grenadeConcussiveExplosion(Entity entity, Player player, Vec3 pos) { @@ -140,8 +139,6 @@ static void grenadeConcussiveExplosion(Entity entity, Player player, Vec3 pos) { var11.explode(); var11.finalizeExplosion(false); - PacketHandler.sendToAllAround(new PacketFXConcussiveExplosion((float) 4.0, pos), new PacketDistributor.TargetPoint(entity.getX(), entity.getY(), entity.getZ(), 96.0D, entity.getCommandSenderWorld().dimension())); - + PacketDistributor.sendToPlayersTrackingEntity(entity, new SpawnConcussiveExplosionParticlesPayload((float) 4.0, pos)); } - } diff --git a/src/main/java/reliquary/entities/EnderStaffProjectileEntity.java b/src/main/java/reliquary/entities/EnderStaffProjectile.java similarity index 71% rename from src/main/java/reliquary/entities/EnderStaffProjectileEntity.java rename to src/main/java/reliquary/entities/EnderStaffProjectile.java index 1b43352a..e48d26b3 100644 --- a/src/main/java/reliquary/entities/EnderStaffProjectileEntity.java +++ b/src/main/java/reliquary/entities/EnderStaffProjectile.java @@ -3,9 +3,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.entity.Entity; @@ -21,27 +20,19 @@ import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.entity.IEntityAdditionalSpawnData; -import net.minecraftforge.event.ForgeEventFactory; -import net.minecraftforge.network.NetworkHooks; +import net.neoforged.neoforge.event.EventHooks; import reliquary.init.ModEntities; @SuppressWarnings("squid:S2160") -@OnlyIn( - value = Dist.CLIENT, - _interface = ItemSupplier.class -) -public class EnderStaffProjectileEntity extends ThrowableProjectile implements ItemSupplier, IEntityAdditionalSpawnData { - public EnderStaffProjectileEntity(EntityType entityType, Level world) { - super(entityType, world); +public class EnderStaffProjectile extends ThrowableProjectile implements ItemSupplier { + public EnderStaffProjectile(EntityType entityType, Level level) { + super(entityType, level); } private boolean normalGravity = false; - public EnderStaffProjectileEntity(Level world, Player entityPlayer, boolean shortRange) { - super(ModEntities.ENDER_STAFF_PROJECTILE.get(), entityPlayer, world); + public EnderStaffProjectile(Level level, Player entityPlayer, boolean shortRange) { + super(ModEntities.ENDER_STAFF_PROJECTILE.get(), entityPlayer, level); normalGravity = shortRange; } @@ -49,15 +40,15 @@ public EnderStaffProjectileEntity(Level world, Player entityPlayer, boolean shor * Gets the amount of gravity to apply to the thrown entity with each tick. */ @Override - protected float getGravity() { + protected double getDefaultGravity() { if (normalGravity) { - return super.getGravity(); + return super.getDefaultGravity(); } return 0.005F; } @Override - protected void defineSynchedData() { + protected void defineSynchedData(SynchedEntityData.Builder builder) { //noop } @@ -127,7 +118,7 @@ private void onThrowableCollision(HitResult result) { float targetY = y + 0.5F; float targetZ = z + 0.5F; if (thrower instanceof ServerPlayer serverPlayer) { - ForgeEventFactory.onEnderPearlLand(serverPlayer, targetX, targetY, targetZ, new ThrownEnderpearl(level(), serverPlayer), 0, result); + EventHooks.onEnderPearlLand(serverPlayer, targetX, targetY, targetZ, new ThrownEnderpearl(level(), serverPlayer), 0, result); } thrower.playSound(SoundEvents.ENDERMAN_TELEPORT, 1.0f, 1.0f); @@ -142,17 +133,14 @@ public ItemStack getItem() { } @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); + protected void addAdditionalSaveData(CompoundTag tag) { + super.addAdditionalSaveData(tag); + tag.putBoolean("normalGravity", normalGravity); } @Override - public void writeSpawnData(FriendlyByteBuf buffer) { - buffer.writeBoolean(normalGravity); - } - - @Override - public void readSpawnData(FriendlyByteBuf additionalData) { - normalGravity = additionalData.readBoolean(); + protected void readAdditionalSaveData(CompoundTag tag) { + super.readAdditionalSaveData(tag); + normalGravity = tag.getBoolean("normalGravity"); } } diff --git a/src/main/java/reliquary/entities/EntityXRFakePlayer.java b/src/main/java/reliquary/entities/EntityXRFakePlayer.java deleted file mode 100644 index cab37be1..00000000 --- a/src/main/java/reliquary/entities/EntityXRFakePlayer.java +++ /dev/null @@ -1,85 +0,0 @@ -package reliquary.entities; - -import com.mojang.authlib.GameProfile; -import net.minecraft.core.BlockPos; -import net.minecraft.core.NonNullList; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.phys.Vec3; -import net.minecraftforge.common.util.FakePlayer; - -import javax.annotation.Nullable; -import java.util.UUID; - -@SuppressWarnings({"squid:S2160", "squid:MaximumInheritanceDepth"}) -public class EntityXRFakePlayer extends FakePlayer { - private final NonNullList fakePlayerHandInventory = NonNullList.withSize(2, ItemStack.EMPTY); - private static final String FAKE_PLAYER_USERNAME = "reliquary_pedestal_fake_player"; - - public EntityXRFakePlayer(ServerLevel world) { - this(world, new GameProfile(UUID.nameUUIDFromBytes(FAKE_PLAYER_USERNAME.getBytes()), FAKE_PLAYER_USERNAME)); - } - - private EntityXRFakePlayer(ServerLevel world, GameProfile name) { - super(world, name); - } - - @Override - public void tick() { - if (level().isClientSide) { - return; - } - - for (int i = 0; i < 2; i++) { - EquipmentSlot entityEquipmentSlot = EquipmentSlot.values()[i]; - - ItemStack itemstack = fakePlayerHandInventory.get(entityEquipmentSlot.getIndex()); - ItemStack itemstack1 = getItemBySlot(entityEquipmentSlot); - - if (!ItemStack.matches(itemstack1, itemstack)) { - if (!itemstack.isEmpty()) { - getAttributes().removeAttributeModifiers(itemstack.getAttributeModifiers(entityEquipmentSlot)); - } - - if (!itemstack1.isEmpty()) { - getAttributes().addTransientAttributeModifiers(itemstack1.getAttributeModifiers(entityEquipmentSlot)); - } - - setItemSlot(entityEquipmentSlot, itemstack1.isEmpty() ? ItemStack.EMPTY : itemstack1); - break; - } - } - - //finish previous swing or cool down caused by change of weapons - attackStrengthTicker = (int) getCurrentItemAttackStrengthDelay(); - } - - @Override - protected void onEffectAdded(MobEffectInstance effect, @Nullable Entity entity) { - //noop - } - - @Override - protected void onEffectUpdated(MobEffectInstance effect, boolean updateAttributes, @Nullable Entity entity) { - //noop - } - - - @Override - protected void onEffectRemoved(MobEffectInstance effect) { - //noop - } - - @Override - public Vec3 position() { - return position; - } - - @Override - public BlockPos blockPosition() { - return blockPosition; - } -} diff --git a/src/main/java/reliquary/entities/GlowingWaterEntity.java b/src/main/java/reliquary/entities/GlowingWater.java similarity index 63% rename from src/main/java/reliquary/entities/GlowingWaterEntity.java rename to src/main/java/reliquary/entities/GlowingWater.java index dcbdcde0..38fd3338 100644 --- a/src/main/java/reliquary/entities/GlowingWaterEntity.java +++ b/src/main/java/reliquary/entities/GlowingWater.java @@ -1,16 +1,16 @@ package reliquary.entities; +import net.minecraft.core.Position; import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.EntityTypeTags; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.ItemSupplier; import net.minecraft.world.entity.projectile.ThrowableProjectile; @@ -18,45 +18,37 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkHooks; -import net.minecraftforge.network.PacketDistributor; +import net.neoforged.neoforge.network.PacketDistributor; import reliquary.init.ModEntities; import reliquary.init.ModItems; -import reliquary.network.PacketFXThrownPotionImpact; -import reliquary.network.PacketHandler; +import reliquary.network.SpawnThrownPotionImpactParticlesPayload; import reliquary.reference.Colors; import java.util.List; -@OnlyIn( - value = Dist.CLIENT, - _interface = ItemSupplier.class -) -public class GlowingWaterEntity extends ThrowableProjectile implements ItemSupplier { - public GlowingWaterEntity(EntityType entityType, Level world) { - super(entityType, world); +public class GlowingWater extends ThrowableProjectile implements ItemSupplier { + public GlowingWater(EntityType entityType, Level level) { + super(entityType, level); } - public GlowingWaterEntity(Level world, Player player) { - super(ModEntities.GLOWING_WATER.get(), player, world); + public GlowingWater(Level level, Player player) { + super(ModEntities.GLOWING_WATER.get(), player, level); } - public GlowingWaterEntity(Level world, double x, double y, double z) { - super(ModEntities.GLOWING_WATER.get(), x, y, z, world); + public GlowingWater(Level level, Position position) { + super(ModEntities.GLOWING_WATER.get(), position.x(), position.y(), position.z(), level); } /** * Gets the amount of gravity to apply to the thrown entity with each tick. */ @Override - protected float getGravity() { + protected double getDefaultGravity() { return 0.05F; } private boolean isUndead(LivingEntity e) { - return e.getMobType() == MobType.UNDEAD; + return e.getType().is(EntityTypeTags.UNDEAD); } /** @@ -94,12 +86,12 @@ private void spawnParticles() { } level().playSound(null, blockPosition(), SoundEvents.GLASS_BREAK, SoundSource.NEUTRAL, 1.0F, level().random.nextFloat() * 0.1F + 0.9F); - PacketHandler.sendToAllAround(new PacketFXThrownPotionImpact(Colors.get(Colors.BLUE), getX(), getY(), getZ()), new PacketDistributor.TargetPoint(getX(), getY(), getZ(), 32.0D, level().dimension())); + PacketDistributor.sendToPlayersTrackingEntity(this, new SpawnThrownPotionImpactParticlesPayload(Colors.get(Colors.BLUE), getX(), getY(), getZ())); } @Override - protected void defineSynchedData() { + protected void defineSynchedData(SynchedEntityData.Builder builder) { //noop } @@ -107,9 +99,4 @@ protected void defineSynchedData() { public ItemStack getItem() { return new ItemStack(ModItems.GLOWING_WATER.get()); } - - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); - } } diff --git a/src/main/java/reliquary/entities/HolyHandGrenadeEntity.java b/src/main/java/reliquary/entities/HolyHandGrenade.java similarity index 55% rename from src/main/java/reliquary/entities/HolyHandGrenadeEntity.java rename to src/main/java/reliquary/entities/HolyHandGrenade.java index f02861a9..f95f720f 100644 --- a/src/main/java/reliquary/entities/HolyHandGrenadeEntity.java +++ b/src/main/java/reliquary/entities/HolyHandGrenade.java @@ -1,9 +1,11 @@ package reliquary.entities; +import net.minecraft.core.Position; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.util.FastColor; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.ItemSupplier; @@ -12,45 +14,38 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkHooks; import reliquary.init.ModEntities; import reliquary.init.ModItems; @SuppressWarnings("squid:S2160") -@OnlyIn( - value = Dist.CLIENT, - _interface = ItemSupplier.class -) -public class HolyHandGrenadeEntity extends ThrowableProjectile implements ItemSupplier { +public class HolyHandGrenade extends ThrowableProjectile implements ItemSupplier { private int count = 0; private Player playerThrower; - public HolyHandGrenadeEntity(EntityType entityType, Level world) { - super(entityType, world); + public HolyHandGrenade(EntityType entityType, Level level) { + super(entityType, level); } - public HolyHandGrenadeEntity(Level world, Player player, String customName) { - super(ModEntities.HOLY_HAND_GRENADE.get(), player, world); + public HolyHandGrenade(Level level, Player player, String customName) { + super(ModEntities.HOLY_HAND_GRENADE.get(), player, level); playerThrower = player; setCustomName(Component.literal(customName)); } - public HolyHandGrenadeEntity(Level world, double x, double y, double z) { - super(ModEntities.HOLY_HAND_GRENADE.get(), x, y, z, world); + public HolyHandGrenade(Level level, Position position) { + super(ModEntities.HOLY_HAND_GRENADE.get(), position.x(), position.y(), position.z(), level); } /** * Gets the amount of gravity to apply to the thrown entity with each tick. */ @Override - protected float getGravity() { + protected double getDefaultGravity() { return 0.03F; } @Override - protected void defineSynchedData() { + protected void defineSynchedData(SynchedEntityData.Builder builder) { //noop } @@ -59,7 +54,7 @@ public void tick() { super.tick(); if (count == 2) { for (int particles = 0; particles < random.nextInt(2) + 1; particles++) { - level().addParticle(ParticleTypes.ENTITY_EFFECT, getX() + level().random.nextDouble(), getY() + level().random.nextDouble(), getZ() + level().random.nextDouble(), 0D, 0D, 0D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, FastColor.ARGB32.opaque( 0)), getX() + level().random.nextDouble(), getY() + level().random.nextDouble(), getZ() + level().random.nextDouble(), 0D, 0D, 0D); } count = 0; } else { @@ -76,21 +71,15 @@ protected void onHit(HitResult result) { return; } - discard(); - - //just making sure that player doesn't see the particles on client when the grenade is thrown if (tickCount > 3 || result.getType() != HitResult.Type.ENTITY || !(((EntityHitResult) result).getEntity() instanceof Player)) { ConcussiveExplosion.grenadeConcussiveExplosion(this, playerThrower, position()); } + + discard(); } @Override public ItemStack getItem() { return new ItemStack(ModItems.HOLY_HAND_GRENADE.get()); } - - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); - } } diff --git a/src/main/java/reliquary/entities/KrakenSlimeEntity.java b/src/main/java/reliquary/entities/KrakenSlime.java similarity index 77% rename from src/main/java/reliquary/entities/KrakenSlimeEntity.java rename to src/main/java/reliquary/entities/KrakenSlime.java index c3d4673f..95c04737 100644 --- a/src/main/java/reliquary/entities/KrakenSlimeEntity.java +++ b/src/main/java/reliquary/entities/KrakenSlime.java @@ -1,8 +1,6 @@ package reliquary.entities; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.effect.MobEffectInstance; @@ -17,17 +15,16 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.network.NetworkHooks; +import reliquary.init.ModEffects; import reliquary.init.ModEntities; -import reliquary.init.ModPotions; -public class KrakenSlimeEntity extends ThrowableItemProjectile { - public KrakenSlimeEntity(EntityType entityType, Level world) { - super(entityType, world); +public class KrakenSlime extends ThrowableItemProjectile { + public KrakenSlime(EntityType entityType, Level level) { + super(entityType, level); } - public KrakenSlimeEntity(Level world, Player player) { - super(ModEntities.KRAKEN_SLIME.get(), player, world); + public KrakenSlime(Level level, Player player) { + super(ModEntities.KRAKEN_SLIME.get(), player, level); } @Override @@ -40,7 +37,7 @@ protected void onHit(HitResult result) { if (result.getType() == HitResult.Type.ENTITY && ((EntityHitResult) result).getEntity() instanceof Mob living) { living.hurt(damageSources().thrown(this, thrower), 5.0f); living.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 20 * 20, 2)); - living.addEffect(new MobEffectInstance(ModPotions.PACIFICATION_POTION.get(), 15 * 20)); + living.addEffect(new MobEffectInstance(ModEffects.PACIFICATION, 15 * 20)); } double motionX = getDeltaMovement().x(); @@ -55,7 +52,7 @@ protected void onHit(HitResult result) { } @Override - protected float getGravity() { + protected double getDefaultGravity() { return 0.001F; } @@ -89,10 +86,4 @@ public void tick() { discard(); } } - - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); - } - } diff --git a/src/main/java/reliquary/entities/LyssaHook.java b/src/main/java/reliquary/entities/LyssaHook.java index 619e731a..28c7e2d2 100644 --- a/src/main/java/reliquary/entities/LyssaHook.java +++ b/src/main/java/reliquary/entities/LyssaHook.java @@ -1,16 +1,10 @@ package reliquary.entities; import net.minecraft.core.BlockPos; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; -import net.minecraft.world.entity.Entity; -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.*; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.FishingHook; @@ -18,31 +12,24 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.entity.IEntityAdditionalSpawnData; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; -import net.minecraftforge.network.NetworkHooks; import reliquary.init.ModEntities; import reliquary.init.ModItems; -import reliquary.reference.Settings; -import reliquary.util.LogHelper; +import reliquary.reference.Config; -import java.lang.reflect.Field; import java.util.List; import java.util.Optional; -public class LyssaHook extends FishingHook implements IEntityAdditionalSpawnData { - public LyssaHook(EntityType entityType, Level world) { - this(entityType, world, 0, 0); +public class LyssaHook extends FishingHook { + public LyssaHook(EntityType entityType, Level level) { + this(entityType, level, 0, 0); } private LyssaHook(EntityType entityType, Level level, int luck, int lureSpeed) { super(entityType, level, luck, lureSpeed); } - public LyssaHook(Level world, Player fishingPlayer, int lureSpeed, int luck) { - this(ModEntities.LYSSA_HOOK.get(), world, luck, lureSpeed); + public LyssaHook(Level level, Player fishingPlayer, int lureSpeed, int luck) { + this(ModEntities.LYSSA_HOOK.get(), level, luck, lureSpeed); setOwner(fishingPlayer); shoot(fishingPlayer); @@ -65,34 +52,19 @@ private void shoot(Player fishingPlayer) { double d3 = vec3.length(); vec3 = vec3.multiply(0.6D / d3 + 0.5D + random.nextGaussian() * 0.0045D, 0.6D / d3 + 0.5D + random.nextGaussian() * 0.0045D, 0.6D / d3 + 0.5D + random.nextGaussian() * 0.0045D); setDeltaMovement(vec3); - //noinspection SuspiciousNameCombination setYRot((float) (Mth.atan2(vec3.x, vec3.z) * (180F / (float) Math.PI))); setXRot((float) (Mth.atan2(vec3.y, vec3.horizontalDistance()) * (180F / (float) Math.PI))); yRotO = getYRot(); xRotO = getXRot(); } - @OnlyIn(Dist.CLIENT) @Override public boolean shouldRenderAtSqrDistance(double distance) { //much higher visible range than regular hook return distance < 16384; } - @Override // TODO are these two methods even needed? they seem to duplicate what Projectile does already - public void writeSpawnData(FriendlyByteBuf buffer) { - buffer.writeInt(getFishingPlayerOptional().map(Player::getId).orElse(0)); - } - - @Override - public void readSpawnData(FriendlyByteBuf additionalData) { - int entityId = additionalData.readInt(); - if (entityId != 0) { - setOwner(level().getEntity(entityId)); - } - } - - public Optional getFishingPlayerOptional() { + public Optional getFishingPlayer() { Entity entity = getOwner(); return Optional.ofNullable(entity instanceof Player player ? player : null); } @@ -150,11 +122,11 @@ private void pullItemEntitiesTowardsHook() { public void handleHookRetraction(ItemStack stack) { if (!level().isClientSide) { Entity hookedIn = getHookedIn(); - if (hookedIn != null && getFishingPlayerOptional().map(Entity::isCrouching).orElse(false) && canStealFromEntity()) { + if (hookedIn != null && getFishingPlayer().map(Entity::isCrouching).orElse(false) && canStealFromEntity()) { stealFromLivingEntity(); discard(); } else { - if (!level().isClientSide && getFishingPlayerOptional().isPresent() && hookedIn != null) { + if (!level().isClientSide && getFishingPlayer().isPresent() && hookedIn != null) { bringInHookedEntity(); level().broadcastEntityEvent(this, (byte) 31); discard(); @@ -183,13 +155,13 @@ private void bringInHookedEntity() { private boolean canStealFromEntity() { Entity hookedIn = getHookedIn(); - return hookedIn instanceof LivingEntity && (Settings.COMMON.items.rodOfLyssa.stealFromPlayers.get() || !(hookedIn instanceof Player)) && Settings.COMMON.items.rodOfLyssa.canStealFromEntity(hookedIn); + return hookedIn instanceof LivingEntity && (Config.COMMON.items.rodOfLyssa.stealFromPlayers.get() || !(hookedIn instanceof Player)) && Config.COMMON.items.rodOfLyssa.canStealFromEntity(hookedIn); } private void pullItemEntitiesWithHook() { List pullingItemsList = level().getEntitiesOfClass(ItemEntity.class, getBoundingBox().expandTowards(getDeltaMovement()).inflate(1.0D, 1.0D, 1.0D)); - getFishingPlayerOptional().ifPresent(p -> { + getFishingPlayer().ifPresent(p -> { for (ItemEntity e : pullingItemsList) { double d1 = p.getX() - getX(); double d3 = p.getY() - getY(); @@ -208,7 +180,7 @@ private void stealFromLivingEntity() { EquipmentSlot slotBeingStolenFrom = EquipmentSlot.values()[level().random.nextInt(EquipmentSlot.values().length)]; ItemStack stolenStack = livingEntity.getItemBySlot(slotBeingStolenFrom); - if (stolenStack.isEmpty() && Boolean.TRUE.equals(Settings.COMMON.items.rodOfLyssa.stealFromVacantSlots.get())) { + if (stolenStack.isEmpty() && Boolean.TRUE.equals(Config.COMMON.items.rodOfLyssa.stealFromVacantSlots.get())) { for (EquipmentSlot slot : EquipmentSlot.values()) { stolenStack = livingEntity.getItemBySlot(slot); if (!stolenStack.isEmpty() && canDropFromSlot(livingEntity, slot)) { @@ -220,7 +192,7 @@ private void stealFromLivingEntity() { float failProbabilityFactor; - Optional p = getFishingPlayerOptional(); + Optional p = getFishingPlayer(); if (p.isEmpty()) { return; @@ -228,27 +200,31 @@ private void stealFromLivingEntity() { Player fishingPlayer = p.get(); - if (Boolean.TRUE.equals(Settings.COMMON.items.rodOfLyssa.useLeveledFailureRate.get())) { - failProbabilityFactor = 1F / ((float) Math.sqrt(Math.max(1, Math.min(fishingPlayer.experienceLevel, Settings.COMMON.items.rodOfLyssa.levelCapForLeveledFormula.get()))) * 2); + if (Boolean.TRUE.equals(Config.COMMON.items.rodOfLyssa.useLeveledFailureRate.get())) { + failProbabilityFactor = 1F / ((float) Math.sqrt(Math.max(1, Math.min(fishingPlayer.experienceLevel, Config.COMMON.items.rodOfLyssa.levelCapForLeveledFormula.get()))) * 2); } else { - failProbabilityFactor = Settings.COMMON.items.rodOfLyssa.flatStealFailurePercentRate.get() / 100F; + failProbabilityFactor = Config.COMMON.items.rodOfLyssa.flatStealFailurePercentRate.get() / 100F; } - if ((random.nextFloat() <= failProbabilityFactor || (stolenStack.isEmpty() && Settings.COMMON.items.rodOfLyssa.failStealFromVacantSlots.get())) && Boolean.TRUE.equals(Settings.COMMON.items.rodOfLyssa.angerOnStealFailure.get())) { + if ((random.nextFloat() <= failProbabilityFactor || (stolenStack.isEmpty() && Config.COMMON.items.rodOfLyssa.failStealFromVacantSlots.get())) && Boolean.TRUE.equals(Config.COMMON.items.rodOfLyssa.angerOnStealFailure.get())) { livingEntity.hurt(damageSources().playerAttack(fishingPlayer), 0.0F); + return; } - if (!stolenStack.isEmpty()) { + if (!stolenStack.isEmpty() && level() instanceof ServerLevel serverLevel) { int randomItemDamage = level().random.nextInt(3); - stolenStack.hurtAndBreak(randomItemDamage, livingEntity, e -> {}); - ItemEntity entityitem = new ItemEntity(level(), getX(), getY(), getZ(), stolenStack); - entityitem.setPickUpDelay(5); - double d1 = fishingPlayer.getX() - getX(); - double d3 = fishingPlayer.getY() - getY(); - double d5 = fishingPlayer.getZ() - getZ(); - double d7 = Math.sqrt(d1 * d1 + d3 * d3 + d5 * d5); - double d9 = 0.1D; - entityitem.setDeltaMovement(d1 * d9, d3 * d9 + Math.sqrt(d7) * 0.08D, d5 * d9); - level().addFreshEntity(entityitem); + stolenStack.hurtAndBreak(randomItemDamage, serverLevel, livingEntity, e -> { + }); + if (!stolenStack.isEmpty()) { + ItemEntity entityitem = new ItemEntity(level(), getX(), getY(), getZ(), stolenStack); + entityitem.setPickUpDelay(5); + double d1 = fishingPlayer.getX() - getX(); + double d3 = fishingPlayer.getY() - getY(); + double d5 = fishingPlayer.getZ() - getZ(); + double d7 = Math.sqrt(d1 * d1 + d3 * d3 + d5 * d5); + double d9 = 0.1D; + entityitem.setDeltaMovement(d1 * d9, d3 * d9 + Math.sqrt(d7) * 0.08D, d5 * d9); + level().addFreshEntity(entityitem); + } livingEntity.setItemSlot(slotBeingStolenFrom, ItemStack.EMPTY); } @@ -259,25 +235,10 @@ private boolean canDropFromSlot(LivingEntity entity, EquipmentSlot slot) { return true; } - try { - if (slot.getType() == EquipmentSlot.Type.HAND) { - return ((float[]) HANDS_CHANCES.get(mob))[slot.getIndex()] > -1; - } else { - return ((float[]) ARMOR_CHANCES.get(mob))[slot.getIndex()] > -1; - } - } - catch (IllegalAccessException e) { - LogHelper.error(e); + if (slot.getType() == EquipmentSlot.Type.HAND) { + return mob.handDropChances[slot.getIndex()] > -1; + } else { + return mob.armorDropChances[slot.getIndex()] > -1; } - - return false; - } - - private static final Field HANDS_CHANCES = ObfuscationReflectionHelper.findField(Mob.class, "f_21347_"); - private static final Field ARMOR_CHANCES = ObfuscationReflectionHelper.findField(Mob.class, "f_21348_"); - - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); } } diff --git a/src/main/java/reliquary/entities/ReliquaryFakePlayer.java b/src/main/java/reliquary/entities/ReliquaryFakePlayer.java new file mode 100644 index 00000000..bc2162d2 --- /dev/null +++ b/src/main/java/reliquary/entities/ReliquaryFakePlayer.java @@ -0,0 +1,107 @@ +package reliquary.entities; + +import com.mojang.authlib.GameProfile; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.AttributeMap; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.phys.Vec3; +import net.neoforged.neoforge.common.util.FakePlayer; + +import javax.annotation.Nullable; +import java.util.UUID; + +@SuppressWarnings({"squid:S2160", "squid:MaximumInheritanceDepth"}) +public class ReliquaryFakePlayer extends FakePlayer { + private final NonNullList fakePlayerHandInventory = NonNullList.withSize(2, ItemStack.EMPTY); + private static final String FAKE_PLAYER_USERNAME = "reliquary_pedestal_fake_player"; + + public ReliquaryFakePlayer(ServerLevel level) { + this(level, new GameProfile(UUID.nameUUIDFromBytes(FAKE_PLAYER_USERNAME.getBytes()), FAKE_PLAYER_USERNAME)); + } + + private ReliquaryFakePlayer(ServerLevel level, GameProfile name) { + super(level, name); + } + + @Override + public void tick() { + if (level().isClientSide) { + return; + } + + for (int i = 0; i < 2; i++) { + EquipmentSlot equipmentSlot = EquipmentSlot.values()[i]; + + ItemStack oldStack = fakePlayerHandInventory.get(equipmentSlot.getIndex()); + ItemStack newStack = getItemBySlot(equipmentSlot); + + if (!ItemStack.matches(newStack, oldStack)) { + if (!oldStack.isEmpty()) { + AttributeMap attributeMap = getAttributes(); + oldStack.forEachModifier(equipmentSlot, (attribute, attributeModifier) -> { + AttributeInstance attributeinstance = attributeMap.getInstance(attribute); + if (attributeinstance != null) { + attributeinstance.removeModifier(attributeModifier); + } + + EnchantmentHelper.stopLocationBasedEffects(oldStack, this, equipmentSlot); + }); + } + + if (!newStack.isEmpty()) { + AttributeMap attributeMap = getAttributes(); + newStack.forEachModifier(equipmentSlot, (attribute, attributeModifier) -> { + AttributeInstance attributeinstance = attributeMap.getInstance(attribute); + if (attributeinstance != null) { + attributeinstance.removeModifier(attributeModifier.id()); + attributeinstance.addTransientModifier(attributeModifier); + } + + if (level() instanceof ServerLevel serverlevel) { + EnchantmentHelper.runLocationChangedEffects(serverlevel, newStack, this, equipmentSlot); + } + }); + } + + setItemSlot(equipmentSlot, newStack.isEmpty() ? ItemStack.EMPTY : newStack); + break; + } + } + + //finish previous swing or cool down caused by change of weapons + attackStrengthTicker = (int) getCurrentItemAttackStrengthDelay(); + } + + @Override + protected void onEffectAdded(MobEffectInstance effect, @Nullable Entity entity) { + //noop + } + + @Override + protected void onEffectUpdated(MobEffectInstance effect, boolean updateAttributes, @Nullable Entity entity) { + //noop + } + + + @Override + protected void onEffectRemoved(MobEffectInstance effect) { + //noop + } + + @Override + public Vec3 position() { + return position; + } + + @Override + public BlockPos blockPosition() { + return blockPosition; + } +} diff --git a/src/main/java/reliquary/entities/SpecialSnowballEntity.java b/src/main/java/reliquary/entities/SpecialSnowball.java similarity index 72% rename from src/main/java/reliquary/entities/SpecialSnowballEntity.java rename to src/main/java/reliquary/entities/SpecialSnowball.java index a6e39a31..804abf3c 100644 --- a/src/main/java/reliquary/entities/SpecialSnowballEntity.java +++ b/src/main/java/reliquary/entities/SpecialSnowball.java @@ -4,8 +4,6 @@ import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.Entity; @@ -22,38 +20,35 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkHooks; import reliquary.init.ModEntities; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.RandHelper; import static reliquary.items.IceMagusRodItem.ICE_PARTICLE; @SuppressWarnings({"squid:S2160", "squid:MaximumInheritanceDepth"}) -public class SpecialSnowballEntity extends ThrowableItemProjectile { +public class SpecialSnowball extends ThrowableItemProjectile { private boolean fromGlacialStaff; - public SpecialSnowballEntity(EntityType entityType, Level world) { - super(entityType, world); + public SpecialSnowball(EntityType entityType, Level level) { + super(entityType, level); } - public SpecialSnowballEntity(Level world, LivingEntity entity, boolean b) { - super(ModEntities.SPECIAL_SNOWBALL.get(), entity, world); + public SpecialSnowball(Level level, LivingEntity entity, boolean b) { + super(ModEntities.SPECIAL_SNOWBALL.get(), entity, level); fromGlacialStaff = b; } private int getSnowballDamage() { - return fromGlacialStaff ? Settings.COMMON.items.glacialStaff.snowballDamage.get() : Settings.COMMON.items.iceMagusRod.snowballDamage.get(); + return fromGlacialStaff ? Config.COMMON.items.glacialStaff.snowballDamage.get() : Config.COMMON.items.iceMagusRod.snowballDamage.get(); } private int getSnowballDamageFireImmuneBonus() { - return fromGlacialStaff ? Settings.COMMON.items.glacialStaff.snowballDamageBonusFireImmune.get() : Settings.COMMON.items.iceMagusRod.snowballDamageBonusFireImmune.get(); + return fromGlacialStaff ? Config.COMMON.items.glacialStaff.snowballDamageBonusFireImmune.get() : Config.COMMON.items.iceMagusRod.snowballDamageBonusFireImmune.get(); } private int getSnowballDamageBlazeBonus() { - return fromGlacialStaff ? Settings.COMMON.items.glacialStaff.snowballDamageBonusBlaze.get() : Settings.COMMON.items.iceMagusRod.snowballDamageBonusBlaze.get(); + return fromGlacialStaff ? Config.COMMON.items.glacialStaff.snowballDamageBonusBlaze.get() : Config.COMMON.items.iceMagusRod.snowballDamageBonusBlaze.get(); } /** @@ -102,7 +97,7 @@ public void tick() { * Gets the amount of gravity to apply to the thrown entity with each tick. */ @Override - protected float getGravity() { + protected double getDefaultGravity() { // flies slightly farther than a normal projectile return 0.01F; } @@ -113,10 +108,9 @@ protected Item getDefaultItem() { } @Override - @OnlyIn(Dist.CLIENT) public void handleEntityEvent(byte id) { if (id == 3) { - ItemStack stack = getItemRaw(); + ItemStack stack = getItem(); ParticleOptions particleData = stack.isEmpty() ? ParticleTypes.ITEM_SNOWBALL : new ItemParticleOption(ParticleTypes.ITEM, stack); for (int i = 0; i < 8; ++i) { @@ -125,12 +119,6 @@ public void handleEntityEvent(byte id) { } } - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); - } - - @OnlyIn(Dist.CLIENT) @Override public boolean shouldRenderAtSqrDistance(double distance) { double d0 = 4.0D; diff --git a/src/main/java/reliquary/entities/TippedArrow.java b/src/main/java/reliquary/entities/TippedArrow.java new file mode 100644 index 00000000..e46ee099 --- /dev/null +++ b/src/main/java/reliquary/entities/TippedArrow.java @@ -0,0 +1,136 @@ +package reliquary.entities; + +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.particles.ColorParticleOption; +import net.minecraft.core.particles.ParticleTypes; +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.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.alchemy.PotionContents; +import net.minecraft.world.level.Level; +import reliquary.init.ModEntities; +import reliquary.init.ModItems; +import reliquary.util.potions.PotionHelper; + +import javax.annotation.Nullable; + +@SuppressWarnings("squid:S2160") +public class TippedArrow extends AbstractArrow { + private static final EntityDataAccessor COLOR = SynchedEntityData.defineId(TippedArrow.class, EntityDataSerializers.INT); + private PotionContents potionContents = PotionContents.EMPTY; + + public TippedArrow(EntityType entityType, Level level) { + super(entityType, level); + } + + public TippedArrow(Level level, LivingEntity shooter, ItemStack pickupItemStack, @Nullable ItemStack projectileWeaponStack) { + super(ModEntities.TIPPED_ARROW.get(), shooter, level, pickupItemStack, projectileWeaponStack); + } + + @Override + protected ItemStack getDefaultPickupItem() { + return new ItemStack(ModItems.TIPPED_ARROW.get()); + } + + public void setPotionEffect(ItemStack stack) { + potionContents = stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); + entityData.set(COLOR, potionContents.getColor()); + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(COLOR, 0); + } + + @Override + public void tick() { + super.tick(); + + if (level().isClientSide) { + if (inGround) { + if (inGroundTime % 5 == 0) { + spawnPotionParticles(1); + } + } else { + spawnPotionParticles(2); + } + } else if (inGround && inGroundTime != 0 && potionContents.hasEffects() && inGroundTime >= 600) { + level().broadcastEntityEvent(this, (byte) 0); + potionContents = PotionContents.EMPTY; + entityData.set(COLOR, 0); + } + } + + private void spawnPotionParticles(int particleCount) { + int color = getColor(); + + if (color != 0 && particleCount > 0) { + for (int j = 0; j < particleCount; ++j) { + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, color), getX() + (random.nextDouble() - 0.5D) * getBbWidth(), getY() + random.nextDouble() * getBbHeight(), getZ() + (random.nextDouble() - 0.5D) * getBbWidth(), 0, 0, 0); + } + } + } + + public int getColor() { + return entityData.get(COLOR); + } + + @Override + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + PotionHelper.addPotionContentsToCompoundTag(compound, potionContents); + } + + @Override + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + potionContents = PotionHelper.getPotionContentsFromCompoundTag(compound); + + if (potionContents.hasEffects()) { + entityData.set(COLOR, potionContents.getColor()); + } + } + + @Override + protected void doPostHurtEffects(LivingEntity living) { + super.doPostHurtEffects(living); + Entity shooter = getOwner(); + if (shooter != null) { + PotionHelper.applyEffectsToEntity(potionContents, this, shooter, living); + } + } + + @Override + protected ItemStack getPickupItem() { + if (!potionContents.hasEffects()) { + return new ItemStack(Items.ARROW); + } else { + ItemStack stack = new ItemStack(ModItems.TIPPED_ARROW.get()); + stack.set(DataComponents.POTION_CONTENTS, potionContents); + return stack; + } + } + + @Override + public void handleEntityEvent(byte id) { + if (id == 0) { + int color = getColor(); + + if (color > 0) { + for (int j = 0; j < 20; ++j) { + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, color), getX() + (random.nextDouble() - 0.5D) * getBbWidth(), getY() + random.nextDouble() * getBbHeight(), getZ() + (random.nextDouble() - 0.5D) * getBbWidth(), 0, 0, 0); + } + } + } else { + super.handleEntityEvent(id); + } + } +} diff --git a/src/main/java/reliquary/entities/XRTippedArrowEntity.java b/src/main/java/reliquary/entities/XRTippedArrowEntity.java deleted file mode 100644 index 464fb26e..00000000 --- a/src/main/java/reliquary/entities/XRTippedArrowEntity.java +++ /dev/null @@ -1,155 +0,0 @@ -package reliquary.entities; - -import com.google.common.collect.Lists; -import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; -import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.network.syncher.EntityDataSerializers; -import net.minecraft.network.syncher.SynchedEntityData; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.projectile.AbstractArrow; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.alchemy.PotionUtils; -import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkHooks; -import reliquary.init.ModEntities; -import reliquary.init.ModItems; -import reliquary.util.potions.XRPotionHelper; - -import java.util.List; - -@SuppressWarnings("squid:S2160") -public class XRTippedArrowEntity extends AbstractArrow { - private static final EntityDataAccessor COLOR = SynchedEntityData.defineId(XRTippedArrowEntity.class, EntityDataSerializers.INT); - private List effects = Lists.newArrayList(); - - public XRTippedArrowEntity(EntityType entityType, Level world) { - super(entityType, world); - } - - public XRTippedArrowEntity(Level world, double x, double y, double z) { - super(ModEntities.TIPPED_ARROW.get(), x, y, z, world); - } - - public XRTippedArrowEntity(Level world, LivingEntity shooter) { - super(ModEntities.TIPPED_ARROW.get(), shooter, world); - } - - public void setPotionEffect(ItemStack stack) { - effects = XRPotionHelper.getPotionEffectsFromStack(stack); - - entityData.set(COLOR, PotionUtils.getColor(effects)); - } - - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - entityData.define(COLOR, 0); - } - - @Override - public void tick() { - super.tick(); - - if (level().isClientSide) { - if (inGround) { - if (inGroundTime % 5 == 0) { - spawnPotionParticles(1); - } - } else { - spawnPotionParticles(2); - } - } else if (inGround && inGroundTime != 0 && !effects.isEmpty() && inGroundTime >= 600) { - level().broadcastEntityEvent(this, (byte) 0); - effects.clear(); - entityData.set(COLOR, 0); - } - } - - private void spawnPotionParticles(int particleCount) { - int i = getColor(); - - if (i != 0 && particleCount > 0) { - double d0 = (i >> 16 & 255) / 255.0D; - double d1 = (i >> 8 & 255) / 255.0D; - double d2 = (i & 255) / 255.0D; - - for (int j = 0; j < particleCount; ++j) { - level().addParticle(ParticleTypes.ENTITY_EFFECT, getX() + (random.nextDouble() - 0.5D) * getBbWidth(), getY() + random.nextDouble() * getBbHeight(), getZ() + (random.nextDouble() - 0.5D) * getBbWidth(), d0, d1, d2); - } - } - } - - public int getColor() { - return entityData.get(COLOR); - } - - @Override - public void addAdditionalSaveData(CompoundTag compound) { - super.addAdditionalSaveData(compound); - XRPotionHelper.addPotionEffectsToCompoundTag(compound, effects); - } - - @Override - public void readAdditionalSaveData(CompoundTag compound) { - super.readAdditionalSaveData(compound); - effects = XRPotionHelper.getPotionEffectsFromCompoundTag(compound); - - if (!effects.isEmpty()) { - entityData.set(COLOR, PotionUtils.getColor(effects)); - } - } - - @Override - protected void doPostHurtEffects(LivingEntity living) { - super.doPostHurtEffects(living); - Entity shooter = getOwner(); - if (shooter != null) { - XRPotionHelper.applyEffectsToEntity(effects, this, shooter, living); - } - } - - @Override - protected ItemStack getPickupItem() { - if (effects.isEmpty()) { - return new ItemStack(Items.ARROW); - } else { - ItemStack itemstack = new ItemStack(ModItems.TIPPED_ARROW.get()); - XRPotionHelper.addPotionEffectsToStack(itemstack, effects); - return itemstack; - } - } - - @Override - @OnlyIn(Dist.CLIENT) - public void handleEntityEvent(byte id) { - if (id == 0) { - int i = getColor(); - - if (i > 0) { - double d0 = (i >> 16 & 255) / 255.0D; - double d1 = (i >> 8 & 255) / 255.0D; - double d2 = (i & 255) / 255.0D; - - for (int j = 0; j < 20; ++j) { - level().addParticle(ParticleTypes.ENTITY_EFFECT, getX() + (random.nextDouble() - 0.5D) * getBbWidth(), getY() + random.nextDouble() * getBbHeight(), getZ() + (random.nextDouble() - 0.5D) * getBbWidth(), d0, d1, d2); - } - } - } else { - super.handleEntityEvent(id); - } - } - - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); - } -} diff --git a/src/main/java/reliquary/entities/potion/AphroditePotionEntity.java b/src/main/java/reliquary/entities/potion/AphroditePotion.java similarity index 74% rename from src/main/java/reliquary/entities/potion/AphroditePotionEntity.java rename to src/main/java/reliquary/entities/potion/AphroditePotion.java index f77c490c..8815696c 100644 --- a/src/main/java/reliquary/entities/potion/AphroditePotionEntity.java +++ b/src/main/java/reliquary/entities/potion/AphroditePotion.java @@ -1,5 +1,6 @@ package reliquary.entities.potion; +import net.minecraft.core.Position; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -12,17 +13,17 @@ import reliquary.init.ModItems; import reliquary.reference.Colors; -public class AphroditePotionEntity extends ThrownPotionEntity { - public AphroditePotionEntity(EntityType entityType, Level world) { - super(entityType, world, new ItemStack(ModItems.APHRODITE_POTION.get())); +public class AphroditePotion extends ThrownPotionBase { + public AphroditePotion(EntityType entityType, Level level) { + super(entityType, level, new ItemStack(ModItems.APHRODITE_POTION.get())); } - public AphroditePotionEntity(Level world, Player player) { - super(ModEntities.APHRODITE_POTION.get(), world, player, new ItemStack(ModItems.APHRODITE_POTION.get())); + public AphroditePotion(Level level, Player player) { + super(ModEntities.APHRODITE_POTION.get(), level, player, new ItemStack(ModItems.APHRODITE_POTION.get())); } - public AphroditePotionEntity(Level world, double x, double y, double z) { - super(ModEntities.APHRODITE_POTION.get(), world, x, y, z, new ItemStack(ModItems.APHRODITE_POTION.get())); + public AphroditePotion(Level level, Position position) { + super(ModEntities.APHRODITE_POTION.get(), level, position.x(), position.y(), position.z(), new ItemStack(ModItems.APHRODITE_POTION.get())); } @Override diff --git a/src/main/java/reliquary/entities/potion/FertilePotionEntity.java b/src/main/java/reliquary/entities/potion/FertilePotion.java similarity index 73% rename from src/main/java/reliquary/entities/potion/FertilePotionEntity.java rename to src/main/java/reliquary/entities/potion/FertilePotion.java index da4ccb16..9002ad0c 100644 --- a/src/main/java/reliquary/entities/potion/FertilePotionEntity.java +++ b/src/main/java/reliquary/entities/potion/FertilePotion.java @@ -1,6 +1,7 @@ package reliquary.entities.potion; import net.minecraft.core.BlockPos; +import net.minecraft.core.Position; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -12,17 +13,17 @@ import reliquary.init.ModItems; import reliquary.reference.Colors; -public class FertilePotionEntity extends ThrownPotionEntity { - public FertilePotionEntity(EntityType entityType, Level world) { - super(entityType, world, new ItemStack(ModItems.FERTILE_POTION.get())); +public class FertilePotion extends ThrownPotionBase { + public FertilePotion(EntityType entityType, Level level) { + super(entityType, level, new ItemStack(ModItems.FERTILE_POTION.get())); } - public FertilePotionEntity(Level world, Player player) { - super(ModEntities.FERTILE_POTION.get(), world, player, new ItemStack(ModItems.FERTILE_POTION.get())); + public FertilePotion(Level level, Player player) { + super(ModEntities.FERTILE_POTION.get(), level, player, new ItemStack(ModItems.FERTILE_POTION.get())); } - public FertilePotionEntity(Level world, double x, double y, double z) { - super(ModEntities.FERTILE_POTION.get(), world, x, y, z, new ItemStack(ModItems.FERTILE_POTION.get())); + public FertilePotion(Level level, Position position) { + super(ModEntities.FERTILE_POTION.get(), level, position.x(), position.y(), position.z(), new ItemStack(ModItems.FERTILE_POTION.get())); } @Override diff --git a/src/main/java/reliquary/entities/potion/ThrownXRPotionEntity.java b/src/main/java/reliquary/entities/potion/ThrownPotion.java similarity index 54% rename from src/main/java/reliquary/entities/potion/ThrownXRPotionEntity.java rename to src/main/java/reliquary/entities/potion/ThrownPotion.java index f79719c3..822e9303 100644 --- a/src/main/java/reliquary/entities/potion/ThrownXRPotionEntity.java +++ b/src/main/java/reliquary/entities/potion/ThrownPotion.java @@ -1,18 +1,15 @@ package reliquary.entities.potion; +import net.minecraft.core.Position; import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.RandomSource; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.AreaEffectCloud; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -20,43 +17,34 @@ import net.minecraft.world.entity.projectile.ItemSupplier; import net.minecraft.world.entity.projectile.ThrowableProjectile; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.entity.IEntityAdditionalSpawnData; -import net.minecraftforge.network.NetworkHooks; -import net.minecraftforge.network.PacketDistributor; +import net.neoforged.neoforge.network.PacketDistributor; import reliquary.init.ModEntities; import reliquary.init.ModItems; import reliquary.items.util.IPotionItem; -import reliquary.network.PacketFXThrownPotionImpact; -import reliquary.network.PacketHandler; -import reliquary.util.potions.XRPotionHelper; +import reliquary.network.SpawnThrownPotionImpactParticlesPayload; +import reliquary.util.potions.PotionHelper; import java.util.List; -@OnlyIn( - value = Dist.CLIENT, - _interface = ItemSupplier.class -) -public class ThrownXRPotionEntity extends ThrowableProjectile implements IEntityAdditionalSpawnData, ItemSupplier { - private static final EntityDataAccessor ITEM = SynchedEntityData.defineId(ThrownXRPotionEntity.class, EntityDataSerializers.ITEM_STACK); +public class ThrownPotion extends ThrowableProjectile implements ItemSupplier { + private static final EntityDataAccessor ITEM = SynchedEntityData.defineId(ThrownPotion.class, EntityDataSerializers.ITEM_STACK); - public ThrownXRPotionEntity(EntityType entityType, Level world) { - super(entityType, world); + public ThrownPotion(EntityType entityType, Level level) { + super(entityType, level); } - public ThrownXRPotionEntity(Level world, double x, double y, double z, ItemStack potion) { - super(ModEntities.THROWN_POTION.get(), x, y, z, world); + public ThrownPotion(Level level, Position position, ItemStack potion) { + super(ModEntities.THROWN_POTION.get(), position.x(), position.y(), position.z(), level); setItem(potion); } - public ThrownXRPotionEntity(Level world, LivingEntity entity, ItemStack potion) { - super(ModEntities.THROWN_POTION.get(), entity, world); + public ThrownPotion(Level level, LivingEntity entity, ItemStack potion) { + super(ModEntities.THROWN_POTION.get(), entity, level); setItem(potion); } @@ -64,8 +52,8 @@ public ThrownXRPotionEntity(Level world, LivingEntity entity, ItemStack potion) * Gets the amount of gravity to apply to the thrown entity with each tick. */ @Override - protected float getGravity() { - return 0.04F; + protected double getDefaultGravity() { + return 0.04D; } //no clue what these do @@ -80,13 +68,13 @@ protected void onHit(HitResult result) { if (!(potion.getItem() instanceof IPotionItem)) { return; } - List effects = ((IPotionItem) potion.getItem()).getEffects(potion); + PotionContents potionContents = ((IPotionItem) potion.getItem()).getPotionContents(potion); - int color = PotionUtils.getColor(effects); + int color = potionContents.getColor(); if (potion.getItem() == ModItems.LINGERING_POTION.get()) { - spawnAreaEffectCloud(effects, color); + spawnAreaEffectCloud(potionContents); } else { - splashPotion(result, effects); + splashPotion(result, potionContents); } spawnParticles(color); @@ -94,28 +82,28 @@ protected void onHit(HitResult result) { } } - private void splashPotion(HitResult result, List effects) { + private void splashPotion(HitResult result, PotionContents potionContents) { AABB axisalignedbb = getBoundingBox().inflate(4.0D, 2.0D, 4.0D); List livingEntities = level().getEntitiesOfClass(LivingEntity.class, axisalignedbb); if (!livingEntities.isEmpty()) { for (LivingEntity entity : livingEntities) { - double d0 = distanceTo(entity); + double distance = distanceTo(entity); - if (d0 < 16.0D) { - double d1 = 1.0D - Math.sqrt(d0) / 4.0D; + if (distance < 16.0D) { + double amplifier = 1.0D - Math.sqrt(distance) / 4.0D; if (result.getType() == HitResult.Type.ENTITY && entity == ((EntityHitResult) result).getEntity()) { - d1 = 1.0D; + amplifier = 1.0D; } - XRPotionHelper.applyEffectsToEntity(effects, this, getOwner(), entity, d1); + PotionHelper.applyEffectsToEntity(potionContents, this, getOwner(), entity, amplifier); } } } } - private void spawnAreaEffectCloud(List effects, int color) { + private void spawnAreaEffectCloud(PotionContents potionContents) { Entity thrower = getOwner(); if (!(thrower instanceof LivingEntity)) { return; @@ -126,12 +114,7 @@ private void spawnAreaEffectCloud(List effects, int color) { areaEffectCloud.setRadiusOnUse(-0.5F); areaEffectCloud.setWaitTime(10); areaEffectCloud.setRadiusPerTick(-areaEffectCloud.getRadius() / areaEffectCloud.getDuration()); - areaEffectCloud.setFixedColor(color); - - for (MobEffectInstance potionEffect : effects) { - areaEffectCloud.addEffect(new MobEffectInstance(potionEffect.getEffect(), potionEffect.getDuration(), potionEffect.getAmplifier())); - } - + areaEffectCloud.setPotionContents(potionContents); level().addFreshEntity(areaEffectCloud); } @@ -146,24 +129,24 @@ private void spawnParticles(int color) { } level().playSound(null, blockPosition(), SoundEvents.GLASS_BREAK, SoundSource.BLOCKS, 1.0F, level().random.nextFloat() * 0.1F + 0.9F); - PacketHandler.sendToAllAround(new PacketFXThrownPotionImpact(color, getX(), getY(), getZ()), new PacketDistributor.TargetPoint(getX(), getY(), getZ(), 32.0D, level().dimension())); + PacketDistributor.sendToPlayersTrackingEntity(this, new SpawnThrownPotionImpactParticlesPayload(color, getX(), getY(), getZ())); } @Override public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); - nbt.put("item", getItem().save(new CompoundTag())); + nbt.put("item", getItem().save(this.registryAccess(), new CompoundTag())); } @Override public void readAdditionalSaveData(CompoundTag nbt) { super.readAdditionalSaveData(nbt); - setItem(ItemStack.of(nbt.getCompound("item"))); + setItem(ItemStack.parse(this.registryAccess(), nbt.getCompound("Item")).orElseGet(() -> new ItemStack(ModItems.POTION.get()))); } @Override - protected void defineSynchedData() { - entityData.define(ITEM, ItemStack.EMPTY); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + builder.define(ITEM, ItemStack.EMPTY); } @Override @@ -174,20 +157,5 @@ public ItemStack getItem() { private void setItem(ItemStack stack) { entityData.set(ITEM, stack); } - - @Override - public void writeSpawnData(FriendlyByteBuf buffer) { - buffer.writeItem(getItem()); - } - - @Override - public void readSpawnData(FriendlyByteBuf additionalData) { - setItem(additionalData.readItem()); - } - - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); - } } diff --git a/src/main/java/reliquary/entities/potion/ThrownPotionEntity.java b/src/main/java/reliquary/entities/potion/ThrownPotionBase.java similarity index 64% rename from src/main/java/reliquary/entities/potion/ThrownPotionEntity.java rename to src/main/java/reliquary/entities/potion/ThrownPotionBase.java index 77a9a156..d0979bd9 100644 --- a/src/main/java/reliquary/entities/potion/ThrownPotionEntity.java +++ b/src/main/java/reliquary/entities/potion/ThrownPotionBase.java @@ -2,8 +2,6 @@ import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; @@ -19,35 +17,27 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkHooks; -import net.minecraftforge.network.PacketDistributor; -import reliquary.network.PacketFXThrownPotionImpact; -import reliquary.network.PacketHandler; +import net.neoforged.neoforge.network.PacketDistributor; +import reliquary.network.SpawnThrownPotionImpactParticlesPayload; import reliquary.util.LogHelper; import java.util.List; -@OnlyIn( - value = Dist.CLIENT, - _interface = ItemSupplier.class -) -public abstract class ThrownPotionEntity extends ThrowableProjectile implements ItemSupplier { - private static final EntityDataAccessor ITEM = SynchedEntityData.defineId(ThrownPotionEntity.class, EntityDataSerializers.ITEM_STACK); +public abstract class ThrownPotionBase extends ThrowableProjectile implements ItemSupplier { + private static final EntityDataAccessor ITEM = SynchedEntityData.defineId(ThrownPotionBase.class, EntityDataSerializers.ITEM_STACK); - ThrownPotionEntity(EntityType entityType, Level world, ItemStack thrownStack) { - super(entityType, world); + ThrownPotionBase(EntityType entityType, Level level, ItemStack thrownStack) { + super(entityType, level); setItem(thrownStack); } - ThrownPotionEntity(EntityType entityType, Level world, Player player, ItemStack thrownStack) { - super(entityType, player, world); + ThrownPotionBase(EntityType entityType, Level level, Player player, ItemStack thrownStack) { + super(entityType, player, level); setItem(thrownStack); } - ThrownPotionEntity(EntityType entityType, Level world, double x, double y, double z, ItemStack thrownStack) { - super(entityType, x, y, z, world); + ThrownPotionBase(EntityType entityType, Level level, double x, double y, double z, ItemStack thrownStack) { + super(entityType, x, y, z, level); setItem(thrownStack); } @@ -56,8 +46,8 @@ private void setItem(ItemStack thrownStack) { } @Override - protected float getGravity() { - return 0.05F; + protected double getDefaultGravity() { + return 0.05; } @Override @@ -95,7 +85,7 @@ private void spawnParticles() { level().playSound(null, blockPosition(), SoundEvents.GLASS_BREAK, SoundSource.BLOCKS, 1.0F, level().random.nextFloat() * 0.1F + 0.9F); - PacketHandler.sendToAllAround(new PacketFXThrownPotionImpact(getColor(), getX(), getY(), getZ()), new PacketDistributor.TargetPoint(getX(), getY(), getZ(), 32D, level().dimension())); + PacketDistributor.sendToPlayersTrackingEntity(this, new SpawnThrownPotionImpactParticlesPayload(getColor(), getX(), getY(), getZ())); } // this gets called inside the on-impact method on EVERY living entity @@ -107,8 +97,8 @@ private void spawnParticles() { abstract int getColor(); @Override - protected void defineSynchedData() { - entityData.define(ITEM, ItemStack.EMPTY); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + builder.define(ITEM, ItemStack.EMPTY); } @Override @@ -122,9 +112,4 @@ public ItemStack getItem() { return stack; } } - - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); - } } diff --git a/src/main/java/reliquary/entities/shot/BlazeShotEntity.java b/src/main/java/reliquary/entities/shot/BlazeShot.java similarity index 86% rename from src/main/java/reliquary/entities/shot/BlazeShotEntity.java rename to src/main/java/reliquary/entities/shot/BlazeShot.java index c70eb57c..e7cc3970 100644 --- a/src/main/java/reliquary/entities/shot/BlazeShotEntity.java +++ b/src/main/java/reliquary/entities/shot/BlazeShot.java @@ -2,6 +2,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; @@ -20,13 +21,13 @@ import reliquary.init.ModEntities; import reliquary.reference.ClientReference; -public class BlazeShotEntity extends ShotEntityBase { - public BlazeShotEntity(EntityType entityType, Level world) { - super(entityType, world); +public class BlazeShot extends ShotBase { + public BlazeShot(EntityType entityType, Level level) { + super(entityType, level); } - public BlazeShotEntity(Level world, Player player, InteractionHand hand) { - super(ModEntities.BLAZE_SHOT.get(), world, player, hand); + public BlazeShot(Level level, Player player, InteractionHand hand) { + super(ModEntities.BLAZE_SHOT.get(), level, player, hand); } @Override @@ -39,7 +40,7 @@ void doFlightEffects() { @Override void doFiringEffects() { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.5F, 0.5F, 0.5F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); spawnMotionBasedParticle(ParticleTypes.FLAME); } @@ -73,9 +74,9 @@ protected void onHit(HitResult result) { } @Override - protected void onImpact(LivingEntity entityLiving) { - entityLiving.setSecondsOnFire(40); - super.onImpact(entityLiving); + protected void onImpact(LivingEntity livingEntity) { + livingEntity.igniteForSeconds(40); + super.onImpact(livingEntity); } @Override diff --git a/src/main/java/reliquary/entities/shot/BusterShotEntity.java b/src/main/java/reliquary/entities/shot/BusterShot.java similarity index 70% rename from src/main/java/reliquary/entities/shot/BusterShotEntity.java rename to src/main/java/reliquary/entities/shot/BusterShot.java index 1842cb31..a19bc322 100644 --- a/src/main/java/reliquary/entities/shot/BusterShotEntity.java +++ b/src/main/java/reliquary/entities/shot/BusterShot.java @@ -1,6 +1,7 @@ package reliquary.entities.shot; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; @@ -12,13 +13,13 @@ import reliquary.init.ModEntities; import reliquary.reference.ClientReference; -public class BusterShotEntity extends ShotEntityBase { - public BusterShotEntity(EntityType entityType, Level world) { - super(entityType, world); +public class BusterShot extends ShotBase { + public BusterShot(EntityType entityType, Level level) { + super(entityType, level); } - public BusterShotEntity(Level world, Player player, InteractionHand hand) { - super(ModEntities.BUSTER_SHOT.get(), world, player, hand); + public BusterShot(Level level, Player player, InteractionHand hand) { + super(ModEntities.BUSTER_SHOT.get(), level, player, hand); } @Override @@ -28,7 +29,7 @@ void doBurstEffect(Direction sideHit) { @Override void doFiringEffects() { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.5F, 0.5F, 0.5F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); spawnMotionBasedParticle(ParticleTypes.FLAME); } @@ -45,9 +46,9 @@ void spawnHitParticles(int i) { } @Override - protected void onImpact(LivingEntity entityLiving) { + protected void onImpact(LivingEntity livingEntity) { ConcussiveExplosion.customBusterExplosion(this, getX(), getY(), getZ(), 4.0F); - super.onImpact(entityLiving); + super.onImpact(livingEntity); } @Override diff --git a/src/main/java/reliquary/entities/shot/ConcussiveShotEntity.java b/src/main/java/reliquary/entities/shot/ConcussiveShot.java similarity index 68% rename from src/main/java/reliquary/entities/shot/ConcussiveShotEntity.java rename to src/main/java/reliquary/entities/shot/ConcussiveShot.java index e9663cb3..3275dda4 100644 --- a/src/main/java/reliquary/entities/shot/ConcussiveShotEntity.java +++ b/src/main/java/reliquary/entities/shot/ConcussiveShot.java @@ -1,6 +1,7 @@ package reliquary.entities.shot; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; @@ -12,13 +13,13 @@ import reliquary.init.ModEntities; import reliquary.reference.ClientReference; -public class ConcussiveShotEntity extends ShotEntityBase { - public ConcussiveShotEntity(EntityType entityType, Level world) { - super(entityType, world); +public class ConcussiveShot extends ShotBase { + public ConcussiveShot(EntityType entityType, Level level) { + super(entityType, level); } - public ConcussiveShotEntity(Level world, Player player, InteractionHand hand) { - super(ModEntities.CONCUSSIVE_SHOT.get(), world, player, hand); + public ConcussiveShot(Level level, Player player, InteractionHand hand) { + super(ModEntities.CONCUSSIVE_SHOT.get(), level, player, hand); } @Override @@ -33,7 +34,7 @@ int getDamageOfShot(LivingEntity mop) { @Override void doFlightEffects() { - if(ticksInAir % 3 == 0) { + if (ticksInAir % 3 == 0) { spawnMotionBasedParticle(ParticleTypes.SMOKE); } } @@ -45,18 +46,18 @@ void spawnHitParticles(int i) { @Override void doFiringEffects() { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.5F, 0.5F, 0.5F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); spawnMotionBasedParticle(ParticleTypes.FLAME); } @Override - protected void onImpact(LivingEntity entityLiving) { + protected void onImpact(LivingEntity livingEntity) { if (level().isClientSide) { return; } getShooterPlayer().ifPresent(player -> ConcussiveExplosion.customConcussiveExplosion(this, player, position(), 1.5F, true)); - super.onImpact(entityLiving); + super.onImpact(livingEntity); } @Override diff --git a/src/main/java/reliquary/entities/shot/EnderShotEntity.java b/src/main/java/reliquary/entities/shot/EnderShot.java similarity index 78% rename from src/main/java/reliquary/entities/shot/EnderShotEntity.java rename to src/main/java/reliquary/entities/shot/EnderShot.java index ab830b59..f599512c 100644 --- a/src/main/java/reliquary/entities/shot/EnderShotEntity.java +++ b/src/main/java/reliquary/entities/shot/EnderShot.java @@ -1,6 +1,7 @@ package reliquary.entities.shot; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; @@ -14,13 +15,13 @@ import reliquary.init.ModEntities; import reliquary.reference.ClientReference; -public class EnderShotEntity extends ShotEntityBase { - public EnderShotEntity(EntityType entityType, Level world) { - super(entityType, world); +public class EnderShot extends ShotBase { + public EnderShot(EntityType entityType, Level level) { + super(entityType, level); } - public EnderShotEntity(Level world, Player player, InteractionHand hand) { - super(ModEntities.ENDER_SHOT.get(), world, player, hand); + public EnderShot(Level level, Player player, InteractionHand hand) { + super(ModEntities.ENDER_SHOT.get(), level, player, hand); } private void doPortalExplosion() { @@ -39,7 +40,7 @@ void doBurstEffect(Direction sideHit) { @Override void doFiringEffects() { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.5F, 0.5F, 0.5F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); spawnMotionBasedParticle(ParticleTypes.FLAME); } @@ -56,9 +57,9 @@ protected void onHit(HitResult result) { } @Override - protected void onImpact(LivingEntity mop) { - if (mop != getOwner() || ticksInAir > 3) { - doDamage(mop); + protected void onImpact(LivingEntity livingEntity) { + if (livingEntity != getOwner() || ticksInAir > 3) { + doDamage(livingEntity); } spawnHitParticles(8); diff --git a/src/main/java/reliquary/entities/shot/ExorcismShotEntity.java b/src/main/java/reliquary/entities/shot/ExorcismShot.java similarity index 53% rename from src/main/java/reliquary/entities/shot/ExorcismShotEntity.java rename to src/main/java/reliquary/entities/shot/ExorcismShot.java index 1a19f39b..58757a08 100644 --- a/src/main/java/reliquary/entities/shot/ExorcismShotEntity.java +++ b/src/main/java/reliquary/entities/shot/ExorcismShot.java @@ -1,37 +1,38 @@ package reliquary.entities.shot; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.EntityTypeTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.MobType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import reliquary.init.ModEntities; import reliquary.reference.ClientReference; -public class ExorcismShotEntity extends ShotEntityBase { - public ExorcismShotEntity(EntityType entityType, Level world) { - super(entityType, world); +public class ExorcismShot extends ShotBase { + public ExorcismShot(EntityType entityType, Level level) { + super(entityType, level); } - public ExorcismShotEntity(Level world, Player player, InteractionHand hand) { - super(ModEntities.EXORCISM_SHOT.get(), world, player, hand); + public ExorcismShot(Level level, Player player, InteractionHand hand) { + super(ModEntities.EXORCISM_SHOT.get(), level, player, hand); } @Override void doFlightEffects() { - if(ticksInAir % 3 == 0) { - double gauss = gaussian(1.0F); - level().addParticle(ParticleTypes.ENTITY_EFFECT, getX(), getY(), getZ(), gauss, gauss, 0.0F); + if (ticksInAir % 3 == 0) { + float gauss = gaussian(1.0F); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, gauss, gauss, 0.0F), getX(), getY(), getZ(), 0, 0, 0); } } @Override void doFiringEffects() { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.5F, 0.5F, 0.5F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); spawnMotionBasedParticle(ParticleTypes.FLAME); } @@ -42,13 +43,13 @@ void doBurstEffect(Direction sideHit) { @Override void spawnHitParticles(int i) { - for(int particles = 0; particles < i; particles++) { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), posGauss(1.0F), posGauss(1.0F), 0.0F); + for (int particles = 0; particles < i; particles++) { + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, posGauss(1.0F), posGauss(1.0F), 0.0F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); } } private boolean isUndead(LivingEntity e) { - return e.getMobType() == MobType.UNDEAD; + return e.getType().is(EntityTypeTags.UNDEAD); } @Override diff --git a/src/main/java/reliquary/entities/shot/NeutralShotEntity.java b/src/main/java/reliquary/entities/shot/NeutralShot.java similarity index 67% rename from src/main/java/reliquary/entities/shot/NeutralShotEntity.java rename to src/main/java/reliquary/entities/shot/NeutralShot.java index 638981ab..e5c5f577 100644 --- a/src/main/java/reliquary/entities/shot/NeutralShotEntity.java +++ b/src/main/java/reliquary/entities/shot/NeutralShot.java @@ -1,6 +1,7 @@ package reliquary.entities.shot; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; @@ -11,13 +12,13 @@ import reliquary.init.ModEntities; import reliquary.reference.ClientReference; -public class NeutralShotEntity extends ShotEntityBase { - public NeutralShotEntity(EntityType entityType, Level world) { - super(entityType, world); +public class NeutralShot extends ShotBase { + public NeutralShot(EntityType entityType, Level level) { + super(entityType, level); } - public NeutralShotEntity(Level world, Player player, InteractionHand hand) { - super(ModEntities.NEUTRAL_SHOT.get(), world, player, hand); + public NeutralShot(Level level, Player player, InteractionHand hand) { + super(ModEntities.NEUTRAL_SHOT.get(), level, player, hand); } @Override @@ -32,7 +33,7 @@ int getDamageOfShot(LivingEntity mop) { @Override void doFiringEffects() { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.5F, 0.5F, 0.5F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); spawnMotionBasedParticle(ParticleTypes.FLAME); } diff --git a/src/main/java/reliquary/entities/shot/SandShotEntity.java b/src/main/java/reliquary/entities/shot/SandShot.java similarity index 79% rename from src/main/java/reliquary/entities/shot/SandShotEntity.java rename to src/main/java/reliquary/entities/shot/SandShot.java index a92ec045..246591c3 100644 --- a/src/main/java/reliquary/entities/shot/SandShotEntity.java +++ b/src/main/java/reliquary/entities/shot/SandShot.java @@ -1,6 +1,7 @@ package reliquary.entities.shot; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; @@ -17,18 +18,18 @@ import reliquary.init.ModEntities; import reliquary.reference.ClientReference; -public class SandShotEntity extends ShotEntityBase { - public SandShotEntity(EntityType entityType, Level world) { - super(entityType, world); +public class SandShot extends ShotBase { + public SandShot(EntityType entityType, Level level) { + super(entityType, level); } - public SandShotEntity(Level world, Player player, InteractionHand hand) { - super(ModEntities.SAND_SHOT.get(), world, player, hand); + public SandShot(Level level, Player player, InteractionHand hand) { + super(ModEntities.SAND_SHOT.get(), level, player, hand); } @Override void doFiringEffects() { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.5F, 0.5F, 0.5F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); spawnMotionBasedParticle(ParticleTypes.FLAME); } diff --git a/src/main/java/reliquary/entities/shot/SeekerShotEntity.java b/src/main/java/reliquary/entities/shot/SeekerShot.java similarity index 51% rename from src/main/java/reliquary/entities/shot/SeekerShotEntity.java rename to src/main/java/reliquary/entities/shot/SeekerShot.java index f043880b..40eae0f3 100644 --- a/src/main/java/reliquary/entities/shot/SeekerShotEntity.java +++ b/src/main/java/reliquary/entities/shot/SeekerShot.java @@ -1,6 +1,7 @@ package reliquary.entities.shot; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; @@ -11,19 +12,19 @@ import reliquary.init.ModEntities; import reliquary.reference.ClientReference; -public class SeekerShotEntity extends ShotEntityBase { - public SeekerShotEntity(EntityType entityType, Level world) { - super(entityType, world); +public class SeekerShot extends ShotBase { + public SeekerShot(EntityType entityType, Level level) { + super(entityType, level); } - public SeekerShotEntity(Level world, Player player, InteractionHand hand) { - super(ModEntities.SEEKER_SHOT.get(), world, player, hand); + public SeekerShot(Level level, Player player, InteractionHand hand) { + super(ModEntities.SEEKER_SHOT.get(), level, player, hand); } @Override void doFlightEffects() { - if(ticksInAir % 3 == 0) { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX(), getY(), getZ(), 0.0F, gaussian(1.0F), gaussian(1.0F)); + if (ticksInAir % 3 == 0) { + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.0F, gaussian(1.0F), gaussian(1.0F)), getX(), getY(), getZ(), 0, 0, 0); } // housed in the base class @@ -32,7 +33,7 @@ void doFlightEffects() { @Override void doFiringEffects() { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.5F, 0.5F, 0.5F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); spawnMotionBasedParticle(ParticleTypes.FLAME); } @@ -43,8 +44,8 @@ void doBurstEffect(Direction sideHit) { @Override void spawnHitParticles(int i) { - for(int particles = 0; particles < i; particles++) { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.1F, 1.0F, 1.0F); + for (int particles = 0; particles < i; particles++) { + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.1F, 1.0F, 1.0F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); } } diff --git a/src/main/java/reliquary/entities/shot/ShotEntityBase.java b/src/main/java/reliquary/entities/shot/ShotBase.java similarity index 79% rename from src/main/java/reliquary/entities/shot/ShotEntityBase.java rename to src/main/java/reliquary/entities/shot/ShotBase.java index 2565c664..d149d630 100644 --- a/src/main/java/reliquary/entities/shot/ShotEntityBase.java +++ b/src/main/java/reliquary/entities/shot/ShotBase.java @@ -1,11 +1,10 @@ package reliquary.entities.shot; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; @@ -13,55 +12,43 @@ import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; -import net.minecraft.world.item.alchemy.PotionUtils; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; -import net.minecraft.world.phys.AABB; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.EntityHitResult; -import net.minecraft.world.phys.HitResult; -import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkHooks; +import net.minecraft.world.phys.*; import reliquary.init.ModEntities; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.RegistryHelper; -import reliquary.util.potions.XRPotionHelper; +import reliquary.util.potions.PotionHelper; import javax.annotation.Nullable; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Optional; @SuppressWarnings("squid:S2160") -public abstract class ShotEntityBase extends Projectile { - private static final EntityDataAccessor CRITICAL = SynchedEntityData.defineId(ShotEntityBase.class, EntityDataSerializers.BYTE); - private static final EntityDataAccessor COLOR = SynchedEntityData.defineId(ShotEntityBase.class, EntityDataSerializers.INT); - private List potionEffects = Collections.emptyList(); +public abstract class ShotBase extends Projectile { + private static final EntityDataAccessor CRITICAL = SynchedEntityData.defineId(ShotBase.class, EntityDataSerializers.BYTE); + private static final EntityDataAccessor COLOR = SynchedEntityData.defineId(ShotBase.class, EntityDataSerializers.INT); + private PotionContents potionContents = PotionContents.EMPTY; - /** - * The owner of this arrow. - */ protected int ticksInAir = 0; private int ricochetCounter = 0; private boolean scheduledForDeath = false; - protected ShotEntityBase(EntityType entityType, Level world) { - super(entityType, world); + protected ShotBase(EntityType entityType, Level level) { + super(entityType, level); } - protected ShotEntityBase(EntityType entityType, Level world, Player player, InteractionHand hand) { - this(entityType, world); + protected ShotBase(EntityType entityType, Level level, Player player, InteractionHand hand) { + this(entityType, level); setOwner(player); moveTo(player.getX(), player.getY() + player.getEyeHeight(), player.getZ(), player.getYRot(), player.getXRot()); setPos( @@ -76,15 +63,15 @@ protected Optional getShooterPlayer() { } @Override - protected void defineSynchedData() { - entityData.define(CRITICAL, (byte) 0); - entityData.define(COLOR, 0); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + builder.define(CRITICAL, (byte) 0); + builder.define(COLOR, 0); } - public ShotEntityBase addPotionEffects(List effects) { - if (!effects.isEmpty()) { - potionEffects = effects; - entityData.set(COLOR, PotionUtils.getColor(effects)); + public ShotBase addPotionContents(PotionContents potionContents) { + if (potionContents.hasEffects()) { + this.potionContents = potionContents; + entityData.set(COLOR, potionContents.getColor()); } return this; @@ -111,17 +98,6 @@ public void shoot(double motionX, double motionY, double motionZ, float velocity } @Override - @OnlyIn(Dist.CLIENT) - public void lerpTo(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean teleport) { - setPos(x, y, z); - setRot(yaw, pitch); - } - - /** - * Sets the velocity to the args. Args: x, y, z - */ - @Override - @OnlyIn(Dist.CLIENT) public void lerpMotion(double motionX, double motionY, double motionZ) { setDeltaMovement(motionX, motionY, motionZ); @@ -181,7 +157,7 @@ public void tick() { objectStruckByVector = new EntityHitResult(hitEntity); } - //noinspection ConstantConditions - world.rayTraceBlocks can still produce null under certain conditions + //noinspection ConstantConditions - level.rayTraceBlocks can still produce null under certain conditions if (objectStruckByVector != null) { applyPotionEffects(objectStruckByVector); onHit(objectStruckByVector); @@ -227,12 +203,8 @@ private void spawnPotionParticles() { int color = getColor(); if (color != 0) { - double d0 = (color >> 16 & 255) / 255.0D; - double d1 = (color >> 8 & 255) / 255.0D; - double d2 = (color & 255) / 255.0D; - for (int j = 0; j < 2; ++j) { - level().addParticle(ParticleTypes.ENTITY_EFFECT, getX() + (random.nextDouble() - 0.5D) * getBbWidth(), getY() + random.nextDouble() * getBbHeight(), getZ() + (random.nextDouble() - 0.5D) * getBbWidth(), d0, d1, d2); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, color), getX() + (random.nextDouble() - 0.5D) * getBbWidth(), getY() + random.nextDouble() * getBbHeight(), getZ() + (random.nextDouble() - 0.5D) * getBbWidth(), 0, 0, 0); } } } @@ -244,20 +216,20 @@ public int getColor() { private void applyPotionEffects(HitResult objectStruckByVector) { if (objectStruckByVector.getType() == HitResult.Type.ENTITY) { EntityHitResult entityStruckResult = ((EntityHitResult) objectStruckByVector); - if (entityStruckResult.getEntity() instanceof LivingEntity living && potionEffects != null && !potionEffects.isEmpty()) { - XRPotionHelper.applyEffectsToEntity(potionEffects, this, getOwner(), living); + if (entityStruckResult.getEntity() instanceof LivingEntity living && potionContents.hasEffects()) { + PotionHelper.applyEffectsToEntity(potionContents, this, getOwner(), living); } } } @Override protected void readAdditionalSaveData(CompoundTag compound) { - potionEffects = XRPotionHelper.getPotionEffectsFromCompoundTag(compound); + potionContents = PotionHelper.getPotionContentsFromCompoundTag(compound); } @Override protected void addAdditionalSaveData(CompoundTag compound) { - XRPotionHelper.addPotionEffectsToCompoundTag(compound, potionEffects); + PotionHelper.addPotionContentsToCompoundTag(compound, potionContents); } @Override @@ -265,7 +237,6 @@ protected MovementEmission getMovementEmission() { return MovementEmission.NONE; } - @OnlyIn(Dist.CLIENT) @Override public boolean shouldRenderAtSqrDistance(double distance) { double d0 = 64.0D; @@ -305,7 +276,7 @@ protected DamageSource getDamageSource(LivingEntity livingEntity) { } private float adjustDamageForPotionShots(int damageOfShot) { - return potionEffects != null && !potionEffects.isEmpty() ? 4 : damageOfShot; //setting the cap to damage 4 for potion shots + return potionContents.hasEffects() ? 4 : damageOfShot; //setting the cap to damage 4 for potion shots } protected void spawnMotionBasedParticle(ParticleOptions particleData) { @@ -314,7 +285,7 @@ protected void spawnMotionBasedParticle(ParticleOptions particleData) { protected void spawnMotionBasedParticle(ParticleOptions particleData, double y) { Vec3 motion = getDeltaMovement(); - level().addParticle(particleData, getX(), y, getZ(), gaussian(motion.x()), gaussian(motion.y()), gaussian(motion.z())); + level().addParticle(particleData, getX(), y, getZ(), gaussian((float) motion.x()), gaussian((float) motion.y()), gaussian((float) motion.z())); } protected void groundImpact(Direction sideHit) { @@ -333,6 +304,10 @@ protected double smallGauss(double d) { * @param d is the factor of the double * @return a positive value between 0% and 50% of d */ + float posGauss(float d) { + return random.nextFloat() * 0.5F * d; + } + double posGauss(double d) { return random.nextFloat() * 0.5D * d; } @@ -343,8 +318,12 @@ protected double smallGauss(double d) { * @return a [comparatively] normal gaussian ranging from 75% to 125% of the * parameter d */ + float gaussian(float d) { + return d + d * ((random.nextFloat() - 0.5F) / 4); + } + double gaussian(double d) { - return d + d * ((random.nextFloat() - 0.5D) / 4); + return d + d * (random.nextFloat() - 0.5F); } /** @@ -376,10 +355,14 @@ private void ricochet(Direction sideHit) { scheduledForDeath = true; for (int particles = 0; particles < 4; particles++) { switch (sideHit) { - case DOWN -> level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D)); - case UP, SOUTH, EAST -> level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); - case NORTH -> level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D)); - case WEST -> level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); + case DOWN -> + level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), gaussian(0.1F), -gaussian(0.1F), gaussian(0.1F)); + case UP, SOUTH, EAST -> + level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), gaussian(0.1F), gaussian(0.1F), gaussian(0.1F)); + case NORTH -> + level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), gaussian(0.1F), gaussian(0.1F), -gaussian(0.1F)); + case WEST -> + level().addParticle(ParticleTypes.SMOKE, getX(), getY(), getZ(), -gaussian(0.1F), gaussian(0.1F), gaussian(0.1F)); default -> {/*noop*/} } } @@ -393,7 +376,7 @@ private void ricochet(Direction sideHit) { */ void seekTarget() { Entity closestTarget = null; - List huntableEntitiesBlacklist = Settings.COMMON.items.seekerShot.huntableEntitiesBlacklist.get(); + List huntableEntitiesBlacklist = Config.COMMON.items.seekerShot.huntableEntitiesBlacklist.get(); List targetsList = level().getEntities(this, new AABB(getX() - 5, getY() - 5, getZ() - 5, getX() + 5, getY() + 5, getZ() + 5), Mob.class::isInstance); @@ -456,12 +439,12 @@ void seekTarget() { /** * Additional entity impact effects should go here * - * @param entityLiving the entity being struck + * @param livingEntity the entity being struck */ - protected void onImpact(LivingEntity entityLiving) { + protected void onImpact(LivingEntity livingEntity) { if (!level().isClientSide) { - if (entityLiving != getOwner() || ticksInAir > 3) { - doDamage(entityLiving); + if (livingEntity != getOwner() || ticksInAir > 3) { + doDamage(livingEntity); } spawnHitParticles(8); scheduledForDeath = true; @@ -514,9 +497,4 @@ protected void onHit(HitResult result) { // used by the renderer to pull the shot texture directly from the entity. // This might not work. public abstract ResourceLocation getShotTexture(); - - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); - } } diff --git a/src/main/java/reliquary/entities/shot/StormShotEntity.java b/src/main/java/reliquary/entities/shot/StormShot.java similarity index 84% rename from src/main/java/reliquary/entities/shot/StormShotEntity.java rename to src/main/java/reliquary/entities/shot/StormShot.java index 011e8c7a..77dded04 100644 --- a/src/main/java/reliquary/entities/shot/StormShotEntity.java +++ b/src/main/java/reliquary/entities/shot/StormShot.java @@ -2,6 +2,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; @@ -18,18 +19,18 @@ import reliquary.init.ModEntities; import reliquary.reference.ClientReference; -public class StormShotEntity extends ShotEntityBase { - public StormShotEntity(EntityType entityType, Level world) { - super(entityType, world); +public class StormShot extends ShotBase { + public StormShot(EntityType entityType, Level level) { + super(entityType, level); } - public StormShotEntity(Level world, Player player, InteractionHand hand) { - super(ModEntities.STORM_SHOT.get(), world, player, hand); + public StormShot(Level level, Player player, InteractionHand hand) { + super(ModEntities.STORM_SHOT.get(), level, player, hand); } @Override void doFiringEffects() { - level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); + level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.5F, 0.5F, 0.5F), getX() + smallGauss(0.1D), getY() + smallGauss(0.1D), getZ() + smallGauss(0.1D), 0, 0, 0); spawnMotionBasedParticle(ParticleTypes.FLAME); } diff --git a/src/main/java/reliquary/handler/ClientEventHandler.java b/src/main/java/reliquary/handler/ClientEventHandler.java index 027da350..fd32678c 100644 --- a/src/main/java/reliquary/handler/ClientEventHandler.java +++ b/src/main/java/reliquary/handler/ClientEventHandler.java @@ -8,8 +8,10 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.PlayerModel; +import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.player.LocalPlayer; +import net.minecraft.client.renderer.entity.FishingHookRenderer; import net.minecraft.client.renderer.entity.ThrownItemRenderer; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.client.renderer.item.ItemPropertyFunction; @@ -18,37 +20,34 @@ import net.minecraft.util.Tuple; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.FishingRodItem; 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.minecraftforge.client.event.EntityRenderersEvent; -import net.minecraftforge.client.event.InputEvent; -import net.minecraftforge.client.event.RegisterGuiOverlaysEvent; -import net.minecraftforge.client.event.RegisterKeyMappingsEvent; -import net.minecraftforge.client.event.RenderLivingEvent; -import net.minecraftforge.client.gui.overlay.VanillaGuiOverlay; -import net.minecraftforge.client.settings.KeyConflictContext; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.ModLoadingContext; +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; +import net.neoforged.fml.event.lifecycle.FMLLoadCompleteEvent; +import net.neoforged.neoforge.client.event.*; +import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions; +import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; +import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent; +import net.neoforged.neoforge.client.gui.VanillaGuiLayers; +import net.neoforged.neoforge.client.settings.KeyConflictContext; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.network.PacketDistributor; +import reliquary.Reliquary; import reliquary.client.gui.components.Box; import reliquary.client.gui.components.Component; import reliquary.client.gui.components.ItemStackPane; import reliquary.client.gui.components.TextPane; -import reliquary.client.gui.hud.ChargePane; -import reliquary.client.gui.hud.ChargeableItemInfoPane; -import reliquary.client.gui.hud.CharmPane; -import reliquary.client.gui.hud.DynamicChargePane; -import reliquary.client.gui.hud.HUDPosition; -import reliquary.client.gui.hud.HUDRenderrer; -import reliquary.client.gui.hud.HandgunPane; -import reliquary.client.gui.hud.HeroMedallionPane; +import reliquary.client.gui.hud.*; import reliquary.client.init.ItemModels; import reliquary.client.init.ModBlockColors; import reliquary.client.init.ModItemColors; @@ -56,48 +55,39 @@ import reliquary.client.model.MobCharmBeltModel; import reliquary.client.model.WitchHatModel; import reliquary.client.registry.PedestalClientRegistry; -import reliquary.client.render.ApothecaryMortarRenderer; -import reliquary.client.render.LyssaHookRenderer; -import reliquary.client.render.PassivePedestalRenderer; -import reliquary.client.render.PedestalFishHookRenderer; -import reliquary.client.render.PedestalRenderer; -import reliquary.client.render.ShotRenderer; -import reliquary.client.render.XRTippedArrowRenderer; +import reliquary.client.render.*; import reliquary.init.ModBlocks; import reliquary.init.ModEntities; +import reliquary.init.ModFluids; import reliquary.init.ModItems; -import reliquary.items.EnderStaffItem; -import reliquary.items.FortuneCoinToggler; -import reliquary.items.HarvestRodItem; -import reliquary.items.InfernalTearItem; -import reliquary.items.PyromancerStaffItem; -import reliquary.items.RendingGaleItem; -import reliquary.items.RodOfLyssaItem; -import reliquary.items.VoidTearItem; +import reliquary.items.*; import reliquary.items.util.IScrollableItem; -import reliquary.network.PacketHandler; -import reliquary.network.ScrolledItemPacket; +import reliquary.network.ScrolledItemPayload; import reliquary.reference.Colors; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; -import reliquary.util.NBTHelper; -import reliquary.util.potions.XRPotionHelper; +import reliquary.util.potions.PotionHelper; +import javax.annotation.Nonnull; import java.util.List; import java.util.Map; public class ClientEventHandler { - private ClientEventHandler() {} + private ClientEventHandler() { + } private static final int KEY_UNKNOWN = -1; public static final KeyMapping FORTUNE_COIN_TOGGLE_KEYBIND = new KeyMapping("keybind.reliquary.fortune_coin", KeyConflictContext.UNIVERSAL, InputConstants.Type.KEYSYM.getOrCreate(KEY_UNKNOWN), "keybind.reliquary.category"); - private static final String VOID_TEAR_MODE_TRANSLATION = "item." + Reference.MOD_ID + ".void_tear.mode."; - public static final ModelLayerLocation WITCH_HAT_LAYER = new ModelLayerLocation(new ResourceLocation(Reference.MOD_ID, "witch_hat"), "main"); - public static final ModelLayerLocation MOB_CHARM_BELT_LAYER = new ModelLayerLocation(new ResourceLocation(Reference.MOD_ID, "mob_charm_belt"), "main"); + private static final String VOID_TEAR_MODE_TRANSLATION = "item." + Reliquary.MOD_ID + ".void_tear.mode."; + public static final ModelLayerLocation WITCH_HAT_LAYER = new ModelLayerLocation(Reliquary.getRL("witch_hat"), "main"); + public static final ModelLayerLocation MOB_CHARM_BELT_LAYER = new ModelLayerLocation(Reliquary.getRL("mob_charm_belt"), "main"); + + public static void registerHandlers(ModContainer container) { + IEventBus modBus = ModLoadingContext.get().getActiveContainer().getEventBus(); + if (modBus == null) { + return; + } - public static void registerHandlers() { - IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); modBus.addListener(ClientEventHandler::clientSetup); modBus.addListener(ClientEventHandler::registerKeyMappings); modBus.addListener(ClientEventHandler::loadComplete); @@ -108,10 +98,13 @@ public static void registerHandlers() { modBus.addListener(ModBlockColors::registerBlockColors); modBus.addListener(ModItemColors::registerItemColors); modBus.addListener(ClientEventHandler::registerOverlay); + modBus.addListener(ClientEventHandler::registerBackpackClientExtension); - IEventBus eventBus = MinecraftForge.EVENT_BUS; + IEventBus eventBus = NeoForge.EVENT_BUS; eventBus.addListener(ClientEventHandler::onRenderLiving); eventBus.addListener(ClientEventHandler::onMouseScrolled); + + //container.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new); TODO add but requires adding a ton of translations and translation keys (so that they follow config setting levels) } private static void onRenderLiving(RenderLivingEvent.Pre> event) { @@ -158,8 +151,8 @@ private static InteractionHand getActiveHandgunHand(Player player, boolean handg return handgunInMain ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; } - boolean mainValid = isValidTimeFrame(player.level(), player.getMainHandItem()); - boolean offValid = isValidTimeFrame(player.level(), player.getOffhandItem()); + boolean mainValid = isValidTimeFrame(player, player.getMainHandItem()); + boolean offValid = isValidTimeFrame(player, player.getOffhandItem()); if (mainValid != offValid) { return mainValid ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND; @@ -169,20 +162,21 @@ private static InteractionHand getActiveHandgunHand(Player player, boolean handg } private static boolean isHandgunActive(Player player, boolean handgunInMain, boolean handgunInOff) { - return handgunInMain && isValidTimeFrame(player.level(), player.getMainHandItem()) || handgunInOff && isValidTimeFrame(player.level(), player.getOffhandItem()); + return handgunInMain && isValidTimeFrame(player, player.getMainHandItem()) || handgunInOff && isValidTimeFrame(player, player.getOffhandItem()); } - private static boolean isValidTimeFrame(Level world, ItemStack handgun) { + private static boolean isValidTimeFrame(Player player, ItemStack handgun) { long cooldownTime = ModItems.HANDGUN.get().getCooldown(handgun) + 5; + Level level = player.level(); - return cooldownTime - world.getGameTime() <= ModItems.HANDGUN.get().getUseDuration(handgun) && cooldownTime >= world.getGameTime(); + return cooldownTime - level.getGameTime() <= ModItems.HANDGUN.get().getUseDuration(handgun, player) && cooldownTime >= level.getGameTime(); } private static final List> hudComponents = Lists.newArrayList(); - private static void registerOverlay(RegisterGuiOverlaysEvent event) { - event.registerAbove(VanillaGuiOverlay.HOTBAR.id(), "reliquary_hud", (gui, guiGraphics, partialTick, screenWidth, screenHeight) -> { + private static void registerOverlay(RegisterGuiLayersEvent event) { + event.registerAbove(VanillaGuiLayers.HOTBAR, Reliquary.getRL("reliquary_hud"), (guiGraphics, deltaTracker) -> { if (hudComponents.isEmpty()) { initHUDComponents(); } @@ -200,9 +194,9 @@ private static void onMouseScrolled(InputEvent.MouseScrollingEvent evt) { return; } ItemStack stack = player.getMainHandItem(); - double scrollDelta = evt.getScrollDelta(); + double scrollDelta = evt.getScrollDeltaY(); if (stack.getItem() instanceof IScrollableItem scrollableItem && scrollableItem.onMouseScrolled(stack, player, scrollDelta) == InteractionResult.PASS) { - PacketHandler.sendToServer(new ScrolledItemPacket(scrollDelta)); + PacketDistributor.sendToServer(new ScrolledItemPayload(scrollDelta)); evt.setCanceled(true); } } @@ -214,54 +208,54 @@ private static void renderHUDComponents(GuiGraphics guiGraphics) { } private static void initHUDComponents() { - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.ALKAHESTRY_TOME.get(), Settings.CLIENT.hudPositions.alkahestryTome.get(), new ItemStack(Items.REDSTONE), is -> NBTHelper.getInt("charge", is)), - Settings.CLIENT.hudPositions.alkahestryTome.get())); + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.ALKAHESTRY_TOME.get(), Config.CLIENT.hudPositions.alkahestryTome.get(), new ItemStack(Items.REDSTONE), AlkahestryTomeItem::getCharge), + Config.CLIENT.hudPositions.alkahestryTome.get())); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.DESTRUCTION_CATALYST.get(), Settings.CLIENT.hudPositions.destructionCatalyst.get(), new ItemStack(Items.GUNPOWDER), is -> NBTHelper.getInt("gunpowder", is)), - Settings.CLIENT.hudPositions.destructionCatalyst.get())); + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.DESTRUCTION_CATALYST.get(), Config.CLIENT.hudPositions.destructionCatalyst.get(), new ItemStack(Items.GUNPOWDER), DestructionCatalystItem::getGunpowder), + Config.CLIENT.hudPositions.destructionCatalyst.get())); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.MIDAS_TOUCHSTONE.get(), Settings.CLIENT.hudPositions.midasTouchstone.get(), new ItemStack(Items.GLOWSTONE_DUST), is -> NBTHelper.getInt("glowstone", is)), - Settings.CLIENT.hudPositions.midasTouchstone.get())); + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.MIDAS_TOUCHSTONE.get(), Config.CLIENT.hudPositions.midasTouchstone.get(), new ItemStack(Items.GLOWSTONE_DUST), MidasTouchstoneItem::getGlowstoneCharge), + Config.CLIENT.hudPositions.midasTouchstone.get())); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.INFERNAL_CHALICE.get(), Settings.CLIENT.hudPositions.infernalChalice.get(), new ItemStack(Items.LAVA_BUCKET), is -> NBTHelper.getInt("fluidStacks", is) / 1000, Colors.get(Colors.RED)), - Settings.CLIENT.hudPositions.infernalChalice.get())); + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.INFERNAL_CHALICE.get(), Config.CLIENT.hudPositions.infernalChalice.get(), new ItemStack(Items.LAVA_BUCKET), InfernalChaliceItem::getFluidBucketAmount, Colors.get(Colors.RED)), + Config.CLIENT.hudPositions.infernalChalice.get())); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.ICE_MAGUS_ROD.get(), Settings.CLIENT.hudPositions.iceMagusRod.get(), new ItemStack(Items.SNOWBALL), is -> NBTHelper.getInt("snowballs", is)), - Settings.CLIENT.hudPositions.iceMagusRod.get())); + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.ICE_MAGUS_ROD.get(), Config.CLIENT.hudPositions.iceMagusRod.get(), new ItemStack(Items.SNOWBALL), IceMagusRodItem::getSnowballs), + Config.CLIENT.hudPositions.iceMagusRod.get())); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.GLACIAL_STAFF.get(), Settings.CLIENT.hudPositions.glacialStaff.get(), new ItemStack(Items.SNOWBALL), is -> NBTHelper.getInt("snowballs", is)), - Settings.CLIENT.hudPositions.glacialStaff.get())); + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.GLACIAL_STAFF.get(), Config.CLIENT.hudPositions.glacialStaff.get(), new ItemStack(Items.SNOWBALL), GlacialStaffItem::getSnowballs), + Config.CLIENT.hudPositions.glacialStaff.get())); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.ENDER_STAFF.get(), Settings.CLIENT.hudPositions.enderStaff.get(), is -> ModItems.ENDER_STAFF.get().getMode(is).getSerializedName(), + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.ENDER_STAFF.get(), Config.CLIENT.hudPositions.enderStaff.get(), is -> ModItems.ENDER_STAFF.get().getMode(is).getSerializedName(), Map.of( - EnderStaffItem.Mode.CAST.getSerializedName(), new ChargePane(ModItems.ENDER_STAFF.get(), new ItemStack(Items.ENDER_PEARL), is -> ModItems.ENDER_STAFF.get().getPearlCount(is, true)), - EnderStaffItem.Mode.NODE_WARP.getSerializedName(), new ChargePane(ModItems.ENDER_STAFF.get(), new ItemStack(ModBlocks.WRAITH_NODE.get()), is -> ModItems.ENDER_STAFF.get().getPearlCount(is, true)), - EnderStaffItem.Mode.LONG_CAST.getSerializedName(), new ChargePane(ModItems.ENDER_STAFF.get(), new ItemStack(Items.ENDER_EYE), is -> ModItems.ENDER_STAFF.get().getPearlCount(is, true)) - )), Settings.CLIENT.hudPositions.enderStaff.get())); + EnderStaffItem.Mode.CAST.getSerializedName(), new ChargePane(ModItems.ENDER_STAFF.get(), new ItemStack(Items.ENDER_PEARL), is -> ModItems.ENDER_STAFF.get().getPearlCount(is)), + EnderStaffItem.Mode.NODE_WARP.getSerializedName(), new ChargePane(ModItems.ENDER_STAFF.get(), new ItemStack(ModBlocks.WRAITH_NODE.get()), is -> ModItems.ENDER_STAFF.get().getPearlCount(is)), + EnderStaffItem.Mode.LONG_CAST.getSerializedName(), new ChargePane(ModItems.ENDER_STAFF.get(), new ItemStack(Items.ENDER_EYE), is -> ModItems.ENDER_STAFF.get().getPearlCount(is)) + )), Config.CLIENT.hudPositions.enderStaff.get())); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.PYROMANCER_STAFF.get(), Settings.CLIENT.hudPositions.pyromancerStaff.get(), is -> ModItems.PYROMANCER_STAFF.get().getMode(is).getSerializedName(), + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.PYROMANCER_STAFF.get(), Config.CLIENT.hudPositions.pyromancerStaff.get(), is -> ModItems.PYROMANCER_STAFF.get().getMode(is).getSerializedName(), Map.of( - PyromancerStaffItem.Mode.BLAZE.getSerializedName(), new ChargePane(ModItems.PYROMANCER_STAFF.get(), new ItemStack(Items.BLAZE_POWDER), is -> ModItems.PYROMANCER_STAFF.get().getInternalStorageItemCount(is, Items.BLAZE_POWDER)), - PyromancerStaffItem.Mode.FIRE_CHARGE.getSerializedName(), new ChargePane(ModItems.PYROMANCER_STAFF.get(), new ItemStack(Items.FIRE_CHARGE), is -> ModItems.PYROMANCER_STAFF.get().getInternalStorageItemCount(is, Items.FIRE_CHARGE)), - PyromancerStaffItem.Mode.ERUPTION.getSerializedName(), Box.createVertical(Box.Alignment.RIGHT, new TextPane("ERUPT"), new ChargePane(ModItems.PYROMANCER_STAFF.get(), new ItemStack(Items.BLAZE_POWDER), is -> ModItems.PYROMANCER_STAFF.get().getInternalStorageItemCount(is, Items.BLAZE_POWDER))), + PyromancerStaffItem.Mode.BLAZE.getSerializedName(), new ChargePane(ModItems.PYROMANCER_STAFF.get(), new ItemStack(Items.BLAZE_POWDER), staff -> ModItems.PYROMANCER_STAFF.get().getBlazePowderCount(staff)), + PyromancerStaffItem.Mode.FIRE_CHARGE.getSerializedName(), new ChargePane(ModItems.PYROMANCER_STAFF.get(), new ItemStack(Items.FIRE_CHARGE), staff -> ModItems.PYROMANCER_STAFF.get().getFireChargeCount(staff)), + PyromancerStaffItem.Mode.ERUPTION.getSerializedName(), Box.createVertical(Box.Alignment.RIGHT, new TextPane("ERUPT"), new ChargePane(ModItems.PYROMANCER_STAFF.get(), new ItemStack(Items.BLAZE_POWDER), staff -> ModItems.PYROMANCER_STAFF.get().getBlazePowderCount(staff))), PyromancerStaffItem.Mode.FLINT_AND_STEEL.getSerializedName(), new ItemStackPane(Items.FLINT_AND_STEEL) - )), Settings.CLIENT.hudPositions.pyromancerStaff.get())); + )), Config.CLIENT.hudPositions.pyromancerStaff.get())); ChargePane rendingGaleFeatherPane = new ChargePane(ModItems.RENDING_GALE.get(), new ItemStack(Items.FEATHER), is -> { LocalPlayer player = Minecraft.getInstance().player; return player == null ? 0 : ModItems.RENDING_GALE.get().getFeatherCountClient(is, player) / 100; }); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.RENDING_GALE.get(), Settings.CLIENT.hudPositions.rendingGale.get(), is -> ModItems.RENDING_GALE.get().getMode(is).getSerializedName(), + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.RENDING_GALE.get(), Config.CLIENT.hudPositions.rendingGale.get(), is -> ModItems.RENDING_GALE.get().getMode(is).getSerializedName(), Map.of( RendingGaleItem.Mode.PUSH.getSerializedName(), Box.createVertical(Box.Alignment.RIGHT, new TextPane("PUSH"), rendingGaleFeatherPane), RendingGaleItem.Mode.PULL.getSerializedName(), Box.createVertical(Box.Alignment.RIGHT, new TextPane("PULL"), rendingGaleFeatherPane), RendingGaleItem.Mode.BOLT.getSerializedName(), Box.createVertical(Box.Alignment.RIGHT, new TextPane("BOLT"), rendingGaleFeatherPane), RendingGaleItem.Mode.FLIGHT.getSerializedName(), Box.createVertical(Box.Alignment.RIGHT, new TextPane("FLIGHT"), rendingGaleFeatherPane) - )), Settings.CLIENT.hudPositions.rendingGale.get())); + )), Config.CLIENT.hudPositions.rendingGale.get())); Component contentsPane = new DynamicChargePane(ModItems.VOID_TEAR.get(), - is -> VoidTearItem.getTearContents(is, true), is -> VoidTearItem.getTearContents(is, true).getCount()); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.VOID_TEAR.get(), Settings.CLIENT.hudPositions.voidTear.get(), is -> ModItems.VOID_TEAR.get().getMode(is).getSerializedName(), + VoidTearItem::getTearContents, is -> VoidTearItem.getTearContents(is).getCount()); + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.VOID_TEAR.get(), Config.CLIENT.hudPositions.voidTear.get(), is -> ModItems.VOID_TEAR.get().getMode(is).getSerializedName(), Map.of( VoidTearItem.Mode.FULL_INVENTORY.getSerializedName(), Box.createVertical(Box.Alignment.RIGHT, new TextPane(Language.getInstance().getOrDefault(VOID_TEAR_MODE_TRANSLATION + VoidTearItem.Mode.FULL_INVENTORY.getSerializedName().toLowerCase())), contentsPane), VoidTearItem.Mode.NO_REFILL.getSerializedName(), Box.createVertical(Box.Alignment.RIGHT, new TextPane(Language.getInstance().getOrDefault(VOID_TEAR_MODE_TRANSLATION + VoidTearItem.Mode.NO_REFILL.getSerializedName().toLowerCase())), contentsPane), @@ -270,27 +264,30 @@ private static void initHUDComponents() { @Override public boolean shouldRender() { LocalPlayer player = Minecraft.getInstance().player; - return player != null && !VoidTearItem.isEmpty(InventoryHelper.getCorrectItemFromEitherHand(player, ModItems.VOID_TEAR.get()), true); + return player != null && !ModItems.VOID_TEAR.get().isEmpty(InventoryHelper.getCorrectItemFromEitherHand(player, ModItems.VOID_TEAR.get())); } - }, Settings.CLIENT.hudPositions.voidTear.get())); + }, Config.CLIENT.hudPositions.voidTear.get())); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.HARVEST_ROD.get(), Settings.CLIENT.hudPositions.harvestRod.get(), is -> ModItems.HARVEST_ROD.get().getMode(is).getSerializedName(), + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.HARVEST_ROD.get(), Config.CLIENT.hudPositions.harvestRod.get(), is -> ModItems.HARVEST_ROD.get().getMode(is).getSerializedName(), Map.of( - HarvestRodItem.Mode.BONE_MEAL.getSerializedName(), new ChargePane(ModItems.HARVEST_ROD.get(), new ItemStack(Items.BONE_MEAL), is -> ModItems.HARVEST_ROD.get().getBoneMealCount(is, true)), + HarvestRodItem.Mode.BONE_MEAL.getSerializedName(), new ChargePane(ModItems.HARVEST_ROD.get(), new ItemStack(Items.BONE_MEAL), is -> ModItems.HARVEST_ROD.get().getBoneMealCount(is)), HarvestRodItem.Mode.HOE.getSerializedName(), new ItemStackPane(Items.WOODEN_HOE), - ChargeableItemInfoPane.DYNAMIC_PANE, new DynamicChargePane(ModItems.HARVEST_ROD.get(), is -> ModItems.HARVEST_ROD.get().getCurrentPlantable(is, true), is -> ModItems.HARVEST_ROD.get().getPlantableQuantity(is, ModItems.HARVEST_ROD.get().getCurrentPlantableSlot(is), true)) - )), Settings.CLIENT.hudPositions.harvestRod.get())); + ChargeableItemInfoPane.DYNAMIC_PANE, new DynamicChargePane(ModItems.HARVEST_ROD.get(), is -> ModItems.HARVEST_ROD.get().getCurrentPlantable(is), is -> ModItems.HARVEST_ROD.get().getPlantableQuantity(is, ModItems.HARVEST_ROD.get().getCurrentPlantableSlot(is))) + )), Config.CLIENT.hudPositions.harvestRod.get())); - hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.SOJOURNER_STAFF.get(), Settings.CLIENT.hudPositions.sojournerStaff.get(), is -> ChargeableItemInfoPane.DYNAMIC_PANE, + hudComponents.add(new Tuple<>(new ChargeableItemInfoPane(ModItems.SOJOURNER_STAFF.get(), Config.CLIENT.hudPositions.sojournerStaff.get(), is -> ChargeableItemInfoPane.DYNAMIC_PANE, Map.of( - ChargeableItemInfoPane.DYNAMIC_PANE, new DynamicChargePane(ModItems.SOJOURNER_STAFF.get(), ModItems.SOJOURNER_STAFF.get()::getCurrentTorch, ModItems.SOJOURNER_STAFF.get()::getTorchCount) - )), Settings.CLIENT.hudPositions.sojournerStaff.get())); + ChargeableItemInfoPane.DYNAMIC_PANE, new DynamicChargePane(ModItems.SOJOURNER_STAFF.get(), stack -> { + ItemStack currentTorch = ModItems.SOJOURNER_STAFF.get().getCurrentTorch(stack); + return currentTorch.isEmpty() ? new ItemStack(Items.TORCH) : currentTorch; + }, ModItems.SOJOURNER_STAFF.get()::getTorchCount) + )), Config.CLIENT.hudPositions.sojournerStaff.get())); - hudComponents.add(new Tuple<>(new HeroMedallionPane(), Settings.CLIENT.hudPositions.heroMedallion.get())); + hudComponents.add(new Tuple<>(new HeroMedallionPane(), Config.CLIENT.hudPositions.heroMedallion.get())); - hudComponents.add(new Tuple<>(Box.createVertical(Box.Alignment.RIGHT, new HandgunPane(InteractionHand.OFF_HAND), new HandgunPane(InteractionHand.MAIN_HAND)), Settings.CLIENT.hudPositions.handgun.get())); + hudComponents.add(new Tuple<>(Box.createVertical(Box.Alignment.RIGHT, new HandgunPane(InteractionHand.OFF_HAND), new HandgunPane(InteractionHand.MAIN_HAND)), Config.CLIENT.hudPositions.handgun.get())); - hudComponents.add(new Tuple<>(new CharmPane(), Settings.CLIENT.hudPositions.mobCharm.get())); + hudComponents.add(new Tuple<>(new CharmPane(), Config.CLIENT.hudPositions.mobCharm.get())); } private static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderers event) { @@ -298,7 +295,7 @@ private static void registerEntityRenderers(EntityRenderersEvent.RegisterRendere event.registerBlockEntityRenderer(ModBlocks.PEDESTAL_TILE_TYPE.get(), context -> new PedestalRenderer()); event.registerBlockEntityRenderer(ModBlocks.PASSIVE_PEDESTAL_TILE_TYPE.get(), context -> new PassivePedestalRenderer()); - event.registerEntityRenderer(ModEntities.LYSSA_HOOK.get(), LyssaHookRenderer::new); + event.registerEntityRenderer(ModEntities.LYSSA_HOOK.get(), FishingHookRenderer::new); event.registerEntityRenderer(ModEntities.BLAZE_SHOT.get(), ShotRenderer::new); event.registerEntityRenderer(ModEntities.BUSTER_SHOT.get(), ShotRenderer::new); event.registerEntityRenderer(ModEntities.CONCUSSIVE_SHOT.get(), ShotRenderer::new); @@ -308,7 +305,7 @@ private static void registerEntityRenderers(EntityRenderersEvent.RegisterRendere event.registerEntityRenderer(ModEntities.SEEKER_SHOT.get(), ShotRenderer::new); event.registerEntityRenderer(ModEntities.SAND_SHOT.get(), ShotRenderer::new); event.registerEntityRenderer(ModEntities.STORM_SHOT.get(), ShotRenderer::new); - event.registerEntityRenderer(ModEntities.TIPPED_ARROW.get(), XRTippedArrowRenderer::new); + event.registerEntityRenderer(ModEntities.TIPPED_ARROW.get(), TippedArrowRenderer::new); event.registerEntityRenderer(ModEntities.GLOWING_WATER.get(), ThrownItemRenderer::new); event.registerEntityRenderer(ModEntities.APHRODITE_POTION.get(), ThrownItemRenderer::new); event.registerEntityRenderer(ModEntities.FERTILE_POTION.get(), ThrownItemRenderer::new); @@ -327,7 +324,7 @@ private static void clientSetup(FMLClientSetupEvent event) { } private static void registerBulletAndMagazineItemProperties() { - registerPropertyToItems(new ResourceLocation(Reference.MOD_ID, "potion"), (stack, world, livingEntity, seed) -> isPotionAttached(stack) ? 1 : 0, + registerPropertyToItems(Reliquary.getRL("potion"), (stack, level, livingEntity, seed) -> isPotionAttached(stack) ? 1 : 0, ModItems.BLAZE_BULLET.get(), ModItems.BUSTER_BULLET.get(), ModItems.CONCUSSIVE_BULLET.get(), ModItems.ENDER_BULLET.get(), ModItems.EXORCISM_BULLET.get(), ModItems.NEUTRAL_BULLET.get(), ModItems.SAND_BULLET.get(), ModItems.SEEKER_BULLET.get(), ModItems.STORM_BULLET.get(), ModItems.BLAZE_MAGAZINE.get(), ModItems.BUSTER_MAGAZINE.get(), ModItems.CONCUSSIVE_MAGAZINE.get(), ModItems.ENDER_MAGAZINE.get(), ModItems.EXORCISM_MAGAZINE.get(), @@ -335,25 +332,25 @@ private static void registerBulletAndMagazineItemProperties() { } private static void registerVoidTearItemProperties() { - ItemProperties.register(ModItems.VOID_TEAR.get(), new ResourceLocation("empty"), - (stack, level, entity, seed) -> VoidTearItem.isEmpty(stack, true) ? 1.0F : 0.0F); + ItemProperties.register(ModItems.VOID_TEAR.get(), ResourceLocation.parse("empty"), + (stack, level, entity, seed) -> ModItems.VOID_TEAR.get().isEmpty(stack) ? 1.0F : 0.0F); } private static void registerInfernalTearItemProperties() { - ItemProperties.register(ModItems.INFERNAL_TEAR.get(), new ResourceLocation("empty"), + ItemProperties.register(ModItems.INFERNAL_TEAR.get(), ResourceLocation.parse("empty"), (stack, level, entity, seed) -> InfernalTearItem.getStackFromTear(stack).isEmpty() ? 1.0F : 0.0F); } private static void registerLyssaRodItemProperties() { - ItemProperties.register(ModItems.ROD_OF_LYSSA.get(), new ResourceLocation("cast"), (stack, world, entity, seed) -> { + ItemProperties.register(ModItems.ROD_OF_LYSSA.get(), ResourceLocation.parse("cast"), (stack, level, entity, seed) -> { if (entity == null) { return 0.0F; } else { - if (world == null) { + if (level == null) { return 0.0F; } int entityId = RodOfLyssaItem.getHookEntityId(stack); - return (entity.getMainHandItem() == stack || entity.getOffhandItem() == stack) && entityId > 0 && world.getEntity(entityId) != null ? 1.0F : 0.0F; + return (entity.getMainHandItem() == stack || entity.getOffhandItem() == stack) && entityId > 0 && level.getEntity(entityId) != null ? 1.0F : 0.0F; } }); } @@ -369,13 +366,44 @@ private static void registerPropertyToItems(ResourceLocation registryName, @Supp } private static boolean isPotionAttached(ItemStack stack) { - return !XRPotionHelper.getPotionEffectsFromStack(stack).isEmpty(); + return PotionHelper.hasPotionContents(stack); } private static void loadComplete(FMLLoadCompleteEvent event) { event.enqueueWork(() -> { PedestalClientRegistry.registerItemRenderer(FishingRodItem.class, PedestalFishHookRenderer::new); - MinecraftForge.EVENT_BUS.addListener(FortuneCoinToggler::handleKeyInputEvent); + PedestalClientRegistry.registerItemRenderer(RodOfLyssaItem.class, PedestalFishHookRenderer::new); + NeoForge.EVENT_BUS.addListener(FortuneCoinToggler::handleKeyInputEvent); }); } + + private static void registerBackpackClientExtension(RegisterClientExtensionsEvent event) { + event.registerItem(new IClientItemExtensions() { + private WitchHatModel hatModel = null; + + @Override + public @Nonnull HumanoidModel getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel original) { + if (hatModel == null) { + EntityModelSet entityModels = Minecraft.getInstance().getEntityModels(); + hatModel = new WitchHatModel(entityModels.bakeLayer(ClientEventHandler.WITCH_HAT_LAYER)); + } + return hatModel; + } + }, ModItems.WITCH_HAT.get()); + + event.registerFluidType(new IClientFluidTypeExtensions() { + private static final ResourceLocation XP_STILL_TEXTURE = ResourceLocation.fromNamespaceAndPath(Reliquary.MOD_ID, "block/xp_still"); + private static final ResourceLocation XP_FLOWING_TEXTURE = ResourceLocation.fromNamespaceAndPath(Reliquary.MOD_ID, "block/xp_flowing"); + + @Override + public ResourceLocation getStillTexture() { + return XP_STILL_TEXTURE; + } + + @Override + public ResourceLocation getFlowingTexture() { + return XP_FLOWING_TEXTURE; + } + }, ModFluids.EXPERIENCE_FLUID_TYPE.get()); + } } diff --git a/src/main/java/reliquary/handler/CommonEventHandler.java b/src/main/java/reliquary/handler/CommonEventHandler.java index f88fb6cb..80fbad2d 100644 --- a/src/main/java/reliquary/handler/CommonEventHandler.java +++ b/src/main/java/reliquary/handler/CommonEventHandler.java @@ -1,27 +1,30 @@ package reliquary.handler; import com.google.common.collect.Sets; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.Enchantments; -import net.minecraftforge.event.AnvilUpdateEvent; -import net.minecraftforge.event.TickEvent; -import net.minecraftforge.event.entity.living.LivingAttackEvent; -import net.minecraftforge.event.entity.living.LivingDeathEvent; -import net.minecraftforge.event.entity.player.PlayerEvent; -import net.minecraftforge.event.level.LevelEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.LogicalSide; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.common.NeoForgeMod; +import net.neoforged.neoforge.event.AnvilUpdateEvent; +import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; +import net.neoforged.neoforge.event.entity.player.PlayerEvent; +import net.neoforged.neoforge.event.level.LevelEvent; +import net.neoforged.neoforge.event.tick.PlayerTickEvent; import reliquary.blocks.PassivePedestalBlock; import reliquary.init.ModItems; import reliquary.items.RendingGaleItem; import reliquary.pedestal.PedestalRegistry; -import reliquary.util.XRFakePlayerFactory; +import reliquary.util.FakePlayerFactory; import java.util.HashMap; import java.util.Map; @@ -29,7 +32,8 @@ import java.util.UUID; public class CommonEventHandler { - private CommonEventHandler() {} + private CommonEventHandler() { + } private static final Set playerHurtHandlers = Sets.newTreeSet(new HandlerPriorityComparator()); private static final Set playerDeathHandlers = Sets.newTreeSet(new HandlerPriorityComparator()); @@ -64,7 +68,8 @@ public static void preventMendingAndUnbreaking(AnvilUpdateEvent event) { return; } - if (EnchantmentHelper.getEnchantments(event.getRight()).keySet().stream().anyMatch(e -> e == Enchantments.UNBREAKING)) { + HolderLookup.RegistryLookup enchantmentRegistry = event.getPlayer().level().registryAccess().lookupOrThrow(Registries.ENCHANTMENT); + if (event.getRight().getEnchantmentLevel(enchantmentRegistry.getOrThrow(Enchantments.MENDING)) > 0 || event.getRight().getEnchantmentLevel(enchantmentRegistry.getOrThrow(Enchantments.UNBREAKING)) > 0) { event.setCanceled(true); } } @@ -78,7 +83,7 @@ public static void blameDrullkus(PlayerEvent.PlayerLoggedInEvent event) { } } - public static void beforePlayerHurt(LivingAttackEvent event) { + public static void beforePlayerHurt(LivingIncomingDamageEvent event) { Entity entity = event.getEntity(); if (!(entity instanceof Player player)) { return; @@ -94,7 +99,6 @@ public static void beforePlayerHurt(LivingAttackEvent event) { if (cancel) { event.setCanceled(true); - event.setResult(null); } } @@ -114,26 +118,28 @@ public static void beforePlayerDeath(LivingDeathEvent event) { if (cancel) { event.setCanceled(true); - event.setResult(null); } } public static void onDimensionUnload(LevelEvent.Unload event) { if (event.getLevel() instanceof ServerLevel serverLevel) { - XRFakePlayerFactory.unloadWorld(serverLevel); + FakePlayerFactory.unloadWorld(serverLevel); } } - public static void onPlayerTick(TickEvent.PlayerTickEvent event) { - if (event.side == LogicalSide.CLIENT) { + public static void onPlayerTick(PlayerTickEvent.Post event) { + Player player = event.getEntity(); + if (player.level().isClientSide()) { return; } - Player player = event.player; if (player.isUsingItem() && player.getUseItem().getItem() == ModItems.RENDING_GALE.get() && ModItems.RENDING_GALE.get().getMode(player.getUseItem()) == RendingGaleItem.Mode.FLIGHT && ModItems.RENDING_GALE.get().hasFlightCharge(player.getUseItem())) { playersFlightStatus.put(player.getGameProfile().getId(), true); - player.getAbilities().mayfly = true; + AttributeInstance creativeFlightAttribute = player.getAttribute(NeoForgeMod.CREATIVE_FLIGHT); + if (creativeFlightAttribute != null) { + creativeFlightAttribute.setBaseValue(1); + } ((ServerPlayer) player).connection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); } else { if (!playersFlightStatus.containsKey(player.getGameProfile().getId())) { @@ -144,7 +150,10 @@ public static void onPlayerTick(TickEvent.PlayerTickEvent event) { if (isFlying) { playersFlightStatus.put(player.getGameProfile().getId(), false); if (!player.isCreative()) { - player.getAbilities().mayfly = false; + AttributeInstance creativeFlightAttribute = player.getAttribute(NeoForgeMod.CREATIVE_FLIGHT); + if (creativeFlightAttribute != null) { + creativeFlightAttribute.setBaseValue(0); + } player.getAbilities().flying = false; ((ServerPlayer) player).connection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); } diff --git a/src/main/java/reliquary/handler/IPlayerDeathHandler.java b/src/main/java/reliquary/handler/IPlayerDeathHandler.java index 1713d779..017901b8 100644 --- a/src/main/java/reliquary/handler/IPlayerDeathHandler.java +++ b/src/main/java/reliquary/handler/IPlayerDeathHandler.java @@ -1,7 +1,7 @@ package reliquary.handler; import net.minecraft.world.entity.player.Player; -import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; public interface IPlayerDeathHandler extends IPrioritizedHandler { boolean canApply(Player player, LivingDeathEvent event); diff --git a/src/main/java/reliquary/handler/IPlayerHurtHandler.java b/src/main/java/reliquary/handler/IPlayerHurtHandler.java index 93529e12..de873f64 100644 --- a/src/main/java/reliquary/handler/IPlayerHurtHandler.java +++ b/src/main/java/reliquary/handler/IPlayerHurtHandler.java @@ -1,9 +1,10 @@ package reliquary.handler; import net.minecraft.world.entity.player.Player; -import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; public interface IPlayerHurtHandler extends IPrioritizedHandler { - boolean canApply(Player player, LivingAttackEvent event); - boolean apply(Player player, LivingAttackEvent event); + boolean canApply(Player player, LivingIncomingDamageEvent event); + + boolean apply(Player player, LivingIncomingDamageEvent event); } diff --git a/src/main/java/reliquary/init/ModBlocks.java b/src/main/java/reliquary/init/ModBlocks.java index 8fa7ca04..b06d499d 100644 --- a/src/main/java/reliquary/init/ModBlocks.java +++ b/src/main/java/reliquary/init/ModBlocks.java @@ -1,6 +1,7 @@ package reliquary.init; import com.google.common.collect.ImmutableMap; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.DyeColor; @@ -9,37 +10,26 @@ 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.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import reliquary.blocks.AlkahestryAltarBlock; -import reliquary.blocks.ApothecaryCauldronBlock; -import reliquary.blocks.ApothecaryMortarBlock; -import reliquary.blocks.FertileLilyPadBlock; -import reliquary.blocks.InterdictionTorchBlock; -import reliquary.blocks.PassivePedestalBlock; -import reliquary.blocks.PedestalBlock; -import reliquary.blocks.WallInterdictionTorchBlock; -import reliquary.blocks.WraithNodeBlock; -import reliquary.blocks.tile.AlkahestryAltarBlockEntity; -import reliquary.blocks.tile.ApothecaryCauldronBlockEntity; -import reliquary.blocks.tile.ApothecaryMortarBlockEntity; -import reliquary.blocks.tile.PassivePedestalBlockEntity; -import reliquary.blocks.tile.PedestalBlockEntity; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; +import net.neoforged.neoforge.registries.DeferredRegister; +import reliquary.Reliquary; +import reliquary.blocks.*; +import reliquary.blocks.tile.*; import reliquary.items.block.BlockItemBase; import reliquary.items.block.FertileLilyPadItem; import reliquary.items.block.InterdictionTorchItem; -import reliquary.reference.Reference; import java.util.Map; +import java.util.function.Supplier; public class ModBlocks { private ModBlocks() {} - public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Reference.MOD_ID); - private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Reference.MOD_ID); - private static final DeferredRegister> BLOCK_ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, Reference.MOD_ID); + public static final DeferredRegister ITEMS = DeferredRegister.create(BuiltInRegistries.ITEM, Reliquary.MOD_ID); + private static final DeferredRegister BLOCKS = DeferredRegister.create(BuiltInRegistries.BLOCK, Reliquary.MOD_ID); + private static final DeferredRegister> BLOCK_ENTITY_TYPES = DeferredRegister.create(BuiltInRegistries.BLOCK_ENTITY_TYPE, Reliquary.MOD_ID); private static final String ALKAHESTRY_ALTAR_REGISTRY_NAME = "alkahestry_altar"; private static final String INTERDICTION_TORCH_REGISTRY_NAME = "interdiction_torch"; @@ -48,20 +38,20 @@ private ModBlocks() {} private static final String FERTILE_LILY_PAD_REGISTRY_NAME = "fertile_lily_pad"; private static final String WRAITH_NODE_REGISTRY_NAME = "wraith_node"; - public static final RegistryObject ALKAHESTRY_ALTAR = BLOCKS.register(ALKAHESTRY_ALTAR_REGISTRY_NAME, AlkahestryAltarBlock::new); - public static final RegistryObject APOTHECARY_CAULDRON = BLOCKS.register(APOTHECARY_CAULDRON_REGISTRY_NAME, ApothecaryCauldronBlock::new); - public static final RegistryObject APOTHECARY_MORTAR = BLOCKS.register(APOTHECARY_MORTAR_REGISTRY_NAME, ApothecaryMortarBlock::new); - public static final RegistryObject FERTILE_LILY_PAD = BLOCKS.register(FERTILE_LILY_PAD_REGISTRY_NAME, FertileLilyPadBlock::new); - public static final RegistryObject INTERDICTION_TORCH = BLOCKS.register(INTERDICTION_TORCH_REGISTRY_NAME, InterdictionTorchBlock::new); - public static final RegistryObject WALL_INTERDICTION_TORCH = BLOCKS.register("wall_interdiction_torch", WallInterdictionTorchBlock::new); - public static final RegistryObject WRAITH_NODE = BLOCKS.register(WRAITH_NODE_REGISTRY_NAME, WraithNodeBlock::new); + public static final Supplier ALKAHESTRY_ALTAR = BLOCKS.register(ALKAHESTRY_ALTAR_REGISTRY_NAME, AlkahestryAltarBlock::new); + public static final Supplier APOTHECARY_CAULDRON = BLOCKS.register(APOTHECARY_CAULDRON_REGISTRY_NAME, ApothecaryCauldronBlock::new); + public static final Supplier APOTHECARY_MORTAR = BLOCKS.register(APOTHECARY_MORTAR_REGISTRY_NAME, ApothecaryMortarBlock::new); + public static final Supplier FERTILE_LILY_PAD = BLOCKS.register(FERTILE_LILY_PAD_REGISTRY_NAME, FertileLilyPadBlock::new); + public static final Supplier INTERDICTION_TORCH = BLOCKS.register(INTERDICTION_TORCH_REGISTRY_NAME, InterdictionTorchBlock::new); + public static final Supplier WALL_INTERDICTION_TORCH = BLOCKS.register("wall_interdiction_torch", WallInterdictionTorchBlock::new); + public static final Supplier WRAITH_NODE = BLOCKS.register(WRAITH_NODE_REGISTRY_NAME, WraithNodeBlock::new); - public static final Map> PASSIVE_PEDESTALS; - public static final Map> PEDESTALS; + public static final Map> PASSIVE_PEDESTALS; + public static final Map> PEDESTALS; static { - ImmutableMap.Builder> passiveBuilder = ImmutableMap.builder(); - ImmutableMap.Builder> activeBuilder = ImmutableMap.builder(); + ImmutableMap.Builder> passiveBuilder = ImmutableMap.builder(); + ImmutableMap.Builder> activeBuilder = ImmutableMap.builder(); for (DyeColor color : DyeColor.values()) { passiveBuilder.put(color, BLOCKS.register("pedestals/passive/" + color.getName() + "_passive_pedestal", PassivePedestalBlock::new)); activeBuilder.put(color, BLOCKS.register("pedestals/" + color.getName() + "_pedestal", PedestalBlock::new)); @@ -70,52 +60,52 @@ private ModBlocks() {} PEDESTALS = activeBuilder.build(); } - public static final RegistryObject> ALKAHESTRY_ALTAR_TILE_TYPE = BLOCK_ENTITY_TYPES.register(ALKAHESTRY_ALTAR_REGISTRY_NAME, + public static final Supplier> ALKAHESTRY_ALTAR_TILE_TYPE = BLOCK_ENTITY_TYPES.register(ALKAHESTRY_ALTAR_REGISTRY_NAME, () -> getTileEntityType(AlkahestryAltarBlockEntity::new, ALKAHESTRY_ALTAR.get())); - public static final RegistryObject> PEDESTAL_TILE_TYPE = BLOCK_ENTITY_TYPES.register("pedestal", - () -> getTileEntityType(PedestalBlockEntity::new, PEDESTALS.values().stream().map(RegistryObject::get).toArray(PedestalBlock[]::new))); - public static final RegistryObject> PASSIVE_PEDESTAL_TILE_TYPE = BLOCK_ENTITY_TYPES.register("passive_pedestal", - () -> getTileEntityType(PassivePedestalBlockEntity::new, PASSIVE_PEDESTALS.values().stream().map(RegistryObject::get).toArray(PassivePedestalBlock[]::new))); - public static final RegistryObject> APOTHECARY_CAULDRON_TILE_TYPE = BLOCK_ENTITY_TYPES.register(APOTHECARY_CAULDRON_REGISTRY_NAME, + public static final Supplier> PEDESTAL_TILE_TYPE = BLOCK_ENTITY_TYPES.register("pedestal", + () -> getTileEntityType(PedestalBlockEntity::new, PEDESTALS.values().stream().map(Supplier::get).toArray(PedestalBlock[]::new))); + public static final Supplier> PASSIVE_PEDESTAL_TILE_TYPE = BLOCK_ENTITY_TYPES.register("passive_pedestal", + () -> getTileEntityType(PassivePedestalBlockEntity::new, PASSIVE_PEDESTALS.values().stream().map(Supplier::get).toArray(PassivePedestalBlock[]::new))); + public static final Supplier> APOTHECARY_CAULDRON_TILE_TYPE = BLOCK_ENTITY_TYPES.register(APOTHECARY_CAULDRON_REGISTRY_NAME, () -> getTileEntityType(ApothecaryCauldronBlockEntity::new, APOTHECARY_CAULDRON.get())); - public static final RegistryObject> APOTHECARY_MORTAR_TILE_TYPE = BLOCK_ENTITY_TYPES.register(APOTHECARY_MORTAR_REGISTRY_NAME, + public static final Supplier> APOTHECARY_MORTAR_TILE_TYPE = BLOCK_ENTITY_TYPES.register(APOTHECARY_MORTAR_REGISTRY_NAME, () -> getTileEntityType(ApothecaryMortarBlockEntity::new, APOTHECARY_MORTAR.get())); - public static final RegistryObject ALKAHESTRY_ALTAR_ITEM = ITEMS.register(ALKAHESTRY_ALTAR_REGISTRY_NAME, () -> new BlockItemBase(ALKAHESTRY_ALTAR.get())); - public static final RegistryObject APOTHECARY_CAULDRON_ITEM = ITEMS.register(APOTHECARY_CAULDRON_REGISTRY_NAME, () -> new BlockItemBase(APOTHECARY_CAULDRON.get())); - public static final RegistryObject APOTHECARY_MORTAR_ITEM = ITEMS.register(APOTHECARY_MORTAR_REGISTRY_NAME, () -> new BlockItemBase(APOTHECARY_MORTAR.get())); - public static final RegistryObject FERTILE_LILY_PAD_ITEM = ITEMS.register(FERTILE_LILY_PAD_REGISTRY_NAME, FertileLilyPadItem::new); - public static final RegistryObject WRAITH_NODE_ITEM = ITEMS.register(WRAITH_NODE_REGISTRY_NAME, () -> new BlockItemBase(WRAITH_NODE.get())); - public static final RegistryObject INTERDICTION_TORCH_ITEM = ITEMS.register(INTERDICTION_TORCH_REGISTRY_NAME, InterdictionTorchItem::new); - public static final Map> PEDESTAL_ITEMS; - public static final Map> PASSIVE_PEDESTAL_ITEMS; + public static final Supplier ALKAHESTRY_ALTAR_ITEM = ITEMS.register(ALKAHESTRY_ALTAR_REGISTRY_NAME, () -> new BlockItemBase(ALKAHESTRY_ALTAR.get())); + public static final Supplier APOTHECARY_CAULDRON_ITEM = ITEMS.register(APOTHECARY_CAULDRON_REGISTRY_NAME, () -> new BlockItemBase(APOTHECARY_CAULDRON.get())); + public static final Supplier APOTHECARY_MORTAR_ITEM = ITEMS.register(APOTHECARY_MORTAR_REGISTRY_NAME, () -> new BlockItemBase(APOTHECARY_MORTAR.get())); + public static final Supplier FERTILE_LILY_PAD_ITEM = ITEMS.register(FERTILE_LILY_PAD_REGISTRY_NAME, FertileLilyPadItem::new); + public static final Supplier WRAITH_NODE_ITEM = ITEMS.register(WRAITH_NODE_REGISTRY_NAME, () -> new BlockItemBase(WRAITH_NODE.get())); + public static final Supplier INTERDICTION_TORCH_ITEM = ITEMS.register(INTERDICTION_TORCH_REGISTRY_NAME, InterdictionTorchItem::new); + public static final Map> PEDESTAL_ITEMS; + public static final Map> PASSIVE_PEDESTAL_ITEMS; private static final String BLOCK_PREFIX = "block."; static { - ImmutableMap.Builder> passiveBuilder = ImmutableMap.builder(); - ImmutableMap.Builder> activeBuilder = ImmutableMap.builder(); + ImmutableMap.Builder> passiveBuilder = ImmutableMap.builder(); + ImmutableMap.Builder> activeBuilder = ImmutableMap.builder(); for (DyeColor color : DyeColor.values()) { passiveBuilder.put(color, ITEMS.register("pedestals/passive/" + color.getName() + "_passive_pedestal", () -> new BlockItemBase(PASSIVE_PEDESTALS.get(color).get(), new Item.Properties()) { @Override public Component getName(ItemStack stack) { - return Component.translatable(BLOCK_PREFIX + Reference.MOD_ID + ".passive_pedestal"); + return Component.translatable(BLOCK_PREFIX + Reliquary.MOD_ID + ".passive_pedestal"); } @Override public String getDescriptionId() { - return BLOCK_PREFIX + Reference.MOD_ID + ".passive_pedestal"; + return BLOCK_PREFIX + Reliquary.MOD_ID + ".passive_pedestal"; } })); activeBuilder.put(color, ITEMS.register("pedestals/" + color.getName() + "_pedestal", () -> new BlockItemBase(PEDESTALS.get(color).get(), new Item.Properties()) { @Override public Component getName(ItemStack stack) { - return Component.translatable(BLOCK_PREFIX + Reference.MOD_ID + ".pedestal"); + return Component.translatable(BLOCK_PREFIX + Reliquary.MOD_ID + ".pedestal"); } @Override public String getDescriptionId() { - return BLOCK_PREFIX + Reference.MOD_ID + ".pedestal"; + return BLOCK_PREFIX + Reliquary.MOD_ID + ".pedestal"; } })); } @@ -127,10 +117,19 @@ public static void registerListeners(IEventBus modBus) { ITEMS.register(modBus); BLOCKS.register(modBus); BLOCK_ENTITY_TYPES.register(modBus); + modBus.addListener(ModBlocks::registerCapabilities); } @SuppressWarnings({"squid:S4449", "ConstantConditions"}) // no datafixer is defined for any of the tile entities so this is moot private static BlockEntityType getTileEntityType(BlockEntityType.BlockEntitySupplier tileFactory, Block... validBlocks) { return BlockEntityType.Builder.of(tileFactory, validBlocks).build(null); } + + private static void registerCapabilities(RegisterCapabilitiesEvent event) { + event.registerBlockEntity(Capabilities.ItemHandler.BLOCK, APOTHECARY_MORTAR_TILE_TYPE.get(), (mortar, direction) -> mortar.getItems()); + event.registerBlockEntity(Capabilities.ItemHandler.BLOCK, PASSIVE_PEDESTAL_TILE_TYPE.get(), (pedestal, direction) -> pedestal.getItemHandler()); + event.registerBlockEntity(Capabilities.ItemHandler.BLOCK, PEDESTAL_TILE_TYPE.get(), (pedestal, direction) -> pedestal.getItemHandler()); + + event.registerBlockEntity(Capabilities.FluidHandler.BLOCK, PEDESTAL_TILE_TYPE.get(), (pedestal, direction) -> pedestal.getFluidHandler()); + } } diff --git a/src/main/java/reliquary/init/ModCapabilities.java b/src/main/java/reliquary/init/ModCapabilities.java deleted file mode 100644 index d8ed3698..00000000 --- a/src/main/java/reliquary/init/ModCapabilities.java +++ /dev/null @@ -1,22 +0,0 @@ -package reliquary.init; - -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.CapabilityManager; -import net.minecraftforge.common.capabilities.CapabilityToken; -import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import reliquary.items.util.IHarvestRodCache; - -public class ModCapabilities { - private ModCapabilities() {} - - public static final Capability HARVEST_ROD_CACHE = CapabilityManager.get(new CapabilityToken<>() {}); - - public static void registerListeners(IEventBus modBus) { - modBus.addListener(ModCapabilities::onRegister); - } - - public static void onRegister(RegisterCapabilitiesEvent event) { - event.register(IHarvestRodCache.class); - } -} diff --git a/src/main/java/reliquary/init/ModCompat.java b/src/main/java/reliquary/init/ModCompat.java index d14134c9..33a7c0d9 100644 --- a/src/main/java/reliquary/init/ModCompat.java +++ b/src/main/java/reliquary/init/ModCompat.java @@ -1,6 +1,7 @@ package reliquary.init; -import net.minecraftforge.fml.ModList; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModList; import reliquary.compat.botania.BotaniaCompat; import reliquary.compat.curios.CuriosCompat; import reliquary.compat.tconstruct.TConstructCompat; @@ -9,28 +10,30 @@ import java.util.HashMap; import java.util.Map; +import java.util.function.Consumer; import java.util.function.Supplier; public class ModCompat { - private ModCompat() {} + private ModCompat() { + } - private static final Map> compatFactories = new HashMap<>(); - static { - compatFactories.put(Compatibility.ModIds.CURIOS, () -> CuriosCompat::new); - compatFactories.put(Compatibility.ModIds.BOTANIA, () -> BotaniaCompat::new); - compatFactories.put(Compatibility.ModIds.TINKERS_CONSTRUCT, () -> TConstructCompat::new); - } + private static final Map>> compatFactories = new HashMap<>(); - public static void initCompats() { - for(Map.Entry> entry : compatFactories.entrySet()) { - if (ModList.get().isLoaded(entry.getKey())) { - try { - entry.getValue().get().run(); - } - catch (Exception e) { - LogHelper.error("Error instantiating compatibility ", e); - } - } - } - } + static { + compatFactories.put(Compatibility.ModIds.CURIOS, () -> CuriosCompat::new); + compatFactories.put(Compatibility.ModIds.BOTANIA, () -> BotaniaCompat::new); + compatFactories.put(Compatibility.ModIds.TINKERS_CONSTRUCT, () -> TConstructCompat::new); + } + + public static void initCompats(IEventBus modBus) { + for (Map.Entry>> entry : compatFactories.entrySet()) { + if (ModList.get().isLoaded(entry.getKey())) { + try { + entry.getValue().get().accept(modBus); + } catch (Exception e) { + LogHelper.error("Error instantiating compatibility ", e); + } + } + } + } } diff --git a/src/main/java/reliquary/init/ModDataComponents.java b/src/main/java/reliquary/init/ModDataComponents.java new file mode 100644 index 00000000..36de321c --- /dev/null +++ b/src/main/java/reliquary/init/ModDataComponents.java @@ -0,0 +1,104 @@ +package reliquary.init; + +import com.mojang.serialization.Codec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ExtraCodecs; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.fluids.SimpleFluidContent; +import net.neoforged.neoforge.registries.DeferredRegister; +import reliquary.Reliquary; +import reliquary.items.*; +import reliquary.items.component.OversizedItemContainerContents; +import reliquary.util.CodecHelper; + +import java.util.HashSet; +import java.util.Set; +import java.util.function.Supplier; + +public class ModDataComponents { + private static final DeferredRegister> DATA_COMPONENT_TYPES = DeferredRegister.create(BuiltInRegistries.DATA_COMPONENT_TYPE, Reliquary.MOD_ID); + + public static final Supplier> ENTITY_NAME = DATA_COMPONENT_TYPES.register("entity_name", + () -> new DataComponentType.Builder().persistent(ResourceLocation.CODEC).networkSynchronized(ResourceLocation.STREAM_CODEC).build() + ); + + public static final Supplier> FLUID_CONTENTS = DATA_COMPONENT_TYPES.register("fluid_contents", + () -> new DataComponentType.Builder().persistent(SimpleFluidContent.CODEC).networkSynchronized(SimpleFluidContent.STREAM_CODEC).build()); + + public static final Supplier> OVERSIZED_ITEM_CONTAINER_CONTENTS = DATA_COMPONENT_TYPES.register("oversized_item_container_contents", + () -> new DataComponentType.Builder().persistent(OversizedItemContainerContents.CODEC).networkSynchronized(OversizedItemContainerContents.STREAM_CODEC).build()); + + public static final Supplier> WARP_POSITION = DATA_COMPONENT_TYPES.register("warp_position", + () -> new DataComponentType.Builder().persistent(BlockPos.CODEC).networkSynchronized(BlockPos.STREAM_CODEC).build()); + + public static final Supplier> WARP_DIMENSION = DATA_COMPONENT_TYPES.register("warp_dimension", + () -> new DataComponentType.Builder().persistent(ResourceLocation.CODEC).networkSynchronized(ResourceLocation.STREAM_CODEC).build()); + + public static final Supplier>> FROZEN_POSITIONS = DATA_COMPONENT_TYPES.register("frozen_positions", + () -> new DataComponentType.Builder>().persistent(CodecHelper.setOf(BlockPos.CODEC)).networkSynchronized(BlockPos.STREAM_CODEC.apply(ByteBufCodecs.collection(HashSet::new))).build()); + + public static final Supplier> CHARGE = DATA_COMPONENT_TYPES.register("charge", + () -> new DataComponentType.Builder().persistent(ExtraCodecs.NON_NEGATIVE_INT).networkSynchronized(ByteBufCodecs.INT).build()); + + public static final Supplier> GUNPOWDER = DATA_COMPONENT_TYPES.register("gunpowder", + () -> new DataComponentType.Builder().persistent(ExtraCodecs.NON_NEGATIVE_INT).networkSynchronized(ByteBufCodecs.INT).build()); + + public static final Supplier> ENDER_STAFF_MODE = DATA_COMPONENT_TYPES.register("ender_staff_mode", + () -> new DataComponentType.Builder().persistent(EnderStaffItem.Mode.CODEC).networkSynchronized(EnderStaffItem.Mode.STREAM_CODEC).build()); + + public static final Supplier> ENABLED = DATA_COMPONENT_TYPES.register("enabled", + () -> new DataComponentType.Builder().persistent(Codec.BOOL).networkSynchronized(ByteBufCodecs.BOOL).build()); + + public static final Supplier> SNOWBALLS = DATA_COMPONENT_TYPES.register("snowballs", + () -> new DataComponentType.Builder().persistent(ExtraCodecs.NON_NEGATIVE_INT).networkSynchronized(ByteBufCodecs.INT).build()); + + public static final Supplier> BULLET_COUNT = DATA_COMPONENT_TYPES.register("bullet_count", + () -> new DataComponentType.Builder().persistent(Codec.SHORT).networkSynchronized(ByteBufCodecs.SHORT).build()); + + public static final Supplier> MAGAZINE_TYPE = DATA_COMPONENT_TYPES.register("magazine_type", + () -> new DataComponentType.Builder().persistent(ResourceLocation.CODEC).networkSynchronized(ResourceLocation.STREAM_CODEC).build()); + + public static final Supplier> COOLDOWN_TIME = DATA_COMPONENT_TYPES.register("cooldown_time", + () -> new DataComponentType.Builder().persistent(Codec.LONG).networkSynchronized(ByteBufCodecs.VAR_LONG).build()); + + public static final Supplier> PLANTABLE_INDEX = DATA_COMPONENT_TYPES.register("plantable_index", + () -> new DataComponentType.Builder().persistent(Codec.BYTE).networkSynchronized(ByteBufCodecs.BYTE).build()); + + public static final Supplier> HARVEST_ROD_MODE = DATA_COMPONENT_TYPES.register("harvest_rod", + () -> new DataComponentType.Builder().persistent(HarvestRodItem.Mode.CODEC).networkSynchronized(HarvestRodItem.Mode.STREAM_CODEC).build()); + + public static final Supplier> EXPERIENCE = DATA_COMPONENT_TYPES.register("experience", + () -> new DataComponentType.Builder().persistent(ExtraCodecs.NON_NEGATIVE_INT).networkSynchronized(ByteBufCodecs.INT).build()); + + public static final Supplier> DRAIN_XP_LEVELS = DATA_COMPONENT_TYPES.register("drain_xp_levels", + () -> new DataComponentType.Builder().persistent(ExtraCodecs.NON_NEGATIVE_INT).networkSynchronized(ByteBufCodecs.INT).build()); + + public static final Supplier> STOP_AT_XP_LEVEL = DATA_COMPONENT_TYPES.register("stop_at_xp_level", + () -> new DataComponentType.Builder().persistent(ExtraCodecs.NON_NEGATIVE_INT).networkSynchronized(ByteBufCodecs.INT).build()); + + public static final Supplier> GLOWSTONE = DATA_COMPONENT_TYPES.register("glowstone", + () -> new DataComponentType.Builder().persistent(ExtraCodecs.NON_NEGATIVE_INT).networkSynchronized(ByteBufCodecs.INT).build()); + + public static final Supplier> PYROMANCER_STAFF_MODE = DATA_COMPONENT_TYPES.register("pyromancer_staff_mode", + () -> new DataComponentType.Builder().persistent(PyromancerStaffItem.Mode.CODEC).networkSynchronized(PyromancerStaffItem.Mode.STREAM_CODEC).build()); + + public static final Supplier> RENDING_GALE_MODE = DATA_COMPONENT_TYPES.register("rending_gale_mode", + () -> new DataComponentType.Builder().persistent(RendingGaleItem.Mode.CODEC).networkSynchronized(RendingGaleItem.Mode.STREAM_CODEC).build()); + + public static final Supplier> HOOK_ENTITY_ID = DATA_COMPONENT_TYPES.register("hook_entity_id", + () -> new DataComponentType.Builder().persistent(Codec.INT).networkSynchronized(ByteBufCodecs.INT).build()); + + public static final Supplier> TORCH_INDEX = DATA_COMPONENT_TYPES.register("torch_index", + () -> new DataComponentType.Builder().persistent(Codec.BYTE).networkSynchronized(ByteBufCodecs.BYTE).build()); + + public static final Supplier> VOID_TEAR_MODE = DATA_COMPONENT_TYPES.register("void_tear_mode", + () -> new DataComponentType.Builder().persistent(VoidTearItem.Mode.CODEC).networkSynchronized(VoidTearItem.Mode.STREAM_CODEC).build()); + + public static void register(IEventBus modBus) { + DATA_COMPONENT_TYPES.register(modBus); + } +} diff --git a/src/main/java/reliquary/init/ModEffects.java b/src/main/java/reliquary/init/ModEffects.java new file mode 100644 index 00000000..5690a695 --- /dev/null +++ b/src/main/java/reliquary/init/ModEffects.java @@ -0,0 +1,25 @@ +package reliquary.init; + +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.effect.MobEffect; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredRegister; +import reliquary.Reliquary; +import reliquary.potions.CureEffect; +import reliquary.potions.FlightEffect; +import reliquary.potions.PacificationEffect; + +public class ModEffects { + private ModEffects() {} + + private static final DeferredRegister MOB_EFFECTS = DeferredRegister.create(BuiltInRegistries.MOB_EFFECT, Reliquary.MOD_ID); + + public static Holder FLIGHT = MOB_EFFECTS.register("flight", FlightEffect::new); + public static Holder PACIFICATION = MOB_EFFECTS.register("pacification", PacificationEffect::new); + public static Holder CURE = MOB_EFFECTS.register("cure", CureEffect::new); + + public static void registerListeners(IEventBus modBus) { + MOB_EFFECTS.register(modBus); + } +} diff --git a/src/main/java/reliquary/init/ModEnchantments.java b/src/main/java/reliquary/init/ModEnchantments.java deleted file mode 100644 index d0233b46..00000000 --- a/src/main/java/reliquary/init/ModEnchantments.java +++ /dev/null @@ -1,44 +0,0 @@ -package reliquary.init; - -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentCategory; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import reliquary.reference.Reference; - -public class ModEnchantments { - private ModEnchantments() {} - - private static final DeferredRegister ENCHANTMENTS = DeferredRegister.create(ForgeRegistries.ENCHANTMENTS, Reference.MOD_ID); - public static final RegistryObject SEVERING = ENCHANTMENTS.register("severing", SeveringEnchantment::new); - - public static void register(IEventBus modBus) { - ENCHANTMENTS.register(modBus); - } - - public static class SeveringEnchantment extends Enchantment { - protected SeveringEnchantment() { - super(Rarity.RARE, EnchantmentCategory.WEAPON, new EquipmentSlot[] {EquipmentSlot.MAINHAND}); - } - - @Override - public int getMaxLevel() { - return 5; - } - - @Override - public int getMinCost(int level) { - return 15 + (level - 1) * 9; - } - - @Override - public int getMaxCost(int level) { - return super.getMinCost(level) + 50; - } - - } - -} diff --git a/src/main/java/reliquary/init/ModEntities.java b/src/main/java/reliquary/init/ModEntities.java index 24695b15..03dcb55e 100644 --- a/src/main/java/reliquary/init/ModEntities.java +++ b/src/main/java/reliquary/init/ModEntities.java @@ -1,62 +1,47 @@ package reliquary.init; +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.world.damagesource.DamageType; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import reliquary.entities.EnderStaffProjectileEntity; -import reliquary.entities.GlowingWaterEntity; -import reliquary.entities.HolyHandGrenadeEntity; -import reliquary.entities.KrakenSlimeEntity; -import reliquary.entities.LyssaHook; -import reliquary.entities.SpecialSnowballEntity; -import reliquary.entities.XRTippedArrowEntity; -import reliquary.entities.potion.AphroditePotionEntity; -import reliquary.entities.potion.FertilePotionEntity; -import reliquary.entities.potion.ThrownXRPotionEntity; -import reliquary.entities.shot.BlazeShotEntity; -import reliquary.entities.shot.BusterShotEntity; -import reliquary.entities.shot.ConcussiveShotEntity; -import reliquary.entities.shot.EnderShotEntity; -import reliquary.entities.shot.ExorcismShotEntity; -import reliquary.entities.shot.NeutralShotEntity; -import reliquary.entities.shot.SandShotEntity; -import reliquary.entities.shot.SeekerShotEntity; -import reliquary.entities.shot.ShotEntityBase; -import reliquary.entities.shot.StormShotEntity; -import reliquary.reference.Reference; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredRegister; +import reliquary.Reliquary; +import reliquary.entities.*; +import reliquary.entities.potion.AphroditePotion; +import reliquary.entities.potion.FertilePotion; +import reliquary.entities.potion.ThrownPotion; +import reliquary.entities.shot.*; + +import java.util.function.Supplier; public class ModEntities { - private static final DeferredRegister> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, Reference.MOD_ID); + private static final DeferredRegister> ENTITY_TYPES = DeferredRegister.create(BuiltInRegistries.ENTITY_TYPE, Reliquary.MOD_ID); - public static final RegistryObject> APHRODITE_POTION = ENTITY_TYPES.register("aphrodite_potion", () -> getDefaultSizeEntityType(AphroditePotionEntity::new)); - public static final RegistryObject> FERTILE_POTION = ENTITY_TYPES.register("fertile_potion", () -> getDefaultSizeEntityType(FertilePotionEntity::new)); - public static final RegistryObject> THROWN_POTION = ENTITY_TYPES.register("thrown_potion", () -> getDefaultSizeEntityType(ThrownXRPotionEntity::new)); - public static final RegistryObject> BLAZE_SHOT = ENTITY_TYPES.register("blaze_shot", () -> getShotEntityType(BlazeShotEntity::new)); - public static final RegistryObject> BUSTER_SHOT = ENTITY_TYPES.register("buster_shot", () -> getShotEntityType(BusterShotEntity::new)); - public static final RegistryObject> CONCUSSIVE_SHOT = ENTITY_TYPES.register("concussive_shot", () -> getShotEntityType(ConcussiveShotEntity::new)); - public static final RegistryObject> ENDER_SHOT = ENTITY_TYPES.register("ender_shot", () -> getShotEntityType(EnderShotEntity::new)); - public static final RegistryObject> EXORCISM_SHOT = ENTITY_TYPES.register("exorcism_shot", () -> getShotEntityType(ExorcismShotEntity::new)); - public static final RegistryObject> NEUTRAL_SHOT = ENTITY_TYPES.register("neutral_shot", () -> getShotEntityType(NeutralShotEntity::new)); - public static final RegistryObject> SAND_SHOT = ENTITY_TYPES.register("sand_shot", () -> getShotEntityType(SandShotEntity::new)); - public static final RegistryObject> SEEKER_SHOT = ENTITY_TYPES.register("seeker_shot", () -> getShotEntityType(SeekerShotEntity::new)); - public static final RegistryObject> STORM_SHOT = ENTITY_TYPES.register("storm_shot", () -> getShotEntityType(StormShotEntity::new)); - public static final RegistryObject> ENDER_STAFF_PROJECTILE = ENTITY_TYPES.register("ender_staff_projectile", () -> getEntityType(EnderStaffProjectileEntity::new, 0.25F, 0.25F, 256)); - public static final RegistryObject> GLOWING_WATER = ENTITY_TYPES.register("glowing_water", () -> getDefaultSizeEntityType(GlowingWaterEntity::new)); - public static final RegistryObject> HOLY_HAND_GRENADE = ENTITY_TYPES.register("holy_hand_grenade", () -> getDefaultSizeEntityType(HolyHandGrenadeEntity::new)); - public static final RegistryObject> KRAKEN_SLIME = ENTITY_TYPES.register("kraken_slime", () -> getDefaultSizeEntityType(KrakenSlimeEntity::new)); - public static final RegistryObject> LYSSA_HOOK = ENTITY_TYPES.register("lyssa_hook", () -> getDefaultSizeEntityType(LyssaHook::new)); - public static final RegistryObject> TIPPED_ARROW = ENTITY_TYPES.register("tipped_arrow", () -> getDefaultSizeEntityType(XRTippedArrowEntity::new)); - public static final RegistryObject> SPECIAL_SNOWBALL = ENTITY_TYPES.register("special_snowball", () -> getEntityType(SpecialSnowballEntity::new, 0.01F, 0.01F)); + public static final Supplier> APHRODITE_POTION = ENTITY_TYPES.register("aphrodite_potion", () -> getDefaultSizeEntityType(AphroditePotion::new)); + public static final Supplier> FERTILE_POTION = ENTITY_TYPES.register("fertile_potion", () -> getDefaultSizeEntityType(FertilePotion::new)); + public static final Supplier> THROWN_POTION = ENTITY_TYPES.register("thrown_potion", () -> getDefaultSizeEntityType(ThrownPotion::new)); + public static final Supplier> BLAZE_SHOT = ENTITY_TYPES.register("blaze_shot", () -> getShotEntityType(BlazeShot::new)); + public static final Supplier> BUSTER_SHOT = ENTITY_TYPES.register("buster_shot", () -> getShotEntityType(BusterShot::new)); + public static final Supplier> CONCUSSIVE_SHOT = ENTITY_TYPES.register("concussive_shot", () -> getShotEntityType(ConcussiveShot::new)); + public static final Supplier> ENDER_SHOT = ENTITY_TYPES.register("ender_shot", () -> getShotEntityType(EnderShot::new)); + public static final Supplier> EXORCISM_SHOT = ENTITY_TYPES.register("exorcism_shot", () -> getShotEntityType(ExorcismShot::new)); + public static final Supplier> NEUTRAL_SHOT = ENTITY_TYPES.register("neutral_shot", () -> getShotEntityType(NeutralShot::new)); + public static final Supplier> SAND_SHOT = ENTITY_TYPES.register("sand_shot", () -> getShotEntityType(SandShot::new)); + public static final Supplier> SEEKER_SHOT = ENTITY_TYPES.register("seeker_shot", () -> getShotEntityType(SeekerShot::new)); + public static final Supplier> STORM_SHOT = ENTITY_TYPES.register("storm_shot", () -> getShotEntityType(StormShot::new)); + public static final Supplier> ENDER_STAFF_PROJECTILE = ENTITY_TYPES.register("ender_staff_projectile", () -> getEntityType(EnderStaffProjectile::new, 0.25F, 0.25F, 256)); + public static final Supplier> GLOWING_WATER = ENTITY_TYPES.register("glowing_water", () -> getDefaultSizeEntityType(GlowingWater::new)); + public static final Supplier> HOLY_HAND_GRENADE = ENTITY_TYPES.register("holy_hand_grenade", () -> getDefaultSizeEntityType(HolyHandGrenade::new)); + public static final Supplier> KRAKEN_SLIME = ENTITY_TYPES.register("kraken_slime", () -> getDefaultSizeEntityType(KrakenSlime::new)); + public static final Supplier> LYSSA_HOOK = ENTITY_TYPES.register("lyssa_hook", () -> getDefaultSizeEntityType(LyssaHook::new)); + public static final Supplier> TIPPED_ARROW = ENTITY_TYPES.register("tipped_arrow", () -> getDefaultSizeEntityType(TippedArrow::new)); + public static final Supplier> SPECIAL_SNOWBALL = ENTITY_TYPES.register("special_snowball", () -> getEntityType(SpecialSnowball::new, 0.01F, 0.01F)); - public static final ResourceKey BULLET_DAMAGE_TYPE = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(Reference.MOD_ID, "bullet")); + public static final ResourceKey BULLET_DAMAGE_TYPE = ResourceKey.create(Registries.DAMAGE_TYPE, Reliquary.getRL("bullet")); private ModEntities() {} @@ -68,7 +53,7 @@ private static EntityType getDefaultSizeEntityType(EntityT return getEntityType(factory, 0.25F, 0.25F); } - private static EntityType getShotEntityType(EntityType.EntityFactory factory) { + private static EntityType getShotEntityType(EntityType.EntityFactory factory) { return getEntityType(factory, 0.01F, 0.01F); } diff --git a/src/main/java/reliquary/init/ModFluids.java b/src/main/java/reliquary/init/ModFluids.java index c2412248..79984b46 100644 --- a/src/main/java/reliquary/init/ModFluids.java +++ b/src/main/java/reliquary/init/ModFluids.java @@ -1,53 +1,36 @@ package reliquary.init; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.Fluid; -import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fluids.FluidType; -import net.minecraftforge.fluids.ForgeFlowingFluid; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import reliquary.reference.Reference; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.fluids.BaseFlowingFluid; +import net.neoforged.neoforge.fluids.FluidType; +import net.neoforged.neoforge.registries.DeferredRegister; +import net.neoforged.neoforge.registries.NeoForgeRegistries; +import reliquary.Reliquary; -import java.util.function.Consumer; +import java.util.function.Supplier; public class ModFluids { - private ModFluids() {} - - private static ForgeFlowingFluid.Properties fluidProperties() { - return new ForgeFlowingFluid.Properties(XP_JUICE_FLUID_TYPE, XP_JUICE_STILL, XP_JUICE_FLOWING); + private ModFluids() { } - public static final ResourceLocation EXPERIENCE_TAG_NAME = new ResourceLocation("forge:experience"); - public static final TagKey EXPERIENCE_TAG = TagKey.create(ForgeRegistries.Keys.FLUIDS, EXPERIENCE_TAG_NAME); - public static final DeferredRegister FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, Reference.MOD_ID); - public static final DeferredRegister FLUID_TYPES = DeferredRegister.create(ForgeRegistries.Keys.FLUID_TYPES, Reference.MOD_ID); - public static final RegistryObject XP_JUICE_STILL = FLUIDS.register("xp_juice_still", () -> new ForgeFlowingFluid.Source(fluidProperties())); - public static final RegistryObject XP_JUICE_FLOWING = FLUIDS.register("xp_juice_flowing", () -> new ForgeFlowingFluid.Flowing(fluidProperties())); - - public static final RegistryObject XP_JUICE_FLUID_TYPE = FLUID_TYPES.register("xp_juice", () -> new FluidType(FluidType.Properties.create().lightLevel(10).density(800).viscosity(1500)) { - @Override - public void initializeClient(Consumer consumer) { - consumer.accept(new IClientFluidTypeExtensions() { - private static final ResourceLocation XP_STILL_TEXTURE = new ResourceLocation(Reference.MOD_ID, "block/xp_juice_still"); - private static final ResourceLocation XP_FLOWING_TEXTURE = new ResourceLocation(Reference.MOD_ID, "block/xp_juice_flowing"); + private static BaseFlowingFluid.Properties fluidProperties() { + return new BaseFlowingFluid.Properties(EXPERIENCE_FLUID_TYPE, XP_STILL, XP_FLOWING); + } - @Override - public ResourceLocation getStillTexture() { - return XP_STILL_TEXTURE; - } + public static final ResourceLocation EXPERIENCE_TAG_NAME = ResourceLocation.fromNamespaceAndPath("c", "experience"); + public static final TagKey EXPERIENCE_TAG = TagKey.create(Registries.FLUID, EXPERIENCE_TAG_NAME); + public static final DeferredRegister FLUIDS = DeferredRegister.create(BuiltInRegistries.FLUID, Reliquary.MOD_ID); + public static final DeferredRegister FLUID_TYPES = DeferredRegister.create(NeoForgeRegistries.FLUID_TYPES, Reliquary.MOD_ID); + public static final Supplier XP_STILL = FLUIDS.register("xp_still", () -> new BaseFlowingFluid.Source(fluidProperties())); + public static final Supplier XP_FLOWING = FLUIDS.register("xp_flowing", () -> new BaseFlowingFluid.Flowing(fluidProperties())); - @Override - public ResourceLocation getFlowingTexture() { - return XP_FLOWING_TEXTURE; - } - }); - } - }); + public static final Supplier EXPERIENCE_FLUID_TYPE = FLUID_TYPES.register("experience", () -> new FluidType(FluidType.Properties.create().lightLevel(10).density(800).viscosity(1500))); public static void registerHandlers(IEventBus modBus) { FLUIDS.register(modBus); diff --git a/src/main/java/reliquary/init/ModItems.java b/src/main/java/reliquary/init/ModItems.java index e6b7425c..bd96c280 100644 --- a/src/main/java/reliquary/init/ModItems.java +++ b/src/main/java/reliquary/init/ModItems.java @@ -1,264 +1,212 @@ package reliquary.init; -import com.mojang.serialization.Codec; -import net.minecraft.client.gui.screens.MenuScreens; -import net.minecraft.core.BlockSource; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.Holder; import net.minecraft.core.Position; -import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior; -import net.minecraft.core.dispenser.DispenseItemBehavior; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; -import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.sounds.SoundEvents; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.inventory.MenuType; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.*; +import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.crafting.CraftingHelper; -import net.minecraftforge.common.extensions.IForgeMenuType; -import net.minecraftforge.common.loot.IGlobalLootModifier; -import net.minecraftforge.event.AddReloadListenerEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.DistExecutor; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegisterEvent; -import net.minecraftforge.registries.RegistryObject; -import reliquary.client.gui.AlkahestryTomeGui; -import reliquary.client.gui.MobCharmBeltGui; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.loading.FMLEnvironment; +import net.neoforged.neoforge.attachment.AttachmentType; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.capabilities.ItemCapability; +import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.common.conditions.ICondition; +import net.neoforged.neoforge.common.extensions.IMenuTypeExtension; +import net.neoforged.neoforge.common.loot.IGlobalLootModifier; +import net.neoforged.neoforge.event.AddReloadListenerEvent; +import net.neoforged.neoforge.registries.DeferredRegister; +import net.neoforged.neoforge.registries.NeoForgeRegistries; +import org.jetbrains.annotations.Nullable; +import reliquary.Reliquary; import reliquary.common.gui.AlkahestTomeMenu; import reliquary.common.gui.MobCharmBeltMenu; -import reliquary.crafting.AlkahestryChargingRecipe; -import reliquary.crafting.AlkahestryCraftingRecipe; -import reliquary.crafting.AlkahestryDrainRecipe; -import reliquary.crafting.FragmentToSpawnEggRecipe; -import reliquary.crafting.MobCharmRecipe; -import reliquary.crafting.MobCharmRepairRecipe; -import reliquary.crafting.PotionEffectsRecipe; -import reliquary.crafting.conditions.AlkahestryEnabledCondition; -import reliquary.crafting.conditions.HandgunEnabledCondition; -import reliquary.crafting.conditions.MobDropsCraftableCondition; -import reliquary.crafting.conditions.PassivePedestalEnabledCondition; -import reliquary.crafting.conditions.PedestalEnabledCondition; -import reliquary.crafting.conditions.PotionsEnabledCondition; -import reliquary.crafting.conditions.SpawnEggEnabledCondition; +import reliquary.crafting.*; +import reliquary.crafting.conditions.*; import reliquary.data.ChestLootEnabledCondition; import reliquary.data.EntityLootEnabledCondition; -import reliquary.data.RandomChanceLootingSeveringCondition; import reliquary.data.ReliquaryLootModifierProvider; -import reliquary.entities.GlowingWaterEntity; -import reliquary.entities.HolyHandGrenadeEntity; -import reliquary.entities.XRTippedArrowEntity; -import reliquary.entities.potion.AphroditePotionEntity; -import reliquary.entities.potion.FertilePotionEntity; -import reliquary.entities.potion.ThrownXRPotionEntity; -import reliquary.entities.shot.BlazeShotEntity; -import reliquary.entities.shot.BusterShotEntity; -import reliquary.entities.shot.ConcussiveShotEntity; -import reliquary.entities.shot.EnderShotEntity; -import reliquary.entities.shot.ExorcismShotEntity; -import reliquary.entities.shot.NeutralShotEntity; -import reliquary.entities.shot.SandShotEntity; -import reliquary.entities.shot.SeekerShotEntity; -import reliquary.entities.shot.StormShotEntity; -import reliquary.items.AlkahestryTomeItem; -import reliquary.items.AngelheartVialItem; -import reliquary.items.AngelicFeatherItem; -import reliquary.items.AphroditePotionItem; -import reliquary.items.BulletItem; -import reliquary.items.DestructionCatalystItem; -import reliquary.items.EmperorChaliceItem; -import reliquary.items.EnderStaffItem; -import reliquary.items.FertilePotionItem; -import reliquary.items.FortuneCoinItem; -import reliquary.items.GlacialStaffItem; -import reliquary.items.GlowingWaterItem; -import reliquary.items.HandgunItem; -import reliquary.items.HarvestRodItem; -import reliquary.items.HeroMedallionItem; -import reliquary.items.HolyHandGrenadeItem; -import reliquary.items.ICreativeTabItemGenerator; -import reliquary.items.IceMagusRodItem; -import reliquary.items.InfernalChaliceItem; -import reliquary.items.InfernalClawsItem; -import reliquary.items.InfernalTearItem; -import reliquary.items.ItemBase; -import reliquary.items.KrakenShellItem; -import reliquary.items.LanternOfParanoiaItem; -import reliquary.items.MagazineItem; -import reliquary.items.MagicbaneItem; -import reliquary.items.MercyCrossItem; -import reliquary.items.MidasTouchstoneItem; -import reliquary.items.MobCharmBeltItem; -import reliquary.items.MobCharmFragmentItem; -import reliquary.items.MobCharmItem; -import reliquary.items.MobDropItem; -import reliquary.items.PhoenixDownItem; -import reliquary.items.PotionEssenceItem; +import reliquary.entities.shot.*; import reliquary.items.PotionItem; -import reliquary.items.PotionItemBase; -import reliquary.items.PyromancerStaffItem; -import reliquary.items.RendingGaleItem; -import reliquary.items.RodOfLyssaItem; -import reliquary.items.SalamanderEyeItem; -import reliquary.items.SerpentStaffItem; -import reliquary.items.ShearsOfWinterItem; -import reliquary.items.SojournerStaffItem; -import reliquary.items.ThrownPotionItem; import reliquary.items.TippedArrowItem; -import reliquary.items.TwilightCloakItem; -import reliquary.items.VoidTearItem; -import reliquary.items.WitchHatItem; -import reliquary.items.WitherlessRoseItem; +import reliquary.items.*; +import reliquary.items.util.HarvestRodCache; +import reliquary.items.util.fluid.FluidHandlerEmperorChalice; +import reliquary.items.util.fluid.FluidHandlerHeroMedallion; +import reliquary.items.util.fluid.FluidHandlerInfernalChalice; import reliquary.reference.Colors; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.RegistryHelper; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + public class ModItems { - private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, Reference.MOD_ID); - public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB.location(), Reference.MOD_ID); - private static final DeferredRegister> MENU_TYPES = DeferredRegister.create(ForgeRegistries.MENU_TYPES, Reference.MOD_ID); - private static final DeferredRegister> RECIPE_SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, Reference.MOD_ID); - public static final DeferredRegister LOOT_CONDITION_TYPES = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE.location(), Reference.MOD_ID); - public static final DeferredRegister> LOOT_MODIFIERS = DeferredRegister.create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, Reference.MOD_ID); + private static final DeferredRegister ITEMS = DeferredRegister.create(BuiltInRegistries.ITEM, Reliquary.MOD_ID); + public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB.location(), Reliquary.MOD_ID); + private static final DeferredRegister> MENU_TYPES = DeferredRegister.create(BuiltInRegistries.MENU, Reliquary.MOD_ID); + private static final DeferredRegister> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, Reliquary.MOD_ID); + private static final DeferredRegister> RECIPE_SERIALIZERS = DeferredRegister.create(BuiltInRegistries.RECIPE_SERIALIZER, Reliquary.MOD_ID); + public static final DeferredRegister LOOT_CONDITION_TYPES = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE.location(), Reliquary.MOD_ID); + public static final DeferredRegister> LOOT_MODIFIERS = DeferredRegister.create(NeoForgeRegistries.GLOBAL_LOOT_MODIFIER_SERIALIZERS, Reliquary.MOD_ID); + public static final DeferredRegister ARMOR_MATERIALS = DeferredRegister.create(BuiltInRegistries.ARMOR_MATERIAL, Reliquary.MOD_ID); + + public static final Holder WITCH_HAT_MATERIAL = ARMOR_MATERIALS.register("witch_hat", () -> new ArmorMaterial( + Map.of(ArmorItem.Type.HELMET, 0), 0, SoundEvents.ARMOR_EQUIP_GENERIC, () -> Ingredient.EMPTY, + List.of(new ArmorMaterial.Layer(Reliquary.getRL("witch_hat"))), 0, 0)); - public static final RegistryObject ALKAHESTRY_TOME = ITEMS.register("alkahestry_tome", AlkahestryTomeItem::new); - public static final RegistryObject MERCY_CROSS = ITEMS.register("mercy_cross", MercyCrossItem::new); - public static final RegistryObject ANGELHEART_VIAL = ITEMS.register("angelheart_vial", AngelheartVialItem::new); - public static final RegistryObject ANGELIC_FEATHER = ITEMS.register("angelic_feather", AngelicFeatherItem::new); - public static final RegistryObject APHRODITE_POTION = ITEMS.register("aphrodite_potion", AphroditePotionItem::new); - public static final RegistryObject POTION_ESSENCE = ITEMS.register("potion_essence", PotionEssenceItem::new); - public static final RegistryObject DESTRUCTION_CATALYST = ITEMS.register("destruction_catalyst", DestructionCatalystItem::new); - public static final RegistryObject EMPEROR_CHALICE = ITEMS.register("emperor_chalice", EmperorChaliceItem::new); - public static final RegistryObject ENDER_STAFF = ITEMS.register("ender_staff", EnderStaffItem::new); - public static final RegistryObject FERTILE_POTION = ITEMS.register("fertile_potion", FertilePotionItem::new); - public static final RegistryObject FORTUNE_COIN = ITEMS.register("fortune_coin", FortuneCoinItem::new); - public static final RegistryObject GLACIAL_STAFF = ITEMS.register("glacial_staff", GlacialStaffItem::new); - public static final RegistryObject GLOWING_WATER = ITEMS.register("glowing_water", GlowingWaterItem::new); - public static final RegistryObject HOLY_HAND_GRENADE = ITEMS.register("holy_hand_grenade", HolyHandGrenadeItem::new); - public static final RegistryObject HANDGUN = ITEMS.register("handgun", HandgunItem::new); - public static final RegistryObject GRIP_ASSEMBLY = ITEMS.register("grip_assembly", () -> new ItemBase(new Item.Properties().stacksTo(4), Settings.COMMON.disable.disableHandgun)); - public static final RegistryObject BARREL_ASSEMBLY = ITEMS.register("barrel_assembly", () -> new ItemBase(new Item.Properties().stacksTo(4), Settings.COMMON.disable.disableHandgun)); - public static final RegistryObject HAMMER_ASSEMBLY = ITEMS.register("hammer_assembly", () -> new ItemBase(new Item.Properties().stacksTo(4), Settings.COMMON.disable.disableHandgun)); - public static final RegistryObject HARVEST_ROD = ITEMS.register("harvest_rod", HarvestRodItem::new); - public static final RegistryObject MOB_CHARM_FRAGMENT = ITEMS.register("mob_charm_fragment", MobCharmFragmentItem::new); - public static final RegistryObject HERO_MEDALLION = ITEMS.register("hero_medallion", HeroMedallionItem::new); - public static final RegistryObject ICE_MAGUS_ROD = ITEMS.register("ice_magus_rod", IceMagusRodItem::new); - public static final RegistryObject INFERNAL_CHALICE = ITEMS.register("infernal_chalice", InfernalChaliceItem::new); - public static final RegistryObject INFERNAL_CLAWS = ITEMS.register("infernal_claws", InfernalClawsItem::new); - public static final RegistryObject INFERNAL_TEAR = ITEMS.register("infernal_tear", InfernalTearItem::new); - public static final RegistryObject KRAKEN_SHELL = ITEMS.register("kraken_shell", KrakenShellItem::new); - public static final RegistryObject MIDAS_TOUCHSTONE = ITEMS.register("midas_touchstone", MidasTouchstoneItem::new); - public static final RegistryObject PHOENIX_DOWN = ITEMS.register("phoenix_down", PhoenixDownItem::new); - public static final RegistryObject PYROMANCER_STAFF = ITEMS.register("pyromancer_staff", PyromancerStaffItem::new); - public static final RegistryObject RENDING_GALE = ITEMS.register("rending_gale", RendingGaleItem::new); - public static final RegistryObject ROD_OF_LYSSA = ITEMS.register("rod_of_lyssa", RodOfLyssaItem::new); - public static final RegistryObject SOJOURNER_STAFF = ITEMS.register("sojourner_staff", SojournerStaffItem::new); - public static final RegistryObject TIPPED_ARROW = ITEMS.register("tipped_arrow", TippedArrowItem::new); - public static final RegistryObject VOID_TEAR = ITEMS.register("void_tear", VoidTearItem::new); - public static final RegistryObject WITCH_HAT = ITEMS.register("witch_hat", WitchHatItem::new); - public static final RegistryObject WITHERLESS_ROSE = ITEMS.register("witherless_rose", WitherlessRoseItem::new); - public static final RegistryObject EMPTY_POTION_VIAL = ITEMS.register("empty_potion_vial", () -> new ItemBase(Settings.COMMON.disable.disablePotions)); - public static final RegistryObject POTION = ITEMS.register("potion", PotionItem::new); - public static final RegistryObject SPLASH_POTION = ITEMS.register("splash_potion", ThrownPotionItem::new); - public static final RegistryObject LINGERING_POTION = ITEMS.register("lingering_potion", ThrownPotionItem::new); - public static final RegistryObject MOB_CHARM_BELT = ITEMS.register("mob_charm_belt", MobCharmBeltItem::new); - public static final RegistryObject MOB_CHARM = ITEMS.register("mob_charm", MobCharmItem::new); - public static final RegistryObject EMPTY_MAGAZINE = ITEMS.register("magazines/empty_magazine", () -> + public static final Supplier ALKAHESTRY_TOME = ITEMS.register("alkahestry_tome", AlkahestryTomeItem::new); + public static final Supplier MERCY_CROSS = ITEMS.register("mercy_cross", MercyCrossItem::new); + public static final Supplier ANGELHEART_VIAL = ITEMS.register("angelheart_vial", AngelheartVialItem::new); + public static final Supplier ANGELIC_FEATHER = ITEMS.register("angelic_feather", AngelicFeatherItem::new); + public static final Supplier APHRODITE_POTION = ITEMS.register("aphrodite_potion", AphroditePotionItem::new); + public static final Supplier POTION_ESSENCE = ITEMS.register("potion_essence", PotionEssenceItem::new); + public static final Supplier DESTRUCTION_CATALYST = ITEMS.register("destruction_catalyst", DestructionCatalystItem::new); + public static final Supplier EMPEROR_CHALICE = ITEMS.register("emperor_chalice", EmperorChaliceItem::new); + public static final Supplier ENDER_STAFF = ITEMS.register("ender_staff", EnderStaffItem::new); + public static final Supplier FERTILE_POTION = ITEMS.register("fertile_potion", FertilePotionItem::new); + public static final Supplier FORTUNE_COIN = ITEMS.register("fortune_coin", FortuneCoinItem::new); + public static final Supplier GLACIAL_STAFF = ITEMS.register("glacial_staff", GlacialStaffItem::new); + public static final Supplier GLOWING_WATER = ITEMS.register("glowing_water", GlowingWaterItem::new); + public static final Supplier HOLY_HAND_GRENADE = ITEMS.register("holy_hand_grenade", HolyHandGrenadeItem::new); + public static final Supplier HANDGUN = ITEMS.register("handgun", HandgunItem::new); + public static final Supplier GRIP_ASSEMBLY = ITEMS.register("grip_assembly", () -> new ItemBase(new Item.Properties().stacksTo(4), Config.COMMON.disable.disableHandgun)); + public static final Supplier BARREL_ASSEMBLY = ITEMS.register("barrel_assembly", () -> new ItemBase(new Item.Properties().stacksTo(4), Config.COMMON.disable.disableHandgun)); + public static final Supplier HAMMER_ASSEMBLY = ITEMS.register("hammer_assembly", () -> new ItemBase(new Item.Properties().stacksTo(4), Config.COMMON.disable.disableHandgun)); + public static final Supplier HARVEST_ROD = ITEMS.register("harvest_rod", HarvestRodItem::new); + public static final Supplier MOB_CHARM_FRAGMENT = ITEMS.register("mob_charm_fragment", MobCharmFragmentItem::new); + public static final Supplier HERO_MEDALLION = ITEMS.register("hero_medallion", HeroMedallionItem::new); + public static final Supplier ICE_MAGUS_ROD = ITEMS.register("ice_magus_rod", IceMagusRodItem::new); + public static final Supplier INFERNAL_CHALICE = ITEMS.register("infernal_chalice", InfernalChaliceItem::new); + public static final Supplier INFERNAL_CLAWS = ITEMS.register("infernal_claws", InfernalClawsItem::new); + public static final Supplier INFERNAL_TEAR = ITEMS.register("infernal_tear", InfernalTearItem::new); + public static final Supplier KRAKEN_SHELL = ITEMS.register("kraken_shell", KrakenShellItem::new); + public static final Supplier MIDAS_TOUCHSTONE = ITEMS.register("midas_touchstone", MidasTouchstoneItem::new); + public static final Supplier PHOENIX_DOWN = ITEMS.register("phoenix_down", PhoenixDownItem::new); + public static final Supplier PYROMANCER_STAFF = ITEMS.register("pyromancer_staff", PyromancerStaffItem::new); + public static final Supplier RENDING_GALE = ITEMS.register("rending_gale", RendingGaleItem::new); + public static final Supplier ROD_OF_LYSSA = ITEMS.register("rod_of_lyssa", RodOfLyssaItem::new); + public static final Supplier SOJOURNER_STAFF = ITEMS.register("sojourner_staff", SojournerStaffItem::new); + public static final Supplier TIPPED_ARROW = ITEMS.register("tipped_arrow", TippedArrowItem::new); + public static final Supplier VOID_TEAR = ITEMS.register("void_tear", VoidTearItem::new); + public static final Supplier WITCH_HAT = ITEMS.register("witch_hat", WitchHatItem::new); + public static final Supplier WITHERLESS_ROSE = ITEMS.register("witherless_rose", WitherlessRoseItem::new); + public static final Supplier EMPTY_POTION_VIAL = ITEMS.register("empty_potion_vial", () -> new ItemBase(Config.COMMON.disable.disablePotions)); + public static final Supplier POTION = ITEMS.register("potion", PotionItem::new); + public static final Supplier SPLASH_POTION = ITEMS.register("splash_potion", ThrownPotionItem::new); + public static final Supplier LINGERING_POTION = ITEMS.register("lingering_potion", ThrownPotionItem::new); + public static final Supplier MOB_CHARM_BELT = ITEMS.register("mob_charm_belt", MobCharmBeltItem::new); + public static final Supplier MOB_CHARM = ITEMS.register("mob_charm", MobCharmItem::new); + public static final Supplier EMPTY_MAGAZINE = ITEMS.register("magazines/empty_magazine", () -> new MagazineItem(false, Integer.parseInt(Colors.DARKEST, 16))); - public static final RegistryObject NEUTRAL_MAGAZINE = ITEMS.register("magazines/neutral_magazine", () -> + public static final Supplier NEUTRAL_MAGAZINE = ITEMS.register("magazines/neutral_magazine", () -> new MagazineItem(true, Integer.parseInt(Colors.NEUTRAL_SHOT_COLOR, 16))); - public static final RegistryObject EXORCISM_MAGAZINE = ITEMS.register("magazines/exorcism_magazine", () -> + public static final Supplier EXORCISM_MAGAZINE = ITEMS.register("magazines/exorcism_magazine", () -> new MagazineItem(false, Integer.parseInt(Colors.EXORCISM_SHOT_COLOR, 16))); - public static final RegistryObject BLAZE_MAGAZINE = ITEMS.register("magazines/blaze_magazine", () -> + public static final Supplier BLAZE_MAGAZINE = ITEMS.register("magazines/blaze_magazine", () -> new MagazineItem(false, Integer.parseInt(Colors.BLAZE_SHOT_COLOR, 16))); - public static final RegistryObject ENDER_MAGAZINE = ITEMS.register("magazines/ender_magazine", () -> + public static final Supplier ENDER_MAGAZINE = ITEMS.register("magazines/ender_magazine", () -> new MagazineItem(false, Integer.parseInt(Colors.ENDER_SHOT_COLOR, 16))); - public static final RegistryObject CONCUSSIVE_MAGAZINE = ITEMS.register("magazines/concussive_magazine", () -> + public static final Supplier CONCUSSIVE_MAGAZINE = ITEMS.register("magazines/concussive_magazine", () -> new MagazineItem(false, Integer.parseInt(Colors.CONCUSSIVE_SHOT_COLOR, 16))); - public static final RegistryObject BUSTER_MAGAZINE = ITEMS.register("magazines/buster_magazine", () -> + public static final Supplier BUSTER_MAGAZINE = ITEMS.register("magazines/buster_magazine", () -> new MagazineItem(false, Integer.parseInt(Colors.BUSTER_SHOT_COLOR, 16))); - public static final RegistryObject SEEKER_MAGAZINE = ITEMS.register("magazines/seeker_magazine", () -> + public static final Supplier SEEKER_MAGAZINE = ITEMS.register("magazines/seeker_magazine", () -> new MagazineItem(false, Integer.parseInt(Colors.SEEKER_SHOT_COLOR, 16))); - public static final RegistryObject SAND_MAGAZINE = ITEMS.register("magazines/sand_magazine", () -> + public static final Supplier SAND_MAGAZINE = ITEMS.register("magazines/sand_magazine", () -> new MagazineItem(false, Integer.parseInt(Colors.SAND_SHOT_COLOR, 16))); - public static final RegistryObject STORM_MAGAZINE = ITEMS.register("magazines/storm_magazine", () -> + public static final Supplier STORM_MAGAZINE = ITEMS.register("magazines/storm_magazine", () -> new MagazineItem(false, Integer.parseInt(Colors.STORM_SHOT_COLOR, 16))); - public static final RegistryObject EMPTY_BULLET = ITEMS.register("bullets/empty_bullet", () -> + public static final Supplier EMPTY_BULLET = ITEMS.register("bullets/empty_bullet", () -> new BulletItem(false, false, Integer.parseInt(Colors.DARKEST, 16))); - public static final RegistryObject NEUTRAL_BULLET = ITEMS.register("bullets/neutral_bullet", () -> + public static final Supplier NEUTRAL_BULLET = ITEMS.register("bullets/neutral_bullet", () -> new BulletItem(false, true, Integer.parseInt(Colors.NEUTRAL_SHOT_COLOR, 16))); - public static final RegistryObject EXORCISM_BULLET = ITEMS.register("bullets/exorcism_bullet", () -> + public static final Supplier EXORCISM_BULLET = ITEMS.register("bullets/exorcism_bullet", () -> new BulletItem(true, false, Integer.parseInt(Colors.EXORCISM_SHOT_COLOR, 16))); - public static final RegistryObject BLAZE_BULLET = ITEMS.register("bullets/blaze_bullet", () -> + public static final Supplier BLAZE_BULLET = ITEMS.register("bullets/blaze_bullet", () -> new BulletItem(true, false, Integer.parseInt(Colors.BLAZE_SHOT_COLOR, 16))); - public static final RegistryObject ENDER_BULLET = ITEMS.register("bullets/ender_bullet", () -> + public static final Supplier ENDER_BULLET = ITEMS.register("bullets/ender_bullet", () -> new BulletItem(true, false, Integer.parseInt(Colors.ENDER_SHOT_COLOR, 16))); - public static final RegistryObject CONCUSSIVE_BULLET = ITEMS.register("bullets/concussive_bullet", () -> + public static final Supplier CONCUSSIVE_BULLET = ITEMS.register("bullets/concussive_bullet", () -> new BulletItem(true, false, Integer.parseInt(Colors.CONCUSSIVE_SHOT_COLOR, 16))); - public static final RegistryObject BUSTER_BULLET = ITEMS.register("bullets/buster_bullet", () -> + public static final Supplier BUSTER_BULLET = ITEMS.register("bullets/buster_bullet", () -> new BulletItem(true, false, Integer.parseInt(Colors.BUSTER_SHOT_COLOR, 16))); - public static final RegistryObject SEEKER_BULLET = ITEMS.register("bullets/seeker_bullet", () -> + public static final Supplier SEEKER_BULLET = ITEMS.register("bullets/seeker_bullet", () -> new BulletItem(true, false, Integer.parseInt(Colors.SEEKER_SHOT_COLOR, 16))); - public static final RegistryObject SAND_BULLET = ITEMS.register("bullets/sand_bullet", () -> + public static final Supplier SAND_BULLET = ITEMS.register("bullets/sand_bullet", () -> new BulletItem(true, false, Integer.parseInt(Colors.SAND_SHOT_COLOR, 16))); - public static final RegistryObject STORM_BULLET = ITEMS.register("bullets/storm_bullet", () -> + public static final Supplier STORM_BULLET = ITEMS.register("bullets/storm_bullet", () -> new BulletItem(true, false, Integer.parseInt(Colors.STORM_SHOT_COLOR, 16))); - public static final RegistryObject ZOMBIE_HEART = ITEMS.register("zombie_heart", MobDropItem::new); - public static final RegistryObject SQUID_BEAK = ITEMS.register("squid_beak", MobDropItem::new); - public static final RegistryObject RIB_BONE = ITEMS.register("rib_bone", MobDropItem::new); - public static final RegistryObject CATALYZING_GLAND = ITEMS.register("catalyzing_gland", MobDropItem::new); - public static final RegistryObject CHELICERAE = ITEMS.register("chelicerae", MobDropItem::new); - public static final RegistryObject SLIME_PEARL = ITEMS.register("slime_pearl", MobDropItem::new); - public static final RegistryObject KRAKEN_SHELL_FRAGMENT = ITEMS.register("kraken_shell_fragment", ItemBase::new); - public static final RegistryObject BAT_WING = ITEMS.register("bat_wing", MobDropItem::new); - public static final RegistryObject WITHERED_RIB = ITEMS.register("withered_rib", MobDropItem::new); - public static final RegistryObject MOLTEN_CORE = ITEMS.register("molten_core", MobDropItem::new); - public static final RegistryObject EYE_OF_THE_STORM = ITEMS.register("eye_of_the_storm", MobDropItem::new); - public static final RegistryObject FERTILE_ESSENCE = ITEMS.register("fertile_essence", ItemBase::new); - public static final RegistryObject FROZEN_CORE = ITEMS.register("frozen_core", MobDropItem::new); - public static final RegistryObject NEBULOUS_HEART = ITEMS.register("nebulous_heart", MobDropItem::new); - public static final RegistryObject INFERNAL_CLAW = ITEMS.register("infernal_claw", ItemBase::new); - public static final RegistryObject GUARDIAN_SPIKE = ITEMS.register("guardian_spike", MobDropItem::new); - public static final RegistryObject CRIMSON_CLOTH = ITEMS.register("crimson_cloth", ItemBase::new); - public static final RegistryObject LANTERN_OF_PARANOIA = ITEMS.register("lantern_of_paranoia", LanternOfParanoiaItem::new); - public static final RegistryObject MAGICBANE = ITEMS.register("magicbane", MagicbaneItem::new); - public static final RegistryObject SALAMANDER_EYE = ITEMS.register("salamander_eye", SalamanderEyeItem::new); - public static final RegistryObject SERPENT_STAFF = ITEMS.register("serpent_staff", SerpentStaffItem::new); - public static final RegistryObject SHEARS_OF_WINTER = ITEMS.register("shears_of_winter", ShearsOfWinterItem::new); - public static final RegistryObject TWILIGHT_CLOAK = ITEMS.register("twilight_cloak", TwilightCloakItem::new); - public static final RegistryObject GLOWING_BREAD = ITEMS.register("glowing_bread", () -> - new ItemBase(new Item.Properties().rarity(Rarity.RARE).food(new FoodProperties.Builder().nutrition(20).saturationMod(1F).fast().build()))); + public static final Supplier ZOMBIE_HEART = ITEMS.register("zombie_heart", MobDropItem::new); + public static final Supplier SQUID_BEAK = ITEMS.register("squid_beak", MobDropItem::new); + public static final Supplier RIB_BONE = ITEMS.register("rib_bone", MobDropItem::new); + public static final Supplier CATALYZING_GLAND = ITEMS.register("catalyzing_gland", MobDropItem::new); + public static final Supplier CHELICERAE = ITEMS.register("chelicerae", MobDropItem::new); + public static final Supplier SLIME_PEARL = ITEMS.register("slime_pearl", MobDropItem::new); + public static final Supplier KRAKEN_SHELL_FRAGMENT = ITEMS.register("kraken_shell_fragment", () -> new ItemBase()); + public static final Supplier BAT_WING = ITEMS.register("bat_wing", MobDropItem::new); + public static final Supplier WITHERED_RIB = ITEMS.register("withered_rib", MobDropItem::new); + public static final Supplier MOLTEN_CORE = ITEMS.register("molten_core", MobDropItem::new); + public static final Supplier EYE_OF_THE_STORM = ITEMS.register("eye_of_the_storm", MobDropItem::new); + public static final Supplier FERTILE_ESSENCE = ITEMS.register("fertile_essence", () -> new ItemBase()); + public static final Supplier FROZEN_CORE = ITEMS.register("frozen_core", MobDropItem::new); + public static final Supplier NEBULOUS_HEART = ITEMS.register("nebulous_heart", MobDropItem::new); + public static final Supplier INFERNAL_CLAW = ITEMS.register("infernal_claw", () -> new ItemBase()); + public static final Supplier GUARDIAN_SPIKE = ITEMS.register("guardian_spike", MobDropItem::new); + public static final Supplier CRIMSON_CLOTH = ITEMS.register("crimson_cloth", () -> new ItemBase()); + public static final Supplier LANTERN_OF_PARANOIA = ITEMS.register("lantern_of_paranoia", LanternOfParanoiaItem::new); + public static final Supplier MAGICBANE = ITEMS.register("magicbane", MagicbaneItem::new); + public static final Supplier SALAMANDER_EYE = ITEMS.register("salamander_eye", SalamanderEyeItem::new); + public static final Supplier SERPENT_STAFF = ITEMS.register("serpent_staff", SerpentStaffItem::new); + public static final Supplier SHEARS_OF_WINTER = ITEMS.register("shears_of_winter", ShearsOfWinterItem::new); + public static final Supplier TWILIGHT_CLOAK = ITEMS.register("twilight_cloak", TwilightCloakItem::new); + public static final Supplier GLOWING_BREAD = ITEMS.register("glowing_bread", () -> + new ItemBase(new Item.Properties().rarity(Rarity.RARE).food(new FoodProperties.Builder().nutrition(20).saturationModifier(1F).fast().build()))); + public static final Supplier XP_BUCKET = ITEMS.register("xp_bucket", () -> new BucketItem(ModFluids.XP_STILL.get(), new Item.Properties().stacksTo(1))); + + public static final Supplier> ALKAHEST_TOME_MENU_TYPE = MENU_TYPES.register("alkahest_tome", + () -> IMenuTypeExtension.create((windowId, inv, data) -> AlkahestTomeMenu.fromBuffer(windowId))); - public static final RegistryObject> ALKAHEST_TOME_MENU_TYPE = MENU_TYPES.register("alkahest_tome", - () -> IForgeMenuType.create((windowId, inv, data) -> AlkahestTomeMenu.fromBuffer(windowId))); + public static final Supplier> MOB_CHAR_BELT_MENU_TYPE = MENU_TYPES.register("mob_char_belt", + () -> IMenuTypeExtension.create(MobCharmBeltMenu::fromBuffer)); - public static final RegistryObject> MOB_CHAR_BELT_MENU_TYPE = MENU_TYPES.register("mob_char_belt", - () -> IForgeMenuType.create(MobCharmBeltMenu::fromBuffer)); - public static final RegistryObject> MOB_CHARM_RECIPE_SERIALIZER = RECIPE_SERIALIZERS.register("mob_charm", MobCharmRecipe.Serializer::new); - public static final RegistryObject> FRAGMENT_TO_SPAWN_EGG_SERIALIZER = RECIPE_SERIALIZERS.register("fragment_to_spawn_egg", FragmentToSpawnEggRecipe.Serializer::new); - public static final RegistryObject> MOB_CHARM_REPAIR_SERIALIZER = RECIPE_SERIALIZERS.register("mob_charm_repair", () -> new SimpleCraftingRecipeSerializer<>(MobCharmRepairRecipe::new)); - public static final RegistryObject> ALKAHESTRY_CHARGING_SERIALIZER = RECIPE_SERIALIZERS.register("alkahestry_charging", AlkahestryChargingRecipe.Serializer::new); - public static final RegistryObject> ALKAHESTRY_CRAFTING_SERIALIZER = RECIPE_SERIALIZERS.register("alkahestry_crafting", AlkahestryCraftingRecipe.Serializer::new); - public static final RegistryObject> ALKAHESTRY_DRAIN_SERIALIZER = RECIPE_SERIALIZERS.register("alkahestry_drain", AlkahestryDrainRecipe.Serializer::new); - public static final RegistryObject> POTION_EFFECTS_SERIALIZER = RECIPE_SERIALIZERS.register("potion_effects", PotionEffectsRecipe.Serializer::new); - public static final RegistryObject CHEST_LOOT_ENABLED_CONDITION = LOOT_CONDITION_TYPES.register("chest_loot_enabled", () -> new LootItemConditionType(new ChestLootEnabledCondition.Serializer())); - public static final RegistryObject ENTITY_LOOT_ENABLED_CONDITION = LOOT_CONDITION_TYPES.register("entity_loot_enabled", () -> new LootItemConditionType(new EntityLootEnabledCondition.Serializer())); - public static final RegistryObject RANDOM_CHANCE_LOOTING_SEVERING = LOOT_CONDITION_TYPES.register("random_chance_looting_severing", () -> new LootItemConditionType(new RandomChanceLootingSeveringCondition.Serializer())); - public static final RegistryObject> INJECT_LOOT = LOOT_MODIFIERS.register("inject_loot", () -> ReliquaryLootModifierProvider.InjectLootModifier.CODEC); + public static final Supplier> ALKAHESTRY_ENABLED_CONDITION = CONDITION_CODECS.register("alkahestry_enabled", () -> AlkahestryEnabledCondition.CODEC); + public static final Supplier> MOB_DROPS_CRAFTABLE_CONDITION = CONDITION_CODECS.register("mob_drops_craftable", () -> MobDropsCraftableCondition.CODEC); + public static final Supplier> HANDGUN_ENABLED_CONDITION = CONDITION_CODECS.register("handgun_enabled", () -> HandgunEnabledCondition.CODEC); + public static final Supplier> POTIONS_ENABLED_CONDITION = CONDITION_CODECS.register("potions_enabled", () -> PotionsEnabledCondition.CODEC); + public static final Supplier> PASSIVE_PEDESTAL_ENABLED_CONDITION = CONDITION_CODECS.register("passive_pedestal_enabled", () -> PassivePedestalEnabledCondition.CODEC); + public static final Supplier> PEDESTAL_ENABLED_CONDITION = CONDITION_CODECS.register("pedestal_enabled", () -> PedestalEnabledCondition.CODEC); + public static final Supplier> SPAWN_EGG_ENABLED_CONDITION = CONDITION_CODECS.register("spawn_egg_enabled", () -> SpawnEggEnabledCondition.CODEC); - public static RegistryObject CREATIVE_TAB = CREATIVE_MODE_TABS.register("main", () -> + public static final Supplier> MOB_CHARM_RECIPE_SERIALIZER = RECIPE_SERIALIZERS.register("mob_charm", MobCharmRecipe.Serializer::new); + public static final Supplier> FRAGMENT_TO_SPAWN_EGG_SERIALIZER = RECIPE_SERIALIZERS.register("fragment_to_spawn_egg", FragmentToSpawnEggRecipe.Serializer::new); + public static final Supplier> MOB_CHARM_REPAIR_SERIALIZER = RECIPE_SERIALIZERS.register("mob_charm_repair", () -> new SimpleCraftingRecipeSerializer<>(MobCharmRepairRecipe::new)); + public static final Supplier> ALKAHESTRY_CHARGING_SERIALIZER = RECIPE_SERIALIZERS.register("alkahestry_charging", AlkahestryChargingRecipe.Serializer::new); + public static final Supplier> ALKAHESTRY_CRAFTING_SERIALIZER = RECIPE_SERIALIZERS.register("alkahestry_crafting", AlkahestryCraftingRecipe.Serializer::new); + public static final Supplier> ALKAHESTRY_DRAIN_SERIALIZER = RECIPE_SERIALIZERS.register("alkahestry_drain", AlkahestryDrainRecipe.Serializer::new); + public static final Supplier> POTION_EFFECTS_SERIALIZER = RECIPE_SERIALIZERS.register("potion_effects", PotionEffectsRecipe.Serializer::new); + public static final Supplier CHEST_LOOT_ENABLED_CONDITION = LOOT_CONDITION_TYPES.register("chest_loot_enabled", () -> new LootItemConditionType(ChestLootEnabledCondition.CODEC)); + public static final Supplier ENTITY_LOOT_ENABLED_CONDITION = LOOT_CONDITION_TYPES.register("entity_loot_enabled", () -> new LootItemConditionType(EntityLootEnabledCondition.CODEC)); + public static final Supplier> INJECT_LOOT = LOOT_MODIFIERS.register("inject_loot", () -> ReliquaryLootModifierProvider.InjectLootModifier.CODEC); + + private static final DeferredRegister> ATTACHMENT_TYPES = DeferredRegister.create(NeoForgeRegistries.Keys.ATTACHMENT_TYPES, Reliquary.MOD_ID); + public static final ItemCapability HARVEST_ROD_CACHE_CAPABILITY = ItemCapability.createVoid(Reliquary.getRL("harvest_rod_cache"), HarvestRodCache.class); + public static final Supplier CREATIVE_TAB = CREATIVE_MODE_TABS.register("main", () -> CreativeModeTab.builder().icon(() -> new ItemStack(ModItems.MERCY_CROSS.get())) .title(Component.translatable("itemGroup.reliquary")) .displayItems((featureFlags, output) -> { @@ -266,134 +214,50 @@ public class ModItems { .forEach(i -> ((ICreativeTabItemGenerator) i.get()).addCreativeTabItems(output::accept)); ModBlocks.ITEMS.getEntries().stream().filter(i -> i.get() instanceof ICreativeTabItemGenerator) .forEach(i -> ((ICreativeTabItemGenerator) i.get()).addCreativeTabItems(output::accept)); + output.accept(new ItemStack(XP_BUCKET.get())); } ).build()); - public static void registerContainers(RegisterEvent event) { - if (!event.getRegistryKey().equals(ForgeRegistries.Keys.MENU_TYPES)) { - return; - } - - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { - MenuScreens.register(ALKAHEST_TOME_MENU_TYPE.get(), AlkahestryTomeGui::new); - MenuScreens.register(MOB_CHAR_BELT_MENU_TYPE.get(), MobCharmBeltGui::new); - }); - } - public static void registerDispenseBehaviors() { - if (Boolean.FALSE.equals(Settings.COMMON.disable.disablePotions.get())) { - DispenserBlock.registerBehavior(ModItems.SPLASH_POTION.get(), new BehaviorDefaultProjectileDispense() { - @Override - ProjectileEntityFactory getProjectileEntityFactory() { - return (world, position, stack) -> new ThrownXRPotionEntity(world, position.x(), position.y(), position.z(), stack); - } - }); - - DispenserBlock.registerBehavior(ModItems.LINGERING_POTION.get(), new BehaviorDefaultProjectileDispense() { - @Override - ProjectileEntityFactory getProjectileEntityFactory() { - return (world, position, stack) -> new ThrownXRPotionEntity(world, position.x(), position.y(), position.z(), stack); - } - }); - - DispenserBlock.registerBehavior(ModItems.APHRODITE_POTION.get(), new BehaviorDefaultProjectileDispense() { - @Override - ProjectileEntityFactory getProjectileEntityFactory() { - return (world, position, stack) -> new AphroditePotionEntity(world, position.x(), position.y(), position.z()); - } - }); - - DispenserBlock.registerBehavior(ModItems.FERTILE_POTION.get(), new BehaviorDefaultProjectileDispense() { - @Override - ProjectileEntityFactory getProjectileEntityFactory() { - return (world, position, stack) -> new FertilePotionEntity(world, position.x(), position.y(), position.z()); - } - }); - - DispenserBlock.registerBehavior(ModItems.TIPPED_ARROW.get(), new AbstractProjectileDispenseBehavior() { - @Override - protected Projectile getProjectile(Level world, Position position, ItemStack stack) { - XRTippedArrowEntity entitytippedarrow = new XRTippedArrowEntity(world, position.x(), position.y(), position.z()); - entitytippedarrow.setPotionEffect(stack); - entitytippedarrow.pickup = AbstractArrow.Pickup.ALLOWED; - return entitytippedarrow; - } - }); - } - DispenserBlock.registerBehavior(ModItems.GLOWING_WATER.get(), new BehaviorDefaultProjectileDispense() { - @Override - ProjectileEntityFactory getProjectileEntityFactory() { - return (world, position, stack) -> new GlowingWaterEntity(world, position.x(), position.y(), position.z()); - } - }); - - DispenserBlock.registerBehavior(ModItems.HOLY_HAND_GRENADE.get(), new BehaviorDefaultProjectileDispense() { - @Override - ProjectileEntityFactory getProjectileEntityFactory() { - return (world, position, stack) -> new HolyHandGrenadeEntity(world, position.x(), position.y(), position.z()); - } - }); - } - - public static void registerRecipeSerializers(RegisterEvent event) { - if (event.getRegistryKey().equals(ForgeRegistries.Keys.RECIPE_SERIALIZERS)) { - CraftingHelper.register(MobDropsCraftableCondition.SERIALIZER); - CraftingHelper.register(AlkahestryEnabledCondition.SERIALIZER); - CraftingHelper.register(HandgunEnabledCondition.SERIALIZER); - CraftingHelper.register(PotionsEnabledCondition.SERIALIZER); - CraftingHelper.register(PassivePedestalEnabledCondition.SERIALIZER); - CraftingHelper.register(PedestalEnabledCondition.SERIALIZER); - CraftingHelper.register(SpawnEggEnabledCondition.SERIALIZER); + if (Boolean.FALSE.equals(Config.COMMON.disable.disablePotions.get())) { + DispenserBlock.registerProjectileBehavior(ModItems.SPLASH_POTION.get()); + DispenserBlock.registerProjectileBehavior(ModItems.LINGERING_POTION.get()); + DispenserBlock.registerProjectileBehavior(ModItems.APHRODITE_POTION.get()); + DispenserBlock.registerProjectileBehavior(ModItems.FERTILE_POTION.get()); + DispenserBlock.registerProjectileBehavior(ModItems.TIPPED_ARROW.get()); } + DispenserBlock.registerProjectileBehavior(ModItems.GLOWING_WATER.get()); + DispenserBlock.registerProjectileBehavior(ModItems.HOLY_HAND_GRENADE.get()); } public static void registerHandgunMagazines() { HandgunItem handgun = HANDGUN.get(); - handgun.registerMagazine(RegistryHelper.getRegistryName(NEUTRAL_MAGAZINE.get()).toString(), NeutralShotEntity::new, NEUTRAL_BULLET); - handgun.registerMagazine(RegistryHelper.getRegistryName(EXORCISM_MAGAZINE.get()).toString(), ExorcismShotEntity::new, EXORCISM_BULLET); - handgun.registerMagazine(RegistryHelper.getRegistryName(BLAZE_MAGAZINE.get()).toString(), BlazeShotEntity::new, BLAZE_BULLET); - handgun.registerMagazine(RegistryHelper.getRegistryName(ENDER_MAGAZINE.get()).toString(), EnderShotEntity::new, ENDER_BULLET); - handgun.registerMagazine(RegistryHelper.getRegistryName(CONCUSSIVE_MAGAZINE.get()).toString(), ConcussiveShotEntity::new, CONCUSSIVE_BULLET); - handgun.registerMagazine(RegistryHelper.getRegistryName(BUSTER_MAGAZINE.get()).toString(), BusterShotEntity::new, BUSTER_BULLET); - handgun.registerMagazine(RegistryHelper.getRegistryName(SEEKER_MAGAZINE.get()).toString(), SeekerShotEntity::new, SEEKER_BULLET); - handgun.registerMagazine(RegistryHelper.getRegistryName(SAND_MAGAZINE.get()).toString(), SandShotEntity::new, SAND_BULLET); - handgun.registerMagazine(RegistryHelper.getRegistryName(STORM_MAGAZINE.get()).toString(), StormShotEntity::new, STORM_BULLET); + handgun.registerMagazine(RegistryHelper.getRegistryName(NEUTRAL_MAGAZINE.get()), NeutralShot::new, NEUTRAL_BULLET); + handgun.registerMagazine(RegistryHelper.getRegistryName(EXORCISM_MAGAZINE.get()), ExorcismShot::new, EXORCISM_BULLET); + handgun.registerMagazine(RegistryHelper.getRegistryName(BLAZE_MAGAZINE.get()), BlazeShot::new, BLAZE_BULLET); + handgun.registerMagazine(RegistryHelper.getRegistryName(ENDER_MAGAZINE.get()), EnderShot::new, ENDER_BULLET); + handgun.registerMagazine(RegistryHelper.getRegistryName(CONCUSSIVE_MAGAZINE.get()), ConcussiveShot::new, CONCUSSIVE_BULLET); + handgun.registerMagazine(RegistryHelper.getRegistryName(BUSTER_MAGAZINE.get()), BusterShot::new, BUSTER_BULLET); + handgun.registerMagazine(RegistryHelper.getRegistryName(SEEKER_MAGAZINE.get()), SeekerShot::new, SEEKER_BULLET); + handgun.registerMagazine(RegistryHelper.getRegistryName(SAND_MAGAZINE.get()), SandShot::new, SAND_BULLET); + handgun.registerMagazine(RegistryHelper.getRegistryName(STORM_MAGAZINE.get()), StormShot::new, STORM_BULLET); } public static void registerListeners(IEventBus modBus) { ITEMS.register(modBus); MENU_TYPES.register(modBus); RECIPE_SERIALIZERS.register(modBus); + CONDITION_CODECS.register(modBus); LOOT_CONDITION_TYPES.register(modBus); LOOT_MODIFIERS.register(modBus); CREATIVE_MODE_TABS.register(modBus); - modBus.addListener(ModItems::registerRecipeSerializers); - modBus.addListener(ModItems::registerContainers); - MinecraftForge.EVENT_BUS.addListener(ModItems::onResourceReload); - } - - private abstract static class BehaviorDefaultProjectileDispense implements DispenseItemBehavior { - abstract ProjectileEntityFactory getProjectileEntityFactory(); + ATTACHMENT_TYPES.register(modBus); + ARMOR_MATERIALS.register(modBus); + modBus.addListener(ModItems::registerCapabilities); + NeoForge.EVENT_BUS.addListener(ModItems::onResourceReload); - @Override - public ItemStack dispense(BlockSource source, ItemStack stack) { - return (new AbstractProjectileDispenseBehavior() { - - @Override - protected Projectile getProjectile(Level world, Position position, ItemStack stack) { - return getProjectileEntityFactory().createProjectileEntity(world, position, stack); - } - - @Override - protected float getUncertainty() { - return super.getUncertainty() * 0.5F; - } - - @Override - protected float getPower() { - return super.getPower() * 1.25F; - } - }).dispense(source, stack); + if (FMLEnvironment.dist.isClient()) { + ModItemsClient.init(modBus); } } @@ -401,7 +265,19 @@ private static void onResourceReload(AddReloadListenerEvent event) { MobCharmRecipe.REGISTERED_RECIPES.clear(); } + private static void registerCapabilities(RegisterCapabilitiesEvent event) { + event.registerItem(Capabilities.FluidHandler.ITEM, (itemStack, context) -> new FluidHandlerHeroMedallion(itemStack), HERO_MEDALLION.get()); + event.registerItem(Capabilities.ItemHandler.ITEM, (itemStack, context) -> VOID_TEAR.get().createHandler(itemStack), VOID_TEAR.get()); + event.registerItem(Capabilities.ItemHandler.ITEM, (itemStack, context) -> HARVEST_ROD.get().createHandler(itemStack), HARVEST_ROD.get()); + event.registerItem(Capabilities.ItemHandler.ITEM, (itemStack, context) -> ENDER_STAFF.get().createHandler(itemStack), ENDER_STAFF.get()); + event.registerItem(Capabilities.ItemHandler.ITEM, (itemStack, context) -> RENDING_GALE.get().createHandler(itemStack), RENDING_GALE.get()); + event.registerItem(Capabilities.FluidHandler.ITEM, (itemStack, context) -> new FluidHandlerEmperorChalice(itemStack), EMPEROR_CHALICE.get()); + event.registerItem(Capabilities.FluidHandler.ITEM, (itemStack, context) -> new FluidHandlerHeroMedallion(itemStack), HERO_MEDALLION.get()); + event.registerItem(Capabilities.FluidHandler.ITEM, (itemStack, context) -> new FluidHandlerInfernalChalice(ModDataComponents.FLUID_CONTENTS, itemStack), INFERNAL_CHALICE.get()); + event.registerItem(HARVEST_ROD_CACHE_CAPABILITY, (itemStack, context) -> new HarvestRodCache(), HARVEST_ROD.get()); + } + private interface ProjectileEntityFactory { - Projectile createProjectileEntity(Level world, Position position, ItemStack stack); + Projectile createProjectileEntity(Level level, Position position, ItemStack stack); } } diff --git a/src/main/java/reliquary/init/ModItemsClient.java b/src/main/java/reliquary/init/ModItemsClient.java new file mode 100644 index 00000000..6d7e8596 --- /dev/null +++ b/src/main/java/reliquary/init/ModItemsClient.java @@ -0,0 +1,18 @@ +package reliquary.init; + +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent; +import reliquary.client.gui.AlkahestryTomeScreen; +import reliquary.client.gui.MobCharmBeltScreen; + +public class ModItemsClient { + + public static void init(IEventBus modBus) { + modBus.addListener(ModItemsClient::onMenuScreenRegister); + } + + private static void onMenuScreenRegister(RegisterMenuScreensEvent event) { + event.register(ModItems.ALKAHEST_TOME_MENU_TYPE.get(), AlkahestryTomeScreen::new); + event.register(ModItems.MOB_CHAR_BELT_MENU_TYPE.get(), MobCharmBeltScreen::new); + } +} diff --git a/src/main/java/reliquary/init/ModPayloads.java b/src/main/java/reliquary/init/ModPayloads.java new file mode 100644 index 00000000..55c50682 --- /dev/null +++ b/src/main/java/reliquary/init/ModPayloads.java @@ -0,0 +1,23 @@ +package reliquary.init; + +import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent; +import net.neoforged.neoforge.network.registration.PayloadRegistrar; +import reliquary.Reliquary; +import reliquary.network.*; + +public class ModPayloads { + private ModPayloads() { + } + + public static void registerPackets(final RegisterPayloadHandlersEvent event) { + final PayloadRegistrar registrar = event.registrar(Reliquary.MOD_ID).versioned("1.0"); + registrar.playToClient(SpawnThrownPotionImpactParticlesPayload.TYPE, SpawnThrownPotionImpactParticlesPayload.STREAM_CODEC, (payload1, context1) -> SpawnThrownPotionImpactParticlesPayload.handlePayload(payload1)); + registrar.playToClient(SpawnAngelheartVialParticlesPayload.TYPE, SpawnAngelheartVialParticlesPayload.STREAM_CODEC, (payload, context) -> SpawnAngelheartVialParticlesPayload.handlePayload(payload)); + registrar.playToClient(SpawnPhoenixDownParticlesPayload.TYPE, SpawnPhoenixDownParticlesPayload.STREAM_CODEC, (payload, context) -> SpawnPhoenixDownParticlesPayload.handlePayload(payload)); + registrar.playToServer(ScrolledItemPayload.TYPE, ScrolledItemPayload.STREAM_CODEC, ScrolledItemPayload::handlePayload); + registrar.playToClient(SpawnConcussiveExplosionParticlesPayload.TYPE, SpawnConcussiveExplosionParticlesPayload.STREAM_CODEC, SpawnConcussiveExplosionParticlesPayload::handlePayload); + registrar.playToClient(MobCharmDamagePayload.TYPE, MobCharmDamagePayload.STREAM_CODEC, (payload, context) -> MobCharmDamagePayload.handlePayload(payload)); + registrar.playToClient(PedestalFishHookPayload.TYPE, PedestalFishHookPayload.STREAM_CODEC, (payload, context) -> PedestalFishHookPayload.handlePayload(payload)); + registrar.playToServer(FortuneCoinTogglePressedPayload.TYPE, FortuneCoinTogglePressedPayload.STREAM_CODEC, FortuneCoinTogglePressedPayload::handlePayload); + } +} diff --git a/src/main/java/reliquary/init/ModPotions.java b/src/main/java/reliquary/init/ModPotions.java deleted file mode 100644 index a089c1f9..00000000 --- a/src/main/java/reliquary/init/ModPotions.java +++ /dev/null @@ -1,25 +0,0 @@ -package reliquary.init; - -import net.minecraft.world.effect.MobEffect; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import reliquary.potions.CurePotion; -import reliquary.potions.FlightPotion; -import reliquary.potions.PacificationPotion; -import reliquary.reference.Reference; - -public class ModPotions { - private ModPotions() {} - - private static final DeferredRegister MOB_EFFECTS = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, Reference.MOD_ID); - - public static RegistryObject FLIGHT_POTION = MOB_EFFECTS.register("flight", FlightPotion::new); - public static RegistryObject PACIFICATION_POTION = MOB_EFFECTS.register("pacification", PacificationPotion::new); - public static RegistryObject CURE_POTION = MOB_EFFECTS.register("cure", CurePotion::new); - - public static void registerListeners(IEventBus modBus) { - MOB_EFFECTS.register(modBus); - } -} diff --git a/src/main/java/reliquary/init/ModSounds.java b/src/main/java/reliquary/init/ModSounds.java index 6380030e..0b6b9d39 100644 --- a/src/main/java/reliquary/init/ModSounds.java +++ b/src/main/java/reliquary/init/ModSounds.java @@ -1,21 +1,22 @@ package reliquary.init; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.sounds.SoundEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; -import reliquary.reference.Reference; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredRegister; +import reliquary.Reliquary; + +import java.util.function.Supplier; public class ModSounds { - private ModSounds() {} + private ModSounds() { + } - private static final DeferredRegister SOUND_EVENTS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, Reference.MOD_ID); + private static final DeferredRegister SOUND_EVENTS = DeferredRegister.create(BuiltInRegistries.SOUND_EVENT, Reliquary.MOD_ID); - public static final RegistryObject BOOK = SOUND_EVENTS.register("book", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(Reference.MOD_ID, "book"))); - public static final RegistryObject HANDGUN_LOAD = SOUND_EVENTS.register("handgun_load", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(Reference.MOD_ID, "handgun_load"))); - public static final RegistryObject HANDGUN_SHOT = SOUND_EVENTS.register("handgun_shot", () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(Reference.MOD_ID, "handgun_shot"))); + public static final Supplier BOOK = SOUND_EVENTS.register("book", () -> SoundEvent.createVariableRangeEvent(Reliquary.getRL("book"))); + public static final Supplier HANDGUN_LOAD = SOUND_EVENTS.register("handgun_load", () -> SoundEvent.createVariableRangeEvent(Reliquary.getRL("handgun_load"))); + public static final Supplier HANDGUN_SHOT = SOUND_EVENTS.register("handgun_shot", () -> SoundEvent.createVariableRangeEvent(Reliquary.getRL("handgun_shot"))); public static void registerListeners(IEventBus modBus) { SOUND_EVENTS.register(modBus); diff --git a/src/main/java/reliquary/init/PedestalItems.java b/src/main/java/reliquary/init/PedestalItems.java index dda18959..79b900f7 100644 --- a/src/main/java/reliquary/init/PedestalItems.java +++ b/src/main/java/reliquary/init/PedestalItems.java @@ -8,14 +8,9 @@ import net.minecraft.world.level.block.RedStoneWireBlock; import reliquary.items.HarvestRodItem; import reliquary.items.RendingGaleItem; +import reliquary.items.RodOfLyssaItem; import reliquary.pedestal.PedestalRegistry; -import reliquary.pedestal.wrappers.PedestalBucketWrapper; -import reliquary.pedestal.wrappers.PedestalFishingRodWrapper; -import reliquary.pedestal.wrappers.PedestalHarvestRodWrapper; -import reliquary.pedestal.wrappers.PedestalMeleeWeaponWrapper; -import reliquary.pedestal.wrappers.PedestalRedstoneWrapper; -import reliquary.pedestal.wrappers.PedestalRendingGaleWrapper; -import reliquary.pedestal.wrappers.PedestalShearsWrapper; +import reliquary.pedestal.wrappers.*; public class PedestalItems { private PedestalItems() {} @@ -29,5 +24,6 @@ public static void init() { PedestalRegistry.registerItemBlockWrapper(RedStoneWireBlock.class, PedestalRedstoneWrapper.Toggleable::new); PedestalRegistry.registerItemBlockWrapper(PoweredBlock.class, PedestalRedstoneWrapper.AlwaysOn::new); PedestalRegistry.registerItemWrapper(FishingRodItem.class, PedestalFishingRodWrapper::new); + PedestalRegistry.registerItemWrapper(RodOfLyssaItem.class, PedestalFishingRodWrapper::new); } } diff --git a/src/main/java/reliquary/items/AlkahestryTomeItem.java b/src/main/java/reliquary/items/AlkahestryTomeItem.java index b4c5f31e..ca1d9f99 100644 --- a/src/main/java/reliquary/items/AlkahestryTomeItem.java +++ b/src/main/java/reliquary/items/AlkahestryTomeItem.java @@ -1,5 +1,8 @@ package reliquary.items; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -10,29 +13,19 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentCategory; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkHooks; +import org.jetbrains.annotations.Nullable; import reliquary.common.gui.AlkahestTomeMenu; import reliquary.crafting.AlkahestryChargingRecipe; import reliquary.crafting.AlkahestryRecipeRegistry; +import reliquary.init.ModDataComponents; import reliquary.init.ModSounds; -import reliquary.reference.Settings; -import reliquary.util.NBTHelper; +import reliquary.reference.Config; import reliquary.util.TooltipBuilder; -import javax.annotation.Nullable; - public class AlkahestryTomeItem extends ToggleableItem { public AlkahestryTomeItem() { - super(new Properties().setNoRepair().rarity(Rarity.EPIC).stacksTo(1), Settings.COMMON.disable.disableAlkahestry); - } - - @Override - public boolean canBeDepleted() { - return true; + super(new Properties().setNoRepair().rarity(Rarity.EPIC).stacksTo(1).durability(10).component(DataComponents.REPAIR_COST, Integer.MAX_VALUE), Config.COMMON.disable.disableAlkahestry); } @Override @@ -46,45 +39,45 @@ public int getDamage(ItemStack stack) { } @Override - public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { - return enchantment.category != EnchantmentCategory.BREAKABLE && super.canApplyAtEnchantingTable(stack, enchantment); - } - - @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); - ItemStack newStack = super.use(world, player, hand).getObject(); + ItemStack newStack = super.use(level, player, hand).getObject(); if (player.isShiftKeyDown()) { return new InteractionResultHolder<>(InteractionResult.SUCCESS, newStack); } player.playSound(ModSounds.BOOK.get(), 1.0f, 1.0f); - if (!world.isClientSide && player instanceof ServerPlayer serverPlayer) { - NetworkHooks.openScreen(serverPlayer, new SimpleMenuProvider((w, p, pl) -> new AlkahestTomeMenu(w), stack.getHoverName())); + if (!level.isClientSide && player instanceof ServerPlayer serverPlayer) { + serverPlayer.openMenu(new SimpleMenuProvider((w, p, pl) -> new AlkahestTomeMenu(w), stack.getHoverName())); } return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } @Override - public void inventoryTick(ItemStack tome, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || world.getGameTime() % 10 != 0 || !isEnabled(tome) || getCharge(tome) == getChargeLimit()) { - return; - } + public boolean isEnchantable(ItemStack stack) { + return false; + } - if (!(entity instanceof Player player)) { + @Override + public boolean supportsEnchantment(ItemStack stack, Holder enchantment) { + return false; + } + + @Override + public void inventoryTick(ItemStack tome, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 10 != 0 || !isEnabled(tome) || getCharge(tome) == getChargeLimit()) { return; } for (AlkahestryChargingRecipe recipe : AlkahestryRecipeRegistry.getChargingRecipes()) { consumeAndCharge(player, getChargeLimit() - getCharge(tome), recipe.getChargeToAdd(), - ist -> recipe.getChargingIngredient().test(ist), 16, chargeToAdd -> addCharge(tome, chargeToAdd)); + stack -> recipe.getChargingIngredient().test(stack), 16, chargeToAdd -> addCharge(tome, chargeToAdd)); } } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack tome, @Nullable Level level, TooltipBuilder tooltipBuilder) { - if (level == null) { + protected void addMoreInformation(ItemStack tome, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { + if (registries == null) { return; } @@ -92,7 +85,7 @@ protected void addMoreInformation(ItemStack tome, @Nullable Level level, Tooltip tooltipBuilder.description(this, ".tooltip3"); if (isEnabled(tome)) { - tooltipBuilder.absorbActive(AlkahestryRecipeRegistry.getDrainRecipe().map(r -> r.getResultItem(level.registryAccess()).getHoverName().getString()).orElse("")); + tooltipBuilder.absorbActive(AlkahestryRecipeRegistry.getDrainRecipe().map(r -> r.getResultItem(registries).getHoverName().getString()).orElse("")); } else { tooltipBuilder.absorb(); } @@ -104,16 +97,16 @@ protected boolean hasMoreInformation(ItemStack stack) { } public static int getChargeLimit() { - return Settings.COMMON.items.alkahestryTome.chargeLimit.get(); + return Config.getOrDefault(Config.COMMON.items.alkahestryTome.chargeLimit, Config.COMMON_SPEC); } public static ItemStack setCharge(ItemStack tome, int charge) { - NBTHelper.putInt("charge", tome, charge); + tome.set(ModDataComponents.CHARGE, charge); return tome; } public static int getCharge(ItemStack tome) { - return NBTHelper.getInt("charge", tome); + return tome.getOrDefault(ModDataComponents.CHARGE, 0); } public static void addCharge(ItemStack tome, int chageToAdd) { diff --git a/src/main/java/reliquary/items/AngelheartVialItem.java b/src/main/java/reliquary/items/AngelheartVialItem.java index 01fc9fa1..c8ad6f2e 100644 --- a/src/main/java/reliquary/items/AngelheartVialItem.java +++ b/src/main/java/reliquary/items/AngelheartVialItem.java @@ -1,20 +1,17 @@ package reliquary.items; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.network.PacketDistributor; import reliquary.handler.CommonEventHandler; import reliquary.handler.HandlerPriority; import reliquary.handler.IPlayerDeathHandler; import reliquary.init.ModItems; -import reliquary.network.PacketHandler; -import reliquary.network.SpawnAngelheartVialParticlesPacket; -import reliquary.reference.Settings; +import reliquary.network.SpawnAngelheartVialParticlesPayload; +import reliquary.reference.Config; import reliquary.util.EntityHelper; import reliquary.util.InventoryHelper; @@ -28,24 +25,25 @@ public boolean canApply(Player player, LivingDeathEvent event) { return InventoryHelper.playerHasItem(player, ModItems.ANGELHEART_VIAL.get()); } - @SuppressWarnings({"java:S2440", "InstantiationOfUtilityClass"}) //instantiating the packet for its type to be used as identifier for the packet + @SuppressWarnings({"java:S2440"}) + //instantiating the packet for its type to be used as identifier for the packet @Override public boolean apply(Player player, LivingDeathEvent event) { decreaseAngelHeartByOne(player); // player should see a vial "shatter" effect and hear the glass break to // let them know they lost a vial. - PacketHandler.sendToClient((ServerPlayer) player, new SpawnAngelheartVialParticlesPacket()); + PacketDistributor.sendToPlayersTrackingEntityAndSelf(player, new SpawnAngelheartVialParticlesPayload(player.position())); // play some glass breaking effects at the player location player.level().playSound(null, player.blockPosition(), SoundEvents.GLASS_BREAK, SoundSource.NEUTRAL, 1.0F, player.level().random.nextFloat() * 0.1F + 0.9F); // gives the player a few hearts, sparing them from death. - float amountHealed = player.getMaxHealth() * (float) Settings.COMMON.items.angelHeartVial.healPercentageOfMaxLife.get() / 100F; + float amountHealed = player.getMaxHealth() * (float) Config.COMMON.items.angelHeartVial.healPercentageOfMaxLife.get() / 100F; player.setHealth(amountHealed); // if the player had any negative status effects [vanilla only for now], remove them: - if (Boolean.TRUE.equals(Settings.COMMON.items.angelHeartVial.removeNegativeStatus.get())) { + if (Boolean.TRUE.equals(Config.COMMON.items.angelHeartVial.removeNegativeStatus.get())) { EntityHelper.removeNegativeStatusEffects(player); } @@ -60,7 +58,6 @@ public HandlerPriority getPriority() { } @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return true; } diff --git a/src/main/java/reliquary/items/AngelicFeatherItem.java b/src/main/java/reliquary/items/AngelicFeatherItem.java index ec9b5ec2..fee231bb 100644 --- a/src/main/java/reliquary/items/AngelicFeatherItem.java +++ b/src/main/java/reliquary/items/AngelicFeatherItem.java @@ -7,12 +7,12 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; import net.minecraft.world.level.Level; -import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; import reliquary.handler.CommonEventHandler; import reliquary.handler.HandlerPriority; import reliquary.handler.IPlayerHurtHandler; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; public class AngelicFeatherItem extends ItemBase { @@ -20,7 +20,7 @@ public AngelicFeatherItem() { super(new Properties().stacksTo(1).setNoRepair().rarity(Rarity.EPIC)); CommonEventHandler.registerPlayerHurtHandler(new IPlayerHurtHandler() { @Override - public boolean canApply(Player player, LivingAttackEvent event) { + public boolean canApply(Player player, LivingIncomingDamageEvent event) { return event.getSource() == player.damageSources().fall() && player.getFoodData().getFoodLevel() > 0 && InventoryHelper.playerHasItem(player, ModItems.ANGELIC_FEATHER.get()) @@ -28,8 +28,8 @@ public boolean canApply(Player player, LivingAttackEvent event) { } @Override - public boolean apply(Player player, LivingAttackEvent event) { - float hungerDamage = event.getAmount() * ((float) Settings.COMMON.items.angelicFeather.hungerCostPercent.get() / 100F); + public boolean apply(Player player, LivingIncomingDamageEvent event) { + float hungerDamage = event.getAmount() * ((float) Config.COMMON.items.angelicFeather.hungerCostPercent.get() / 100F); player.causeFoodExhaustion(hungerDamage); return true; } @@ -43,8 +43,8 @@ public HandlerPriority getPriority() { // minor jump buff @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { - int potency = this instanceof PhoenixDownItem ? Settings.COMMON.items.phoenixDown.leapingPotency.get() : Settings.COMMON.items.angelicFeather.leapingPotency.get(); + public void inventoryTick(ItemStack stack, Level level, Entity entity, int itemSlot, boolean isSelected) { + int potency = this instanceof PhoenixDownItem ? Config.COMMON.items.phoenixDown.leapingPotency.get() : Config.COMMON.items.angelicFeather.leapingPotency.get(); if (potency == 0) { return; } diff --git a/src/main/java/reliquary/items/AphroditePotionItem.java b/src/main/java/reliquary/items/AphroditePotionItem.java index 5f9ba0c9..92e4487a 100644 --- a/src/main/java/reliquary/items/AphroditePotionItem.java +++ b/src/main/java/reliquary/items/AphroditePotionItem.java @@ -1,21 +1,25 @@ package reliquary.items; +import net.minecraft.core.Direction; +import net.minecraft.core.Position; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; 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.ProjectileItem; import net.minecraft.world.level.Level; -import reliquary.entities.potion.AphroditePotionEntity; +import reliquary.entities.potion.AphroditePotion; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; -public class AphroditePotionItem extends ItemBase { +public class AphroditePotionItem extends ItemBase implements ProjectileItem { public AphroditePotionItem() { - super(new Properties(), Settings.COMMON.disable.disablePotions); + super(new Properties(), Config.COMMON.disable.disablePotions); } @Override @@ -29,18 +33,23 @@ public ItemStack getCraftingRemainingItem(ItemStack stack) { } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); - if (world.isClientSide) { + if (level.isClientSide) { return new InteractionResultHolder<>(InteractionResult.PASS, stack); } if (!player.isCreative()) { stack.shrink(1); } - world.playSound(null, player.blockPosition(), SoundEvents.DISPENSER_LAUNCH, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); - AphroditePotionEntity aphroditePotion = new AphroditePotionEntity(world, player); + level.playSound(null, player.blockPosition(), SoundEvents.DISPENSER_LAUNCH, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); + AphroditePotion aphroditePotion = new AphroditePotion(level, player); aphroditePotion.shootFromRotation(player, player.getXRot(), player.getYRot(), -20.0F, 0.7F, 1.0F); - world.addFreshEntity(aphroditePotion); + level.addFreshEntity(aphroditePotion); return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } + + @Override + public Projectile asProjectile(Level level, Position position, ItemStack itemStack, Direction direction) { + return new AphroditePotion(level, position); + } } diff --git a/src/main/java/reliquary/items/BulletItem.java b/src/main/java/reliquary/items/BulletItem.java index 60bbd02c..9863eeea 100644 --- a/src/main/java/reliquary/items/BulletItem.java +++ b/src/main/java/reliquary/items/BulletItem.java @@ -1,20 +1,17 @@ package reliquary.items; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.world.item.alchemy.PotionContents; import reliquary.items.util.IPotionItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.TooltipBuilder; import reliquary.util.potions.PotionEssence; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionMap; -import reliquary.util.potions.XRPotionHelper; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; @@ -31,9 +28,8 @@ public BulletItem(boolean hasTooltip, boolean addPotionBulletsInItemGroup, int c } @Override - @OnlyIn(Dist.CLIENT) - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - TooltipBuilder tooltipBuilder = TooltipBuilder.of(tooltip); + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flag) { + TooltipBuilder tooltipBuilder = TooltipBuilder.of(tooltip, context); if (hasTooltip) { tooltipBuilder.itemTooltip(this); } @@ -42,27 +38,27 @@ public void appendHoverText(ItemStack stack, @Nullable Level world, List itemConsumer) { - if (Boolean.TRUE.equals(Settings.COMMON.disable.disableHandgun.get())) { + if (Boolean.TRUE.equals(Config.COMMON.disable.disableHandgun.get())) { return; } itemConsumer.accept(new ItemStack(this)); - if (!addPotionBulletsInItemGroup || Boolean.TRUE.equals(Settings.COMMON.disable.disablePotions.get())) { + if (!addPotionBulletsInItemGroup || Boolean.TRUE.equals(Config.COMMON.disable.disablePotions.get())) { return; } for (PotionEssence essence : PotionMap.uniquePotionEssences) { ItemStack bullet = new ItemStack(this); - XRPotionHelper.addPotionEffectsToStack(bullet, XRPotionHelper.changePotionEffectsDuration(essence.getEffects(), 0.2F)); + PotionHelper.addPotionContentsToStack(bullet, PotionHelper.changePotionEffectsDuration(essence.getPotionContents(), 0.2F)); itemConsumer.accept(bullet); } } @Override - public List getEffects(ItemStack stack) { - return XRPotionHelper.getPotionEffectsFromStack(stack); + public PotionContents getPotionContents(ItemStack stack) { + return stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); } public int getColor() { diff --git a/src/main/java/reliquary/items/DestructionCatalystItem.java b/src/main/java/reliquary/items/DestructionCatalystItem.java index aacab0f0..19e5ae8f 100644 --- a/src/main/java/reliquary/items/DestructionCatalystItem.java +++ b/src/main/java/reliquary/items/DestructionCatalystItem.java @@ -2,7 +2,9 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionResult; @@ -13,11 +15,8 @@ import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.registries.ForgeRegistries; -import reliquary.reference.Settings; -import reliquary.util.NBTHelper; +import reliquary.init.ModDataComponents; +import reliquary.reference.Config; import reliquary.util.RandHelper; import reliquary.util.TooltipBuilder; @@ -25,16 +24,13 @@ public class DestructionCatalystItem extends ToggleableItem { - private static final String GUNPOWDER_TAG = "gunpowder"; - public DestructionCatalystItem() { super(new Properties().stacksTo(1).setNoRepair()); } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack catalyst, @Nullable Level world, TooltipBuilder tooltipBuilder) { - tooltipBuilder.charge(this, ".tooltip2", NBTHelper.getInt(GUNPOWDER_TAG, catalyst)); + protected void addMoreInformation(ItemStack catalyst, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { + tooltipBuilder.charge(this, ".tooltip2", getGunpowder(catalyst)); if (isEnabled(catalyst)) { tooltipBuilder.absorbActive(Items.GUNPOWDER.getName(new ItemStack(Items.GUNPOWDER)).getString()); @@ -56,9 +52,9 @@ public InteractionResult useOn(UseOnContext itemUseContext) { } ItemStack stack = itemUseContext.getItemInHand(); - if (NBTHelper.getInt(GUNPOWDER_TAG, stack) > gunpowderCost() || (player != null && player.isCreative())) { + if (getGunpowder(stack) >= gunpowderCost() || (player != null && player.isCreative())) { if (doExplosion(itemUseContext.getLevel(), itemUseContext.getClickedPos(), itemUseContext.getClickedFace()) && player != null && !player.isCreative()) { - NBTHelper.putInt(GUNPOWDER_TAG, stack, NBTHelper.getInt(GUNPOWDER_TAG, stack) - gunpowderCost()); + setGunpowder(stack, getGunpowder(stack) - gunpowderCost()); } return InteractionResult.SUCCESS; } @@ -66,34 +62,39 @@ public InteractionResult useOn(UseOnContext itemUseContext) { } @Override - public void inventoryTick(ItemStack catalyst, Level world, Entity e, int itemSlot, boolean isSelected) { - if (world.isClientSide || world.getGameTime() % 10 != 0) { - return; - } - if (!(e instanceof Player player)) { + public void inventoryTick(ItemStack catalyst, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 10 != 0) { return; } if (isEnabled(catalyst)) { - int gunpowderCharge = NBTHelper.getInt(GUNPOWDER_TAG, catalyst); + int gunpowderCharge = getGunpowder(catalyst); consumeAndCharge(player, gunpowderLimit() - gunpowderCharge, gunpowderWorth(), Items.GUNPOWDER, 16, - chargeToAdd -> NBTHelper.putInt(GUNPOWDER_TAG, catalyst, gunpowderCharge + chargeToAdd)); + chargeToAdd -> setGunpowder(catalyst, gunpowderCharge + chargeToAdd)); } } + public static int getGunpowder(ItemStack catalyst) { + return catalyst.getOrDefault(ModDataComponents.GUNPOWDER, 0); + } + + private void setGunpowder(ItemStack catalyst, int gunpowder) { + catalyst.set(ModDataComponents.GUNPOWDER, gunpowder); + } + private int getExplosionRadius() { - return Settings.COMMON.items.destructionCatalyst.explosionRadius.get(); + return Config.COMMON.items.destructionCatalyst.explosionRadius.get(); } private boolean perfectCube() { - return Settings.COMMON.items.destructionCatalyst.perfectCube.get(); + return Config.COMMON.items.destructionCatalyst.perfectCube.get(); } - private boolean doExplosion(Level world, BlockPos pos, Direction direction) { + private boolean doExplosion(Level level, BlockPos pos, Direction direction) { boolean destroyedSomething = false; boolean playOnce = true; BlockPos origin = pos; - if (Boolean.FALSE.equals(Settings.COMMON.items.destructionCatalyst.centeredExplosion.get())) { + if (Boolean.FALSE.equals(Config.COMMON.items.destructionCatalyst.centeredExplosion.get())) { origin = pos.relative(direction.getOpposite(), getExplosionRadius()); } for (BlockPos target : BlockPos.betweenClosed(origin.offset(-getExplosionRadius(), -getExplosionRadius(), -getExplosionRadius()), @@ -106,14 +107,14 @@ private boolean doExplosion(Level world, BlockPos pos, Direction direction) { } //noinspection ConstantConditions - if (isBreakable(ForgeRegistries.BLOCKS.getKey(world.getBlockState(target).getBlock()).toString())) { - world.setBlockAndUpdate(target, Blocks.AIR.defaultBlockState()); - if (world.random.nextInt(2) == 0) { - world.addParticle(ParticleTypes.EXPLOSION, target.getX() + (world.random.nextFloat() - 0.5F), target.getY() + (world.random.nextFloat() - 0.5F), target.getZ() + (world.random.nextFloat() - 0.5F), 0.0D, 0.0D, 0.0D); + if (isBreakable(BuiltInRegistries.BLOCK.getKey(level.getBlockState(target).getBlock()).toString())) { + level.setBlockAndUpdate(target, Blocks.AIR.defaultBlockState()); + if (level.random.nextInt(2) == 0) { + level.addParticle(ParticleTypes.EXPLOSION, target.getX() + (level.random.nextFloat() - 0.5F), target.getY() + (level.random.nextFloat() - 0.5F), target.getZ() + (level.random.nextFloat() - 0.5F), 0.0D, 0.0D, 0.0D); } destroyedSomething = true; if (playOnce) { - world.playSound(null, target, SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS, 4.0F, (1.0F + RandHelper.getRandomMinusOneToOne(world.random) * 0.2F) * 0.7F); + level.playSound(null, target, SoundEvents.GENERIC_EXPLODE.value(), SoundSource.BLOCKS, 4.0F, (1.0F + RandHelper.getRandomMinusOneToOne(level.random) * 0.2F) * 0.7F); playOnce = false; } } @@ -122,18 +123,18 @@ private boolean doExplosion(Level world, BlockPos pos, Direction direction) { } private boolean isBreakable(String id) { - return Settings.COMMON.items.destructionCatalyst.mundaneBlocks.get().contains(id); + return Config.COMMON.items.destructionCatalyst.mundaneBlocks.get().contains(id); } private int gunpowderCost() { - return Settings.COMMON.items.destructionCatalyst.gunpowderCost.get(); + return Config.COMMON.items.destructionCatalyst.gunpowderCost.get(); } private int gunpowderWorth() { - return Settings.COMMON.items.destructionCatalyst.gunpowderWorth.get(); + return Config.COMMON.items.destructionCatalyst.gunpowderWorth.get(); } private int gunpowderLimit() { - return Settings.COMMON.items.destructionCatalyst.gunpowderLimit.get(); + return Config.COMMON.items.destructionCatalyst.gunpowderLimit.get(); } } diff --git a/src/main/java/reliquary/items/ElsewhereFlaskItem.java b/src/main/java/reliquary/items/ElsewhereFlaskItem.java index 4ed91fbd..05e6f77b 100644 --- a/src/main/java/reliquary/items/ElsewhereFlaskItem.java +++ b/src/main/java/reliquary/items/ElsewhereFlaskItem.java @@ -4,8 +4,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.neoforged.fml.relauncher.Side; +import net.neoforged.fml.relauncher.SideOnly; import reliquary.Reliquary; import reliquary.reference.Names; @@ -71,7 +71,6 @@ public void formatPotionList(ImmutableMap toFormat, ItemStack st @Override - @OnlyIn(Dist.CLIENT) public EnumRarity getRarity(ItemStack stack) { return EnumRarity.EPIC; } diff --git a/src/main/java/reliquary/items/EmperorChaliceItem.java b/src/main/java/reliquary/items/EmperorChaliceItem.java index 749aa5ab..f405cbfc 100644 --- a/src/main/java/reliquary/items/EmperorChaliceItem.java +++ b/src/main/java/reliquary/items/EmperorChaliceItem.java @@ -1,6 +1,6 @@ package reliquary.items; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.HolderLookup; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; @@ -17,19 +17,15 @@ import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidType; -import net.minecraftforge.fluids.FluidUtil; -import net.minecraftforge.fluids.capability.IFluidHandlerItem; -import reliquary.items.util.fluid.FluidHandlerEmperorChalice; -import reliquary.reference.Settings; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.common.util.TriState; +import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidType; +import net.neoforged.neoforge.fluids.FluidUtil; +import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; +import reliquary.reference.Config; import reliquary.util.TooltipBuilder; import javax.annotation.Nullable; @@ -38,12 +34,11 @@ public class EmperorChaliceItem extends ToggleableItem { public EmperorChaliceItem() { super(new Properties().stacksTo(1).setNoRepair().rarity(Rarity.EPIC)); - MinecraftForge.EVENT_BUS.addListener(this::onBlockRightClick); + NeoForge.EVENT_BUS.addListener(this::onBlockRightClick); } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack stack, @Nullable Level world, TooltipBuilder tooltipBuilder) { + protected void addMoreInformation(ItemStack stack, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { tooltipBuilder.description(this, ".tooltip2"); } @@ -53,44 +48,39 @@ protected boolean hasMoreInformation(ItemStack stack) { } @Override - public int getUseDuration(ItemStack stack) { + public int getUseDuration(ItemStack stack, LivingEntity livingEntity) { return 16; } - @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - return new FluidHandlerEmperorChalice(stack); - } - @Override public UseAnim getUseAnimation(ItemStack stack) { return UseAnim.DRINK; } @Override - public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity entityLiving) { - if (world.isClientSide) { + public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livingEntity) { + if (level.isClientSide) { return stack; } - if (!(entityLiving instanceof Player player)) { + if (!(livingEntity instanceof Player player)) { return stack; } - int multiplier = Settings.COMMON.items.emperorChalice.hungerSatiationMultiplier.get(); + int multiplier = Config.COMMON.items.emperorChalice.hungerSatiationMultiplier.get(); player.getFoodData().eat(1, (float) multiplier / 2); player.hurt(player.damageSources().drown(), multiplier); return stack; } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack emperorChalice = player.getItemInHand(hand); if (player.isShiftKeyDown()) { - return super.use(world, player, hand); + return super.use(level, player, hand); } boolean isInDrainMode = isEnabled(emperorChalice); - BlockHitResult result = getPlayerPOVHitResult(world, player, isInDrainMode ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE); + BlockHitResult result = getPlayerPOVHitResult(level, player, isInDrainMode ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE); //noinspection ConstantConditions if (result == null || result.getType() == HitResult.Type.MISS) { @@ -99,55 +89,58 @@ public InteractionResultHolder use(Level world, Player player, Intera } return new InteractionResultHolder<>(InteractionResult.SUCCESS, emperorChalice); } else if (result.getType() == HitResult.Type.BLOCK) { - if (!world.mayInteract(player, result.getBlockPos()) || !player.mayUseItemAt(result.getBlockPos(), result.getDirection(), emperorChalice)) { + if (!level.mayInteract(player, result.getBlockPos()) || !player.mayUseItemAt(result.getBlockPos(), result.getDirection(), emperorChalice)) { return new InteractionResultHolder<>(InteractionResult.FAIL, emperorChalice); } - if (emperorChalice.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM).map(fluidHandler -> { + IFluidHandlerItem fluidHandler = emperorChalice.getCapability(Capabilities.FluidHandler.ITEM); + if (fluidHandler != null) { + boolean success; if (!isEnabled(emperorChalice)) { - return placeWater(world, player, hand, fluidHandler, result); + success = placeWater(level, player, hand, fluidHandler, result); } else { - return FluidUtil.tryPickUpFluid(emperorChalice, player, world, result.getBlockPos(), result.getDirection()).isSuccess(); + success = FluidUtil.tryPickUpFluid(emperorChalice, player, level, result.getBlockPos(), result.getDirection()).isSuccess(); + } + if (success) { + return new InteractionResultHolder<>(InteractionResult.SUCCESS, emperorChalice); } - }).orElse(false)) { - return new InteractionResultHolder<>(InteractionResult.SUCCESS, emperorChalice); } } return new InteractionResultHolder<>(InteractionResult.PASS, emperorChalice); } - private boolean placeWater(Level world, Player player, InteractionHand hand, IFluidHandlerItem fluidHandler, BlockHitResult result) { - if (FluidUtil.tryPlaceFluid(player, world, hand, result.getBlockPos(), fluidHandler, new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME))) { + private boolean placeWater(Level level, Player player, InteractionHand hand, IFluidHandlerItem fluidHandler, BlockHitResult result) { + if (FluidUtil.tryPlaceFluid(player, level, hand, result.getBlockPos(), fluidHandler, new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME))) { return true; } - return FluidUtil.tryPlaceFluid(player, world, hand, result.getBlockPos().relative(result.getDirection()), fluidHandler, new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME)); + return FluidUtil.tryPlaceFluid(player, level, hand, result.getBlockPos().relative(result.getDirection()), fluidHandler, new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME)); } private void onBlockRightClick(PlayerInteractEvent.RightClickBlock evt) { if (evt.getItemStack().getItem() == this) { - Level world = evt.getLevel(); - BlockState state = world.getBlockState(evt.getPos()); + Level level = evt.getLevel(); + BlockState state = level.getBlockState(evt.getPos()); if (!isEnabled(evt.getItemStack()) && state.getBlock() == Blocks.CAULDRON) { - fillCauldron(evt, world); + fillCauldron(evt, level); } else if (isEnabled(evt.getItemStack()) && state.getBlock() == Blocks.WATER_CAULDRON && ((LayeredCauldronBlock) state.getBlock()).isFull(state)) { - emptyCauldron(evt, world); + emptyCauldron(evt, level); } } } - private void emptyCauldron(PlayerInteractEvent.RightClickBlock evt, Level world) { - world.setBlockAndUpdate(evt.getPos(), Blocks.CAULDRON.defaultBlockState()); + private void emptyCauldron(PlayerInteractEvent.RightClickBlock evt, Level level) { + level.setBlockAndUpdate(evt.getPos(), Blocks.CAULDRON.defaultBlockState()); cancelEvent(evt); } - private void fillCauldron(PlayerInteractEvent.RightClickBlock evt, Level world) { - world.setBlockAndUpdate(evt.getPos(), Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3)); + private void fillCauldron(PlayerInteractEvent.RightClickBlock evt, Level level) { + level.setBlockAndUpdate(evt.getPos(), Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3)); cancelEvent(evt); } private void cancelEvent(PlayerInteractEvent.RightClickBlock evt) { - evt.setUseItem(Event.Result.DENY); + evt.setUseItem(TriState.FALSE); evt.setCanceled(true); evt.setCancellationResult(InteractionResult.SUCCESS); } diff --git a/src/main/java/reliquary/items/EnderStaffItem.java b/src/main/java/reliquary/items/EnderStaffItem.java index e7a80c50..4236f840 100644 --- a/src/main/java/reliquary/items/EnderStaffItem.java +++ b/src/main/java/reliquary/items/EnderStaffItem.java @@ -1,11 +1,17 @@ package reliquary.items; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; -import net.minecraft.ChatFormatting; +import com.mojang.serialization.Codec; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.StringRepresentable; @@ -21,61 +27,50 @@ import net.minecraft.world.item.UseAnim; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import reliquary.entities.EnderStaffProjectileEntity; +import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.phys.Vec3; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; +import reliquary.entities.EnderStaffProjectile; import reliquary.init.ModBlocks; -import reliquary.items.util.FilteredItemHandlerProvider; -import reliquary.items.util.FilteredItemStack; -import reliquary.items.util.FilteredItemStackHandler; +import reliquary.init.ModDataComponents; import reliquary.items.util.IScrollableItem; -import reliquary.reference.Settings; -import reliquary.util.NBTHelper; +import reliquary.reference.Config; import reliquary.util.TooltipBuilder; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.Map; public class EnderStaffItem extends ToggleableItem implements IScrollableItem { - - private static final String DIMENSION_TAG = "dimensionID"; - private static final String NODE_X_TAG = "nodeX"; - private static final String NODE_Y_TAG = "nodeY"; - private static final String NODE_Z_TAG = "nodeZ"; - public EnderStaffItem() { super(new Properties().stacksTo(1).setNoRepair().rarity(Rarity.EPIC)); } private int getEnderStaffPearlCost() { - return Settings.COMMON.items.enderStaff.enderPearlCastCost.get(); + return Config.COMMON.items.enderStaff.enderPearlCastCost.get(); } private int getEnderStaffNodeWarpCost() { - return Settings.COMMON.items.enderStaff.enderPearlNodeWarpCost.get(); + return Config.COMMON.items.enderStaff.enderPearlNodeWarpCost.get(); } private int getEnderPearlWorth() { - return Settings.COMMON.items.enderStaff.enderPearlWorth.get(); + return Config.COMMON.items.enderStaff.enderPearlWorth.get(); } private int getEnderPearlLimit() { - return Settings.COMMON.items.enderStaff.enderPearlLimit.get(); + return Config.COMMON.items.enderStaff.enderPearlLimit.get(); } private int getNodeWarpCastTime() { - return Settings.COMMON.items.enderStaff.nodeWarpCastTime.get(); + return Config.COMMON.items.enderStaff.nodeWarpCastTime.get(); } public Mode getMode(ItemStack stack) { - return NBTHelper.getEnumConstant(stack, "mode", Mode::fromName).orElse(Mode.CAST); + return stack.getOrDefault(ModDataComponents.ENDER_STAFF_MODE, Mode.CAST); } private void setMode(ItemStack stack, Mode mode) { - NBTHelper.putString("mode", stack, mode.getSerializedName()); + stack.set(ModDataComponents.ENDER_STAFF_MODE, mode); } private void cycleMode(ItemStack stack, boolean next) { @@ -96,20 +91,8 @@ public InteractionResult onMouseScrolled(ItemStack stack, Player player, double } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - ArrayList filteredStacks = new ArrayList<>(); - filteredStacks.add(new FilteredItemStack(Items.ENDER_PEARL, Settings.COMMON.items.enderStaff.enderPearlLimit.get(), - Settings.COMMON.items.enderStaff.enderPearlWorth.get(), false)); - return new FilteredItemHandlerProvider(filteredStacks); - } - - @Override - public void inventoryTick(ItemStack staff, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || world.getGameTime() % 10 != 0) { - return; - } - - if (!(entity instanceof Player player)) { + public void inventoryTick(ItemStack staff, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 10 != 0) { return; } @@ -118,34 +101,26 @@ public void inventoryTick(ItemStack staff, Level world, Entity entity, int itemS } int pearlCharge = getPearlCount(staff); - consumeAndCharge(player, getEnderPearlLimit() - pearlCharge, getEnderPearlWorth(), Items.ENDER_PEARL, 16, + consumeAndCharge(player, getEnderPearlLimit() - pearlCharge, getEnderPearlWorth(), stack -> stack.is(Tags.Items.ENDER_PEARLS), 16, chargeToAdd -> setPearlCount(staff, pearlCharge + chargeToAdd)); } - private void setPearlCount(ItemStack stack, int count) { - stack.getCapability(ForgeCapabilities.ITEM_HANDLER, null).ifPresent(itemHandler -> { - if (!(itemHandler instanceof FilteredItemStackHandler filteredHandler)) { - return; - } - filteredHandler.setTotalCount(0, count); - }); + @Override + protected boolean isItemValidForContainerSlot(int slot, ItemStack stack) { + return stack.isEmpty() || stack.is(Tags.Items.ENDER_PEARLS); } - private int getPearlCount(ItemStack staff) { - return getPearlCount(staff, false); + @Override + protected int getContainerSlotLimit(int slot) { + return getEnderPearlLimit(); } - public int getPearlCount(ItemStack staff, boolean isClient) { - if (isClient) { - return NBTHelper.getInt("count", staff); - } + private void setPearlCount(ItemStack stack, int count) { + runOnHandler(stack, handler -> handler.setStackInSlot(0, new ItemStack(Items.ENDER_PEARL, count))); + } - return staff.getCapability(ForgeCapabilities.ITEM_HANDLER, null).map(itemHandler -> { - if (!(itemHandler instanceof FilteredItemStackHandler filteredHandler)) { - return 0; - } - return filteredHandler.getTotalAmount(0); - }).orElse(0); + public int getPearlCount(ItemStack staff) { + return getFromHandler(staff, handler -> handler.getCountInSlot(0)); } @Override @@ -168,13 +143,13 @@ public UseAnim getUseAnimation(ItemStack stack) { } @Override - public int getUseDuration(ItemStack stack) { + public int getUseDuration(ItemStack stack, LivingEntity livingEntity) { return getMode(stack) == Mode.NODE_WARP ? getNodeWarpCastTime() : 0; } @Override - public void releaseUsing(ItemStack stack, Level worldIn, LivingEntity entityLiving, int timeLeft) { - if (!(entityLiving instanceof Player player)) { + public void releaseUsing(ItemStack stack, Level level, LivingEntity livingEntity, int timeLeft) { + if (!(livingEntity instanceof Player player)) { return; } @@ -184,26 +159,26 @@ public void releaseUsing(ItemStack stack, Level worldIn, LivingEntity entityLivi } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (!player.isShiftKeyDown()) { if (getMode(stack) == Mode.CAST || getMode(stack) == Mode.LONG_CAST) { if (getPearlCount(stack) < getEnderStaffPearlCost() && !player.isCreative()) { return new InteractionResultHolder<>(InteractionResult.FAIL, stack); } - shootEnderStaffProjectile(world, player, hand, stack); + shootEnderStaffProjectile(level, player, hand, stack); } else { player.startUsingItem(hand); } } - return super.use(world, player, hand); + return super.use(level, player, hand); } - private void shootEnderStaffProjectile(Level world, Player player, InteractionHand hand, ItemStack stack) { + private void shootEnderStaffProjectile(Level level, Player player, InteractionHand hand, ItemStack stack) { player.swing(hand); - player.level().playSound(null, player.blockPosition(), SoundEvents.ENDER_PEARL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); + player.level().playSound(null, player.blockPosition(), SoundEvents.ENDER_PEARL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); if (!player.level().isClientSide) { - EnderStaffProjectileEntity enderStaffProjectile = new EnderStaffProjectileEntity(player.level(), player, getMode(stack) != Mode.LONG_CAST); + EnderStaffProjectile enderStaffProjectile = new EnderStaffProjectile(player.level(), player, getMode(stack) != Mode.LONG_CAST); enderStaffProjectile.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F); player.level().addFreshEntity(enderStaffProjectile); if (!player.isCreative()) { @@ -212,66 +187,62 @@ private void shootEnderStaffProjectile(Level world, Player player, InteractionHa } } - private void doWraithNodeWarpCheck(ItemStack stack, Level world, Player player) { - CompoundTag tag = stack.getTag(); - if (tag == null || (getPearlCount(stack) < getEnderStaffNodeWarpCost() && !player.isCreative())) { + private void doWraithNodeWarpCheck(ItemStack stack, Level level, Player player) { + if (!stack.has(ModDataComponents.WARP_DIMENSION) || !stack.has(ModDataComponents.WARP_POSITION) || (getPearlCount(stack) < getEnderStaffNodeWarpCost() && !player.isCreative())) { return; } - if (!tag.getString(DIMENSION_TAG).equals(getDimension(world))) { - if (!world.isClientSide) { - player.sendSystemMessage(Component.literal(ChatFormatting.DARK_RED + "Out of range!")); + ResourceLocation wraithNodeDimension = Preconditions.checkNotNull(stack.get(ModDataComponents.WARP_DIMENSION)); + BlockPos wraithNodePos = Preconditions.checkNotNull(stack.get(ModDataComponents.WARP_POSITION)); + if (!player.level().dimension().location().equals(wraithNodeDimension) && player.level() instanceof ServerLevel serverLevel) { + ServerLevel destination = serverLevel.getServer().getLevel(ResourceKey.create(Registries.DIMENSION, wraithNodeDimension)); + if (destination != null && canTeleport(destination, wraithNodePos)) { + teleportToDimension(player, destination, wraithNodePos); + if (!player.isCreative() && !player.level().isClientSide) { + setPearlCount(stack, getPearlCount(stack) - getEnderStaffNodeWarpCost()); + } } - return; - } - - BlockPos wraithNodePos = new BlockPos(tag.getInt(NODE_X_TAG + getDimension(world)), tag.getInt(NODE_Y_TAG + getDimension(world)), tag.getInt(NODE_Z_TAG + getDimension(world))); - if (world.getBlockState(wraithNodePos).getBlock() == ModBlocks.WRAITH_NODE.get() && canTeleport(world, wraithNodePos)) { - teleportPlayer(world, wraithNodePos, player); - if (!player.isCreative() && !player.level().isClientSide) { - setPearlCount(stack, getPearlCount(stack) - getEnderStaffNodeWarpCost()); + } else { + if (canTeleport(level, wraithNodePos)) { + teleportPlayer(level, wraithNodePos, player); + if (!player.isCreative() && !player.level().isClientSide) { + setPearlCount(stack, getPearlCount(stack) - getEnderStaffNodeWarpCost()); + } } - return; } + } - if (tag.contains(DIMENSION_TAG)) { - tag.remove(DIMENSION_TAG); - tag.remove(NODE_X_TAG); - tag.remove(NODE_Y_TAG); - tag.remove(NODE_Z_TAG); - if (!world.isClientSide) { - player.sendSystemMessage(Component.literal(ChatFormatting.DARK_RED + "Node doesn't exist!")); - } else { - player.playSound(SoundEvents.ENDERMAN_DEATH, 1.0f, 1.0f); - } - } + private static void teleportToDimension(Player player, ServerLevel destination, BlockPos wraithNodePos) { + player.changeDimension(new DimensionTransition(destination, wraithNodePos.above().getBottomCenter(), Vec3.ZERO, + player.getYRot(), player.getXRot(), DimensionTransition.DO_NOTHING)); } - private boolean canTeleport(Level world, BlockPos pos) { + private static boolean canTeleport(Level level, BlockPos pos) { + if (level.getBlockState(pos).getBlock() != ModBlocks.WRAITH_NODE.get()) { + return false; + } + BlockPos up = pos.above(); - return world.isEmptyBlock(up) && world.isEmptyBlock(up.above()); + return level.isEmptyBlock(up) && level.isEmptyBlock(up.above()); } - private void teleportPlayer(Level world, BlockPos pos, Player player) { + private static void teleportPlayer(Level level, BlockPos pos, Player player) { player.teleportTo(pos.getX() + 0.5, pos.getY() + 0.875, pos.getZ() + 0.5); player.playSound(SoundEvents.ENDERMAN_TELEPORT, 1.0f, 1.0f); for (int particles = 0; particles < 2; particles++) { - world.addParticle(ParticleTypes.PORTAL, player.getX(), player.getEyeY(), player.getZ(), world.random.nextGaussian(), world.random.nextGaussian(), world.random.nextGaussian()); + level.addParticle(ParticleTypes.PORTAL, player.getX(), player.getEyeY(), player.getZ(), level.random.nextGaussian(), level.random.nextGaussian(), level.random.nextGaussian()); } } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack staff, @Nullable Level world, TooltipBuilder tooltipBuilder) { + protected void addMoreInformation(ItemStack staff, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { tooltipBuilder.description(this, ".tooltip2"); - tooltipBuilder.charge(this, ".tooltip.charge", getPearlCount(staff, true)); + tooltipBuilder.charge(this, ".tooltip.charge", getPearlCount(staff)); - if (staff.getTag() != null && staff.getTag().contains(NODE_X_TAG + getDimension(world)) && staff.getTag().contains(NODE_Y_TAG + getDimension(world)) && staff.getTag().contains(NODE_Z_TAG + getDimension(world))) { - if (staff.getTag() != null && !staff.getTag().getString(DIMENSION_TAG).equals(getDimension(world))) { - tooltipBuilder.warning(this, ".tooltip.position.out_of_range"); - } else { - tooltipBuilder.data(this, ".tooltip.position", staff.getTag().getInt(NODE_X_TAG + getDimension(world)), staff.getTag().getInt(NODE_Y_TAG + getDimension(world)), staff.getTag().getInt(NODE_Z_TAG + getDimension(world))); - } + if (staff.has(ModDataComponents.WARP_POSITION)) { + ResourceLocation dimension = staff.getOrDefault(ModDataComponents.WARP_DIMENSION, Level.OVERWORLD.location()); + BlockPos pos = staff.getOrDefault(ModDataComponents.WARP_POSITION, BlockPos.ZERO); + tooltipBuilder.data(this, ".tooltip.position", pos.getX(), pos.getY(), pos.getZ(), dimension); } else { tooltipBuilder.description(this, ".tooltip.position.nowhere"); } @@ -291,19 +262,19 @@ protected boolean hasMoreInformation(ItemStack stack) { @Override public InteractionResult useOn(UseOnContext itemUseContext) { ItemStack stack = itemUseContext.getItemInHand(); - Level world = itemUseContext.getLevel(); + Level level = itemUseContext.getLevel(); BlockPos pos = itemUseContext.getClickedPos(); // if right clicking on a wraith node, bind the eye to that wraith node. - if ((stack.getTag() == null || !(stack.getTag().contains(DIMENSION_TAG))) && world.getBlockState(pos).getBlock() == ModBlocks.WRAITH_NODE.get()) { - setWraithNode(stack, pos, getDimension(world)); + if (level.getBlockState(pos).getBlock() == ModBlocks.WRAITH_NODE.get()) { + setWraithNode(stack, pos, level.dimension().location()); Player player = itemUseContext.getPlayer(); if (player != null) { player.playSound(SoundEvents.ENDERMAN_TELEPORT, 1.0f, 1.0f); } for (int particles = 0; particles < 12; particles++) { - world.addParticle(ParticleTypes.PORTAL, pos.getX() + world.random.nextDouble(), pos.getY() + world.random.nextDouble(), pos.getZ() + world.random.nextDouble(), world.random.nextGaussian(), world.random.nextGaussian(), world.random.nextGaussian()); + level.addParticle(ParticleTypes.PORTAL, pos.getX() + level.random.nextDouble(), pos.getY() + level.random.nextDouble(), pos.getZ() + level.random.nextDouble(), level.random.nextGaussian(), level.random.nextGaussian(), level.random.nextGaussian()); } return InteractionResult.SUCCESS; } else { @@ -311,27 +282,9 @@ public InteractionResult useOn(UseOnContext itemUseContext) { } } - private String getDimension(@Nullable Level world) { - return world != null ? world.dimension().registry().toString() : Level.OVERWORLD.location().toString(); - } - - private void setWraithNode(ItemStack eye, BlockPos pos, String dimension) { - NBTHelper.putInt(NODE_X_TAG + dimension, eye, pos.getX()); - NBTHelper.putInt(NODE_Y_TAG + dimension, eye, pos.getY()); - NBTHelper.putInt(NODE_Z_TAG + dimension, eye, pos.getZ()); - NBTHelper.putString(DIMENSION_TAG, eye, dimension); - } - - @Nullable - @Override - public CompoundTag getShareTag(ItemStack staff) { - CompoundTag nbt = super.getShareTag(staff); - if (nbt == null) { - nbt = new CompoundTag(); - } - nbt.putInt("count", getPearlCount(staff)); - - return nbt; + private void setWraithNode(ItemStack eye, BlockPos pos, ResourceLocation dimension) { + eye.set(ModDataComponents.WARP_DIMENSION, dimension); + eye.set(ModDataComponents.WARP_POSITION, pos); } public enum Mode implements StringRepresentable { @@ -339,6 +292,9 @@ public enum Mode implements StringRepresentable { LONG_CAST("long_cast"), NODE_WARP("node_warp"); + public static final Codec CODEC = StringRepresentable.fromEnum(Mode::values); + public static final StreamCodec STREAM_CODEC = NeoForgeStreamCodecs.enumCodec(Mode.class); + private final String name; Mode(String name) { @@ -358,7 +314,6 @@ public Mode previous() { return VALUES[Math.floorMod(ordinal() - 1, VALUES.length)]; } - private static final Map NAME_VALUES; private static final Mode[] VALUES; static { @@ -366,12 +321,7 @@ public Mode previous() { for (Mode value : Mode.values()) { builder.put(value.getSerializedName(), value); } - NAME_VALUES = builder.build(); VALUES = values(); } - - public static Mode fromName(String name) { - return NAME_VALUES.getOrDefault(name, CAST); - } } } diff --git a/src/main/java/reliquary/items/FertilePotionItem.java b/src/main/java/reliquary/items/FertilePotionItem.java index a6251f5f..ecaa612e 100644 --- a/src/main/java/reliquary/items/FertilePotionItem.java +++ b/src/main/java/reliquary/items/FertilePotionItem.java @@ -1,20 +1,24 @@ package reliquary.items; +import net.minecraft.core.Direction; +import net.minecraft.core.Position; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; 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.ProjectileItem; import net.minecraft.world.level.Level; -import reliquary.entities.potion.FertilePotionEntity; +import reliquary.entities.potion.FertilePotion; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; -public class FertilePotionItem extends ItemBase { +public class FertilePotionItem extends ItemBase implements ProjectileItem { public FertilePotionItem() { - super(new Properties(), Settings.COMMON.disable.disablePotions::get); + super(new Properties(), Config.COMMON.disable.disablePotions); } @Override @@ -39,9 +43,14 @@ public InteractionResultHolder use(Level level, Player player, Intera } level.playSound(null, player.blockPosition(), SoundEvents.SPLASH_POTION_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.random.nextFloat() * 0.4F + 0.8F)); - FertilePotionEntity fertilePotion = new FertilePotionEntity(level, player); + FertilePotion fertilePotion = new FertilePotion(level, player); fertilePotion.shootFromRotation(player, player.getXRot(), player.getYRot(), -20.0F, 0.7F, 1.0F); level.addFreshEntity(fertilePotion); return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } + + @Override + public Projectile asProjectile(Level level, Position position, ItemStack itemStack, Direction direction) { + return new FertilePotion(level, position); + } } diff --git a/src/main/java/reliquary/items/FortuneCoinItem.java b/src/main/java/reliquary/items/FortuneCoinItem.java index 48392b8d..f7b46a10 100644 --- a/src/main/java/reliquary/items/FortuneCoinItem.java +++ b/src/main/java/reliquary/items/FortuneCoinItem.java @@ -1,6 +1,8 @@ package reliquary.items; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.sounds.SoundEvents; @@ -19,18 +21,16 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.phys.AABB; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidStack; import reliquary.api.IPedestal; import reliquary.api.IPedestalActionItem; import reliquary.blocks.tile.PedestalBlockEntity; +import reliquary.init.ModDataComponents; import reliquary.init.ModFluids; import reliquary.init.ModItems; import reliquary.items.util.ICuriosItem; import reliquary.pedestal.PedestalRegistry; -import reliquary.reference.Settings; -import reliquary.util.NBTHelper; +import reliquary.reference.Config; import reliquary.util.RandHelper; import reliquary.util.TooltipBuilder; import reliquary.util.XpHelper; @@ -56,7 +56,7 @@ public interface IFortuneCoinPickupChecker { } public FortuneCoinItem() { - super(new Properties().stacksTo(1)); + super(new Properties().stacksTo(1).rarity(Rarity.EPIC)); } @Override @@ -77,8 +77,7 @@ public void onWornTick(ItemStack stack, LivingEntity player) { } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack stack, @Nullable Level world, TooltipBuilder tooltipBuilder) { + protected void addMoreInformation(ItemStack stack, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { tooltipBuilder.description(this, ".tooltip2"); } @@ -88,37 +87,28 @@ protected boolean hasMoreInformation(ItemStack stack) { } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - - @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return isEnabled(stack); } public static boolean isEnabled(ItemStack stack) { - return NBTHelper.getBoolean("enabled", stack); + return stack.getOrDefault(ModDataComponents.ENABLED, false); } @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || world.getGameTime() % 2 != 0) { + public void inventoryTick(ItemStack stack, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 2 != 0) { return; } if (!isEnabled(stack)) { return; } - if (!(entity instanceof Player player) || player.isSpectator()) { - return; - } - scanForEntitiesInRange(world, player, getStandardPullDistance()); + scanForEntitiesInRange(level, player, getStandardPullDistance()); } - private void scanForEntitiesInRange(Level world, Player player, double d) { - List disablePositions = getDisablePositions(world, player.blockPosition()); - List items = world.getEntitiesOfClass(ItemEntity.class, player.getBoundingBox().inflate(d)); + private void scanForEntitiesInRange(Level level, Player player, double d) { + List disablePositions = getDisablePositions(level, player.blockPosition()); + List items = level.getEntitiesOfClass(ItemEntity.class, player.getBoundingBox().inflate(d)); for (ItemEntity item : items) { if (canPickupItem(item, disablePositions, false) && checkForRoom(item.getItem(), player)) { item.setPickUpDelay(0); @@ -128,7 +118,7 @@ private void scanForEntitiesInRange(Level world, Player player, double d) { } } } - List xpOrbs = world.getEntitiesOfClass(ExperienceOrb.class, player.getBoundingBox().inflate(d)); + List xpOrbs = level.getEntitiesOfClass(ExperienceOrb.class, player.getBoundingBox().inflate(d)); for (ExperienceOrb xpOrb : xpOrbs) { if (player.takeXpDelay > 0) { player.takeXpDelay = 0; @@ -167,12 +157,12 @@ private boolean isInDisabledRange(ItemEntity item, List disablePositio return false; } - private List getDisablePositions(Level world, BlockPos coinPos) { + private List getDisablePositions(Level level, BlockPos coinPos) { List disablePositions = new ArrayList<>(); - List pedestalPositions = PedestalRegistry.getPositionsInRange(world.dimension().registry(), coinPos, 10); + List pedestalPositions = PedestalRegistry.getPositionsInRange(level.dimension().registry(), coinPos, 10); for (BlockPos pos : pedestalPositions) { - BlockEntity te = world.getBlockEntity(pos); + BlockEntity te = level.getBlockEntity(pos); if (te instanceof PedestalBlockEntity pedestal && pedestal.switchedOn()) { ItemStack stack = pedestal.getItem(0); if (!stack.isEmpty() && stack.getItem() == this && !isEnabled(stack)) { @@ -184,7 +174,7 @@ private List getDisablePositions(Level world, BlockPos coinPos) { } private void teleportEntityToPlayer(Entity item, Player player) { - player.level().addParticle(ParticleTypes.ENTITY_EFFECT, item.getX() + 0.5D + player.level().random.nextGaussian() / 8, item.getY() + 0.2D, item.getZ() + 0.5D + player.level().random.nextGaussian() / 8, 0.9D, 0.9D, 0.0D); + player.level().addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.9F, 0.9F, 0.0F), item.getX() + 0.5D + player.level().random.nextGaussian() / 8, item.getY() + 0.2D, item.getZ() + 0.5D + player.level().random.nextGaussian() / 8, 0, 0, 0); player.getLookAngle(); double x = player.getX() + player.getLookAngle().x * 0.2D; double y = player.getY(); @@ -223,15 +213,15 @@ public void onUseTick(Level level, LivingEntity livingEntity, ItemStack stack, i } private double getLongRangePullDistance() { - return Settings.COMMON.items.fortuneCoin.longRangePullDistance.get(); + return Config.COMMON.items.fortuneCoin.longRangePullDistance.get(); } private double getStandardPullDistance() { - return Settings.COMMON.items.fortuneCoin.standardPullDistance.get(); + return Config.COMMON.items.fortuneCoin.standardPullDistance.get(); } @Override - public int getUseDuration(ItemStack stack) { + public int getUseDuration(ItemStack stack, LivingEntity livingEntity) { return 64; } @@ -241,7 +231,7 @@ public UseAnim getUseAnimation(ItemStack stack) { } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (player.isShiftKeyDown()) { @@ -289,17 +279,17 @@ private void pickupItems(IPedestal pedestal, Level level, BlockPos pos) { } } - private void pickupXp(IPedestal pedestal, Level world, BlockPos pos) { - List xpOrbs = world.getEntitiesOfClass(ExperienceOrb.class, new AABB(pos).inflate(getStandardPullDistance())); + private void pickupXp(IPedestal pedestal, Level level, BlockPos pos) { + List xpOrbs = level.getEntitiesOfClass(ExperienceOrb.class, new AABB(pos).inflate(getStandardPullDistance())); for (ExperienceOrb xpOrb : xpOrbs) { int amountToTransfer = XpHelper.experienceToLiquid(xpOrb.value); - int amountAdded = pedestal.fillConnectedTank(new FluidStack(ModFluids.XP_JUICE_STILL.get(), amountToTransfer)); + int amountAdded = pedestal.fillConnectedTank(new FluidStack(ModFluids.XP_STILL.get(), amountToTransfer)); if (amountAdded > 0) { xpOrb.discard(); if (amountToTransfer > amountAdded) { - world.addFreshEntity(new ExperienceOrb(world, pos.getX(), pos.getY(), pos.getZ(), XpHelper.liquidToExperience(amountToTransfer - amountAdded))); + level.addFreshEntity(new ExperienceOrb(level, pos.getX(), pos.getY(), pos.getZ(), XpHelper.liquidToExperience(amountToTransfer - amountAdded))); } } else { pedestal.setActionCoolDown(20); @@ -318,6 +308,6 @@ public void stop(ItemStack stack, Level level, IPedestal pedestal) { } public void toggle(ItemStack stack) { - NBTHelper.putBoolean("enabled", stack, !isEnabled(stack)); + stack.set(ModDataComponents.ENABLED, !isEnabled(stack)); } } diff --git a/src/main/java/reliquary/items/FortuneCoinToggler.java b/src/main/java/reliquary/items/FortuneCoinToggler.java index ee1e70ff..0a29f580 100644 --- a/src/main/java/reliquary/items/FortuneCoinToggler.java +++ b/src/main/java/reliquary/items/FortuneCoinToggler.java @@ -3,27 +3,21 @@ import net.minecraft.client.Minecraft; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.event.TickEvent; +import net.neoforged.neoforge.client.event.ClientTickEvent; +import net.neoforged.neoforge.network.PacketDistributor; import reliquary.handler.ClientEventHandler; import reliquary.init.ModItems; -import reliquary.network.PacketFortuneCoinTogglePressed; -import reliquary.network.PacketHandler; +import reliquary.network.FortuneCoinTogglePressedPayload; -@OnlyIn(Dist.CLIENT) public class FortuneCoinToggler { - @OnlyIn(Dist.CLIENT) private static FortuneCoinToggler coinToggler = new FortuneCoinToggler(); - @OnlyIn(Dist.CLIENT) public static void setCoinToggler(FortuneCoinToggler toggler) { coinToggler = toggler; } - @OnlyIn(Dist.CLIENT) @SuppressWarnings({"squid:S1172", "unused"}) //used in addListener reflection code - public static void handleKeyInputEvent(TickEvent.ClientTickEvent event) { + public static void handleKeyInputEvent(ClientTickEvent.Pre event) { if (ClientEventHandler.FORTUNE_COIN_TOGGLE_KEYBIND.consumeClick()) { coinToggler.findAndToggle(); } @@ -38,15 +32,15 @@ public boolean findAndToggle() { for (int slot = 0; slot < player.getInventory().items.size(); slot++) { ItemStack stack = player.getInventory().items.get(slot); if (stack.getItem() == ModItems.FORTUNE_COIN.get()) { - PacketHandler.sendToServer(new PacketFortuneCoinTogglePressed(PacketFortuneCoinTogglePressed.InventoryType.MAIN, slot)); + PacketDistributor.sendToServer(new FortuneCoinTogglePressedPayload(FortuneCoinTogglePressedPayload.InventoryType.MAIN, slot)); ModItems.FORTUNE_COIN.get().toggle(stack); return true; } } - if (player.getInventory().offhand.get(0).getItem() == ModItems.FORTUNE_COIN.get()) { - PacketHandler.sendToServer(new PacketFortuneCoinTogglePressed(PacketFortuneCoinTogglePressed.InventoryType.OFF_HAND, 0)); - ModItems.FORTUNE_COIN.get().toggle(player.getInventory().offhand.get(0)); + if (player.getInventory().offhand.getFirst().getItem() == ModItems.FORTUNE_COIN.get()) { + PacketDistributor.sendToServer(new FortuneCoinTogglePressedPayload(FortuneCoinTogglePressedPayload.InventoryType.OFF_HAND, 0)); + ModItems.FORTUNE_COIN.get().toggle(player.getInventory().offhand.getFirst()); return true; } return false; diff --git a/src/main/java/reliquary/items/GlacialStaffItem.java b/src/main/java/reliquary/items/GlacialStaffItem.java index 1dba9853..9e7b15b6 100644 --- a/src/main/java/reliquary/items/GlacialStaffItem.java +++ b/src/main/java/reliquary/items/GlacialStaffItem.java @@ -1,56 +1,33 @@ package reliquary.items; +import com.google.common.collect.ImmutableSet; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.LongTag; -import net.minecraft.nbt.Tag; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; 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.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import reliquary.util.NBTHelper; -import reliquary.util.TooltipBuilder; +import reliquary.init.ModDataComponents; -import javax.annotation.Nullable; import java.util.HashSet; -import java.util.Iterator; import java.util.Set; @SuppressWarnings("java:S110") public class GlacialStaffItem extends IceMagusRodItem { - private static final String SNOWBALLS_TAG = "snowballs"; - private static final String BLOCK_LOCATIONS_TAG = "blockLocations"; - public GlacialStaffItem() { super(); } - @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack staff, @Nullable Level world, TooltipBuilder tooltipBuilder) { - tooltipBuilder.charge(this, ".tooltip2", NBTHelper.getInt(SNOWBALLS_TAG, staff)); - if (isEnabled(staff)) { - tooltipBuilder.absorbActive(Items.SNOWBALL.getName(new ItemStack(Items.SNOWBALL)).getString()); - } else { - tooltipBuilder.absorb(); - } - } - @Override public boolean onLeftClickEntity(ItemStack stack, Player player, Entity e) { - if (e instanceof LivingEntity livingBase && NBTHelper.getInt(SNOWBALLS_TAG, stack) >= getSnowballCost()) { + if (e instanceof LivingEntity livingBase && getSnowballs(stack) >= getSnowballCost()) { MobEffectInstance slow = new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 30, 0); //if the creature is slowed already, refresh the duration and increase the amplifier by 1. @@ -63,45 +40,41 @@ public boolean onLeftClickEntity(ItemStack stack, Player player, Entity e) { ((LivingEntity) e).addEffect(slow); e.hurt(player.damageSources().playerAttack(player), slow.getAmplifier()); - NBTHelper.putInt(SNOWBALLS_TAG, stack, NBTHelper.getInt(SNOWBALLS_TAG, stack) - getSnowballCost()); + setSnowballs(stack, getSnowballs(stack) - getSnowballCost()); } return super.onLeftClickEntity(stack, player, e); } @Override - public void inventoryTick(ItemStack staff, Level world, Entity entity, int itemSlot, boolean isSelected) { - super.inventoryTick(staff, world, entity, itemSlot, isSelected); + public void inventoryTick(ItemStack staff, Level level, Entity entity, int itemSlot, boolean isSelected) { + super.inventoryTick(staff, level, entity, itemSlot, isSelected); - if (world.getGameTime() % 2 != 0) { - return; - } - - if (!(entity instanceof Player player)) { + if (level.isClientSide() || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 2 != 0) { return; } if (isEnabled(staff)) { - freezeBlocks(staff, world, player); + freezeBlocks(staff, level, player); } - meltBlocks(staff, world, player); + meltBlocks(staff, level, player); } - private void freezeBlocks(ItemStack staff, Level world, Player player) { + private void freezeBlocks(ItemStack staff, Level level, Player player) { BlockPos playerPos = player.blockPosition(); BlockPos.betweenClosed(playerPos.offset(-2, -1, -2), playerPos.offset(2, -1, 2)) .forEach(pos -> { if (Math.abs(playerPos.getX() - pos.getX()) == 2 && Math.abs(playerPos.getZ() - pos.getZ()) == 2) { return; } - doFreezeCheck(staff, pos, world); + doFreezeCheck(staff, pos.immutable(), level); }); } - private void meltBlocks(ItemStack staff, Level world, Player player) { - if (!world.isClientSide) { + private void meltBlocks(ItemStack staff, Level level, Player player) { + if (!level.isClientSide) { BlockPos playerPos = player.blockPosition(); for (BlockPos pos : getBlockLocations(staff)) { - if (!world.isLoaded(pos)) { + if (!level.isLoaded(pos)) { continue; } @@ -113,106 +86,74 @@ private void meltBlocks(ItemStack staff, Level world, Player player) { continue; } - doThawCheck(staff, pos, world); + doThawCheck(staff, pos, level); } } } private Set getBlockLocations(ItemStack stack) { - CompoundTag tagCompound = stack.getTag(); - if (tagCompound == null) { - tagCompound = new CompoundTag(); - } - Set locations = new HashSet<>(); - - tagCompound.getList(BLOCK_LOCATIONS_TAG, Tag.TAG_LONG) - .forEach(nbt -> locations.add(BlockPos.of(((LongTag) nbt).getAsLong()))); - return locations; + return stack.getOrDefault(ModDataComponents.FROZEN_POSITIONS, new HashSet<>()); } - private void doFreezeCheck(ItemStack stack, BlockPos pos, Level world) { - BlockState blockState = world.getBlockState(pos); - if (blockState.getBlock() == Blocks.WATER && blockState.getValue(LiquidBlock.LEVEL) == 0 && world.isEmptyBlock(pos.above())) { + private void doFreezeCheck(ItemStack stack, BlockPos pos, Level level) { + BlockState blockState = level.getBlockState(pos); + if (blockState.getBlock() == Blocks.WATER && blockState.getValue(LiquidBlock.LEVEL) == 0 && level.isEmptyBlock(pos.above())) { addFrozenBlockToList(stack, pos); - world.setBlockAndUpdate(pos, Blocks.PACKED_ICE.defaultBlockState()); - for (int particleNum = world.random.nextInt(3); particleNum < 2; ++particleNum) { - float xVel = world.random.nextFloat(); - float yVel = world.random.nextFloat() + 0.5F; - float zVel = world.random.nextFloat(); - world.addParticle(ICE_PARTICLE, pos.getX() + xVel, pos.getY() + yVel, pos.getZ() + zVel, 0.75F, 0.75F, 1.0F); + level.setBlockAndUpdate(pos, Blocks.PACKED_ICE.defaultBlockState()); + for (int particleNum = level.random.nextInt(3); particleNum < 2; ++particleNum) { + float xVel = level.random.nextFloat(); + float yVel = level.random.nextFloat() + 0.5F; + float zVel = level.random.nextFloat(); + level.addParticle(ICE_PARTICLE, pos.getX() + xVel, pos.getY() + yVel, pos.getZ() + zVel, 0.75F, 0.75F, 1.0F); } } else if (blockState.getBlock() == Blocks.LAVA && blockState.getValue(LiquidBlock.LEVEL) == 0) { addFrozenBlockToList(stack, pos); - world.setBlockAndUpdate(pos, Blocks.OBSIDIAN.defaultBlockState()); - for (int particleNum = world.random.nextInt(3); particleNum < 2; ++particleNum) { - float xVel = world.random.nextFloat(); - float yVel = world.random.nextFloat() + 0.5F; - float zVel = world.random.nextFloat(); - world.addParticle(world.random.nextInt(3) == 0 ? ParticleTypes.LARGE_SMOKE : ParticleTypes.SMOKE, pos.getX() + xVel, pos.getY() + yVel, pos.getZ() + zVel, 0.0D, 0.2D, 0.0D); + level.setBlockAndUpdate(pos, Blocks.OBSIDIAN.defaultBlockState()); + for (int particleNum = level.random.nextInt(3); particleNum < 2; ++particleNum) { + float xVel = level.random.nextFloat(); + float yVel = level.random.nextFloat() + 0.5F; + float zVel = level.random.nextFloat(); + level.addParticle(level.random.nextInt(3) == 0 ? ParticleTypes.LARGE_SMOKE : ParticleTypes.SMOKE, pos.getX() + xVel, pos.getY() + yVel, pos.getZ() + zVel, 0.0D, 0.2D, 0.0D); } } } - private void doThawCheck(ItemStack stack, BlockPos pos, Level world) { - BlockState blockState = world.getBlockState(pos); + private void doThawCheck(ItemStack stack, BlockPos pos, Level level) { + BlockState blockState = level.getBlockState(pos); if (blockState == Blocks.PACKED_ICE.defaultBlockState()) { if (removeFrozenBlockFromList(stack, pos)) { - world.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState()); - for (int particleNum = world.random.nextInt(3); particleNum < 2; ++particleNum) { - float xVel = world.random.nextFloat(); - float yVel = world.random.nextFloat() + 0.5F; - float zVel = world.random.nextFloat(); - world.addParticle(world.random.nextInt(3) == 0 ? ParticleTypes.LARGE_SMOKE : ParticleTypes.SMOKE, pos.getX() + xVel, pos.getY() + yVel, pos.getZ() + zVel, 0.0D, 0.2D, 0.0D); + level.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState()); + for (int particleNum = level.random.nextInt(3); particleNum < 2; ++particleNum) { + float xVel = level.random.nextFloat(); + float yVel = level.random.nextFloat() + 0.5F; + float zVel = level.random.nextFloat(); + level.addParticle(level.random.nextInt(3) == 0 ? ParticleTypes.LARGE_SMOKE : ParticleTypes.SMOKE, pos.getX() + xVel, pos.getY() + yVel, pos.getZ() + zVel, 0.0D, 0.2D, 0.0D); } } } else if (blockState == Blocks.OBSIDIAN.defaultBlockState() && removeFrozenBlockFromList(stack, pos)) { - world.setBlockAndUpdate(pos, Blocks.LAVA.defaultBlockState()); - for (int particleNum = world.random.nextInt(3); particleNum < 2; ++particleNum) { - float xVel = world.random.nextFloat(); - float yVel = world.random.nextFloat() + 0.5F; - float zVel = world.random.nextFloat(); - world.addParticle(DustParticleOptions.REDSTONE, pos.getX() + xVel, pos.getY() + yVel, pos.getZ() + zVel, 0F, 0.2F, 0F); + level.setBlockAndUpdate(pos, Blocks.LAVA.defaultBlockState()); + for (int particleNum = level.random.nextInt(3); particleNum < 2; ++particleNum) { + float xVel = level.random.nextFloat(); + float yVel = level.random.nextFloat() + 0.5F; + float zVel = level.random.nextFloat(); + level.addParticle(DustParticleOptions.REDSTONE, pos.getX() + xVel, pos.getY() + yVel, pos.getZ() + zVel, 0F, 0.2F, 0F); } } } private void addFrozenBlockToList(ItemStack stack, BlockPos pos) { - CompoundTag tagCompound = stack.getTag(); - if (tagCompound == null) { - tagCompound = new CompoundTag(); - } - - ListTag tagList = tagCompound.getList(BLOCK_LOCATIONS_TAG, Tag.TAG_LONG); - tagList.add(LongTag.valueOf(pos.asLong())); - - tagCompound.put(BLOCK_LOCATIONS_TAG, tagList); + HashSet frozenPositions = new HashSet<>(getBlockLocations(stack)); + frozenPositions.add(pos); - stack.setTag(tagCompound); + stack.set(ModDataComponents.FROZEN_POSITIONS, ImmutableSet.copyOf(frozenPositions)); } private boolean removeFrozenBlockFromList(ItemStack stack, BlockPos pos) { - CompoundTag tagCompound = stack.getTag(); - if (tagCompound == null) { - tagCompound = new CompoundTag(); - } - - ListTag tagList = tagCompound.getList(BLOCK_LOCATIONS_TAG, Tag.TAG_LONG); - - Iterator it = tagList.iterator(); - - boolean removedBlock = false; - while (it.hasNext()) { - LongTag nbtPos = (LongTag) it.next(); - if (nbtPos.getAsLong() == pos.asLong()) { - it.remove(); - removedBlock = true; - } - } - - if (removedBlock) { - tagCompound.put(BLOCK_LOCATIONS_TAG, tagList); - stack.setTag(tagCompound); + HashSet frozenPositions = new HashSet<>(getBlockLocations(stack)); + if (frozenPositions.remove(pos)) { + stack.set(ModDataComponents.FROZEN_POSITIONS, ImmutableSet.copyOf(frozenPositions)); + return true; } - return removedBlock; + return false; } } diff --git a/src/main/java/reliquary/items/GlowingWaterItem.java b/src/main/java/reliquary/items/GlowingWaterItem.java index 5bec6e01..55e189ef 100644 --- a/src/main/java/reliquary/items/GlowingWaterItem.java +++ b/src/main/java/reliquary/items/GlowingWaterItem.java @@ -1,19 +1,21 @@ package reliquary.items; +import net.minecraft.core.Direction; +import net.minecraft.core.Position; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; 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.ProjectileItem; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import reliquary.entities.GlowingWaterEntity; +import reliquary.entities.GlowingWater; import reliquary.init.ModItems; -public class GlowingWaterItem extends ItemBase { +public class GlowingWaterItem extends ItemBase implements ProjectileItem { public GlowingWaterItem() { super(new Properties()); } @@ -29,7 +31,6 @@ public boolean hasCraftingRemainingItem(ItemStack stack) { } @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return true; } @@ -46,10 +47,15 @@ public InteractionResultHolder use(Level level, Player player, Intera level.playSound(null, player.blockPosition(), SoundEvents.ARROW_SHOOT, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.random.nextFloat() * 0.4F + 0.8F)); - GlowingWaterEntity glowingWater = new GlowingWaterEntity(level, player); + GlowingWater glowingWater = new GlowingWater(level, player); glowingWater.shootFromRotation(player, player.getXRot(), player.getYRot(), -20.0F, 0.7F, 1.0F); level.addFreshEntity(glowingWater); return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } + + @Override + public Projectile asProjectile(Level level, Position position, ItemStack itemStack, Direction direction) { + return new GlowingWater(level, position); + } } diff --git a/src/main/java/reliquary/items/HandgunItem.java b/src/main/java/reliquary/items/HandgunItem.java index 274f1cb6..7f744bf5 100644 --- a/src/main/java/reliquary/items/HandgunItem.java +++ b/src/main/java/reliquary/items/HandgunItem.java @@ -1,34 +1,35 @@ package reliquary.items; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.effect.MobEffectInstance; 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.item.UseAnim; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.registries.ForgeRegistries; -import reliquary.entities.shot.ShotEntityBase; +import net.minecraft.world.phys.HitResult; +import reliquary.entities.shot.ShotBase; +import reliquary.init.ModDataComponents; import reliquary.init.ModItems; import reliquary.init.ModSounds; -import reliquary.reference.Settings; -import reliquary.util.NBTHelper; +import reliquary.reference.Config; import reliquary.util.RegistryHelper; import reliquary.util.TooltipBuilder; -import reliquary.util.potions.XRPotionHelper; +import reliquary.util.potions.PotionHelper; import javax.annotation.Nullable; -import java.util.Collections; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Supplier; @@ -36,51 +37,49 @@ public class HandgunItem extends ItemBase { private static final int HANDGUN_RELOAD_SKILL_OFFSET = 10; private static final int HANDGUN_COOLDOWN_SKILL_OFFSET = 5; - private static final String MAGAZINE_TYPE_TAG = "magazineType"; - public interface IShotEntityFactory { - ShotEntityBase createShot(Level world, Player player, InteractionHand hand); + public interface IShotFactory { + ShotBase createShot(Level level, Player player, InteractionHand hand); } - private final Map magazineShotFactories = new HashMap<>(); - private final Map> magazineBulletItems = new HashMap<>(); + private final Map magazineShotFactories = new HashMap<>(); + private final Map> magazineBulletItems = new HashMap<>(); - public void registerMagazine(String magazineRegistryName, IShotEntityFactory factory, Supplier getBulletItem) { + public void registerMagazine(ResourceLocation magazineRegistryName, IShotFactory factory, Supplier getBulletItem) { magazineShotFactories.put(magazineRegistryName, factory); magazineBulletItems.put(magazineRegistryName, getBulletItem); } public HandgunItem() { - super(new Properties().stacksTo(1), Settings.COMMON.disable.disableHandgun::get); + super(new Properties().stacksTo(1), Config.COMMON.disable.disableHandgun); } private short getBulletCount(ItemStack handgun) { - return NBTHelper.getShort("bulletCount", handgun); + return handgun.getOrDefault(ModDataComponents.BULLET_COUNT, (short) 0); } public ItemStack getBulletStack(ItemStack handgun) { - String magazineType = getMagazineType(handgun); - if (!magazineBulletItems.containsKey(magazineType)) { - return new ItemStack(ModItems.EMPTY_BULLET.get(), 1); - } - - BulletItem bulletItem = magazineBulletItems.get(magazineType).get(); - ItemStack bulletStack = new ItemStack(bulletItem, getBulletCount(handgun)); - XRPotionHelper.addPotionEffectsToStack(bulletStack, getPotionEffects(handgun)); - - return bulletStack; + return getMagazineType(handgun).map(magazineType -> { + if (!magazineBulletItems.containsKey(magazineType)) { + return new ItemStack(ModItems.EMPTY_BULLET.get(), 1); + } + BulletItem bulletItem = magazineBulletItems.get(magazineType).get(); + ItemStack bulletStack = new ItemStack(bulletItem, getBulletCount(handgun)); + bulletStack.set(DataComponents.POTION_CONTENTS, getPotionContents(handgun)); + return bulletStack; + }).orElseGet(() -> new ItemStack(ModItems.EMPTY_BULLET.get(), 1)); } private void setBulletCount(ItemStack handgun, short bulletCount) { - NBTHelper.putShort("bulletCount", handgun, bulletCount); + handgun.set(ModDataComponents.BULLET_COUNT, bulletCount); } - private String getMagazineType(ItemStack handgun) { - return NBTHelper.getString(MAGAZINE_TYPE_TAG, handgun); + private Optional getMagazineType(ItemStack handgun) { + return Optional.ofNullable(handgun.get(ModDataComponents.MAGAZINE_TYPE)); } private void setMagazineType(ItemStack handgun, ItemStack magazine) { - NBTHelper.putString(MAGAZINE_TYPE_TAG, handgun, RegistryHelper.getItemRegistryName(magazine.getItem())); + handgun.set(ModDataComponents.MAGAZINE_TYPE, RegistryHelper.getRegistryName(magazine.getItem())); } private boolean hasAmmo(ItemStack handgun) { @@ -88,26 +87,24 @@ private boolean hasAmmo(ItemStack handgun) { } public long getCooldown(ItemStack handgun) { - return NBTHelper.getLong("coolDownTime", handgun); + return handgun.getOrDefault(ModDataComponents.COOLDOWN_TIME, 0L); } private void setCooldown(ItemStack handgun, long coolDownTime) { - NBTHelper.putLong("coolDownTime", handgun, coolDownTime); + handgun.set(ModDataComponents.COOLDOWN_TIME, coolDownTime); } - private List getPotionEffects(ItemStack handgun) { - return XRPotionHelper.getPotionEffectsFromStack(handgun); + private PotionContents getPotionContents(ItemStack handgun) { + return handgun.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); } - private void setPotionEffects(ItemStack handgun, List potionEffects) { - XRPotionHelper.cleanPotionEffects(handgun); - XRPotionHelper.addPotionEffectsToStack(handgun, potionEffects); + private void setPotionEffects(ItemStack handgun, PotionContents potionEffects) { + PotionHelper.cleanPotionEffects(handgun); + PotionHelper.addPotionContentsToStack(handgun, potionEffects); } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack handgun, @Nullable Level world, TooltipBuilder tooltipBuilder) { - ItemStack bullets = getBulletStack(handgun); + protected void addMoreInformation(ItemStack handgun, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { if (hasAmmo(handgun)) { tooltipBuilder .data(this, ".tooltip2", getBulletCount(handgun), getMagazineName(handgun)) @@ -121,8 +118,7 @@ protected boolean hasMoreInformation(ItemStack handgun) { } private String getMagazineName(ItemStack handgun) { - Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(getMagazineType(handgun))); - return item != null ? item.getName(new ItemStack(item)).getString() : ""; + return getMagazineType(handgun).map(magazineType -> BuiltInRegistries.ITEM.get(magazineType).getName(new ItemStack(Items.AIR)).getString()).orElse(""); } @Override @@ -139,15 +135,15 @@ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStac return oldStack.getItem() != newStack.getItem() || getBulletCount(oldStack) < getBulletCount(newStack); } - private boolean isCooldownOver(Level world, ItemStack handgun) { - return getCooldown(handgun) < world.getGameTime(); + private boolean isCooldownOver(Level level, ItemStack handgun) { + return getCooldown(handgun) < level.getGameTime(); } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack handgun = player.getItemInHand(hand); - if (getBulletCount(handgun) > 0 && !isCooldownOver(world, handgun) && otherHandgunCooledDownMore(player, hand, handgun)) { + if (getBulletCount(handgun) > 0 && !isCooldownOver(level, handgun) && otherHandgunCooledDownMore(player, hand, handgun)) { return new InteractionResultHolder<>(InteractionResult.PASS, handgun); } @@ -184,21 +180,21 @@ public void onUseTick(Level level, LivingEntity livingEntity, ItemStack handgun, } @Override - public int getUseDuration(ItemStack handgun) { + public int getUseDuration(ItemStack handgun, LivingEntity livingEntity) { return getItemUseDuration(); } @Override - public void releaseUsing(ItemStack handgun, Level worldIn, LivingEntity entityLiving, int timeLeft) { - if (!(entityLiving instanceof Player player)) { + public void releaseUsing(ItemStack handgun, Level level, LivingEntity livingEntity, int timeLeft) { + if (!(livingEntity instanceof Player player)) { return; } // fire bullet if (hasAmmo(handgun)) { if (isCooldownOver(player.level(), handgun)) { - setFiringCooldown(handgun, worldIn, player); - fireBullet(handgun, worldIn, player, handgun == player.getMainHandItem() ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); + setFiringCooldown(handgun, level, player); + fireBullet(handgun, level, player, handgun == player.getMainHandItem() ? InteractionHand.MAIN_HAND : InteractionHand.OFF_HAND); } return; } @@ -209,7 +205,7 @@ public void releaseUsing(ItemStack handgun, Level worldIn, LivingEntity entityLi getMagazineSlot(player).ifPresent(slot -> { ItemStack magazine = player.getInventory().items.get(slot); setMagazineType(handgun, magazine); - setPotionEffects(handgun, XRPotionHelper.getPotionEffectsFromStack(magazine)); + setPotionEffects(handgun, magazine.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY)); magazine.shrink(1); if (magazine.isEmpty()) { player.getInventory().items.set(slot, ItemStack.EMPTY); @@ -218,11 +214,11 @@ public void releaseUsing(ItemStack handgun, Level worldIn, LivingEntity entityLi spawnEmptyMagazine(player); setBulletCount(handgun, (short) 8); player.level().playSound(null, player.blockPosition(), ModSounds.HANDGUN_LOAD.get(), SoundSource.PLAYERS, 0.25F, 1.0F); - setFiringCooldown(handgun, worldIn, player); + setFiringCooldown(handgun, level, player); }); if (getBulletCount(handgun) == 0) { - setPotionEffects(handgun, Collections.emptyList()); + setPotionEffects(handgun, PotionContents.EMPTY); } } @@ -240,47 +236,57 @@ private void setHalfFiringCooldown(Player player, ItemStack potentialHandgun) { } } - private void setFiringCooldown(ItemStack handgun, Level worldIn, Player player) { - setCooldown(handgun, worldIn.getGameTime() + getPlayerFiringCooldown(player)); + private void setFiringCooldown(ItemStack handgun, Level level, Player player) { + setCooldown(handgun, level.getGameTime() + getPlayerFiringCooldown(player)); setSecondHandgunFiringCooldown(player, handgun); } private int getPlayerFiringCooldown(Player player) { - return Settings.COMMON.items.handgun.maxSkillLevel.get() + HANDGUN_COOLDOWN_SKILL_OFFSET - - Math.min(player.experienceLevel, Settings.COMMON.items.handgun.maxSkillLevel.get()); + return Config.COMMON.items.handgun.maxSkillLevel.get() + HANDGUN_COOLDOWN_SKILL_OFFSET + - Math.min(player.experienceLevel, Config.COMMON.items.handgun.maxSkillLevel.get()); } private int getItemUseDuration() { - return HANDGUN_RELOAD_SKILL_OFFSET + Settings.COMMON.items.handgun.maxSkillLevel.get(); + return HANDGUN_RELOAD_SKILL_OFFSET + Config.COMMON.items.handgun.maxSkillLevel.get(); } - private void fireBullet(ItemStack handgun, Level world, Player player, InteractionHand hand) { - if (!world.isClientSide) { - String magazineType = getMagazineType(handgun); - if (!magazineShotFactories.containsKey(magazineType)) { - return; - } - spawnShotEntity(handgun, world, player, hand, magazineType); - world.playSound(null, player.blockPosition(), ModSounds.HANDGUN_SHOT.get(), SoundSource.PLAYERS, 0.5F, 1.2F); + private void fireBullet(ItemStack handgun, Level level, Player player, InteractionHand hand) { + if (!level.isClientSide) { + getMagazineType(handgun).filter(magazineShotFactories::containsKey).ifPresent(magazineType -> { + spawnShotEntity(handgun, level, player, hand, magazineType); + level.playSound(null, player.blockPosition(), ModSounds.HANDGUN_SHOT.get(), SoundSource.PLAYERS, 0.5F, 1.2F); - setBulletCount(handgun, (short) (getBulletCount(handgun) - 1)); - if (getBulletCount(handgun) == 0) { - setPotionEffects(handgun, Collections.emptyList()); - } - spawnCasing(player); + setBulletCount(handgun, (short) (getBulletCount(handgun) - 1)); + if (getBulletCount(handgun) == 0) { + setPotionEffects(handgun, PotionContents.EMPTY); + } + spawnCasing(player); + }); } } - private void spawnShotEntity(ItemStack handgun, Level world, Player player, InteractionHand hand, String magazineType) { + private void spawnShotEntity(ItemStack handgun, Level level, Player player, InteractionHand hand, ResourceLocation magazineType) { if (!magazineShotFactories.containsKey(magazineType)) { return; } - ShotEntityBase shot = magazineShotFactories.get(magazineType).createShot(world, player, hand).addPotionEffects(getPotionEffects(handgun)); - double motionX = -Mth.sin(player.getYRot() / 180.0F * (float) Math.PI) * Mth.cos(player.getXRot() / 180.0F * (float) Math.PI); - double motionZ = Mth.cos(player.getYRot() / 180.0F * (float) Math.PI) * Mth.cos(player.getXRot() / 180.0F * (float) Math.PI); - double motionY = -Mth.sin(player.getXRot() / 180.0F * (float) Math.PI); - shot.shoot(motionX, motionY, motionZ, 1.2F, 1.0F); - world.addFreshEntity(shot); + ShotBase shot = magazineShotFactories.get(magazineType).createShot(level, player, hand).addPotionContents(getPotionContents(handgun)); + + if (level instanceof ServerLevel serverLevel) { + int simulationDistance = serverLevel.getServer().getPlayerList().getSimulationDistance(); + HitResult hitResult = player.pick(simulationDistance, 1, false); + float velocity = 1.2F; + float inaccuracy = 0.2F; + if (hitResult.getType() != HitResult.Type.MISS) { + shot.shoot(hitResult.getLocation().x - shot.getX(), hitResult.getLocation().y - shot.getY(), hitResult.getLocation().z - shot.getZ(), velocity, inaccuracy); + } else { + double motionX = -Mth.sin(player.getYRot() / 180.0F * (float) Math.PI) * Mth.cos(player.getXRot() / 180.0F * (float) Math.PI); + double motionZ = Mth.cos(player.getYRot() / 180.0F * (float) Math.PI) * Mth.cos(player.getXRot() / 180.0F * (float) Math.PI); + double motionY = -Mth.sin(player.getXRot() / 180.0F * (float) Math.PI); + shot.shoot(motionX, motionY, motionZ, velocity, inaccuracy); + } + } + + level.addFreshEntity(shot); } private void spawnEmptyMagazine(Player player) { @@ -320,6 +326,6 @@ private Optional getMagazineSlot(Player player) { } private int getPlayerReloadDelay(Player player) { - return Settings.COMMON.items.handgun.maxSkillLevel.get() + HANDGUN_RELOAD_SKILL_OFFSET - Math.min(player.experienceLevel, Settings.COMMON.items.handgun.maxSkillLevel.get()); + return Config.COMMON.items.handgun.maxSkillLevel.get() + HANDGUN_RELOAD_SKILL_OFFSET - Math.min(player.experienceLevel, Config.COMMON.items.handgun.maxSkillLevel.get()); } } diff --git a/src/main/java/reliquary/items/HarvestRodItem.java b/src/main/java/reliquary/items/HarvestRodItem.java index 12212752..d75d4006 100644 --- a/src/main/java/reliquary/items/HarvestRodItem.java +++ b/src/main/java/reliquary/items/HarvestRodItem.java @@ -1,15 +1,19 @@ package reliquary.items; import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.Codec; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.HolderLookup; +import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.codec.StreamCodec; 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.tags.ItemTags; import net.minecraft.util.StringRepresentable; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -18,55 +22,37 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.BoneMealItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.UseAnim; +import net.minecraft.world.item.*; import net.minecraft.world.level.ClipContext; 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.BonemealableBlock; +import net.minecraft.world.level.block.BushBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.IPlantable; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.capabilities.ICapabilitySerializable; -import net.minecraftforge.common.util.LazyOptional; +import net.neoforged.neoforge.common.SpecialPlantable; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import reliquary.blocks.FertileLilyPadBlock; -import reliquary.entities.EntityXRFakePlayer; -import reliquary.init.ModCapabilities; +import reliquary.entities.ReliquaryFakePlayer; +import reliquary.init.ModDataComponents; +import reliquary.init.ModItems; import reliquary.items.util.HarvestRodCache; -import reliquary.items.util.HarvestRodItemStackHandler; -import reliquary.items.util.IHarvestRodCache; import reliquary.items.util.IScrollableItem; -import reliquary.reference.Settings; -import reliquary.util.InventoryHelper; -import reliquary.util.ItemHelper; -import reliquary.util.NBTHelper; -import reliquary.util.RandHelper; -import reliquary.util.TooltipBuilder; -import reliquary.util.XRFakePlayerFactory; - -import javax.annotation.Nonnull; +import reliquary.reference.Config; +import reliquary.util.*; + import javax.annotation.Nullable; import java.util.List; import java.util.Optional; -import java.util.function.Consumer; -import java.util.function.Function; import java.util.function.Predicate; public class HarvestRodItem extends ToggleableItem implements IScrollableItem { - private static final String MODE_NBT_TAG = "mode"; - private static final String PLANTABLE_INDEX_NBT_TAG = "plantable_index"; private static final int AOE_START_COOLDOWN = 10; + public static final int BONEMEAL_SLOT = 0; public HarvestRodItem() { super(new Properties().stacksTo(1).setNoRepair()); @@ -78,12 +64,11 @@ public MutableComponent getName(ItemStack stack) { } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack rod, @Nullable Level world, TooltipBuilder tooltipBuilder) { - tooltipBuilder.charge(this, ".tooltip2", getBoneMealCount(rod, true)); - for (int slot = 1; slot < getCountPlantable(rod, true); slot++) { - ItemStack plantable = getPlantableInSlot(rod, slot, true); - tooltipBuilder.charge(this, ".tooltip3", plantable.getItem().getName(plantable).getString(), getPlantableQuantity(rod, slot, true)); + protected void addMoreInformation(ItemStack rod, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { + tooltipBuilder.charge(this, ".tooltip2", getBoneMealCount(rod)); + for (int slot = 1; slot < getCountOfPlantables(rod); slot++) { + ItemStack plantable = getPlantableInSlot(rod, slot); + tooltipBuilder.charge(this, ".tooltip3", plantable.getItem().getName(plantable).getString(), getPlantableQuantity(rod, slot)); } if (isEnabled(rod)) { @@ -104,62 +89,51 @@ public UseAnim getUseAnimation(ItemStack stack) { } private int getBonemealLimit() { - return Settings.COMMON.items.harvestRod.boneMealLimit.get(); + return Config.COMMON.items.harvestRod.boneMealLimit.get(); } private int getBonemealWorth() { - return Settings.COMMON.items.harvestRod.boneMealWorth.get(); + return Config.COMMON.items.harvestRod.boneMealWorth.get(); } public int getBonemealCost() { - return Settings.COMMON.items.harvestRod.boneMealCost.get(); + return Config.COMMON.items.harvestRod.boneMealCost.get(); } public int getLuckRolls() { - return Settings.COMMON.items.harvestRod.boneMealLuckRolls.get(); + return Config.COMMON.items.harvestRod.boneMealLuckRolls.get(); } public int getLuckPercent() { - return Settings.COMMON.items.harvestRod.boneMealLuckPercentChance.get(); + return Config.COMMON.items.harvestRod.boneMealLuckPercentChance.get(); } private int getBreakRadius() { - return Settings.COMMON.items.harvestRod.aoeRadius.get(); + return Config.COMMON.items.harvestRod.aoeRadius.get(); } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - return new ICapabilitySerializable() { - final HarvestRodItemStackHandler itemHandler = new HarvestRodItemStackHandler(); - final IHarvestRodCache harvestRodCache = new HarvestRodCache(); - - @Override - public CompoundTag serializeNBT() { - return itemHandler.serializeNBT(); - } - - @Override - public void deserializeNBT(CompoundTag tagCompound) { - itemHandler.deserializeNBT(tagCompound); - } - - @Nonnull - @Override - public LazyOptional getCapability(Capability capability, @Nullable Direction side) { - if (capability == ForgeCapabilities.ITEM_HANDLER) { - return ForgeCapabilities.ITEM_HANDLER.orEmpty(capability, LazyOptional.of(() -> itemHandler)); - } else if (capability == ModCapabilities.HARVEST_ROD_CACHE) { - return ModCapabilities.HARVEST_ROD_CACHE.orEmpty(capability, LazyOptional.of(() -> harvestRodCache)); - } + protected boolean isItemValidForContainerSlot(int slot, ItemStack stack) { + if (stack.isEmpty()) { + return true; + } + if (slot == BONEMEAL_SLOT) { + return stack.is(Items.BONE_MEAL); + } + return isPlantable(stack); + } - return LazyOptional.empty(); - } - }; + @Override + protected int getContainerSlotLimit(int slot) { + if (slot == BONEMEAL_SLOT) { + return getBonemealLimit(); + } + return Config.COMMON.items.harvestRod.maxCapacityPerPlantable.get(); } @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || world.getGameTime() % 10 != 0 || !(entity instanceof Player player)) { + public void inventoryTick(ItemStack stack, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 10 != 0) { return; } @@ -188,31 +162,30 @@ private void consumePlantables(ItemStack harvestRod, Player player) { } } - private boolean isPlantable(ItemStack currentStack) { - Item item = currentStack.getItem(); - return item instanceof BlockItem blockItem && blockItem.getBlock() instanceof IPlantable; + public static boolean isPlantable(ItemStack currentStack) { + return currentStack.is(Tags.Items.SEEDS) || currentStack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS) || currentStack.getItem() instanceof SpecialPlantable; } @Override - public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, Player player) { + public boolean canAttackBlock(BlockState state, Level level, BlockPos pos, Player player) { if (player.level().isClientSide) { - return false; + return true; } boolean brokenBlock = false; - Block block = player.level().getBlockState(pos).getBlock(); - if (block instanceof IPlantable || block == Blocks.MELON || block == Blocks.PUMPKIN) { + BlockState blockState = player.level().getBlockState(pos); + if (canBreakBlock(blockState)) { for (int xOff = -getBreakRadius(); xOff <= getBreakRadius(); xOff++) { for (int yOff = -getBreakRadius(); yOff <= getBreakRadius(); yOff++) { for (int zOff = -getBreakRadius(); zOff <= getBreakRadius(); zOff++) { - brokenBlock |= doHarvestBlockBreak(block, stack, pos, player, xOff, yOff, zOff); + brokenBlock |= doHarvestBlockBreak(blockState.getBlock(), player.getMainHandItem(), pos, player, xOff, yOff, zOff); } } } } - return brokenBlock; + return !brokenBlock; } private boolean doHarvestBlockBreak(Block initialBlock, ItemStack stack, BlockPos pos, Player player, int xOff, int yOff, int zOff) { @@ -225,7 +198,7 @@ private boolean doHarvestBlockBreak(Block initialBlock, ItemStack stack, BlockPo return false; } - if (!(block instanceof IPlantable || block == Blocks.MELON || block == Blocks.PUMPKIN)) { + if (!canBreakBlock(blockState)) { return false; } if (block instanceof FertileLilyPadBlock) { @@ -256,15 +229,21 @@ private boolean doHarvestBlockBreak(Block initialBlock, ItemStack stack, BlockPo return true; } - private void boneMealBlock(ItemStack stack, Player player, Level world, BlockPos pos) { + private static boolean canBreakBlock(BlockState blockState) { + Block block = blockState.getBlock(); + return blockState.is(BlockTags.CROPS) || block instanceof BushBlock || block == Blocks.MELON || block == Blocks.PUMPKIN; + } + + private void boneMealBlock(ItemStack stack, Player player, Level level, BlockPos pos) { ItemStack fakeItemStack = new ItemStack(Items.BONE_MEAL); boolean usedRod = false; for (int repeatedUses = 0; repeatedUses <= getLuckRolls(); repeatedUses++) { - if ((repeatedUses == 0 || world.random.nextInt(100) <= getLuckPercent()) && BoneMealItem.applyBonemeal(fakeItemStack, world, pos, player)) { + if ((repeatedUses == 0 || level.random.nextInt(100) <= getLuckPercent()) && BoneMealItem.applyBonemeal(fakeItemStack, level, pos, player)) { if (!usedRod) { usedRod = true; } + player.level().levelEvent(1505, pos, 15); player.level().playSound(null, player.blockPosition(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.NEUTRAL, 0.1F, 0.5F * (RandHelper.getRandomMinusOneToOne(player.level().random) * 0.7F + 1.2F)); } } @@ -275,56 +254,37 @@ private void boneMealBlock(ItemStack stack, Player player, Level world, BlockPos } public int getBoneMealCount(ItemStack stack) { - return getBoneMealCount(stack, false); - } - - public int getBoneMealCount(ItemStack stack, boolean isClient) { - if (isClient) { - return NBTHelper.getContainedStackCount(stack, 0); - } - return getFromHandler(stack, HarvestRodItemStackHandler::getBoneMealCount).orElse(0); - } - - private Optional getFromHandler(ItemStack harvestRod, Function get) { - return InventoryHelper.getFromHandler(harvestRod, get, HarvestRodItemStackHandler.class); - } - - private void runOnHandler(ItemStack harvestRod, Consumer run) { - InventoryHelper.runOnItemHandler(harvestRod, run, HarvestRodItemStackHandler.class); + return getFromHandler(stack, handler -> handler.getSlots() > 0 ? handler.getCountInSlot(BONEMEAL_SLOT) : 0); } public void setBoneMealCount(ItemStack harvestRod, int boneMealCount) { - runOnHandler(harvestRod, h -> { - h.setBoneMealCount(boneMealCount); - updateContainedItemNBT(harvestRod, (short) 0, ItemStack.EMPTY, boneMealCount); - }); + runOnHandler(harvestRod, h -> h.setStackInSlot(BONEMEAL_SLOT, boneMealCount == 0 ? ItemStack.EMPTY : new ItemStack(Items.BONE_MEAL, boneMealCount))); } private int incrementPlantable(ItemStack harvestRod, ItemStack plantable, int maxCount) { return getFromHandler(harvestRod, h -> { ItemStack plantableCopy = plantable.copy(); plantableCopy.setCount(Math.min(maxCount, plantableCopy.getCount())); - return h.insertPlantable(plantableCopy).map(plantableSlotInserted -> { - updateContainedItemNBT(harvestRod, (short) plantableSlotInserted.getSlot(), plantableCopy, getPlantableQuantity(harvestRod, plantableSlotInserted.getSlot())); - return plantableSlotInserted.getCountInserted(); - }).orElse(0); - }).orElse(0); - } - - private void updateContainedItemNBT(ItemStack harvestRod, short slot, ItemStack stack, int count) { - NBTHelper.updateContainedStack(harvestRod, slot, stack, count); + ItemStack remaining = h.insertItemOrAddIntoNewSlotIfNoStackMatches(plantableCopy); + return plantableCopy.getCount() - remaining.getCount(); + }); } - private void decrementPlantable(ItemStack harvestRod, byte slot) { - getFromHandler(harvestRod, h -> h.getStackInSlot(slot).getCount()).flatMap(amount -> setPlantableQuantityAndGetPlantableStack(harvestRod, slot, amount - 1)) - .ifPresent(plantable -> updateContainedItemNBT(harvestRod, slot, plantable, plantable.getCount())); + public void decrementPlantable(ItemStack harvestRod, byte slot, int amount) { + runOnHandler(harvestRod, h -> { + int remainingCountAfterExtract = h.getCountInSlot(slot) - amount; + h.extractItemAndRemoveSlotIfEmpty(slot, amount, false); + if (remainingCountAfterExtract == 0) { + shiftModeOnEmptyPlantable(harvestRod, slot); + } + }); } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (player.isShiftKeyDown()) { - return super.use(world, player, hand); + return super.use(level, player, hand); } player.startUsingItem(hand); @@ -333,18 +293,12 @@ public InteractionResultHolder use(Level world, Player player, Intera } @Override - void toggleEnabled(ItemStack stack) { - super.toggleEnabled(stack); - updateContainedStacks(stack); - } - - @Override - public int getUseDuration(ItemStack stack) { + public int getUseDuration(ItemStack stack, LivingEntity livingEntity) { return 300; } @Override - public void releaseUsing(ItemStack harvestRod, Level world, LivingEntity entity, int timeLeft) { + public void releaseUsing(ItemStack harvestRod, Level level, LivingEntity entity, int timeLeft) { if (entity.level().isClientSide || !(entity instanceof Player player)) { return; } @@ -352,13 +306,17 @@ public void releaseUsing(ItemStack harvestRod, Level world, LivingEntity entity, BlockHitResult result = getPlayerPOVHitResult(player.level(), player, ClipContext.Fluid.ANY); if (result.getType() == HitResult.Type.BLOCK) { - harvestRod.getCapability(ModCapabilities.HARVEST_ROD_CACHE, null).ifPresent(IHarvestRodCache::reset); + HarvestRodCache harvestRodCache = harvestRod.getCapability(ModItems.HARVEST_ROD_CACHE_CAPABILITY); + if (harvestRodCache == null) { + return; + } + harvestRodCache.reset(); BlockPos pos = result.getBlockPos(); switch (getMode(harvestRod)) { case BONE_MEAL: if (getBoneMealCount(harvestRod) >= getBonemealCost() || player.isCreative()) { - boneMealBlock(harvestRod, player, world, pos); + boneMealBlock(harvestRod, player, level, pos); } break; case PLANTABLE: @@ -367,7 +325,7 @@ public void releaseUsing(ItemStack harvestRod, Level world, LivingEntity entity, } break; case HOE: - hoeLand(world, pos); + hoeLand(level, pos); break; default: } @@ -377,13 +335,13 @@ public void releaseUsing(ItemStack harvestRod, Level world, LivingEntity entity, } } - private void hoeLand(Level world, BlockPos pos) { + private void hoeLand(Level level, BlockPos pos) { ItemStack fakeHoe = new ItemStack(Items.WOODEN_HOE); - EntityXRFakePlayer fakePlayer = XRFakePlayerFactory.get((ServerLevel) world); + ReliquaryFakePlayer fakePlayer = FakePlayerFactory.get((ServerLevel) level); fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, fakeHoe); if (Items.WOODEN_HOE.useOn(ItemHelper.getItemUseContext(pos, fakePlayer)) == InteractionResult.SUCCESS) { - world.playSound(null, pos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F); + level.playSound(null, pos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F); } } @@ -391,18 +349,18 @@ private void removeStackFromCurrent(ItemStack stack, Player player) { if (getMode(stack) == Mode.BONE_MEAL && getBoneMealCount(stack) > 0) { ItemStack boneMealStack = new ItemStack(Items.BONE_MEAL); int numberToAdd = Math.min(boneMealStack.getMaxStackSize(), getBoneMealCount(stack)); - int numberAdded = InventoryHelper.getItemHandlerFrom(player).map(handler -> InventoryHelper.tryToAddToInventory(boneMealStack, handler, numberToAdd)).orElse(0); + IItemHandler playerInventory = InventoryHelper.getMainInventoryItemHandlerFrom(player); + int numberAdded = InventoryHelper.tryToAddToInventory(boneMealStack, playerInventory, numberToAdd); setBoneMealCount(stack, getBoneMealCount(stack) - numberAdded); } else if (getMode(stack) == Mode.PLANTABLE) { byte plantableSlot = getCurrentPlantableSlot(stack); ItemStack plantableStack = getCurrentPlantable(stack); int plantableQuantity = getPlantableQuantity(stack, plantableSlot); int numberToAdd = Math.min(plantableStack.getMaxStackSize(), plantableQuantity); - int numberAdded = InventoryHelper.getItemHandlerFrom(player).map(handler -> InventoryHelper.tryToAddToInventory(plantableStack, handler, numberToAdd)).orElse(0); - - int updatedPlantableQuantity = getPlantableQuantity(stack, plantableSlot) - numberAdded; + IItemHandler playerInventory = InventoryHelper.getMainInventoryItemHandlerFrom(player); + int numberAdded = InventoryHelper.tryToAddToInventory(plantableStack, playerInventory, numberToAdd); - setPlantableQuantity(stack, plantableSlot, updatedPlantableQuantity); + decrementPlantable(stack, plantableSlot, numberAdded); } } @@ -418,41 +376,28 @@ private void plantItem(ItemStack harvestRod, Player player, BlockPos pos, Intera ItemStack fakePlantableStack = getCurrentPlantable(harvestRod).copy(); fakePlantableStack.setCount(1); - EntityXRFakePlayer fakePlayer = XRFakePlayerFactory.get((ServerLevel) player.level()); + ReliquaryFakePlayer fakePlayer = FakePlayerFactory.get((ServerLevel) player.level()); fakePlayer.setItemInHand(hand, fakePlantableStack); if (fakePlantableStack.useOn(ItemHelper.getItemUseContext(pos, fakePlayer)).consumesAction()) { player.level().playSound(null, player.blockPosition(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.PLAYERS, 0.1F, 0.5F * (RandHelper.getRandomMinusOneToOne(player.level().random) * 0.7F + 1.2F)); if (!player.isCreative()) { - decrementPlantable(harvestRod, plantableSlot); + decrementPlantable(harvestRod, plantableSlot, 1); } } } - private ItemStack getCurrentPlantable(ItemStack harvestRod) { - return getCurrentPlantable(harvestRod, false); - } - - public ItemStack getCurrentPlantable(ItemStack harvestRod, boolean isClient) { + public ItemStack getCurrentPlantable(ItemStack harvestRod) { int currentSlot = getCurrentPlantableSlot(harvestRod); - if (isClient) { - return NBTHelper.getContainedStack(harvestRod, currentSlot); - } - return getPlantableInSlot(harvestRod, currentSlot); } public ItemStack getPlantableInSlot(ItemStack harvestRod, int slot) { - return getPlantableInSlot(harvestRod, slot, false); - } - - private ItemStack getPlantableInSlot(ItemStack harvestRod, int slot, boolean isClient) { - if (isClient) { - return NBTHelper.getContainedStack(harvestRod, slot); + if (slot <= BONEMEAL_SLOT) { + return ItemStack.EMPTY; } - - return getFromHandler(harvestRod, h -> h.getStackInSlot(slot)).orElse(ItemStack.EMPTY); + return getFromHandler(harvestRod, h -> h.getSlots() > slot ? h.getStackInSlot(slot) : ItemStack.EMPTY); } @Override @@ -461,61 +406,53 @@ public void onUseTick(Level level, LivingEntity livingEntity, ItemStack harvestR return; } - if (isCoolDownOver(harvestRod, remainingUseDuration)) { + if (isCoolDownOver(harvestRod, remainingUseDuration, livingEntity)) { BlockHitResult result = getPlayerPOVHitResult(player.level(), player, ClipContext.Fluid.ANY); if (result.getType() == HitResult.Type.BLOCK) { - Level world = player.level(); - harvestRod.getCapability(ModCapabilities.HARVEST_ROD_CACHE, null) - .ifPresent(cache -> doAction(harvestRod, player, world, cache, result.getBlockPos())); + HarvestRodCache harvestRodCache = harvestRod.getCapability(ModItems.HARVEST_ROD_CACHE_CAPABILITY); + if (harvestRodCache != null) { + doAction(harvestRod, player, level, harvestRodCache, result.getBlockPos()); + } } } } - private void doAction(ItemStack harvestRod, Player player, Level world, IHarvestRodCache cache, BlockPos pos) { + private void doAction(ItemStack harvestRod, Player player, Level level, HarvestRodCache cache, BlockPos pos) { switch (getMode(harvestRod)) { case BONE_MEAL: if (getBoneMealCount(harvestRod) >= getBonemealCost() || player.isCreative()) { - getNextBlockToBoneMeal(world, cache, pos, Settings.COMMON.items.harvestRod.aoeRadius.get()) - .ifPresent(blockToBoneMeal -> boneMealBlock(harvestRod, player, world, blockToBoneMeal)); + getNextBlockToBoneMeal(level, cache, pos, Config.COMMON.items.harvestRod.aoeRadius.get()) + .ifPresent(blockToBoneMeal -> boneMealBlock(harvestRod, player, level, blockToBoneMeal)); } break; case PLANTABLE: - if (getCountPlantable(harvestRod) > 0) { - clearPlantableIfNoLongerValid(harvestRod, getCurrentPlantableSlot(harvestRod)); - } if (getPlantableQuantity(harvestRod, getCurrentPlantableSlot(harvestRod)) >= 1 || player.isCreative()) { - getNextBlockToPlantOn(world, cache, pos, Settings.COMMON.items.harvestRod.aoeRadius.get(), (IPlantable) ((BlockItem) getCurrentPlantable(harvestRod).getItem()).getBlock()) + getNextBlockToPlantOn(level, cache, pos, Config.COMMON.items.harvestRod.aoeRadius.get(), getCurrentPlantable(harvestRod)) .ifPresent(blockToPlantOn -> plantItem(harvestRod, player, blockToPlantOn, player.getUsedItemHand())); } break; case HOE: - getNextBlockToHoe(world, cache, pos, Settings.COMMON.items.harvestRod.aoeRadius.get()).ifPresent(blockToHoe -> hoeLand(world, blockToHoe)); + getNextBlockToHoe(level, cache, pos, Config.COMMON.items.harvestRod.aoeRadius.get()).ifPresent(blockToHoe -> hoeLand(level, blockToHoe)); break; default: break; } } - public void clearPlantableIfNoLongerValid(ItemStack harvestRod, byte slot) { - if (getPlantableInSlot(harvestRod, slot).isEmpty()) { - setPlantableQuantityAndGetPlantableStack(harvestRod, slot, 0); - } - } - - private Optional getNextBlockToHoe(Level world, IHarvestRodCache cache, BlockPos pos, int range) { + private Optional getNextBlockToHoe(Level level, HarvestRodCache cache, BlockPos pos, int range) { if (cache.isQueueEmpty() || !pos.equals(cache.getStartBlockPos())) { fillQueue(cache, pos, range, currentPos -> { - BlockState blockState = world.getBlockState(currentPos); + BlockState blockState = level.getBlockState(currentPos); Block block = blockState.getBlock(); - return world.isEmptyBlock(currentPos.above()) && (block == Blocks.GRASS_BLOCK || block == Blocks.DIRT_PATH || block == Blocks.DIRT || block == Blocks.COARSE_DIRT); + return level.isEmptyBlock(currentPos.above()) && (block == Blocks.GRASS_BLOCK || block == Blocks.DIRT_PATH || block == Blocks.DIRT || block == Blocks.COARSE_DIRT); }); } return cache.getNextBlockInQueue(); } - private void fillQueue(IHarvestRodCache cache, BlockPos pos, int range, Predicate isValidBlock) { + private void fillQueue(HarvestRodCache cache, BlockPos pos, int range, Predicate isValidBlock) { cache.setStartBlockPos(pos); cache.clearBlockQueue(); BlockPos.betweenClosedStream(pos.offset(-range, -range, -range), pos.offset(range, range, range)) @@ -526,19 +463,19 @@ private void fillQueue(IHarvestRodCache cache, BlockPos pos, int range, Predicat }); } - private Optional getNextBlockToPlantOn(Level world, IHarvestRodCache cache, BlockPos pos, int range, IPlantable plantable) { + private Optional getNextBlockToPlantOn(Level level, HarvestRodCache cache, BlockPos pos, int range, ItemStack plantable) { if (cache.isQueueEmpty() || !pos.equals(cache.getStartBlockPos())) { - fillQueueToPlant(world, cache, pos, range, plantable); + fillQueueToPlant(level, cache, pos, range, plantable); } return cache.getNextBlockInQueue(); } - private void fillQueueToPlant(Level world, IHarvestRodCache cache, BlockPos pos, int range, IPlantable plantable) { + private void fillQueueToPlant(Level level, HarvestRodCache cache, BlockPos pos, int range, ItemStack plantable) { boolean checkerboard = false; boolean bothOddOrEven = false; - if (plantable == Blocks.PUMPKIN_STEM || plantable == Blocks.MELON_STEM) { + if (plantable.getItem() == Items.PUMPKIN_SEEDS || plantable.getItem() == Items.MELON_SEEDS) { checkerboard = true; boolean xEven = pos.getX() % 2 == 0; boolean zEven = pos.getZ() % 2 == 0; @@ -547,10 +484,17 @@ private void fillQueueToPlant(Level world, IHarvestRodCache cache, BlockPos pos, boolean finalCheckerboard = checkerboard; boolean finalBothOddOrEven = bothOddOrEven; - fillQueue(cache, pos, range, currentPos -> { - BlockState blockState = world.getBlockState(currentPos); - return (!finalCheckerboard || (finalBothOddOrEven == ((currentPos.getX() % 2 == 0) == (currentPos.getZ() % 2 == 0)))) && blockState.getBlock().canSustainPlant(blockState, world, pos, Direction.UP, plantable) && world.isEmptyBlock(currentPos.above()); - }); + fillQueue(cache, pos, range, currentPos -> + (!finalCheckerboard || (finalBothOddOrEven == ((currentPos.getX() % 2 == 0) == (currentPos.getZ() % 2 == 0)))) + && level.isEmptyBlock(currentPos.above()) + && canPlacePlantableAt(level, currentPos.above(), plantable)); + } + + public static boolean canPlacePlantableAt(Level level, BlockPos pos, ItemStack plantable) { + if (plantable.getItem() instanceof SpecialPlantable specialPlantable && specialPlantable.canPlacePlantAtPosition(plantable, level, pos, null)) { + return true; + } + return (plantable.getItem() instanceof BlockItem blockItem && blockItem.getBlock().defaultBlockState().canSurvive(level, pos)); } @Override @@ -562,15 +506,15 @@ public InteractionResult onMouseScrolled(ItemStack stack, Player player, double return InteractionResult.SUCCESS; } - private boolean isCoolDownOver(ItemStack stack, int count) { - return getUseDuration(stack) - count >= AOE_START_COOLDOWN && (getUseDuration(stack) - count) % Settings.COMMON.items.harvestRod.aoeCooldown.get() == 0; + private boolean isCoolDownOver(ItemStack stack, int count, LivingEntity livingEntity) { + return getUseDuration(stack, livingEntity) - count >= AOE_START_COOLDOWN && (getUseDuration(stack, livingEntity) - count) % Config.COMMON.items.harvestRod.aoeCooldown.get() == 0; } - private Optional getNextBlockToBoneMeal(Level world, IHarvestRodCache cache, BlockPos pos, int range) { + private Optional getNextBlockToBoneMeal(Level level, HarvestRodCache cache, BlockPos pos, int range) { if (cache.isQueueEmpty() || !pos.equals(cache.getStartBlockPos())) { fillQueue(cache, pos, range, currentPos -> { - BlockState blockState = world.getBlockState(currentPos); - return blockState.getBlock() instanceof BonemealableBlock bonemealableBlock && bonemealableBlock.isValidBonemealTarget(world, currentPos, blockState, world.isClientSide); + BlockState blockState = level.getBlockState(currentPos); + return blockState.getBlock() instanceof BonemealableBlock bonemealableBlock && bonemealableBlock.isValidBonemealTarget(level, currentPos, blockState); }); } @@ -579,7 +523,7 @@ private Optional getNextBlockToBoneMeal(Level world, IHarvestRodCache private void cycleMode(ItemStack harvestRod, boolean next) { Mode currentMode = getMode(harvestRod); - int plantableCount = getCountPlantable(harvestRod); + int plantableCount = getCountOfPlantables(harvestRod); if (next) { setNextMode(harvestRod, currentMode, plantableCount); } else { @@ -619,77 +563,39 @@ private void setNextMode(ItemStack harvestRod, Mode currentMode, int plantableCo setMode(harvestRod, nextMode); } - public int getCountPlantable(ItemStack harvestRod) { - return getCountPlantable(harvestRod, false); - } - - private int getCountPlantable(ItemStack harvestRod, boolean isClient) { - if (isClient) { - return NBTHelper.getCountContainedStacks(harvestRod); - } - - return getFromHandler(harvestRod, HarvestRodItemStackHandler::getCountPlantable).orElse(0); + public int getCountOfPlantables(ItemStack harvestRod) { + return getFromHandler(harvestRod, h -> Math.max(h.getSlots() - 1, 0)); } public byte getCurrentPlantableSlot(ItemStack stack) { - //noinspection ConstantConditions - return stack.hasTag() ? stack.getTag().getByte(PLANTABLE_INDEX_NBT_TAG) : (byte) -1; + return stack.getOrDefault(ModDataComponents.PLANTABLE_INDEX, (byte) -1); } private void setCurrentPlantableSlot(ItemStack stack, byte index) { - if (stack.hasTag()) { - //noinspection ConstantConditions - stack.getTag().putByte(PLANTABLE_INDEX_NBT_TAG, index); - updateContainedStacks(stack); - } + stack.set(ModDataComponents.PLANTABLE_INDEX, index); } private void setMode(ItemStack stack, Mode mode) { - NBTHelper.putString(MODE_NBT_TAG, stack, mode.getSerializedName()); - updateContainedStacks(stack); - } - - public void updateContainedStacks(ItemStack stack) { - NBTHelper.removeContainedStacks(stack); - NBTHelper.updateContainedStack(stack, (short) HarvestRodItemStackHandler.BONEMEAL_SLOT, ItemStack.EMPTY, getBoneMealCount(stack)); - for (short slot = 1; slot < getCountPlantable(stack) + 1; slot++) { - NBTHelper.updateContainedStack(stack, slot, getPlantableInSlot(stack, slot), getPlantableQuantity(stack, slot)); - } + stack.set(ModDataComponents.HARVEST_ROD_MODE, mode); } public Mode getMode(ItemStack stack) { - return NBTHelper.getEnumConstant(stack, MODE_NBT_TAG, Mode::valueOf).orElse(Mode.BONE_MEAL); + return stack.getOrDefault(ModDataComponents.HARVEST_ROD_MODE, Mode.BONE_MEAL); } - public int getPlantableQuantity(ItemStack harvestRod, int parentSlot) { - return getPlantableQuantity(harvestRod, parentSlot, false); - } - - public int getPlantableQuantity(ItemStack harvestRod, int slot, boolean isClient) { - if (isClient) { - return NBTHelper.getContainedStackCount(harvestRod, slot); - } - - return getFromHandler(harvestRod, h -> h.getTotalAmount(slot)).orElse(0); - } - - public Optional setPlantableQuantityAndGetPlantableStack(ItemStack harvestRod, byte plantableSlot, int quantity) { - runOnHandler(harvestRod, h -> h.setTotalCount(plantableSlot, quantity)); - if (quantity == 0) { - shiftModeOnEmptyPlantable(harvestRod, plantableSlot); - return Optional.empty(); + public int getPlantableQuantity(ItemStack harvestRod, int slot) { + if (slot <= BONEMEAL_SLOT) { + return 0; } - return getFromHandler(harvestRod, h -> h.getStackInSlot(plantableSlot)); - } - - private void setPlantableQuantity(ItemStack harvestRod, byte plantableSlot, int quantity) { - setPlantableQuantityAndGetPlantableStack(harvestRod, plantableSlot, quantity) - .ifPresent(plantableStack -> updateContainedItemNBT(harvestRod, plantableSlot, plantableStack, plantableStack.getCount())); + return getFromHandler(harvestRod, h -> h.getSlots() > slot ? h.getCountInSlot(slot) : 0); } public enum Mode implements StringRepresentable { BONE_MEAL, PLANTABLE, HOE; + public static final Codec CODEC = StringRepresentable.fromEnum(Mode::values); + public static final StreamCodec STREAM_CODEC = NeoForgeStreamCodecs.enumCodec(Mode.class); + @Override public String getSerializedName() { return name(); diff --git a/src/main/java/reliquary/items/HeroMedallionItem.java b/src/main/java/reliquary/items/HeroMedallionItem.java index 0b2c5d35..88f00c85 100644 --- a/src/main/java/reliquary/items/HeroMedallionItem.java +++ b/src/main/java/reliquary/items/HeroMedallionItem.java @@ -2,8 +2,9 @@ import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; -import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -15,23 +16,22 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; import net.minecraft.world.item.UseAnim; -import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; +import net.minecraft.world.item.enchantment.ItemEnchantments; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.items.IItemHandler; +import net.neoforged.neoforge.items.IItemHandler; +import reliquary.Reliquary; import reliquary.api.IPedestal; import reliquary.api.IPedestalActionItem; +import reliquary.init.ModDataComponents; import reliquary.items.util.IScrollableItem; -import reliquary.items.util.fluid.FluidHandlerHeroMedallion; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; -import reliquary.util.NBTHelper; +import reliquary.util.PlayerInventoryProvider; import reliquary.util.TooltipBuilder; import reliquary.util.XpHelper; @@ -39,21 +39,13 @@ import java.util.List; public class HeroMedallionItem extends ToggleableItem implements IPedestalActionItem, IScrollableItem { - private static final String EXPERIENCE_TAG = "experience"; - public HeroMedallionItem() { - super(new Properties().durability(0).setNoRepair()); - } - - @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; + super(new Properties().durability(0).setNoRepair().rarity(Rarity.EPIC)); } @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { - return NBTHelper.getBoolean("enabled", stack); + return stack.getOrDefault(ModDataComponents.ENABLED, false); } @Override @@ -62,9 +54,8 @@ public UseAnim getUseAnimation(ItemStack stack) { } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack medallion, @Nullable Level world, TooltipBuilder tooltipBuilder) { - int experience = NBTHelper.getInt(EXPERIENCE_TAG, medallion); + protected void addMoreInformation(ItemStack medallion, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { + int experience = getExperience(medallion); int levels = XpHelper.getLevelForExperience(experience); int remainingExperience = experience - XpHelper.getExperienceForLevel(levels); tooltipBuilder.data(this, ".tooltip2", levels, remainingExperience); @@ -84,13 +75,29 @@ protected boolean hasMoreInformation(ItemStack stack) { } @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || !isEnabled(stack) || world.getGameTime() % 10 != 0) { + public void inventoryTick(ItemStack stack, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || !isEnabled(stack) || level.getGameTime() % 10 != 0) { return; } - if (entity instanceof Player player && (!player.isUsingItem() || player.getUseItem() != stack)) { + if ((!player.isUsingItem() || player.getUseItem() != stack)) { drainExperienceLevel(stack, player); } + + repairItemsInPlayersInventory(stack, player); + } + + private void repairItemsInPlayersInventory(ItemStack heroMedallion, Player player) { + long cooldownTime = heroMedallion.getOrDefault(ModDataComponents.COOLDOWN_TIME, 0L); + if (cooldownTime > player.level().getGameTime()) { + return; + } + heroMedallion.set(ModDataComponents.COOLDOWN_TIME, player.level().getGameTime() + Config.COMMON.items.heroMedallion.repairCoolDown.get()); + + PlayerInventoryProvider.get().runOnPlayerInventoryHandlers(player, stack -> { + if (canRepairWithXp(stack)) { + repairItemWithXp(heroMedallion, stack); + } + }); } private void drainExperienceLevel(ItemStack stack, Player player) { @@ -129,11 +136,11 @@ private void increaseMedallionExperience(ItemStack stack, int xpPoints) { } public int getExperience(ItemStack stack) { - return NBTHelper.getInt(EXPERIENCE_TAG, stack); + return stack.getOrDefault(ModDataComponents.EXPERIENCE, 0); } - public void setExperience(ItemStack stack, int i) { - NBTHelper.putInt(EXPERIENCE_TAG, stack, i); + public void setExperience(ItemStack stack, int experience) { + stack.set(ModDataComponents.EXPERIENCE, experience); } @Override @@ -169,15 +176,15 @@ private void drainExperience(ItemStack stack, Player player, Level level, int xp } @Override - public void releaseUsing(ItemStack stack, Level worldIn, LivingEntity entityLiving, int timeLeft) { - if (entityLiving.level().isClientSide || isEnabled(stack) || !(entityLiving instanceof Player) || getUseDuration(stack) - timeLeft > 10) { + public void releaseUsing(ItemStack stack, Level level, LivingEntity livingEntity, int timeLeft) { + if (livingEntity.level().isClientSide || isEnabled(stack) || !(livingEntity instanceof Player) || getUseDuration(stack, livingEntity) - timeLeft > 10) { return; } - drainExperience(stack, (Player) entityLiving, entityLiving.level(), 1); + drainExperience(stack, (Player) livingEntity, livingEntity.level(), 1); } - private void spawnXpOnGround(ItemStack stack, Level world, BlockPos hitPos, int xpLevels) { + private void spawnXpOnGround(ItemStack stack, Level level, BlockPos hitPos, int xpLevels) { int xp = XpHelper.getExperienceForLevel(xpLevels); if (getExperience(stack) >= xp) { @@ -186,50 +193,61 @@ private void spawnXpOnGround(ItemStack stack, Level world, BlockPos hitPos, int while (xp > 0) { int j = ExperienceOrb.getExperienceValue(xp); xp -= j; - world.addFreshEntity(new ExperienceOrb(world, hitPos.getX(), hitPos.getY(), hitPos.getZ(), j)); + level.addFreshEntity(new ExperienceOrb(level, hitPos.getX(), hitPos.getY(), hitPos.getZ(), j)); } } } - @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - return new FluidHandlerHeroMedallion(stack); - } - @Override public void update(ItemStack stack, Level level, IPedestal pedestal) { - List posInRange = pedestal.getPedestalsInRange(level, Settings.COMMON.items.heroMedallion.pedestalRange.get()); + List posInRange = pedestal.getPedestalsInRange(level, Config.COMMON.items.heroMedallion.pedestalRange.get()); for (BlockPos pedestalPos : posInRange) { - InventoryHelper.getInventoryAtPos(level, pedestalPos).ifPresent(pedestalInventory -> { - List toRepair = getMendingItemsForRepair(pedestalInventory); - - for (ItemStack itemToRepair : toRepair) { - int xpToRepair = Math.min(Settings.COMMON.items.heroMedallion.pedestalRepairStepXP.get(), getExperience(stack)); - int durabilityToRepair = Math.min(XpHelper.xpToDurability(xpToRepair), itemToRepair.getDamageValue()); + InventoryHelper.runOnInventoryAt(level, pedestalPos, pedestalInventory -> repairItemsWithXp(stack, pedestalInventory)); + } + pedestal.setActionCoolDown(Config.COMMON.items.heroMedallion.repairCoolDown.get()); + } - setExperience(stack, getExperience(stack) - XpHelper.durabilityToXp(durabilityToRepair)); - itemToRepair.setDamageValue(itemToRepair.getDamageValue() - durabilityToRepair); - } - }); + private void repairItemsWithXp(ItemStack stack, IItemHandler inventory) { + for (ItemStack itemToRepair : getItemsRepairedWithXp(inventory)) { + repairItemWithXp(stack, itemToRepair); } - pedestal.setActionCoolDown(Settings.COMMON.items.heroMedallion.pedestalCoolDown.get()); } - private List getMendingItemsForRepair(IItemHandler inventory) { + private void repairItemWithXp(ItemStack heroMedallion, ItemStack itemToRepair) { + int xpToRepair = Math.min(Config.COMMON.items.heroMedallion.repairStepXP.get(), getExperience(heroMedallion)); + int durabilityToRepair = Math.min(XpHelper.xpToDurability(xpToRepair), itemToRepair.getDamageValue()); + + setExperience(heroMedallion, getExperience(heroMedallion) - XpHelper.durabilityToXp(durabilityToRepair)); + itemToRepair.setDamageValue(itemToRepair.getDamageValue() - durabilityToRepair); + } + + private List getItemsRepairedWithXp(IItemHandler inventory) { NonNullList stacksToReturn = NonNullList.create(); for (int slot = 0; slot < inventory.getSlots(); slot++) { ItemStack stack = inventory.getStackInSlot(slot); - //only getting items that are more than 1 damaged to not waste xp - if (stack.isDamaged() && stack.getDamageValue() > 1 && stack.getEnchantmentLevel(Enchantments.MENDING) > 0) { + if (canRepairWithXp(stack)) { stacksToReturn.add(stack); } } - return stacksToReturn; } + private boolean canRepairWithXp(ItemStack stack) { + if (stack.isDamaged() && stack.getDamageValue() > 1) { + ItemEnchantments itemenchantments = stack.getTagEnchantments(); + + for (Holder enchantment : itemenchantments.keySet()) { + if (enchantment.value().effects().has(EnchantmentEffectComponents.REPAIR_WITH_XP)) { + return true; + } + } + + } + return false; + } + @Override public void onRemoved(ItemStack stack, Level level, IPedestal pedestal) { //nothing needed @@ -250,29 +268,29 @@ public InteractionResult onMouseScrolled(ItemStack stack, Player player, double if (isEnabled(stack)) { int newLevels = Math.max(0, getStopAtXpLevel(stack) + levelAddition); setStopAtXpLevel(stack, newLevels); - player.displayClientMessage(Component.translatable("chat." + Reference.MOD_ID + ".hero_medallion.fill_levels", Component.literal(String.valueOf(newLevels)).withStyle(ChatFormatting.GREEN)), true); + player.displayClientMessage(Component.translatable("chat." + Reliquary.MOD_ID + ".hero_medallion.fill_levels", Component.literal(String.valueOf(newLevels)).withStyle(ChatFormatting.GREEN)), true); } else { int newLevels = Math.max(1, getDrainXpLevels(stack) + levelAddition); setDrainXpLevels(stack, newLevels); - player.displayClientMessage(Component.translatable("chat." + Reference.MOD_ID + ".hero_medallion.drain_levels", Component.literal(String.valueOf(newLevels)).withStyle(ChatFormatting.RED)), true); + player.displayClientMessage(Component.translatable("chat." + Reliquary.MOD_ID + ".hero_medallion.drain_levels", Component.literal(String.valueOf(newLevels)).withStyle(ChatFormatting.RED)), true); } return InteractionResult.SUCCESS; } private int getDrainXpLevels(ItemStack stack) { - return NBTHelper.getInt(stack, "drainXpLevels").orElse(1); + return stack.getOrDefault(ModDataComponents.DRAIN_XP_LEVELS, 1); } private int getStopAtXpLevel(ItemStack stack) { - return NBTHelper.getInt(stack, "stopAtXpLevel").orElse(0); + return stack.getOrDefault(ModDataComponents.STOP_AT_XP_LEVEL, 0); } private void setDrainXpLevels(ItemStack stack, int levels) { - NBTHelper.putInt("drainXpLevels", stack, levels); + stack.set(ModDataComponents.DRAIN_XP_LEVELS, levels); } private void setStopAtXpLevel(ItemStack stack, int levels) { - NBTHelper.putInt("stopAtXpLevel", stack, levels); + stack.set(ModDataComponents.STOP_AT_XP_LEVEL, levels); } } diff --git a/src/main/java/reliquary/items/HolyHandGrenadeItem.java b/src/main/java/reliquary/items/HolyHandGrenadeItem.java index e5a8d0b4..1865a8ac 100644 --- a/src/main/java/reliquary/items/HolyHandGrenadeItem.java +++ b/src/main/java/reliquary/items/HolyHandGrenadeItem.java @@ -1,31 +1,27 @@ package reliquary.items; +import net.minecraft.core.Direction; +import net.minecraft.core.Position; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; 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.ProjectileItem; import net.minecraft.world.item.Rarity; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import reliquary.entities.HolyHandGrenadeEntity; +import reliquary.entities.HolyHandGrenade; -public class HolyHandGrenadeItem extends ItemBase { +public class HolyHandGrenadeItem extends ItemBase implements ProjectileItem { public HolyHandGrenadeItem() { - super(new Properties()); + super(new Properties().rarity(Rarity.RARE)); } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.RARE; - } - - @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return true; } @@ -43,11 +39,15 @@ public InteractionResultHolder use(Level level, Player player, Intera } level.playSound(null, player.blockPosition(), SoundEvents.ARROW_SHOOT, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.random.nextFloat() * 0.4F + 0.8F)); - HolyHandGrenadeEntity grenade = new HolyHandGrenadeEntity(level, player, stack.getHoverName().getString()); + HolyHandGrenade grenade = new HolyHandGrenade(level, player, stack.getHoverName().getString()); grenade.shootFromRotation(player, player.getXRot(), player.getYRot(), -20.0F, 0.7F, 1.0F); level.addFreshEntity(grenade); return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } + @Override + public Projectile asProjectile(Level level, Position position, ItemStack itemStack, Direction direction) { + return new HolyHandGrenade(level, position); + } } diff --git a/src/main/java/reliquary/items/IceMagusRodItem.java b/src/main/java/reliquary/items/IceMagusRodItem.java index 17d7f8b6..8ff2db29 100644 --- a/src/main/java/reliquary/items/IceMagusRodItem.java +++ b/src/main/java/reliquary/items/IceMagusRodItem.java @@ -1,5 +1,6 @@ package reliquary.items; +import net.minecraft.core.HolderLookup; import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -12,28 +13,24 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.Rarity; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import org.joml.Vector3f; -import reliquary.entities.SpecialSnowballEntity; -import reliquary.reference.Settings; -import reliquary.util.NBTHelper; +import reliquary.entities.SpecialSnowball; +import reliquary.init.ModDataComponents; +import reliquary.reference.Config; import reliquary.util.TooltipBuilder; import javax.annotation.Nullable; public class IceMagusRodItem extends ToggleableItem { public static final DustParticleOptions ICE_PARTICLE = new DustParticleOptions(new Vector3f(99 / 255F, 196 / 255F, 253 / 255F), 1); - private static final String SNOWBALLS_TAG = "snowballs"; public IceMagusRodItem() { - super(new Properties().stacksTo(1).setNoRepair()); + super(new Properties().stacksTo(1).setNoRepair().rarity(Rarity.EPIC)); } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack rod, @Nullable Level world, TooltipBuilder tooltipBuilder) { - tooltipBuilder.charge(this, ".tooltip2", getSnowballCharge(rod)); + protected void addMoreInformation(ItemStack rod, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { + tooltipBuilder.charge(this, ".tooltip2", getSnowballs(rod)); if (isEnabled(rod)) { tooltipBuilder.absorbActive(Items.SNOWBALL.getName(new ItemStack(Items.SNOWBALL)).getString()); } else { @@ -41,25 +38,21 @@ protected void addMoreInformation(ItemStack rod, @Nullable Level world, TooltipB } } - private static int getSnowballCharge(ItemStack rod) { - return NBTHelper.getInt(SNOWBALLS_TAG, rod); - } - @Override protected boolean hasMoreInformation(ItemStack stack) { return true; } private int getSnowballCap() { - return this instanceof GlacialStaffItem ? Settings.COMMON.items.glacialStaff.snowballLimit.get() : Settings.COMMON.items.iceMagusRod.snowballLimit.get(); + return this instanceof GlacialStaffItem ? Config.COMMON.items.glacialStaff.snowballLimit.get() : Config.COMMON.items.iceMagusRod.snowballLimit.get(); } int getSnowballCost() { - return this instanceof GlacialStaffItem ? Settings.COMMON.items.glacialStaff.snowballCost.get() : Settings.COMMON.items.iceMagusRod.snowballCost.get(); + return this instanceof GlacialStaffItem ? Config.COMMON.items.glacialStaff.snowballCost.get() : Config.COMMON.items.iceMagusRod.snowballCost.get(); } private int getSnowballWorth() { - return this instanceof GlacialStaffItem ? Settings.COMMON.items.glacialStaff.snowballWorth.get() : Settings.COMMON.items.iceMagusRod.snowballWorth.get(); + return this instanceof GlacialStaffItem ? Config.COMMON.items.glacialStaff.snowballWorth.get() : Config.COMMON.items.iceMagusRod.snowballWorth.get(); } @Override @@ -67,33 +60,36 @@ public InteractionResultHolder use(Level level, Player player, Intera ItemStack stack = player.getItemInHand(hand); //acts as a cooldown. player.swing(hand); - if (!player.isShiftKeyDown() && (getSnowballCharge(stack) >= getSnowballCost() || player.isCreative())) { + if (!player.isShiftKeyDown() && (getSnowballs(stack) >= getSnowballCost() || player.isCreative())) { level.playSound(null, player.blockPosition(), SoundEvents.ARROW_SHOOT, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.random.nextFloat() * 0.4F + 0.8F)); - SpecialSnowballEntity snowball = new SpecialSnowballEntity(level, player, this instanceof GlacialStaffItem); + SpecialSnowball snowball = new SpecialSnowball(level, player, this instanceof GlacialStaffItem); snowball.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 2.4F, 1.0F); level.addFreshEntity(snowball); if (!player.isCreative()) { - NBTHelper.putInt(SNOWBALLS_TAG, stack, getSnowballCharge(stack) - getSnowballCost()); + setSnowballs(stack, getSnowballs(stack) - getSnowballCost()); } return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } return super.use(level, player, hand); } - @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; + public static int getSnowballs(ItemStack stack) { + return stack.getOrDefault(ModDataComponents.SNOWBALLS, 0); + } + + protected void setSnowballs(ItemStack stack, int snowballs) { + stack.set(ModDataComponents.SNOWBALLS, snowballs); } @Override - public void inventoryTick(ItemStack rod, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || world.getGameTime() % 10 != 0 || !(entity instanceof Player)) { + public void inventoryTick(ItemStack rod, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 10 != 0) { return; } if (isEnabled(rod)) { - int snowCharge = getSnowballCharge(rod); + int snowCharge = getSnowballs(rod); consumeAndCharge((Player) entity, getSnowballCap() - snowCharge, getSnowballWorth(), Items.SNOWBALL, 16, - chargeToAdd -> NBTHelper.putInt(SNOWBALLS_TAG, rod, snowCharge + chargeToAdd)); + chargeToAdd -> setSnowballs(rod, snowCharge + chargeToAdd)); } } } diff --git a/src/main/java/reliquary/items/InfernalChaliceItem.java b/src/main/java/reliquary/items/InfernalChaliceItem.java index 509e9da8..7ab1cb1a 100644 --- a/src/main/java/reliquary/items/InfernalChaliceItem.java +++ b/src/main/java/reliquary/items/InfernalChaliceItem.java @@ -2,7 +2,9 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.HolderLookup; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; import net.minecraft.tags.DamageTypeTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -17,24 +19,20 @@ import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.event.entity.living.LivingAttackEvent; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidType; -import net.minecraftforge.fluids.capability.IFluidHandler; -import net.minecraftforge.fluids.capability.IFluidHandlerItem; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidType; +import net.neoforged.neoforge.fluids.SimpleFluidContent; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; import reliquary.handler.CommonEventHandler; import reliquary.handler.HandlerPriority; import reliquary.handler.IPlayerHurtHandler; +import reliquary.init.ModDataComponents; import reliquary.init.ModItems; -import reliquary.items.util.fluid.FluidHandlerInfernalChalice; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; -import reliquary.util.NBTHelper; import reliquary.util.TooltipBuilder; import javax.annotation.Nullable; @@ -45,15 +43,15 @@ public InfernalChaliceItem() { CommonEventHandler.registerPlayerHurtHandler(new IPlayerHurtHandler() { @Override - public boolean canApply(Player player, LivingAttackEvent event) { + public boolean canApply(Player player, LivingIncomingDamageEvent event) { return (event.getSource().is(DamageTypeTags.IS_FIRE)) && player.getFoodData().getFoodLevel() > 0 && InventoryHelper.playerHasItem(player, ModItems.INFERNAL_CHALICE.get()); } @Override - public boolean apply(Player player, LivingAttackEvent event) { - player.causeFoodExhaustion(event.getAmount() * ((float) Settings.COMMON.items.infernalChalice.hungerCostPercent.get() / 100F)); + public boolean apply(Player player, LivingIncomingDamageEvent event) { + player.causeFoodExhaustion(event.getAmount() * ((float) Config.COMMON.items.infernalChalice.hungerCostPercent.get() / 100F)); return true; } @@ -65,9 +63,8 @@ public HandlerPriority getPriority() { } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack chalice, @Nullable Level world, TooltipBuilder tooltipBuilder) { - tooltipBuilder.charge(this, ".tooltip2", NBTHelper.getInt("fluidStacks", chalice)); + protected void addMoreInformation(ItemStack chalice, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { + tooltipBuilder.charge(this, ".tooltip2", chalice.getOrDefault(ModDataComponents.FLUID_CONTENTS, SimpleFluidContent.EMPTY).getAmount()); if (isEnabled(chalice)) { tooltipBuilder.description("tooltip.reliquary.place"); } else { @@ -81,19 +78,19 @@ protected boolean hasMoreInformation(ItemStack stack) { } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (player.isShiftKeyDown()) { - return super.use(world, player, hand); + return super.use(level, player, hand); } - BlockHitResult result = getPlayerPOVHitResult(world, player, isEnabled(stack) ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE); + BlockHitResult result = getPlayerPOVHitResult(level, player, isEnabled(stack) ? ClipContext.Fluid.SOURCE_ONLY : ClipContext.Fluid.NONE); if (result.getType() != HitResult.Type.BLOCK) { return new InteractionResultHolder<>(InteractionResult.PASS, stack); } else { BlockPos pos = result.getBlockPos(); - if (!world.mayInteract(player, pos)) { + if (!level.mayInteract(player, pos)) { return new InteractionResultHolder<>(InteractionResult.PASS, stack); } @@ -102,15 +99,21 @@ public InteractionResultHolder use(Level world, Player player, Intera return new InteractionResultHolder<>(InteractionResult.PASS, stack); } - return getFluidHandler(stack).map(fluidHandler -> interactWithFluidHandler(world, player, stack, pos, face, fluidHandler)).orElse(new InteractionResultHolder<>(InteractionResult.FAIL, stack)); + IFluidHandlerItem fluidHandler = stack.getCapability(Capabilities.FluidHandler.ITEM); + if (fluidHandler == null) { + return new InteractionResultHolder<>(InteractionResult.FAIL, stack); + } + + return interactWithFluidHandler(level, player, stack, pos, face, fluidHandler); } } - private InteractionResultHolder interactWithFluidHandler(Level world, Player player, ItemStack stack, BlockPos pos, Direction face, IFluidHandlerItem fluidHandler) { - BlockState blockState = world.getBlockState(pos); + private InteractionResultHolder interactWithFluidHandler(Level level, Player player, ItemStack stack, BlockPos pos, Direction face, IFluidHandlerItem fluidHandler) { + BlockState blockState = level.getBlockState(pos); if (isEnabled(stack)) { if (blockState.getBlock() == Blocks.LAVA && blockState.getValue(LiquidBlock.LEVEL) == 0 && fluidHandler.fill(new FluidStack(Fluids.LAVA, FluidType.BUCKET_VOLUME), IFluidHandler.FluidAction.SIMULATE) == FluidType.BUCKET_VOLUME) { - world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + Fluids.LAVA.getPickupSound().ifPresent(soundEvent -> level.playSound(player, pos, soundEvent, SoundSource.BLOCKS, 1.0F, 1.0F)); fluidHandler.fill(new FluidStack(Fluids.LAVA, FluidType.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE); return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } @@ -118,7 +121,7 @@ private InteractionResultHolder interactWithFluidHandler(Level world, FluidStack fluidDrained = fluidHandler.drain(new FluidStack(Fluids.LAVA, FluidType.BUCKET_VOLUME), IFluidHandler.FluidAction.SIMULATE); if (player.isCreative() || fluidDrained.getAmount() == FluidType.BUCKET_VOLUME) { BlockPos adjustedPos = pos.relative(face); - if (tryPlaceContainedLiquid(world, adjustedPos) && !player.isCreative()) { + if (tryPlaceContainedLiquid(player, level, adjustedPos) && !player.isCreative()) { fluidHandler.drain(new FluidStack(Fluids.LAVA, FluidType.BUCKET_VOLUME), IFluidHandler.FluidAction.EXECUTE); return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } @@ -127,22 +130,19 @@ private InteractionResultHolder interactWithFluidHandler(Level world, return new InteractionResultHolder<>(InteractionResult.PASS, stack); } - private LazyOptional getFluidHandler(ItemStack stack) { - return stack.getCapability(ForgeCapabilities.FLUID_HANDLER_ITEM, null); - } - - private boolean tryPlaceContainedLiquid(Level world, BlockPos pos) { - BlockState blockState = world.getBlockState(pos); - if (!world.isEmptyBlock(pos) && blockState.isSolid()) { + private boolean tryPlaceContainedLiquid(Player player, Level level, BlockPos pos) { + BlockState blockState = level.getBlockState(pos); + if (!blockState.canBeReplaced(Fluids.LAVA)) { return false; } else { - world.setBlock(pos, Blocks.LAVA.defaultBlockState(), 3); + level.setBlock(pos, Blocks.LAVA.defaultBlockState(), 3); + level.playSound(player, pos, SoundEvents.BUCKET_EMPTY_LAVA, SoundSource.BLOCKS, 1, 1); return true; } } - @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - return new FluidHandlerInfernalChalice(stack); + public static int getFluidBucketAmount(ItemStack stack) { + IFluidHandlerItem fluidHandler = stack.getCapability(Capabilities.FluidHandler.ITEM); + return fluidHandler != null ? fluidHandler.getFluidInTank(0).getAmount() / FluidType.BUCKET_VOLUME : 0; } } diff --git a/src/main/java/reliquary/items/InfernalClawsItem.java b/src/main/java/reliquary/items/InfernalClawsItem.java index a2a1f46e..5ed7d8aa 100644 --- a/src/main/java/reliquary/items/InfernalClawsItem.java +++ b/src/main/java/reliquary/items/InfernalClawsItem.java @@ -4,14 +4,12 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; import reliquary.handler.CommonEventHandler; import reliquary.handler.HandlerPriority; import reliquary.handler.IPlayerHurtHandler; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; public class InfernalClawsItem extends ItemBase { @@ -20,7 +18,7 @@ public InfernalClawsItem() { CommonEventHandler.registerPlayerHurtHandler(new IPlayerHurtHandler() { @Override - public boolean canApply(Player player, LivingAttackEvent event) { + public boolean canApply(Player player, LivingIncomingDamageEvent event) { return (event.getSource() == player.damageSources().inFire() || event.getSource() == player.damageSources().onFire()) && player.getFoodData().getFoodLevel() > 0 && InventoryHelper.playerHasItem(player, ModItems.INFERNAL_CLAWS.get()); @@ -28,8 +26,8 @@ public boolean canApply(Player player, LivingAttackEvent event) { } @Override - public boolean apply(Player player, LivingAttackEvent event) { - player.causeFoodExhaustion(event.getAmount() * ((float) Settings.COMMON.items.infernalClaws.hungerCostPercent.get() / 100F)); + public boolean apply(Player player, LivingIncomingDamageEvent event) { + player.causeFoodExhaustion(event.getAmount() * ((float) Config.COMMON.items.infernalClaws.hungerCostPercent.get() / 100F)); return true; } @@ -46,7 +44,6 @@ public MutableComponent getName(ItemStack stack) { } @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return true; } diff --git a/src/main/java/reliquary/items/InfernalTearItem.java b/src/main/java/reliquary/items/InfernalTearItem.java index 358a92f8..b4cce369 100644 --- a/src/main/java/reliquary/items/InfernalTearItem.java +++ b/src/main/java/reliquary/items/InfernalTearItem.java @@ -1,7 +1,8 @@ package reliquary.items; import net.minecraft.ChatFormatting; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.InteractionHand; @@ -12,15 +13,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.component.ItemContainerContents; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; -import reliquary.reference.Reference; -import reliquary.reference.Settings; +import net.neoforged.neoforge.items.IItemHandler; +import reliquary.Reliquary; +import reliquary.init.ModDataComponents; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; -import reliquary.util.NBTHelper; import reliquary.util.RegistryHelper; import reliquary.util.TooltipBuilder; @@ -29,12 +28,11 @@ import java.util.Optional; public class InfernalTearItem extends ToggleableItem { - private static final String ENABLED_TAG = "enabled"; private static final int COOLDOWN = 4; private static final int NOTHING_FOUND_COOLDOWN = COOLDOWN * 5; public InfernalTearItem() { - super(new Properties().stacksTo(1).setNoRepair()); + super(new Properties().stacksTo(1).setNoRepair().rarity(Rarity.EPIC)); } @Override @@ -43,59 +41,55 @@ public MutableComponent getName(ItemStack stack) { } @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || world.getGameTime() % COOLDOWN != 0 || !isEnabled(stack) || isInCooldown(stack, world) || !(entity instanceof Player player)) { + public void inventoryTick(ItemStack tear, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % COOLDOWN != 0 || !isEnabled(tear) || isInCooldown(tear, level)) { return; } - ItemStack tearStack = getStackFromTear(stack); + ItemStack tearStack = getStackFromTear(tear); if (tearStack.isEmpty()) { - resetTear(stack); + resetTear(tear); return; } - Optional experience = Settings.COMMON.items.infernalTear.getItemExperience(RegistryHelper.getItemRegistryName(tearStack.getItem())); + Optional experience = Config.COMMON.items.infernalTear.getItemExperience(RegistryHelper.getItemRegistryName(tearStack.getItem())); if (experience.isEmpty()) { - resetTear(stack); + resetTear(tear); return; } - int countConsumed = InventoryHelper.consumeItemStack(ist -> ItemHandlerHelper.canItemStacksStack(tearStack, ist), player, 4).getCount(); + int countConsumed = InventoryHelper.consumeItemStack(stack -> ItemStack.isSameItemSameComponents(tearStack, stack), player, 4).getCount(); if (countConsumed > 0) { player.giveExperiencePoints(experience.get() * countConsumed); } else { - setCooldown(stack, world, NOTHING_FOUND_COOLDOWN); + setCooldown(tear, level, NOTHING_FOUND_COOLDOWN); } } private void resetTear(ItemStack stack) { - CompoundTag tag = stack.getTag(); - if (tag != null) { - tag.remove("item"); - tag.remove(ENABLED_TAG); - } + stack.remove(DataComponents.CONTAINER); + stack.remove(ModDataComponents.ENABLED); } @Override - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - super.appendHoverText(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flag) { + super.appendHoverText(stack, context, tooltip, flag); if (getStackFromTear(stack).isEmpty()) { - TooltipBuilder.of(tooltip).description("tooltip.reliquary.tear_empty"); + TooltipBuilder.of(tooltip, context).description("tooltip.reliquary.tear_empty"); } } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack stack, @Nullable Level world, TooltipBuilder tooltipBuilder) { + protected void addMoreInformation(ItemStack stack, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { ItemStack contents = getStackFromTear(stack); String itemName = contents.getHoverName().getString(); - tooltipBuilder.data("tooltip." + Reference.MOD_ID + ".tear", itemName); + tooltipBuilder.data("tooltip." + Reliquary.MOD_ID + ".tear", itemName); if (isEnabled(stack)) { tooltipBuilder.absorbActive(itemName); } - tooltipBuilder.description("tooltip." + Reference.MOD_ID + ".absorb"); + tooltipBuilder.description("tooltip." + Reliquary.MOD_ID + ".absorb"); tooltipBuilder.description(this, ".infernal_tear.absorb_unset"); } @@ -105,46 +99,37 @@ protected boolean hasMoreInformation(ItemStack stack) { } public static ItemStack getStackFromTear(ItemStack tear) { - CompoundTag itemNBT = NBTHelper.getTagCompound("item", tear); - if (itemNBT.isEmpty()) { - return ItemStack.EMPTY; - } - - return ItemStack.of(itemNBT); + ItemContainerContents contents = tear.getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY); + return contents.getSlots() > 0 ? contents.getStackInSlot(0) : ItemStack.EMPTY; } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - - @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { - ItemStack stack = player.getItemInHand(hand); - InteractionResultHolder actionResult = super.use(world, player, hand); - if (player.isShiftKeyDown() && !isEnabled(stack)) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + if (level.isClientSide()) { + return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand)); + } + InteractionResultHolder actionResult = super.use(level, player, hand); + ItemStack tear = actionResult.getObject(); + if (player.isShiftKeyDown() && !isEnabled(tear)) { return actionResult; } - ItemStack itemStack = actionResult.getObject(); //empty the tear if player is not sneaking and the tear is not empty - CompoundTag nbt = itemStack.getTag(); - if (!player.isShiftKeyDown() && !getStackFromTear(itemStack).isEmpty()) { - NBTHelper.remove(nbt, "item"); - NBTHelper.remove(nbt, ENABLED_TAG); - + if (!player.isShiftKeyDown() && !getStackFromTear(tear).isEmpty()) { + resetTear(tear); return actionResult; } //nothing more to do with a filled tear here - if (!getStackFromTear(itemStack).isEmpty()) { + if (!getStackFromTear(tear).isEmpty()) { return actionResult; } //if user is sneaking or just enabled the tear, let's fill it - if (player.isShiftKeyDown() || !isEnabled(itemStack)) { - ItemStack returnStack = InventoryHelper.getItemHandlerFrom(player).map(handler -> buildTear(itemStack, handler)).orElse(ItemStack.EMPTY); + if (player.isShiftKeyDown() || !isEnabled(tear)) { + IItemHandler playerInventory = InventoryHelper.getMainInventoryItemHandlerFrom(player); + ItemStack returnStack = buildTear(tear, playerInventory); if (!returnStack.isEmpty()) { return new InteractionResultHolder<>(InteractionResult.SUCCESS, returnStack); } @@ -152,8 +137,8 @@ public InteractionResultHolder use(Level world, Player player, Intera //by this time the tear is still empty and there wasn't anything to put in it // so let's disable it if it got enabled - if (isEnabled(itemStack)) { - toggleEnabled(itemStack); + if (isEnabled(tear)) { + toggleEnabled(tear); } return actionResult; } @@ -168,15 +153,15 @@ private ItemStack buildTear(ItemStack stack, IItemHandler inventory) { setTearTarget(tear, target); - if (Boolean.TRUE.equals(Settings.COMMON.items.infernalTear.absorbWhenCreated.get())) { - NBTHelper.putBoolean(ENABLED_TAG, stack, true); + if (Boolean.TRUE.equals(Config.COMMON.items.infernalTear.absorbWhenCreated.get())) { + stack.set(ModDataComponents.ENABLED, true); } return tear; } public static void setTearTarget(ItemStack tear, ItemStack target) { - NBTHelper.putTagCompound("item", tear, target.save(new CompoundTag())); + tear.set(DataComponents.CONTAINER, ItemContainerContents.fromItems(List.of(target))); } private ItemStack getTargetAlkahestItem(ItemStack self, IItemHandler inventory) { @@ -184,8 +169,8 @@ private ItemStack getTargetAlkahestItem(ItemStack self, IItemHandler inventory) int itemQuantity = 0; for (int slot = 0; slot < inventory.getSlots(); slot++) { ItemStack stack = inventory.getStackInSlot(slot); - if (stack.isEmpty() || self.getItem() == stack.getItem() || stack.getMaxStackSize() == 1 || stack.getTag() != null - || Settings.COMMON.items.infernalTear.getItemExperience(RegistryHelper.getItemRegistryName(stack.getItem())).isEmpty()) { + if (stack.isEmpty() || self.getItem() == stack.getItem() || stack.getMaxStackSize() == 1 || !stack.getComponentsPatch().isEmpty() + || Config.COMMON.items.infernalTear.getItemExperience(RegistryHelper.getItemRegistryName(stack.getItem())).isEmpty()) { continue; } if (InventoryHelper.getItemQuantity(stack, inventory) > itemQuantity) { diff --git a/src/main/java/reliquary/items/ItemBase.java b/src/main/java/reliquary/items/ItemBase.java index 598bb206..6acb3019 100644 --- a/src/main/java/reliquary/items/ItemBase.java +++ b/src/main/java/reliquary/items/ItemBase.java @@ -1,17 +1,15 @@ package reliquary.items; import net.minecraft.client.gui.screens.Screen; +import net.minecraft.core.HolderLookup; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import org.jetbrains.annotations.Nullable; import reliquary.util.TooltipBuilder; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; import java.util.function.Supplier; @@ -46,14 +44,13 @@ public void addCreativeTabItems(Consumer itemConsumer) { } @Override - @OnlyIn(Dist.CLIENT) - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - TooltipBuilder tooltipBuilder = TooltipBuilder.of(tooltip).itemTooltip(this); + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flag) { + TooltipBuilder tooltipBuilder = TooltipBuilder.of(tooltip, context).itemTooltip(this); if (hasMoreInformation(stack)) { tooltipBuilder.showMoreInfo(); if (Screen.hasShiftDown()) { - addMoreInformation(stack, world, tooltipBuilder); + addMoreInformation(stack, context.registries(), tooltipBuilder); } } } @@ -63,8 +60,7 @@ protected boolean hasMoreInformation(ItemStack stack) { return false; } - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack stack, @Nullable Level world, TooltipBuilder tooltipBuilder) { + protected void addMoreInformation(ItemStack stack, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { //overriden in child classes } diff --git a/src/main/java/reliquary/items/KrakenShellItem.java b/src/main/java/reliquary/items/KrakenShellItem.java index 18b7ca17..56ffaef0 100644 --- a/src/main/java/reliquary/items/KrakenShellItem.java +++ b/src/main/java/reliquary/items/KrakenShellItem.java @@ -6,14 +6,12 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; import reliquary.handler.CommonEventHandler; import reliquary.handler.HandlerPriority; import reliquary.handler.IPlayerHurtHandler; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; public class KrakenShellItem extends ItemBase { @@ -22,15 +20,15 @@ public KrakenShellItem() { CommonEventHandler.registerPlayerHurtHandler(new IPlayerHurtHandler() { @Override - public boolean canApply(Player player, LivingAttackEvent event) { + public boolean canApply(Player player, LivingIncomingDamageEvent event) { return event.getSource() == player.damageSources().drown() && player.getFoodData().getFoodLevel() > 0 && InventoryHelper.playerHasItem(player, ModItems.KRAKEN_SHELL.get()); } @Override - public boolean apply(Player player, LivingAttackEvent event) { - float hungerDamage = event.getAmount() * ((float) Settings.COMMON.items.krakenShell.hungerCostPercent.get() / 100F); + public boolean apply(Player player, LivingIncomingDamageEvent event) { + float hungerDamage = event.getAmount() * ((float) Config.COMMON.items.krakenShell.hungerCostPercent.get() / 100F); player.causeFoodExhaustion(hungerDamage); return true; } @@ -43,7 +41,6 @@ public HandlerPriority getPriority() { } @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return true; } @@ -51,8 +48,8 @@ public boolean isFoil(ItemStack stack) { // checks to see if the player is in water. If so, give them some minor // buffs. @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.getGameTime() % 3 != 0) { + public void inventoryTick(ItemStack stack, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.getGameTime() % 3 != 0) { return; } diff --git a/src/main/java/reliquary/items/LanternOfParanoiaItem.java b/src/main/java/reliquary/items/LanternOfParanoiaItem.java index 1d3d4fc7..4a78d273 100644 --- a/src/main/java/reliquary/items/LanternOfParanoiaItem.java +++ b/src/main/java/reliquary/items/LanternOfParanoiaItem.java @@ -4,7 +4,9 @@ import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundSource; @@ -19,6 +21,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; @@ -26,9 +29,8 @@ import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraftforge.registries.ForgeRegistries; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; import javax.annotation.Nullable; @@ -45,7 +47,7 @@ public class LanternOfParanoiaItem extends ToggleableItem { private static final Map TORCH_BLOCKS = new HashMap<>(); public LanternOfParanoiaItem() { - super(new Properties().stacksTo(1)); + super(new Properties().stacksTo(1).rarity(Rarity.EPIC)); } @Override @@ -53,26 +55,19 @@ public MutableComponent getName(ItemStack stack) { return super.getName(stack).withStyle(ChatFormatting.YELLOW); } - @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - public int getRange() { - return Settings.COMMON.items.lanternOfParanoia.placementScanRadius.get(); + return Config.COMMON.items.lanternOfParanoia.placementScanRadius.get(); } @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || !isEnabled(stack) || isInCooldown(stack, world)) { + public void inventoryTick(ItemStack stack, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || !isEnabled(stack) || isInCooldown(stack, level)) { return; } - if (entity instanceof Player player) { - if (getPositionsInRange(player).anyMatch(pos -> tryToPlaceAtPos(stack, world, player, pos))) { - setCooldown(stack, world, SUCCESS_COOLDOWN); - } else { - setCooldown(stack, world, NOTHING_FOUND_COOLDOWN); - } + if (getPositionsInRange(player).anyMatch(pos -> tryToPlaceAtPos(stack, level, player, pos))) { + setCooldown(stack, level, SUCCESS_COOLDOWN); + } else { + setCooldown(stack, level, NOTHING_FOUND_COOLDOWN); } } @@ -80,30 +75,30 @@ private Stream getPositionsInRange(Player player) { return BlockPos.betweenClosedStream(player.blockPosition().offset(-getRange(), -getRange() / 2, -getRange()), player.blockPosition().offset(getRange(), getRange() / 2, getRange())); } - private boolean tryToPlaceAtPos(ItemStack stack, Level world, Player player, BlockPos pos) { + private boolean tryToPlaceAtPos(ItemStack stack, Level level, Player player, BlockPos pos) { int lightLevel = player.level().getBrightness(LightLayer.BLOCK, pos); - if (lightLevel > Settings.COMMON.items.lanternOfParanoia.minLightLevel.get()) { + if (lightLevel > Config.COMMON.items.lanternOfParanoia.minLightLevel.get()) { return false; } - BlockState state = world.getBlockState(pos); + BlockState state = level.getBlockState(pos); Block block = state.getBlock(); BlockPlaceContext context = new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, new BlockHitResult(Vec3.atBottomCenterOf(pos), Direction.UP, pos, false)); - if (isBadPlacementToTry(world, pos, state, block, context)) { + if (isBadPlacementToTry(level, pos, state, block, context)) { return false; } - return tryToPlaceTorchAround(stack, pos, player, world); + return tryToPlaceTorchAround(stack, pos, player, level); } - private boolean isBadPlacementToTry(Level world, BlockPos pos, BlockState state, Block block, BlockPlaceContext context) { + private boolean isBadPlacementToTry(Level level, BlockPos pos, BlockState state, Block block, BlockPlaceContext context) { return block instanceof LiquidBlock - || world.getBlockState(pos.below()).getBlock().hasDynamicShape() + || level.getBlockState(pos.below()).getBlock().hasDynamicShape() || !state.getFluidState().isEmpty() || (!state.isAir() && !state.canBeReplaced(BlockPlaceContext.at(context, pos, Direction.DOWN))); } - private boolean isBlockBlockingView(Level world, Player player, BlockPos pos) { + private boolean isBlockBlockingView(Level level, Player player, BlockPos pos) { double playerEyeHeight = player.getY() + player.getEyeHeight(); for (float xOff = -0.2F; xOff <= 0.2F; xOff += 0.4F) { for (float yOff = -0.2F; yOff <= 0.2F; yOff += 0.4F) { @@ -112,7 +107,7 @@ private boolean isBlockBlockingView(Level world, Player player, BlockPos pos) { Vec3 playerVec = new Vec3(player.getX() + xOff, playerEyeHeight + yOff, player.getZ() + zOff); Vec3 rayTraceVector = new Vec3(pos.getX(), pos.getY(), pos.getZ()).add(0.5D + xOff, 0.5D + yOff, 0.5D + zOff); - HitResult rayTraceResult = world.clip(new ClipContext(playerVec, rayTraceVector, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, player)); + HitResult rayTraceResult = level.clip(new ClipContext(playerVec, rayTraceVector, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, player)); if (rayTraceResult.getType() == HitResult.Type.MISS) { return false; @@ -123,37 +118,37 @@ private boolean isBlockBlockingView(Level world, Player player, BlockPos pos) { return true; } - private boolean tryToPlaceTorchAround(ItemStack stack, BlockPos pos, Player player, Level world) { - if (isBlockBlockingView(world, player, pos)) { + private boolean tryToPlaceTorchAround(ItemStack stack, BlockPos pos, Player player, Level level) { + if (isBlockBlockingView(level, player, pos)) { return false; } - for (String torchRegistryName : Settings.COMMON.items.lanternOfParanoia.torches.get()) { - if (getTorchBlock(torchRegistryName).map(torch -> tryToPlaceTorchBlock(stack, pos, player, world, torch)).orElse(false)) { + for (String torchRegistryName : Config.COMMON.items.lanternOfParanoia.torches.get()) { + if (getTorchBlock(torchRegistryName).map(torch -> tryToPlaceTorchBlock(stack, pos, player, level, torch)).orElse(false)) { return true; } } return false; } - private boolean tryToPlaceTorchBlock(ItemStack stack, BlockPos pos, Player player, Level world, Block torch) { - if (torch.defaultBlockState().canSurvive(world, pos)) { + private boolean tryToPlaceTorchBlock(ItemStack stack, BlockPos pos, Player player, Level level, Block torch) { + if (torch.defaultBlockState().canSurvive(level, pos)) { List trySides = Lists.newArrayList(Direction.DOWN, Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST); ItemStack torchStack = new ItemStack(torch); for (Direction side : trySides) { BlockState torchBlockState = getTorchSideAttempt(player, torch, pos, side); - if (torchBlockState == null || !torchBlockState.canSurvive(world, pos) - || !world.isUnobstructed(torchBlockState, pos, CollisionContext.empty()) + if (torchBlockState == null || !torchBlockState.canSurvive(level, pos) + || !level.isUnobstructed(torchBlockState, pos, CollisionContext.empty()) || !(InventoryHelper.consumeItem(torchStack, player, 0, 1) || findAndDrainSojournersStaff(player, torchStack.getItem()))) { continue; } - if (placeBlockAt(stack, player, world, pos, torchBlockState)) { - double gauss = 0.5D + world.random.nextFloat() / 2; - world.addParticle(ParticleTypes.ENTITY_EFFECT, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, gauss, gauss, 0.0F); - SoundType torchSoundType = torch.getSoundType(torchBlockState, world, pos, null); - world.playSound(null, pos, torchSoundType.getStepSound(), SoundSource.BLOCKS, (torchSoundType.getVolume() + 1.0F) / 2.0F, torchSoundType.getPitch() * 0.8F); + if (placeBlockAt(stack, player, level, pos, torchBlockState)) { + float gauss = 0.5F + level.random.nextFloat() / 2; + level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, gauss, gauss, 0.0F), pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, 0, 0, 0); + SoundType torchSoundType = torch.getSoundType(torchBlockState, level, pos, null); + level.playSound(null, pos, torchSoundType.getStepSound(), SoundSource.BLOCKS, (torchSoundType.getVolume() + 1.0F) / 2.0F, torchSoundType.getPitch() * 0.8F); return true; } } @@ -169,7 +164,7 @@ private boolean findAndDrainSojournersStaff(Player player, Item torchItem) { if (player.getInventory().getItem(slot).getItem() != ModItems.SOJOURNER_STAFF.get()) { continue; } - if (ModItems.SOJOURNER_STAFF.get().removeItemFromInternalStorage(player.getInventory().getItem(slot), torchItem, 1, false, player)) { + if (ModItems.SOJOURNER_STAFF.get().removeTorch(player.getInventory().getItem(slot))) { return true; } } @@ -177,7 +172,11 @@ private boolean findAndDrainSojournersStaff(Player player, Item torchItem) { } private Optional getTorchBlock(String registryName) { - return Optional.ofNullable(TORCH_BLOCKS.computeIfAbsent(registryName, rn -> ForgeRegistries.BLOCKS.getValue(new ResourceLocation(rn)))); + Block block = BuiltInRegistries.BLOCK.get(ResourceLocation.parse(registryName)); + if (block == Blocks.AIR) { + return Optional.empty(); + } + return Optional.of(TORCH_BLOCKS.computeIfAbsent(registryName, rn -> BuiltInRegistries.BLOCK.get(ResourceLocation.parse(rn)))); } @Nullable @@ -185,12 +184,12 @@ private BlockState getTorchSideAttempt(Player player, Block torch, BlockPos pos, return torch.getStateForPlacement(new BlockPlaceContext(player, InteractionHand.MAIN_HAND, ItemStack.EMPTY, new BlockHitResult(Vec3.atBottomCenterOf(pos), side, pos, false))); } - private boolean placeBlockAt(ItemStack stack, Player player, Level world, BlockPos pos, BlockState torchBlockState) { - if (!world.setBlock(pos, torchBlockState, 3)) { + private boolean placeBlockAt(ItemStack stack, Player player, Level level, BlockPos pos, BlockState torchBlockState) { + if (!level.setBlock(pos, torchBlockState, 3)) { return false; } - torchBlockState.getBlock().setPlacedBy(world, pos, torchBlockState, player, stack); + torchBlockState.getBlock().setPlacedBy(level, pos, torchBlockState, player, stack); return true; } } diff --git a/src/main/java/reliquary/items/MagicbaneItem.java b/src/main/java/reliquary/items/MagicbaneItem.java index c5701d03..8e222a62 100644 --- a/src/main/java/reliquary/items/MagicbaneItem.java +++ b/src/main/java/reliquary/items/MagicbaneItem.java @@ -1,37 +1,36 @@ package reliquary.items; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import net.minecraft.nbt.ListTag; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import net.minecraft.core.Holder; import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.EquipmentSlotGroup; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Rarity; -import net.minecraft.world.item.SwordItem; -import net.minecraft.world.item.Tiers; -import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; +import net.minecraft.world.item.*; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.ItemEnchantments; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.ItemAttributeModifierEvent; +import reliquary.Reliquary; +import reliquary.data.ReliquaryEnchantmentProvider; import reliquary.util.TooltipBuilder; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; public class MagicbaneItem extends SwordItem implements ICreativeTabItemGenerator { - private static final AttributeModifier SPEED_ATTRIBUTE = new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier", -2.4, AttributeModifier.Operation.ADDITION); + private static final ResourceLocation MAGICBANE_ENCHANTMENTS_BONUS_ID = Reliquary.getRL("magicbane_enchantments_bonus"); public MagicbaneItem() { - super(Tiers.GOLD, 3, -2.4f, new Properties().durability(16).setNoRepair().rarity(Rarity.EPIC)); + super(Tiers.GOLD, new Properties().durability(16).setNoRepair().rarity(Rarity.EPIC) + .attributes(createAttributes(Tiers.GOLD, 4, -2.4f))); + NeoForge.EVENT_BUS.addListener(this::adjustDamageBasedOnEnchantments); } @Override @@ -40,19 +39,13 @@ public void addCreativeTabItems(Consumer itemConsumer) { } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - - @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return true; } @Override - public void appendHoverText(ItemStack magicBane, @Nullable Level world, List tooltip, TooltipFlag flag) { - TooltipBuilder.of(tooltip).itemTooltip(this); + public void appendHoverText(ItemStack magicBane, TooltipContext context, List tooltip, TooltipFlag flag) { + TooltipBuilder.of(tooltip, context).itemTooltip(this); } /** @@ -90,19 +83,25 @@ public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity atta } @Override - public Multimap getAttributeModifiers(EquipmentSlot slot, ItemStack stack) { - if (slot != EquipmentSlot.MAINHAND) { - return ImmutableMultimap.of(); + public int getEnchantmentLevel(ItemStack stack, Holder enchantment) { + if (enchantment.is(ReliquaryEnchantmentProvider.SEVERING)) { + return super.getEnchantmentLevel(stack, enchantment) + 2; + } + + return super.getEnchantmentLevel(stack, enchantment); + } + + private void adjustDamageBasedOnEnchantments(ItemAttributeModifierEvent event) { + ItemStack stack = event.getItemStack(); + if (!(stack.getItem() instanceof MagicbaneItem)) { + return; } - ListTag enchants = stack.getEnchantmentTags(); - int attackDamage = 4; - for (int enchant = 0; enchant < enchants.size(); enchant++) { - attackDamage += enchants.getCompound(enchant).getShort("lvl"); + ItemEnchantments enchantments = stack.getTagEnchantments(); + float attackDamage = 0; + for (Object2IntMap.Entry> holderEntry : enchantments.entrySet()) { + attackDamage += holderEntry.getIntValue(); } - return ImmutableMultimap.of( - Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", attackDamage, AttributeModifier.Operation.ADDITION), - Attributes.ATTACK_SPEED, SPEED_ATTRIBUTE - ); + event.addModifier(Attributes.ATTACK_DAMAGE, new AttributeModifier(MAGICBANE_ENCHANTMENTS_BONUS_ID, attackDamage, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND); } } diff --git a/src/main/java/reliquary/items/MercyCrossItem.java b/src/main/java/reliquary/items/MercyCrossItem.java index 4bcf3723..1f12d100 100644 --- a/src/main/java/reliquary/items/MercyCrossItem.java +++ b/src/main/java/reliquary/items/MercyCrossItem.java @@ -1,41 +1,28 @@ package reliquary.items; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; import net.minecraft.ChatFormatting; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; +import net.minecraft.tags.EntityTypeTags; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobType; -import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; 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.item.Rarity; -import net.minecraft.world.item.SwordItem; -import net.minecraft.world.item.Tiers; -import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.AttackEntityEvent; +import net.minecraft.world.item.*; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.entity.player.AttackEntityEvent; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; public class MercyCrossItem extends SwordItem implements ICreativeTabItemGenerator { - private static final String WEAPON_MODIFIER_NAME = "Weapon modifier"; - public MercyCrossItem() { - super(Tiers.GOLD, 3, -2.4F, new Properties().stacksTo(1).durability(64)); - MinecraftForge.EVENT_BUS.addListener(this::handleDamage); + super(Tiers.GOLD, new Properties().stacksTo(1).durability(64).rarity(Rarity.EPIC) + .attributes(SwordItem.createAttributes(Tiers.GOLD, 6, -2.4f))); + NeoForge.EVENT_BUS.addListener(this::handleDamage); } @Override @@ -44,34 +31,10 @@ public void addCreativeTabItems(Consumer itemConsumer) { } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - - @Override - @OnlyIn(Dist.CLIENT) - public void appendHoverText(ItemStack cross, @Nullable Level world, List tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack cross, TooltipContext context, List tooltip, TooltipFlag flag) { tooltip.add(Component.translatable(getDescriptionId() + ".tooltip").withStyle(ChatFormatting.GRAY)); } - @Override - public float getDamage() { - return 0.0F; - } - - @Override - public Multimap getAttributeModifiers(EquipmentSlot slot, ItemStack stack) { - if (slot == EquipmentSlot.MAINHAND) { - return ImmutableMultimap.builder() - .putAll(super.getAttributeModifiers(slot, stack)) - .put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, WEAPON_MODIFIER_NAME, 6, AttributeModifier.Operation.ADDITION)) - .put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, WEAPON_MODIFIER_NAME, -2.4000000953674316D, AttributeModifier.Operation.ADDITION)) - .build(); - } else { - return super.getAttributeModifiers(slot, stack); - } - } - private void handleDamage(AttackEntityEvent event) { if (event.getEntity().level().isClientSide || !(event.getTarget() instanceof LivingEntity target)) { return; @@ -90,9 +53,9 @@ private void updateAttackDamageModifier(LivingEntity target, Player player) { //noinspection ConstantConditions if (attackAttribute != null && - (attackAttribute.getModifier(BASE_ATTACK_DAMAGE_UUID) == null || attackAttribute.getModifier(BASE_ATTACK_DAMAGE_UUID).getAmount() != dmg)) { - attackAttribute.removeModifier(BASE_ATTACK_DAMAGE_UUID); - attackAttribute.addTransientModifier(new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, WEAPON_MODIFIER_NAME, dmg, AttributeModifier.Operation.ADDITION)); + (attackAttribute.getModifier(BASE_ATTACK_DAMAGE_ID) == null || attackAttribute.getModifier(BASE_ATTACK_DAMAGE_ID).amount() != dmg)) { + attackAttribute.removeModifier(BASE_ATTACK_DAMAGE_ID); + attackAttribute.addTransientModifier(new AttributeModifier(BASE_ATTACK_DAMAGE_ID, dmg, AttributeModifier.Operation.ADD_VALUE)); } } @@ -105,6 +68,6 @@ public boolean onLeftClickEntity(ItemStack stack, Player player, Entity monster) } private boolean isUndead(LivingEntity e) { - return e.getMobType() == MobType.UNDEAD; + return e.getType().is(EntityTypeTags.UNDEAD); } } diff --git a/src/main/java/reliquary/items/MidasTouchstoneItem.java b/src/main/java/reliquary/items/MidasTouchstoneItem.java index c378ec49..310d4b32 100644 --- a/src/main/java/reliquary/items/MidasTouchstoneItem.java +++ b/src/main/java/reliquary/items/MidasTouchstoneItem.java @@ -1,24 +1,17 @@ package reliquary.items; import com.google.common.collect.ImmutableMap; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ArmorMaterial; -import net.minecraft.world.item.ArmorMaterials; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.Rarity; -import net.minecraft.world.item.Tier; -import net.minecraft.world.item.TieredItem; -import net.minecraft.world.item.Tiers; +import net.minecraft.world.item.*; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import reliquary.reference.Settings; +import net.neoforged.neoforge.items.IItemHandler; +import reliquary.init.ModDataComponents; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; -import reliquary.util.NBTHelper; import reliquary.util.RegistryHelper; import reliquary.util.TooltipBuilder; @@ -34,20 +27,18 @@ public class MidasTouchstoneItem extends ToggleableItem { return tier.equals(Tiers.GOLD) || tier.equals(Tiers.NETHERITE); }) .put(ArmorItem.class, item -> { - ArmorMaterial material = ((ArmorItem) item).getMaterial(); + Holder material = ((ArmorItem) item).getMaterial(); return material.equals(ArmorMaterials.GOLD) || material.equals(ArmorMaterials.NETHERITE); }) .build(); - private static final String GLOWSTONE_TAG = "glowstone"; public MidasTouchstoneItem() { - super(new Properties().stacksTo(1)); + super(new Properties().stacksTo(1).rarity(Rarity.EPIC)); } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack touchstone, @Nullable Level world, TooltipBuilder tooltipBuilder) { - tooltipBuilder.charge(this, ".tooltip2", NBTHelper.getInt(GLOWSTONE_TAG, touchstone)); + protected void addMoreInformation(ItemStack touchstone, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { + tooltipBuilder.charge(this, ".tooltip2", getGlowstoneCharge(touchstone)); if (isEnabled(touchstone)) { tooltipBuilder.absorbActive(Items.GLOWSTONE_DUST.getName(new ItemStack(Items.GLOWSTONE_DUST)).getString()); } else { @@ -61,40 +52,45 @@ protected boolean hasMoreInformation(ItemStack stack) { } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - - @Override - public void inventoryTick(ItemStack stack, Level world, Entity e, int i, boolean f) { - if (world.isClientSide || world.getGameTime() % 10 != 0 || !(e instanceof Player player)) { + public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, boolean f) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 10 != 0) { return; } if (isEnabled(stack)) { - int glowstoneCharge = NBTHelper.getInt(GLOWSTONE_TAG, stack); + int glowstoneCharge = getGlowstoneCharge(stack); consumeAndCharge(player, getGlowstoneLimit() - glowstoneCharge, getGlowStoneWorth(), Items.GLOWSTONE_DUST, 16, - chargeToAdd -> NBTHelper.putInt(GLOWSTONE_TAG, stack, glowstoneCharge + chargeToAdd)); + chargeToAdd -> addGlowstoneCharge(stack, chargeToAdd)); } doRepairAndDamageTouchstone(stack, player); } - private void doRepairAndDamageTouchstone(ItemStack touchstone, Player player) { - List goldItems = Settings.COMMON.items.midasTouchstone.goldItems.get(); + public static int getGlowstoneCharge(ItemStack stack) { + return stack.getOrDefault(ModDataComponents.GLOWSTONE, 0); + } + + private void addGlowstoneCharge(ItemStack stack, int chargeToAdd) { + stack.set(ModDataComponents.GLOWSTONE, Math.max(getGlowstoneCharge(stack) + chargeToAdd, 0)); + } - InventoryHelper.getItemHandlerFrom(player, null).ifPresent(itemHandler -> { - for (int slot = 0; slot < itemHandler.getSlots(); slot++) { - ItemStack stack = itemHandler.getStackInSlot(slot); - Item item = stack.getItem(); + private void doRepairAndDamageTouchstone(ItemStack touchstone, Player player) { + List goldItems = Config.COMMON.items.midasTouchstone.goldItems.get(); - if (stack.getDamageValue() <= 0 || !stack.getItem().canBeDepleted()) { - continue; - } + IItemHandler playerInventory = InventoryHelper.getItemHandlerFrom(player); + if (playerInventory == null) { + return; + } + for (int slot = 0; slot < playerInventory.getSlots(); slot++) { + ItemStack stack = playerInventory.getStackInSlot(slot); + Item item = stack.getItem(); - tryRepairingItem(touchstone, player, goldItems, stack, item); + if (stack.getDamageValue() <= 0 || !stack.has(DataComponents.DAMAGE)) { + continue; } - }); + + tryRepairingItem(touchstone, player, goldItems, stack, item); + } } private void tryRepairingItem(ItemStack touchstone, Player player, List goldItems, ItemStack stack, Item item) { @@ -112,9 +108,9 @@ private void repairItem(ItemStack stack, ItemStack touchstone, Player player) { } private boolean reduceTouchStoneCharge(ItemStack stack, Player player) { - if (NBTHelper.getInt(GLOWSTONE_TAG, stack) - getGlowStoneCost() >= 0 || player.isCreative()) { + if (getGlowstoneCharge(stack) - getGlowStoneCost() >= 0 || player.isCreative()) { if (!player.isCreative()) { - NBTHelper.putInt(GLOWSTONE_TAG, stack, NBTHelper.getInt(GLOWSTONE_TAG, stack) - getGlowStoneCost()); + addGlowstoneCharge(stack, -getGlowStoneCost()); } return true; } @@ -122,15 +118,15 @@ private boolean reduceTouchStoneCharge(ItemStack stack, Player player) { } private int getGlowStoneCost() { - return Settings.COMMON.items.midasTouchstone.glowstoneCost.get(); + return Config.COMMON.items.midasTouchstone.glowstoneCost.get(); } private int getGlowStoneWorth() { - return Settings.COMMON.items.midasTouchstone.glowstoneWorth.get(); + return Config.COMMON.items.midasTouchstone.glowstoneWorth.get(); } private int getGlowstoneLimit() { - return Settings.COMMON.items.midasTouchstone.glowstoneLimit.get(); + return Config.COMMON.items.midasTouchstone.glowstoneLimit.get(); } private Optional getRepairableItem(Class item) { diff --git a/src/main/java/reliquary/items/MobCharmBeltItem.java b/src/main/java/reliquary/items/MobCharmBeltItem.java index 1a343df6..d10eb1bd 100644 --- a/src/main/java/reliquary/items/MobCharmBeltItem.java +++ b/src/main/java/reliquary/items/MobCharmBeltItem.java @@ -1,8 +1,8 @@ package reliquary.items; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.Tag; +import net.minecraft.core.NonNullList; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.InteractionHand; @@ -13,18 +13,20 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.ItemContainerContents; import net.minecraft.world.level.Level; -import net.minecraftforge.network.NetworkHooks; +import net.neoforged.neoforge.common.MutableDataComponentHolder; +import net.neoforged.neoforge.items.ComponentItemHandler; import reliquary.common.gui.MobCharmBeltMenu; import reliquary.items.util.ICuriosItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.HashSet; import java.util.Set; +import java.util.function.Consumer; +import java.util.function.Function; public class MobCharmBeltItem extends ItemBase implements ICuriosItem { - private static final String SLOTS_TAG = "Slots"; - public MobCharmBeltItem() { super(new Properties().stacksTo(1)); } @@ -42,39 +44,27 @@ public void onWornTick(ItemStack stack, LivingEntity player) { @Override public void onEquipped(String identifier, LivingEntity player) { if (player.level().isClientSide) { - player.playSound(SoundEvents.ARMOR_EQUIP_LEATHER, 1F, 1F); + player.playSound(SoundEvents.ARMOR_EQUIP_LEATHER.value(), 1F, 1F); } } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (player.isCrouching()) { return new InteractionResultHolder<>(InteractionResult.PASS, stack); } - if (!world.isClientSide && player instanceof ServerPlayer serverPlayer) { - NetworkHooks.openScreen(serverPlayer, new SimpleMenuProvider((w, p, pl) -> new MobCharmBeltMenu(w, p, stack), stack.getHoverName()), buf -> buf.writeBoolean(hand == InteractionHand.MAIN_HAND)); + if (!level.isClientSide && player instanceof ServerPlayer serverPlayer) { + serverPlayer.openMenu(new SimpleMenuProvider((w, p, pl) -> new MobCharmBeltMenu(w, p, stack), stack.getHoverName()), buf -> buf.writeBoolean(hand == InteractionHand.MAIN_HAND)); } return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack); } public ItemStack getMobCharmInSlot(ItemStack belt, int slotIndex) { - CompoundTag nbt = belt.getTag(); - - if (nbt == null || !nbt.contains(SLOTS_TAG)) { - return ItemStack.EMPTY; - } - - ListTag mobCharms = nbt.getList(SLOTS_TAG, Tag.TAG_COMPOUND); - - if (mobCharms.size() <= slotIndex) { - return ItemStack.EMPTY; - } - - return ItemStack.of((CompoundTag) mobCharms.get(slotIndex)); + return getFromHandler(belt, handler -> slotIndex < handler.getSlots() ? handler.getStackInSlot(slotIndex) : ItemStack.EMPTY); } public void putMobCharmInSlot(ItemStack belt, int slotIndex, ItemStack mobCharm) { @@ -83,111 +73,104 @@ public void putMobCharmInSlot(ItemStack belt, int slotIndex, ItemStack mobCharm) return; } - CompoundTag mobCharmNbt = mobCharm.save(new CompoundTag()); - CompoundTag nbt = belt.getTag(); - ListTag mobCharms; - if (nbt == null) { - nbt = new CompoundTag(); - mobCharms = new ListTag(); - } else { - mobCharms = nbt.getList(SLOTS_TAG, Tag.TAG_COMPOUND); - } - - if (mobCharms.size() < slotIndex) { - return; - } - - if (mobCharms.size() == slotIndex) { - mobCharms.add(mobCharmNbt); - } else { - mobCharms.set(slotIndex, mobCharmNbt); - } - nbt.put(SLOTS_TAG, mobCharms); - belt.setTag(nbt); + runOnHandler(belt, handler -> { + if (slotIndex >= handler.getSlots()) { + handler.insertIntoNewSlot(mobCharm); + } else { + handler.setStackInSlot(slotIndex, mobCharm); + } + }); } - public void removeMobCharmInSlot(ItemStack belt, int slotIndex) { - CompoundTag nbt = belt.getTag(); - - if (nbt == null || !nbt.contains(SLOTS_TAG)) { - return; - } - - ListTag mobCharms = nbt.getList(SLOTS_TAG, Tag.TAG_COMPOUND); - - if (mobCharms.size() <= slotIndex) { - return; - } - - mobCharms.remove(slotIndex); + public ItemStack removeMobCharmInSlot(ItemStack belt, int slotIndex) { + return getFromHandler(belt, handler -> slotIndex < handler.getSlots() ? handler.removeStackAndSlot(slotIndex) : ItemStack.EMPTY); } public int getCharmCount(ItemStack belt) { - CompoundTag nbt = belt.getTag(); - - if (nbt == null) { - return 0; - } - - ListTag mobCharms = nbt.getList(SLOTS_TAG, Tag.TAG_COMPOUND); - - return mobCharms.size(); + return getFromHandler(belt, MobCharmComponentItemHandler::getSlots); } - public boolean hasCharm(ItemStack belt, String entityRegistryName) { - CompoundTag nbt = belt.getTag(); - - if (nbt == null || !nbt.contains(SLOTS_TAG)) { + public boolean hasCharm(ItemStack belt, ResourceLocation entityRegistryName) { + return getFromHandler(belt, handler -> { + for (int i = 0; i < handler.getSlots(); i++) { + ItemStack charmStack = handler.getStackInSlot(i); + if (MobCharmItem.isCharmFor(charmStack, entityRegistryName)) { + return true; + } + } return false; - } - - ListTag mobCharms = nbt.getList(SLOTS_TAG, Tag.TAG_COMPOUND); + }); + } - for (int i = mobCharms.size() - 1; i >= 0; i--) { - ItemStack charmStack = ItemStack.of(mobCharms.getCompound(i)); + ItemStack damageCharm(Player player, ItemStack belt, ResourceLocation entityRegistryName) { + return getFromHandler(belt, handler -> { + for (int i = 0; i < handler.getSlots(); i++) { + ItemStack charmStack = handler.getStackInSlot(i); + if (MobCharmItem.isCharmFor(charmStack, entityRegistryName)) { + charmStack.hurtAndBreak(Config.COMMON.items.mobCharm.damagePerKill.get(), player, EquipmentSlot.CHEST); + if (charmStack.isEmpty()) { + handler.removeStackAndSlot(i); + return ItemStack.EMPTY; + } else { + handler.setStackInSlot(i, charmStack); + return charmStack; + } + } + } + return ItemStack.EMPTY; + }); + } - if (MobCharmItem.getEntityRegistryName(charmStack).equals(entityRegistryName)) { - return true; + public Set getCharmRegistryNames(ItemStack slotStack) { + return getFromHandler(slotStack, handler -> { + Set ret = new HashSet<>(); + for (int i = 0; i < handler.getSlots(); i++) { + ItemStack charmStack = handler.getStackInSlot(i); + ret.add(MobCharmItem.getEntityEggRegistryName(charmStack)); } - } + return ret; + }); + } - return false; + private T getFromHandler(ItemStack stack, Function getter) { + return getter.apply(new MobCharmComponentItemHandler(stack)); } - ItemStack damageCharm(Player player, ItemStack belt, String entityRegistryName) { - CompoundTag nbt = belt.getTag(); + private void runOnHandler(ItemStack stack, Consumer runner) { + runner.accept(new MobCharmComponentItemHandler(stack)); + } - if (nbt == null || !nbt.contains(SLOTS_TAG)) { - return ItemStack.EMPTY; + private static class MobCharmComponentItemHandler extends ComponentItemHandler { + public MobCharmComponentItemHandler(MutableDataComponentHolder parent) { + super(parent, DataComponents.CONTAINER, getSlots(parent)); } - ListTag mobCharms = nbt.getList(SLOTS_TAG, Tag.TAG_COMPOUND); - - for (int i = mobCharms.size() - 1; i >= 0; i--) { - ItemStack charmStack = ItemStack.of(mobCharms.getCompound(i)); - - if (MobCharmItem.isCharmFor(charmStack, entityRegistryName)) { - charmStack.hurtAndBreak(Settings.COMMON.items.mobCharm.damagePerKill.get(), player, p -> p.broadcastBreakEvent(EquipmentSlot.CHEST)); - if (charmStack.isEmpty()) { - removeMobCharmInSlot(belt, i); - return ItemStack.EMPTY; - } else { - mobCharms.set(i, charmStack.save(new CompoundTag())); - return charmStack; - } - } + private static int getSlots(MutableDataComponentHolder parent) { + return parent.getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY).getSlots(); } - return ItemStack.EMPTY; - } + public void insertIntoNewSlot(ItemStack stack) { + ItemContainerContents contents = this.getContents(); + NonNullList list = NonNullList.withSize(Math.max(contents.getSlots(), this.getSlots() + 1), ItemStack.EMPTY); + contents.copyInto(list); + list.set(getSlots(), stack); + this.parent.set(this.component, ItemContainerContents.fromItems(list)); + this.onContentsChanged(list.size() - 1, ItemStack.EMPTY, stack); + } - public Set getCharmRegistryNames(ItemStack slotStack) { - Set ret = new HashSet<>(); - ListTag mobCharms = slotStack.getOrCreateTag().getList(SLOTS_TAG, Tag.TAG_COMPOUND); - for (int i = 0; i < mobCharms.size(); i++) { - ItemStack charmStack = ItemStack.of(mobCharms.getCompound(i)); - ret.add(MobCharmItem.getEntityRegistryName(charmStack)); + public ItemStack removeStackAndSlot(int slot) { + ItemContainerContents contents = this.getContents(); + NonNullList list = NonNullList.withSize(this.getSlots() - 1, ItemStack.EMPTY); + ItemStack stack = contents.getStackInSlot(slot); + for (int i = 0; i < slot; i++) { + list.set(i, contents.getSlots() > i ? contents.getStackInSlot(i) : ItemStack.EMPTY); + } + for (int i = slot; i < list.size(); i++) { + list.set(i, contents.getSlots() > i + 1 ? contents.getStackInSlot(i + 1) : ItemStack.EMPTY); + } + this.parent.set(this.component, ItemContainerContents.fromItems(list)); + this.onContentsChanged(slot, stack, ItemStack.EMPTY); + return stack; } - return ret; } } diff --git a/src/main/java/reliquary/items/MobCharmDefinition.java b/src/main/java/reliquary/items/MobCharmDefinition.java index 4dbaf055..3e1dac88 100644 --- a/src/main/java/reliquary/items/MobCharmDefinition.java +++ b/src/main/java/reliquary/items/MobCharmDefinition.java @@ -1,54 +1,57 @@ package reliquary.items; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import reliquary.init.ModItems; import javax.annotation.Nullable; -import java.util.Collections; +import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class MobCharmDefinition { - static final MobCharmDefinition ZOMBIE = new MobCharmDefinition("minecraft:zombie", ModItems.ZOMBIE_HEART.get(), "minecraft:zombie", "minecraft:husk", "minecraft:drowned", "minecraft:zombie_villager"); - static final MobCharmDefinition SKELETON = new MobCharmDefinition("minecraft:skeleton", ModItems.RIB_BONE.get(), "minecraft:skeleton", "minecraft:stray"); - static final MobCharmDefinition WITHER_SKELETON = new MobCharmDefinition("minecraft:wither_skeleton", ModItems.WITHERED_RIB.get(), "minecraft:wither_skeleton"); - static final MobCharmDefinition CREEPER = new MobCharmDefinition("minecraft:creeper", ModItems.CATALYZING_GLAND.get(), "minecraft:creeper"); - static final MobCharmDefinition WITCH = new MobCharmDefinition("minecraft:witch", ModItems.WITCH_HAT.get(), "minecraft:witch"); - static final MobCharmDefinition ZOMBIFIED_PIGLIN = new MobCharmDefinition("minecraft:zombified_piglin", ModItems.ZOMBIE_HEART.get(), "minecraft:zombified_piglin"); - static final MobCharmDefinition CAVE_SPIDER = new MobCharmDefinition("minecraft:cave_spider", ModItems.CHELICERAE.get(), "minecraft:cave_spider"); - static final MobCharmDefinition SPIDER = new MobCharmDefinition("minecraft:spider", ModItems.CHELICERAE.get(), "minecraft:spider"); - static final MobCharmDefinition ENDERMAN = new MobCharmDefinition("minecraft:enderman", ModItems.NEBULOUS_HEART.get(), "minecraft:enderman"); - static final MobCharmDefinition GHAST = new MobCharmDefinition("minecraft:ghast", ModItems.CATALYZING_GLAND.get(), "minecraft:ghast"); - static final MobCharmDefinition SLIME = new MobCharmDefinition("minecraft:slime", ModItems.SLIME_PEARL.get(), "minecraft:slime"); - static final MobCharmDefinition MAGMA_CUBE = new MobCharmDefinition("minecraft:magma_cube", ModItems.MOLTEN_CORE.get(), "minecraft:magma_cube"); - static final MobCharmDefinition BLAZE = new MobCharmDefinition("minecraft:blaze", ModItems.MOLTEN_CORE.get(), "minecraft:blaze"); - static final MobCharmDefinition GUARDIAN = new MobCharmDefinition("minecraft:guardian", ModItems.GUARDIAN_SPIKE.get(), "minecraft:guardian"); - static final MobCharmDefinition PIGLIN = new MobCharmDefinition("minecraft:piglin", null, "minecraft:piglin"); - static final MobCharmDefinition PIGLIN_BRUTE = new MobCharmDefinition("minecraft:piglin_brute", null, "minecraft:piglin_brute"); - static final MobCharmDefinition HOGLIN = new MobCharmDefinition("minecraft:hoglin", null, "minecraft:hoglin"); - - private final Set applicableToEntities = new HashSet<>(); - private final String registryName; + static final MobCharmDefinition ZOMBIE = new MobCharmDefinition(EntityType.ZOMBIE, ModItems.ZOMBIE_HEART.get(), EntityType.HUSK, EntityType.DROWNED, EntityType.ZOMBIE_VILLAGER); + static final MobCharmDefinition SKELETON = new MobCharmDefinition(EntityType.SKELETON, ModItems.RIB_BONE.get(), EntityType.STRAY); + static final MobCharmDefinition WITHER_SKELETON = new MobCharmDefinition(EntityType.WITHER_SKELETON, ModItems.WITHERED_RIB.get()); + static final MobCharmDefinition CREEPER = new MobCharmDefinition(EntityType.CREEPER, ModItems.CATALYZING_GLAND.get()); + static final MobCharmDefinition WITCH = new MobCharmDefinition(EntityType.WITCH, ModItems.WITCH_HAT.get()); + static final MobCharmDefinition ZOMBIFIED_PIGLIN = new MobCharmDefinition(EntityType.ZOMBIFIED_PIGLIN, ModItems.ZOMBIE_HEART.get()); + static final MobCharmDefinition CAVE_SPIDER = new MobCharmDefinition(EntityType.CAVE_SPIDER, ModItems.CHELICERAE.get()); + static final MobCharmDefinition SPIDER = new MobCharmDefinition(EntityType.SPIDER, ModItems.CHELICERAE.get()); + static final MobCharmDefinition ENDERMAN = new MobCharmDefinition(EntityType.ENDERMAN, ModItems.NEBULOUS_HEART.get()); + static final MobCharmDefinition GHAST = new MobCharmDefinition(EntityType.GHAST, ModItems.CATALYZING_GLAND.get()); + static final MobCharmDefinition SLIME = new MobCharmDefinition(EntityType.SLIME, ModItems.SLIME_PEARL.get()); + static final MobCharmDefinition MAGMA_CUBE = new MobCharmDefinition(EntityType.MAGMA_CUBE, ModItems.MOLTEN_CORE.get()); + static final MobCharmDefinition BLAZE = new MobCharmDefinition(EntityType.BLAZE, ModItems.MOLTEN_CORE.get()); + static final MobCharmDefinition GUARDIAN = new MobCharmDefinition(EntityType.GUARDIAN, ModItems.GUARDIAN_SPIKE.get()); + static final MobCharmDefinition PIGLIN = new MobCharmDefinition(EntityType.PIGLIN, null); + static final MobCharmDefinition PIGLIN_BRUTE = new MobCharmDefinition(EntityType.PIGLIN_BRUTE, null); + static final MobCharmDefinition HOGLIN = new MobCharmDefinition(EntityType.HOGLIN, null); + + private final Set applicableToEntities = new HashSet<>(); + private final ResourceLocation registryName; private final Item repairItem; private boolean dynamicallyCreated = false; - public MobCharmDefinition(String registryName) { - this(registryName, null, registryName); + public MobCharmDefinition(EntityType entityType) { + this(entityType, null, entityType); dynamicallyCreated = true; } - public MobCharmDefinition(String registryName, @Nullable Item repairItem, String... applicableTo) { - this.registryName = registryName; + public MobCharmDefinition(EntityType mainEntityType, @Nullable Item repairItem, EntityType... additionalApplicableTo) { + this.registryName = EntityType.getKey(mainEntityType); this.repairItem = repairItem; - Collections.addAll(applicableToEntities, applicableTo); + applicableToEntities.add(registryName); + Arrays.stream(additionalApplicableTo).map(EntityType::getKey).forEach(applicableToEntities::add); } - public String getRegistryName() { + public ResourceLocation getRegistryName() { return registryName; } - public Set getEntities() { + public Set getEntities() { return applicableToEntities; } diff --git a/src/main/java/reliquary/items/MobCharmFragmentItem.java b/src/main/java/reliquary/items/MobCharmFragmentItem.java index 5c1011ef..ee700159 100644 --- a/src/main/java/reliquary/items/MobCharmFragmentItem.java +++ b/src/main/java/reliquary/items/MobCharmFragmentItem.java @@ -1,13 +1,13 @@ package reliquary.items; import net.minecraft.ChatFormatting; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.registries.ForgeRegistries; -import reliquary.util.NBTHelper; +import reliquary.init.ModDataComponents; import java.util.function.Consumer; @@ -18,31 +18,30 @@ public MobCharmFragmentItem() { @Override public void addCreativeTabItems(Consumer itemConsumer) { - for (String entityRegistryName : MobCharmRegistry.getRegisteredNames()) { + for (ResourceLocation entityRegistryName : MobCharmRegistry.getRegisteredNames()) { itemConsumer.accept(getStackFor(entityRegistryName)); } } - public ItemStack getStackFor(String entityRegistryName) { - ItemStack ret = new ItemStack(this); - NBTHelper.putString("entity", ret, entityRegistryName); - return ret; + public ItemStack getStackFor(EntityType entityType) { + return getStackFor(EntityType.getKey(entityType)); } - public static String getEntityRegistryName(ItemStack charm) { - return NBTHelper.getString("entity", charm); + public ItemStack getStackFor(ResourceLocation entityRegistryName) { + ItemStack ret = new ItemStack(this); + ret.set(ModDataComponents.ENTITY_NAME.get(), entityRegistryName); + return ret; } - public static ResourceLocation getEntityEggRegistryName(ItemStack charm) { - return new ResourceLocation(getEntityRegistryName(charm)); + public static ResourceLocation getEntityRegistryName(ItemStack charm) { + return charm.getOrDefault(ModDataComponents.ENTITY_NAME.get(), BuiltInRegistries.ENTITY_TYPE.getDefaultKey()); } @Override public MutableComponent getName(ItemStack stack) { - EntityType entityType = ForgeRegistries.ENTITY_TYPES.getValue(getEntityEggRegistryName(stack)); - if (entityType == null) { - return super.getName(stack); - } - return Component.translatable(getDescriptionId(), entityType.getDescription().getString()).withStyle(ChatFormatting.GREEN); + ResourceLocation entityEggRegistryName = getEntityRegistryName(stack); + return BuiltInRegistries.ENTITY_TYPE.getOptional(entityEggRegistryName) + .map(entityType -> Component.translatable(getDescriptionId(), entityType.getDescription().getString()).withStyle(ChatFormatting.GREEN)) + .orElseGet(() -> super.getName(stack)); } } diff --git a/src/main/java/reliquary/items/MobCharmItem.java b/src/main/java/reliquary/items/MobCharmItem.java index e410fa08..a0baf5c6 100644 --- a/src/main/java/reliquary/items/MobCharmItem.java +++ b/src/main/java/reliquary/items/MobCharmItem.java @@ -2,35 +2,32 @@ import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; 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.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentCategory; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.event.entity.living.LivingChangeTargetEvent; -import net.minecraftforge.event.entity.living.LivingDeathEvent; -import net.minecraftforge.event.entity.living.LivingEvent; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.common.util.FakePlayer; +import net.neoforged.neoforge.event.entity.living.LivingChangeTargetEvent; +import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.event.tick.EntityTickEvent; +import net.neoforged.neoforge.network.PacketDistributor; import reliquary.blocks.tile.PedestalBlockEntity; +import reliquary.init.ModDataComponents; import reliquary.init.ModItems; -import reliquary.network.PacketHandler; -import reliquary.network.PacketMobCharmDamage; +import reliquary.network.MobCharmDamagePayload; import reliquary.pedestal.PedestalRegistry; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.MobHelper; -import reliquary.util.NBTHelper; import reliquary.util.WorldHelper; import javax.annotation.Nullable; @@ -39,56 +36,40 @@ public class MobCharmItem extends ItemBase { public MobCharmItem() { - super(new Properties().stacksTo(1).setNoRepair()); - MinecraftForge.EVENT_BUS.addListener(this::onEntityTargetedEvent); - MinecraftForge.EVENT_BUS.addListener(this::onLivingUpdate); - MinecraftForge.EVENT_BUS.addListener(this::onLivingDeath); - } - - @Override - public boolean canBeDepleted() { - return true; + super(new Properties().stacksTo(1).durability(10).setNoRepair()); + NeoForge.EVENT_BUS.addListener(this::onEntityTargetedEvent); + NeoForge.EVENT_BUS.addListener(this::onLivingUpdate); + NeoForge.EVENT_BUS.addListener(this::onLivingDeath); } @Override public int getMaxDamage(ItemStack stack) { - return Settings.COMMON.items.mobCharm.durability.get(); + return Config.COMMON.items.mobCharm.durability.get(); } @Override - @OnlyIn(Dist.CLIENT) - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - EntityType entityType = ForgeRegistries.ENTITY_TYPES.getValue(getEntityEggRegistryName(stack)); - if (entityType == null) { - return; - } - - tooltip.add(Component.translatable(getDescriptionId() + ".tooltip", entityType.getDescription().getString()).withStyle(ChatFormatting.GRAY)); + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flag) { + BuiltInRegistries.ENTITY_TYPE.getOptional(getEntityEggRegistryName(stack)).ifPresent(entityType -> + tooltip.add(Component.translatable(getDescriptionId() + ".tooltip", entityType.getDescription().getString()).withStyle(ChatFormatting.GRAY)) + ); } @Override public MutableComponent getName(ItemStack stack) { - EntityType entityType = ForgeRegistries.ENTITY_TYPES.getValue(getEntityEggRegistryName(stack)); - if (entityType == null) { - return super.getName(stack); - } - return Component.translatable(getDescriptionId(), entityType.getDescription().getString()).withStyle(ChatFormatting.GREEN); + return BuiltInRegistries.ENTITY_TYPE.getOptional(getEntityEggRegistryName(stack)) + .map(entityType -> Component.translatable(getDescriptionId(), entityType.getDescription().getString()).withStyle(ChatFormatting.GREEN)) + .orElseGet(() -> super.getName(stack)); } @Override public void addCreativeTabItems(Consumer itemConsumer) { - for (String entityRegistryName : MobCharmRegistry.getRegisteredNames()) { + for (ResourceLocation entityRegistryName : MobCharmRegistry.getRegisteredNames()) { itemConsumer.accept(getStackFor(entityRegistryName)); } } - @Override - public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { - return enchantment.category != EnchantmentCategory.BREAKABLE && super.canApplyAtEnchantingTable(stack, enchantment); - } - private void onEntityTargetedEvent(LivingChangeTargetEvent event) { - if (event.getEntity().level().isClientSide() || !(event.getNewTarget() instanceof Player player) || event.getNewTarget() instanceof FakePlayer || + if (event.getEntity().level().isClientSide() || !(event.getNewAboutToBeSetTarget() instanceof Player player) || event.getNewAboutToBeSetTarget() instanceof FakePlayer || !(event.getEntity() instanceof Mob entity)) { return; } @@ -100,7 +81,7 @@ private void onEntityTargetedEvent(LivingChangeTargetEvent event) { }); } - private void onLivingUpdate(LivingEvent.LivingTickEvent event) { + private void onLivingUpdate(EntityTickEvent.Pre event) { if (event.getEntity().level().isClientSide() || !(event.getEntity() instanceof Mob entity)) { return; } @@ -130,7 +111,7 @@ private Optional getRealPlayer(@Nullable LivingEntity livingEntity) { } private void onLivingDeath(LivingDeathEvent event) { - if (event.getSource() == null || event.getSource().getEntity() == null || !(event.getSource().getEntity() instanceof Player player)) { + if (event.getSource().getEntity() == null || !(event.getSource().getEntity() instanceof ServerPlayer player)) { return; } @@ -141,23 +122,23 @@ private void onLivingDeath(LivingDeathEvent event) { }); } - private void damageMobCharmInPedestal(Player player, String entityRegistryName) { - List pedestalPositions = PedestalRegistry.getPositionsInRange(player.level().dimension().registry(), player.blockPosition(), Settings.COMMON.items.mobCharm.pedestalRange.get()); - Level world = player.getCommandSenderWorld(); + private void damageMobCharmInPedestal(Player player, ResourceLocation entityRegistryName) { + List pedestalPositions = PedestalRegistry.getPositionsInRange(player.level().dimension().registry(), player.blockPosition(), Config.COMMON.items.mobCharm.pedestalRange.get()); + Level level = player.getCommandSenderWorld(); for (BlockPos pos : pedestalPositions) { - WorldHelper.getBlockEntity(world, pos, PedestalBlockEntity.class).ifPresent(pedestal -> damageMobCharmInPedestal(player, entityRegistryName, pedestal)); + WorldHelper.getBlockEntity(level, pos, PedestalBlockEntity.class).ifPresent(pedestal -> damageMobCharmInPedestal(player, entityRegistryName, pedestal)); } } - private void damageMobCharmInPedestal(Player player, String entityRegistryName, PedestalBlockEntity pedestal) { + private void damageMobCharmInPedestal(Player player, ResourceLocation entityRegistryName, PedestalBlockEntity pedestal) { if (pedestal.isEnabled()) { ItemStack pedestalItem = pedestal.getItem(); if (isCharmFor(pedestalItem, entityRegistryName)) { - if (pedestalItem.getDamageValue() + Settings.COMMON.items.mobCharm.damagePerKill.get() > pedestalItem.getMaxDamage()) { + if (pedestalItem.getDamageValue() + Config.COMMON.items.mobCharm.damagePerKill.get() > pedestalItem.getMaxDamage()) { pedestal.destroyItem(); } else { - pedestalItem.setDamageValue(pedestalItem.getDamageValue() + Settings.COMMON.items.mobCharm.damagePerKill.get()); + pedestalItem.setDamageValue(pedestalItem.getDamageValue() + Config.COMMON.items.mobCharm.damagePerKill.get()); } } else if (pedestalItem.getItem() == ModItems.MOB_CHARM_BELT.get()) { ModItems.MOB_CHARM_BELT.get().damageCharm(player, pedestalItem, entityRegistryName); @@ -169,21 +150,21 @@ private boolean isMobCharmPresent(Player player, MobCharmDefinition charmDefinit return charmInventoryHandler.playerHasMobCharm(player, charmDefinition) || pedestalWithCharmInRange(player, charmDefinition); } - private boolean isCharmOrBeltFor(ItemStack slotStack, String registryName) { + private boolean isCharmOrBeltFor(ItemStack slotStack, ResourceLocation registryName) { return isCharmFor(slotStack, registryName) || (slotStack.getItem() == ModItems.MOB_CHARM_BELT.get() && ModItems.MOB_CHARM_BELT.get().hasCharm(slotStack, registryName)); } - static boolean isCharmFor(ItemStack slotStack, String registryName) { - return slotStack.getItem() == ModItems.MOB_CHARM.get() && getEntityRegistryName(slotStack).equals(registryName); + static boolean isCharmFor(ItemStack slotStack, ResourceLocation registryName) { + return slotStack.getItem() == ModItems.MOB_CHARM.get() && getEntityEggRegistryName(slotStack).equals(registryName); } private boolean pedestalWithCharmInRange(Player player, MobCharmDefinition charmDefinition) { - List pedestalPositions = PedestalRegistry.getPositionsInRange(player.level().dimension().registry(), player.blockPosition(), Settings.COMMON.items.mobCharm.pedestalRange.get()); + List pedestalPositions = PedestalRegistry.getPositionsInRange(player.level().dimension().registry(), player.blockPosition(), Config.COMMON.items.mobCharm.pedestalRange.get()); - Level world = player.getCommandSenderWorld(); + Level level = player.getCommandSenderWorld(); for (BlockPos pos : pedestalPositions) { - if (WorldHelper.getBlockEntity(world, pos, PedestalBlockEntity.class).map(pedestal -> hasCharm(charmDefinition.getRegistryName(), pedestal)).orElse(false)) { + if (WorldHelper.getBlockEntity(level, pos, PedestalBlockEntity.class).map(pedestal -> hasCharm(charmDefinition.getRegistryName(), pedestal)).orElse(false)) { return true; } } @@ -191,7 +172,7 @@ private boolean pedestalWithCharmInRange(Player player, MobCharmDefinition charm return false; } - private boolean hasCharm(String entityRegistryName, PedestalBlockEntity pedestal) { + private boolean hasCharm(ResourceLocation entityRegistryName, PedestalBlockEntity pedestal) { if (pedestal.isEnabled()) { ItemStack pedestalItem = pedestal.getItem(); return isCharmOrBeltFor(pedestalItem, entityRegistryName); @@ -199,22 +180,18 @@ private boolean hasCharm(String entityRegistryName, PedestalBlockEntity pedestal return false; } - static String getEntityRegistryName(ItemStack charm) { - return NBTHelper.getString("entity", charm); + public static void setEntityRegistryName(ItemStack charm, ResourceLocation regName) { + charm.set(ModDataComponents.ENTITY_NAME, regName); } - public static void setEntityRegistryName(ItemStack charm, String regName) { - NBTHelper.putString("entity", charm, regName); - } - - public ItemStack getStackFor(String entityRegistryName) { + public ItemStack getStackFor(ResourceLocation entityRegistryName) { ItemStack ret = new ItemStack(this); setEntityRegistryName(ret, entityRegistryName); return ret; } public static ResourceLocation getEntityEggRegistryName(ItemStack charm) { - return new ResourceLocation(getEntityRegistryName(charm)); + return charm.getOrDefault(ModDataComponents.ENTITY_NAME, BuiltInRegistries.ENTITY_TYPE.getDefaultKey()); } private CharmInventoryHandler charmInventoryHandler = new CharmInventoryHandler(); @@ -225,16 +202,16 @@ public void setCharmInventoryHandler(CharmInventoryHandler charmInventoryHandler public static class CharmInventoryHandler { private long lastCharmCacheTime = -1; - private final Map> charmsInInventoryCache = new HashMap<>(); + private final Map> charmsInInventoryCache = new HashMap<>(); - protected Set getCharmRegistryNames(Player player) { - Set ret = new HashSet<>(); + protected Set getCharmRegistryNames(Player player) { + Set ret = new HashSet<>(); for (ItemStack slotStack : player.getInventory().items) { if (slotStack.isEmpty()) { continue; } if (slotStack.getItem() == ModItems.MOB_CHARM.get()) { - ret.add(getEntityRegistryName(slotStack)); + ret.add(getEntityEggRegistryName(slotStack)); } if (slotStack.getItem() == ModItems.MOB_CHARM_BELT.get()) { ret.addAll(ModItems.MOB_CHARM_BELT.get().getCharmRegistryNames(slotStack)); @@ -244,7 +221,7 @@ protected Set getCharmRegistryNames(Player player) { } public boolean playerHasMobCharm(Player player, MobCharmDefinition charmDefinition) { - String registryName = charmDefinition.getRegistryName(); + ResourceLocation registryName = charmDefinition.getRegistryName(); if (lastCharmCacheTime != player.level().getGameTime()) { lastCharmCacheTime = player.level().getGameTime(); @@ -254,7 +231,7 @@ public boolean playerHasMobCharm(Player player, MobCharmDefinition charmDefiniti } - public boolean damagePlayersMobCharm(Player player, String entityRegistryName) { + public boolean damagePlayersMobCharm(ServerPlayer player, ResourceLocation entityRegistryName) { if (player.isCreative()) { return true; } @@ -262,7 +239,7 @@ public boolean damagePlayersMobCharm(Player player, String entityRegistryName) { return damageCharmInPlayersInventory(player, entityRegistryName); } - private Boolean damageCharmInPlayersInventory(Player player, String entityRegistryName) { + private boolean damageCharmInPlayersInventory(ServerPlayer player, ResourceLocation entityRegistryName) { for (int slot = 0; slot < player.getInventory().items.size(); slot++) { ItemStack stack = player.getInventory().items.get(slot); @@ -270,32 +247,42 @@ private Boolean damageCharmInPlayersInventory(Player player, String entityRegist continue; } if (isCharmFor(stack, entityRegistryName)) { - if (stack.getDamageValue() + Settings.COMMON.items.mobCharm.damagePerKill.get() > stack.getMaxDamage()) { + if (stack.getDamageValue() + Config.COMMON.items.mobCharm.damagePerKill.get() > stack.getMaxDamage()) { player.getInventory().items.set(slot, ItemStack.EMPTY); - PacketHandler.sendToClient((ServerPlayer) player, new PacketMobCharmDamage(ItemStack.EMPTY, slot)); + PacketDistributor.sendToPlayer(player, new MobCharmDamagePayload(ItemStack.EMPTY, slot)); } else { - stack.setDamageValue(stack.getDamageValue() + Settings.COMMON.items.mobCharm.damagePerKill.get()); - PacketHandler.sendToClient((ServerPlayer) player, new PacketMobCharmDamage(stack, slot)); + stack.setDamageValue(stack.getDamageValue() + Config.COMMON.items.mobCharm.damagePerKill.get()); + PacketDistributor.sendToPlayer(player, new MobCharmDamagePayload(stack, slot)); } return true; } - if (damageMobCharmInBelt((ServerPlayer) player, entityRegistryName, stack)) { + if (damageMobCharmInBelt(player, entityRegistryName, stack)) { return true; } } return false; } - protected boolean damageMobCharmInBelt(ServerPlayer player, String entityRegistryName, ItemStack belt) { + protected boolean damageMobCharmInBelt(ServerPlayer player, ResourceLocation entityRegistryName, ItemStack belt) { if (belt.getItem() == ModItems.MOB_CHARM_BELT.get()) { ItemStack charmStack = ModItems.MOB_CHARM_BELT.get().damageCharm(player, belt, entityRegistryName); if (!charmStack.isEmpty()) { - PacketHandler.sendToClient(player, new PacketMobCharmDamage(charmStack, -1)); + PacketDistributor.sendToPlayer(player, new MobCharmDamagePayload(charmStack, -1)); return true; } } return false; } } + + @Override + public boolean isEnchantable(ItemStack p_41456_) { + return false; + } + + @Override + public boolean supportsEnchantment(ItemStack stack, Holder enchantment) { + return false; + } } diff --git a/src/main/java/reliquary/items/MobCharmRegistry.java b/src/main/java/reliquary/items/MobCharmRegistry.java index 266d3e77..525e90e1 100644 --- a/src/main/java/reliquary/items/MobCharmRegistry.java +++ b/src/main/java/reliquary/items/MobCharmRegistry.java @@ -1,5 +1,8 @@ package reliquary.items; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -7,30 +10,29 @@ import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.event.entity.living.LivingDropsEvent; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.Enchantments; +import net.neoforged.neoforge.event.entity.living.LivingDropsEvent; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.RegistryHelper; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; import static reliquary.items.MobCharmDefinition.*; public class MobCharmRegistry { - private MobCharmRegistry() {} + private MobCharmRegistry() { + } - private static final Map REGISTERED_CHARM_DEFINITIONS = new HashMap<>(); - private static final Map ENTITY_NAME_CHARM_DEFINITIONS = new HashMap<>(); - private static final Set DYNAMICALLY_REGISTERED = new HashSet<>(); + private static final Map REGISTERED_CHARM_DEFINITIONS = new HashMap<>(); + private static final Map ENTITY_NAME_CHARM_DEFINITIONS = new HashMap<>(); + private static final Set DYNAMICALLY_REGISTERED = new HashSet<>(); public static void registerMobCharmDefinition(MobCharmDefinition charmDefinition) { REGISTERED_CHARM_DEFINITIONS.put(charmDefinition.getRegistryName(), charmDefinition); - for (String registryName : charmDefinition.getEntities()) { + for (ResourceLocation registryName : charmDefinition.getEntities()) { ENTITY_NAME_CHARM_DEFINITIONS.put(registryName, charmDefinition); } } @@ -56,7 +58,7 @@ public static void registerMobCharmDefinition(MobCharmDefinition charmDefinition } static Optional getCharmDefinitionFor(Entity entity) { - return Optional.ofNullable(ENTITY_NAME_CHARM_DEFINITIONS.get(RegistryHelper.getRegistryName(entity).toString())); + return Optional.ofNullable(ENTITY_NAME_CHARM_DEFINITIONS.get(RegistryHelper.getRegistryName(entity))); } public static Optional getCharmDefinitionFor(ItemStack stack) { @@ -64,19 +66,18 @@ public static Optional getCharmDefinitionFor(ItemStack stack return Optional.empty(); } - return Optional.ofNullable(ENTITY_NAME_CHARM_DEFINITIONS.get(MobCharmItem.getEntityRegistryName(stack))); + return Optional.ofNullable(ENTITY_NAME_CHARM_DEFINITIONS.get(MobCharmItem.getEntityEggRegistryName(stack))); } - public static Set getRegisteredNames() { + public static Set getRegisteredNames() { return REGISTERED_CHARM_DEFINITIONS.keySet(); } public static void registerDynamicCharmDefinitions() { - for (EntityType entityType : ForgeRegistries.ENTITY_TYPES) { - String registryName = RegistryHelper.getRegistryName(entityType).toString(); - Set blockedEntities = new HashSet<>(Settings.COMMON.items.mobCharm.entityBlockList.get()); - if (!ENTITY_NAME_CHARM_DEFINITIONS.containsKey(registryName) && entityType.getCategory() == MobCategory.MONSTER && !blockedEntities.contains(registryName)) { - registerMobCharmDefinition(new MobCharmDefinition(registryName)); + for (EntityType entityType : BuiltInRegistries.ENTITY_TYPE) { + ResourceLocation registryName = EntityType.getKey(entityType); + if (!ENTITY_NAME_CHARM_DEFINITIONS.containsKey(registryName) && entityType.getCategory() == MobCategory.MONSTER && !Config.COMMON.items.mobCharm.isBlockedEntity(registryName)) { + registerMobCharmDefinition(new MobCharmDefinition(entityType)); DYNAMICALLY_REGISTERED.add(registryName); } } @@ -89,14 +90,17 @@ public static void handleAddingFragmentDrops(LivingDropsEvent evt) { LivingEntity entity = evt.getEntity(); ResourceLocation regName = RegistryHelper.getRegistryName(entity); - if (!DYNAMICALLY_REGISTERED.contains(regName.toString())) { + if (!DYNAMICALLY_REGISTERED.contains(regName)) { return; } - double dynamicDropChance = Settings.COMMON.items.mobCharmFragment.dropChance.get() + evt.getLootingLevel() * Settings.COMMON.items.mobCharmFragment.lootingMultiplier.get(); + HolderLookup.RegistryLookup registrylookup = entity.level().registryAccess().lookupOrThrow(Registries.ENCHANTMENT); + int lootingLevel = EnchantmentHelper.getEnchantmentLevel(registrylookup.getOrThrow(Enchantments.LOOTING), entity); + + double dynamicDropChance = Config.COMMON.items.mobCharmFragment.dropChance.get() + lootingLevel * Config.COMMON.items.mobCharmFragment.lootingMultiplier.get(); if (entity.level().random.nextFloat() < dynamicDropChance) { - ItemEntity fragmentItemEntity = new ItemEntity(entity.level(), entity.getX(), entity.getY(), entity.getZ(), ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(regName.toString())); + ItemEntity fragmentItemEntity = new ItemEntity(entity.level(), entity.getX(), entity.getY(), entity.getZ(), ModItems.MOB_CHARM_FRAGMENT.get().getStackFor(regName)); fragmentItemEntity.setDefaultPickUpDelay(); evt.getDrops().add(fragmentItemEntity); diff --git a/src/main/java/reliquary/items/MobDropItem.java b/src/main/java/reliquary/items/MobDropItem.java index a9505643..1e40998f 100644 --- a/src/main/java/reliquary/items/MobDropItem.java +++ b/src/main/java/reliquary/items/MobDropItem.java @@ -3,17 +3,15 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; -import reliquary.reference.Settings; +import reliquary.reference.Config; -import javax.annotation.Nullable; import java.util.List; public class MobDropItem extends ItemBase { @Override - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - if (Boolean.TRUE.equals(Settings.COMMON.mobDropsEnabled.get())) { - super.appendHoverText(stack, world, tooltip, flag); + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flag) { + if (Boolean.TRUE.equals(Config.COMMON.mobDropsEnabled.get())) { + super.appendHoverText(stack, context, tooltip, flag); } } } diff --git a/src/main/java/reliquary/items/PhoenixDownItem.java b/src/main/java/reliquary/items/PhoenixDownItem.java index c5c19c57..9933f5c4 100644 --- a/src/main/java/reliquary/items/PhoenixDownItem.java +++ b/src/main/java/reliquary/items/PhoenixDownItem.java @@ -1,20 +1,19 @@ package reliquary.items; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.event.entity.living.LivingAttackEvent; -import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; +import net.neoforged.neoforge.network.PacketDistributor; import reliquary.handler.CommonEventHandler; import reliquary.handler.HandlerPriority; import reliquary.handler.IPlayerDeathHandler; import reliquary.handler.IPlayerHurtHandler; import reliquary.init.ModItems; -import reliquary.network.PacketHandler; -import reliquary.network.SpawnPhoenixDownParticlesPacket; -import reliquary.reference.Settings; +import reliquary.network.SpawnPhoenixDownParticlesPayload; +import reliquary.reference.Config; import reliquary.util.EntityHelper; import reliquary.util.InventoryHelper; @@ -25,7 +24,7 @@ public PhoenixDownItem() { CommonEventHandler.registerPlayerHurtHandler(new IPlayerHurtHandler() { @Override - public boolean canApply(Player player, LivingAttackEvent event) { + public boolean canApply(Player player, LivingIncomingDamageEvent event) { return event.getSource() == player.damageSources().fall() && player.getHealth() > Math.round(event.getAmount()) && player.getFoodData().getFoodLevel() > 0 @@ -33,8 +32,8 @@ public boolean canApply(Player player, LivingAttackEvent event) { } @Override - public boolean apply(Player player, LivingAttackEvent event) { - float hungerDamage = event.getAmount() * ((float) Settings.COMMON.items.phoenixDown.hungerCostPercent.get() / 100F); + public boolean apply(Player player, LivingIncomingDamageEvent event) { + float hungerDamage = event.getAmount() * ((float) Config.COMMON.items.phoenixDown.hungerCostPercent.get() / 100F); player.causeFoodExhaustion(hungerDamage); return true; } @@ -57,30 +56,30 @@ public boolean apply(Player player, LivingDeathEvent event) { revertPhoenixDownToAngelicFeather(player); // gives the player a few hearts, sparing them from death. - float amountHealed = player.getMaxHealth() * (float) Settings.COMMON.items.phoenixDown.healPercentageOfMaxLife.get() / 100F; + float amountHealed = player.getMaxHealth() * (float) Config.COMMON.items.phoenixDown.healPercentageOfMaxLife.get() / 100F; player.setHealth(amountHealed); // if the player had any negative status effects [vanilla only for now], remove them: - if (Boolean.TRUE.equals(Settings.COMMON.items.phoenixDown.removeNegativeStatus.get())) { + if (Boolean.TRUE.equals(Config.COMMON.items.phoenixDown.removeNegativeStatus.get())) { EntityHelper.removeNegativeStatusEffects(player); } // added bonus, has some extra effects when drowning or dying to lava - if (event.getSource() == player.damageSources().lava() && Boolean.TRUE.equals(Settings.COMMON.items.phoenixDown.giveTemporaryFireResistanceIfFireDamageKilledYou.get())) { + if (event.getSource() == player.damageSources().lava() && Boolean.TRUE.equals(Config.COMMON.items.phoenixDown.giveTemporaryFireResistanceIfFireDamageKilledYou.get())) { player.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 200, 0)); } - if (event.getSource() == player.damageSources().drown() && Boolean.TRUE.equals(Settings.COMMON.items.phoenixDown.giveTemporaryWaterBreathingIfDrowningKilledYou.get())) { + if (event.getSource() == player.damageSources().drown() && Boolean.TRUE.equals(Config.COMMON.items.phoenixDown.giveTemporaryWaterBreathingIfDrowningKilledYou.get())) { player.setAirSupply(10); player.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 200, 0)); } // give the player temporary resistance to other damages. - if (Boolean.TRUE.equals(Settings.COMMON.items.phoenixDown.giveTemporaryDamageResistance.get())) { + if (Boolean.TRUE.equals(Config.COMMON.items.phoenixDown.giveTemporaryDamageResistance.get())) { player.addEffect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 200, 1)); } // give the player temporary regeneration. - if (Boolean.TRUE.equals(Settings.COMMON.items.phoenixDown.giveTemporaryRegeneration.get())) { + if (Boolean.TRUE.equals(Config.COMMON.items.phoenixDown.giveTemporaryRegeneration.get())) { player.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 200, 1)); } @@ -110,6 +109,6 @@ private static void revertPhoenixDownToAngelicFeather(Player player) { } private static void spawnPhoenixResurrectionParticles(Player player) { - PacketHandler.sendToClient((ServerPlayer) player, SpawnPhoenixDownParticlesPacket.INSTANCE); + PacketDistributor.sendToPlayersTrackingEntityAndSelf(player, new SpawnPhoenixDownParticlesPayload(player.position())); } } diff --git a/src/main/java/reliquary/items/PotionEssenceItem.java b/src/main/java/reliquary/items/PotionEssenceItem.java index d90452b8..e1b5db09 100644 --- a/src/main/java/reliquary/items/PotionEssenceItem.java +++ b/src/main/java/reliquary/items/PotionEssenceItem.java @@ -1,20 +1,17 @@ package reliquary.items; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.world.item.alchemy.PotionContents; import reliquary.items.util.IPotionItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.TooltipBuilder; import reliquary.util.potions.PotionEssence; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionMap; -import reliquary.util.potions.XRPotionHelper; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; @@ -26,26 +23,25 @@ public PotionEssenceItem() { @Override public void addCreativeTabItems(Consumer itemConsumer) { - if (Boolean.TRUE.equals(Settings.COMMON.disable.disablePotions.get())) { + if (Boolean.TRUE.equals(Config.COMMON.disable.disablePotions.get())) { return; } for (PotionEssence essence : PotionMap.uniquePotionEssences) { ItemStack essenceItem = new ItemStack(this, 1); - XRPotionHelper.addPotionEffectsToStack(essenceItem, essence.getEffects()); + PotionHelper.addPotionContentsToStack(essenceItem, essence.getPotionContents()); itemConsumer.accept(essenceItem); } } @Override - @OnlyIn(Dist.CLIENT) - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { - TooltipBuilder.of(tooltip).potionEffects(stack); + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flag) { + TooltipBuilder.of(tooltip, context).potionEffects(stack); } @Override - public List getEffects(ItemStack stack) { - return XRPotionHelper.getPotionEffectsFromStack(stack); + public PotionContents getPotionContents(ItemStack stack) { + return stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); } } diff --git a/src/main/java/reliquary/items/PotionItem.java b/src/main/java/reliquary/items/PotionItem.java index abca95a6..e50d8b2f 100644 --- a/src/main/java/reliquary/items/PotionItem.java +++ b/src/main/java/reliquary/items/PotionItem.java @@ -1,5 +1,6 @@ package reliquary.items; +import net.minecraft.core.component.DataComponents; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; @@ -8,9 +9,10 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemUtils; import net.minecraft.world.item.UseAnim; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.level.Level; import reliquary.init.ModItems; -import reliquary.util.potions.XRPotionHelper; +import reliquary.util.potions.PotionHelper; public class PotionItem extends PotionItemBase { @Override @@ -19,27 +21,27 @@ public UseAnim getUseAnimation(ItemStack stack) { } @Override - public int getUseDuration(ItemStack par1ItemStack) { + public int getUseDuration(ItemStack stack, LivingEntity livingEntity) { return 16; } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); - if (!XRPotionHelper.getPotionEffectsFromStack(stack).isEmpty()) { - return ItemUtils.startUsingInstantly(world, player, hand); + if (PotionHelper.hasPotionContents(stack)) { + return ItemUtils.startUsingInstantly(level, player, hand); } else { return new InteractionResultHolder<>(InteractionResult.PASS, stack); } } @Override - public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity entity) { - if (!(entity instanceof Player player) || world.isClientSide) { + public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity entity) { + if (!(entity instanceof Player player) || level.isClientSide) { return stack; } - XRPotionHelper.applyEffectsToEntity(XRPotionHelper.getPotionEffectsFromStack(stack), player, null, player); + PotionHelper.applyEffectsToEntity(stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY), player, null, player); if (!player.isCreative()) { stack.shrink(1); diff --git a/src/main/java/reliquary/items/PotionItemBase.java b/src/main/java/reliquary/items/PotionItemBase.java index ceb51a48..301d4cd9 100644 --- a/src/main/java/reliquary/items/PotionItemBase.java +++ b/src/main/java/reliquary/items/PotionItemBase.java @@ -1,21 +1,18 @@ package reliquary.items; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.world.item.alchemy.PotionContents; import reliquary.init.ModItems; import reliquary.items.util.IPotionItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.TooltipBuilder; import reliquary.util.potions.PotionEssence; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionMap; -import reliquary.util.potions.XRPotionHelper; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; @@ -28,7 +25,7 @@ public PotionItemBase() { // the base potion types. @Override public boolean hasCraftingRemainingItem(ItemStack stack) { - return !XRPotionHelper.getPotionEffectsFromStack(stack).isEmpty(); + return PotionHelper.hasPotionContents(stack); } @Override @@ -37,27 +34,26 @@ public ItemStack getCraftingRemainingItem(ItemStack itemStack) { } @Override - @OnlyIn(Dist.CLIENT) - public void appendHoverText(ItemStack potion, @Nullable Level world, List tooltip, TooltipFlag flag) { - TooltipBuilder.of(tooltip).potionEffects(potion); + public void appendHoverText(ItemStack potion, TooltipContext context, List tooltip, TooltipFlag flag) { + TooltipBuilder.of(tooltip, context).potionEffects(potion); } @Override public void addCreativeTabItems(Consumer itemConsumer) { - if (Boolean.TRUE.equals(Settings.COMMON.disable.disablePotions.get())) { + if (Boolean.TRUE.equals(Config.COMMON.disable.disablePotions.get())) { return; } for (PotionEssence essence : PotionMap.uniquePotions) { ItemStack potion = new ItemStack(this, 1); - XRPotionHelper.addPotionEffectsToStack(potion, essence.getEffects()); + PotionHelper.addPotionContentsToStack(potion, essence.getPotionContents()); itemConsumer.accept(potion); } } @Override - public List getEffects(ItemStack stack) { - return XRPotionHelper.getPotionEffectsFromStack(stack); + public PotionContents getPotionContents(ItemStack stack) { + return stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); } } diff --git a/src/main/java/reliquary/items/PyromancerStaffItem.java b/src/main/java/reliquary/items/PyromancerStaffItem.java index a3cfbcfd..f908904e 100644 --- a/src/main/java/reliquary/items/PyromancerStaffItem.java +++ b/src/main/java/reliquary/items/PyromancerStaffItem.java @@ -1,11 +1,15 @@ package reliquary.items; import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.Codec; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.StringRepresentable; @@ -30,13 +34,11 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; +import reliquary.init.ModDataComponents; import reliquary.items.util.IScrollableItem; -import reliquary.reference.Settings; -import reliquary.util.NBTHelper; +import reliquary.reference.Config; import reliquary.util.RandHelper; -import reliquary.util.RegistryHelper; import reliquary.util.TooltipBuilder; import javax.annotation.Nullable; @@ -46,6 +48,8 @@ public class PyromancerStaffItem extends ToggleableItem implements IScrollableItem { private static final int EFFECT_COOLDOWN = 2; private static final int INVENTORY_SEARCH_COOLDOWN = EFFECT_COOLDOWN * 5; + public static final int BLAZE_POWDER_SLOT = 0; + public static final int FIRE_CHARGE_SLOT = 1; public PyromancerStaffItem() { super(new Properties().stacksTo(1)); @@ -57,8 +61,8 @@ public MutableComponent getName(ItemStack stack) { } @Override - public void inventoryTick(ItemStack stack, Level world, Entity e, int i, boolean f) { - if (!(e instanceof Player player) || world.getGameTime() % EFFECT_COOLDOWN != 0) { + public void inventoryTick(ItemStack stack, Level level, Entity entity, int i, boolean f) { + if (level.isClientSide() || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % EFFECT_COOLDOWN != 0) { return; } @@ -72,20 +76,13 @@ public void inventoryTick(ItemStack stack, Level world, Entity e, int i, boolean } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack staff, @Nullable Level world, TooltipBuilder tooltipBuilder) { + protected void addMoreInformation(ItemStack staff, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { AtomicInteger charges = new AtomicInteger(0); AtomicInteger blaze = new AtomicInteger(0); - iterateItems(staff, tag -> { - String itemName = tag.getString(ITEM_NAME_TAG); - int quantity = tag.getInt(QUANTITY_TAG); - - if (itemName.equals(RegistryHelper.getItemRegistryName(Items.BLAZE_POWDER))) { - blaze.set(quantity); - } else if (itemName.equals(RegistryHelper.getItemRegistryName(Items.FIRE_CHARGE))) { - charges.set(quantity); - } - }, () -> false); + runOnHandler(staff, handler -> { + charges.set(handler.getCountInSlot(FIRE_CHARGE_SLOT)); + blaze.set(handler.getCountInSlot(BLAZE_POWDER_SLOT)); + }); tooltipBuilder.charge(this, ".tooltip.charges", charges.get()); tooltipBuilder.charge(this, ".tooltip.blaze", blaze.get()); tooltipBuilder.description(this, ".tooltip.controls"); @@ -102,7 +99,7 @@ protected boolean hasMoreInformation(ItemStack stack) { } @Override - public int getUseDuration(ItemStack par1ItemStack) { + public int getUseDuration(ItemStack stack, LivingEntity livingEntity) { return 11; } @@ -112,11 +109,11 @@ public UseAnim getUseAnimation(ItemStack stack) { } public Mode getMode(ItemStack stack) { - return NBTHelper.getEnumConstant(stack, "mode", Mode::valueOf).orElse(Mode.BLAZE); + return stack.getOrDefault(ModDataComponents.PYROMANCER_STAFF_MODE, Mode.BLAZE); } private void setMode(ItemStack stack, Mode mode) { - NBTHelper.putString("mode", stack, mode.getSerializedName()); + stack.set(ModDataComponents.PYROMANCER_STAFF_MODE, mode); } private void cycleMode(ItemStack stack, boolean next) { @@ -133,10 +130,10 @@ public InteractionResult onMouseScrolled(ItemStack stack, Player player, double } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (player.isShiftKeyDown()) { - super.use(world, player, hand); + super.use(level, player, hand); } else { if (getMode(stack) == Mode.BLAZE) { player.swing(hand); @@ -153,12 +150,9 @@ public InteractionResultHolder use(Level world, Player player, Intera } private void shootGhastFireball(Player player, ItemStack stack, Vec3 lookVec) { - if (removeItemFromInternalStorage(stack, Items.FIRE_CHARGE, getFireChargeCost(), player.level().isClientSide, player)) { + if (removeItemFromInternalStorage(stack, FIRE_CHARGE_SLOT, getFireChargeCost(), player.level().isClientSide, player)) { player.level().levelEvent(player, 1016, player.blockPosition(), 0); - LargeFireball fireball = new LargeFireball(player.level(), player, lookVec.x, lookVec.y, lookVec.z, 1); - fireball.xPower = lookVec.x / 3; - fireball.yPower = lookVec.y / 3; - fireball.zPower = lookVec.z / 3; + LargeFireball fireball = new LargeFireball(player.level(), player, lookVec, 1); fireball.setPos(fireball.getX() + lookVec.x, player.getY() + player.getEyeHeight(), fireball.getZ() + lookVec.z); player.level().addFreshEntity(fireball); @@ -168,12 +162,9 @@ private void shootGhastFireball(Player player, ItemStack stack, Vec3 lookVec) { private void shootBlazeFireball(Player player, ItemStack stack) { Vec3 lookVec = player.getLookAngle(); //blaze fireball! - if (removeItemFromInternalStorage(stack, Items.BLAZE_POWDER, getBlazePowderCost(), player.level().isClientSide, player)) { + if (removeItemFromInternalStorage(stack, BLAZE_POWDER_SLOT, getBlazePowderCost(), player.level().isClientSide, player)) { player.level().levelEvent(player, 1018, player.blockPosition(), 0); - SmallFireball fireball = new SmallFireball(player.level(), player, lookVec.x, lookVec.y, lookVec.z); - fireball.xPower = lookVec.x / 3; - fireball.yPower = lookVec.y / 3; - fireball.zPower = lookVec.z / 3; + SmallFireball fireball = new SmallFireball(player.level(), player, lookVec); fireball.setPos(fireball.getX() + lookVec.x, player.getY() + player.getEyeHeight(), fireball.getZ() + lookVec.z); player.level().addFreshEntity(fireball); } @@ -184,17 +175,17 @@ public void onUseTick(Level level, LivingEntity livingEntity, ItemStack stack, i if (!(livingEntity instanceof Player)) { return; } - if (getMode(stack) == Mode.ERUPTION && getInternalStorageItemCount(stack, Items.BLAZE_POWDER) > 0) { + if (getMode(stack) == Mode.ERUPTION && getBlazePowderCount(stack) > 0) { Player player = (Player) livingEntity; HitResult rayTraceResult = player.pick(12, 1, true); if (rayTraceResult.getType() == HitResult.Type.BLOCK) { remainingUseDuration -= 1; - remainingUseDuration = getUseDuration(stack) - remainingUseDuration; + remainingUseDuration = getUseDuration(stack, livingEntity) - remainingUseDuration; BlockHitResult blockRayTraceResult = (BlockHitResult) rayTraceResult; doEruptionAuxEffects(player, blockRayTraceResult.getBlockPos().getX(), blockRayTraceResult.getBlockPos().getY(), blockRayTraceResult.getBlockPos().getZ()); - if (remainingUseDuration % 10 == 0 && removeItemFromInternalStorage(stack, Items.BLAZE_POWDER, getBlazePowderCost(), player.level().isClientSide, player)) { + if (remainingUseDuration % 10 == 0 && removeItemFromInternalStorage(stack, BLAZE_POWDER_SLOT, getBlazePowderCost(), player.level().isClientSide, player)) { doEruptionEffect(player, blockRayTraceResult.getBlockPos().getX(), blockRayTraceResult.getBlockPos().getY(), blockRayTraceResult.getBlockPos().getZ()); } } @@ -264,7 +255,7 @@ private void doEruptionEffect(Player player, int x, int y, int z) { List entities = player.level().getEntitiesOfClass(Mob.class, new AABB(lowerX, y, lowerZ, upperX, upperY, upperZ)); entities.stream().filter(e -> !e.is(player)).forEach(e -> { - e.setSecondsOnFire(40); + e.igniteForSeconds(40); if (!e.fireImmune()) { e.hurt(player.damageSources().playerAttack(player), 4F); } @@ -276,45 +267,45 @@ private void scanForFireChargeAndBlazePowder(ItemStack staff, Player player) { return; } - int currentFireChargeCount = getInternalStorageItemCount(staff, Items.FIRE_CHARGE); + int currentFireChargeCount = getFireChargeCount(staff); consumeAndCharge(player, getFireChargeLimit() - currentFireChargeCount, getFireChargeWorth(), Items.FIRE_CHARGE, 16, - chargeToAdd -> addItemToInternalStorage(staff, Items.FIRE_CHARGE, chargeToAdd)); + chargeToAdd -> addItemToContainer(staff, Items.FIRE_CHARGE, chargeToAdd)); - int currentBlazePowderCount = getInternalStorageItemCount(staff, Items.BLAZE_POWDER); + int currentBlazePowderCount = getBlazePowderCount(staff); consumeAndCharge(player, getBlazePowderLimit() - currentBlazePowderCount, getBlazePowderWorth(), Items.BLAZE_POWDER, 16, - chargeToAdd -> addItemToInternalStorage(staff, Items.BLAZE_POWDER, chargeToAdd)); + chargeToAdd -> addItemToContainer(staff, Items.BLAZE_POWDER, chargeToAdd)); } private int getFireChargeWorth() { - return Settings.COMMON.items.pyromancerStaff.fireChargeWorth.get(); + return Config.COMMON.items.pyromancerStaff.fireChargeWorth.get(); } private int getFireChargeCost() { - return Settings.COMMON.items.pyromancerStaff.fireChargeCost.get(); + return Config.COMMON.items.pyromancerStaff.fireChargeCost.get(); } private int getFireChargeLimit() { - return Settings.COMMON.items.pyromancerStaff.fireChargeLimit.get(); + return Config.COMMON.items.pyromancerStaff.fireChargeLimit.get(); } private int getBlazePowderWorth() { - return Settings.COMMON.items.pyromancerStaff.blazePowderWorth.get(); + return Config.COMMON.items.pyromancerStaff.blazePowderWorth.get(); } private int getBlazePowderCost() { - return Settings.COMMON.items.pyromancerStaff.blazePowderCost.get(); + return Config.COMMON.items.pyromancerStaff.blazePowderCost.get(); } private int getBlazePowderLimit() { - return Settings.COMMON.items.pyromancerStaff.blazePowderLimit.get(); + return Config.COMMON.items.pyromancerStaff.blazePowderLimit.get(); } private int getBlazeAbsorbWorth() { - return Settings.COMMON.items.pyromancerStaff.blazeAbsorbWorth.get(); + return Config.COMMON.items.pyromancerStaff.blazeAbsorbWorth.get(); } private int getGhastAbsorbWorth() { - return Settings.COMMON.items.pyromancerStaff.ghastAbsorbWorth.get(); + return Config.COMMON.items.pyromancerStaff.ghastAbsorbWorth.get(); } private void doExtinguishEffect(Player player) { @@ -344,13 +335,11 @@ private void absorbBlazeFireballs(ItemStack stack, Player player) { if (fireball.getOwner() == player) { continue; } - if (hasSpaceForItem(stack, Items.BLAZE_POWDER, getBlazePowderLimit())) { + if (addItemToContainer(stack, Items.BLAZE_POWDER, getBlazeAbsorbWorth())) { for (int particles = 0; particles < 4; particles++) { player.level().addParticle(DustParticleOptions.REDSTONE, fireball.getX(), fireball.getY(), fireball.getZ(), 0.0D, 1.0D, 1.0D); } player.level().playLocalSound(fireball.getX(), fireball.getY(), fireball.getZ(), SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + RandHelper.getRandomMinusOneToOne(player.level().random) * 0.8F, false); - - addItemToInternalStorage(stack, Items.BLAZE_POWDER, getBlazeAbsorbWorth()); } fireball.discard(); } @@ -360,8 +349,7 @@ private void absorbGhastFireballs(ItemStack stack, Player player) { List ghastFireballs = player.level().getEntitiesOfClass(LargeFireball.class, player.getBoundingBox().inflate(4)); for (LargeFireball fireball : ghastFireballs) { if (fireball.getOwner() != player) { - if (hasSpaceForItem(stack, Items.FIRE_CHARGE, getFireChargeLimit())) { - addItemToInternalStorage(stack, Items.FIRE_CHARGE, getGhastAbsorbWorth()); + if (addItemToContainer(stack, Items.FIRE_CHARGE, getGhastAbsorbWorth())) { player.level().playLocalSound(fireball.getX(), fireball.getY(), fireball.getZ(), SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + RandHelper.getRandomMinusOneToOne(player.level().random) * 0.8F, false); } fireball.discard(); @@ -369,9 +357,51 @@ private void absorbGhastFireballs(ItemStack stack, Player player) { } } + @Override + protected int getContainerInitialSize() { + return 2; + } + + @Override + protected int getStackWorth(int slot) { + return slot == BLAZE_POWDER_SLOT ? getBlazePowderWorth() : getFireChargeWorth(); + } + + @Override + protected int getContainerSlotLimit(int slot) { + if (slot == BLAZE_POWDER_SLOT) { + return Config.COMMON.items.pyromancerStaff.blazePowderLimit.get(); + } else { + return Config.COMMON.items.pyromancerStaff.fireChargeLimit.get(); + } + } + + @Override + protected boolean isItemValidForContainerSlot(int slot, ItemStack stack) { + if (stack.isEmpty()) { + return true; + } + if (slot == BLAZE_POWDER_SLOT) { + return stack.is(Items.BLAZE_POWDER); + } else { + return stack.is(Items.FIRE_CHARGE); + } + } + + public int getBlazePowderCount(ItemStack staff) { + return getFromHandler(staff, handler -> handler.getCountInSlot(BLAZE_POWDER_SLOT)); + } + + public int getFireChargeCount(ItemStack staff) { + return getFromHandler(staff, handler -> handler.getCountInSlot(FIRE_CHARGE_SLOT)); + } + public enum Mode implements StringRepresentable { BLAZE, FIRE_CHARGE, ERUPTION, FLINT_AND_STEEL; + public static final Codec CODEC = StringRepresentable.fromEnum(Mode::values); + public static final StreamCodec STREAM_CODEC = NeoForgeStreamCodecs.enumCodec(Mode.class); + @Override public String getSerializedName() { return name(); diff --git a/src/main/java/reliquary/items/RendingGaleItem.java b/src/main/java/reliquary/items/RendingGaleItem.java index 2742cc9d..69d420e2 100644 --- a/src/main/java/reliquary/items/RendingGaleItem.java +++ b/src/main/java/reliquary/items/RendingGaleItem.java @@ -1,23 +1,21 @@ package reliquary.items; import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.Codec; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.core.particles.BlockParticleOption; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.Mth; import net.minecraft.util.StringRepresentable; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.LightningBolt; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MoverType; +import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.item.ItemStack; @@ -30,28 +28,17 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; -import reliquary.items.util.FilteredItemHandlerProvider; -import reliquary.items.util.FilteredItemStack; -import reliquary.items.util.FilteredItemStackHandler; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; +import reliquary.init.ModDataComponents; import reliquary.items.util.IScrollableItem; -import reliquary.reference.Settings; -import reliquary.util.LogHelper; -import reliquary.util.NBTHelper; +import reliquary.reference.Config; import reliquary.util.RegistryHelper; import reliquary.util.TooltipBuilder; import javax.annotation.Nullable; -import java.lang.reflect.Field; -import java.util.ArrayList; import java.util.List; public class RendingGaleItem extends ToggleableItem implements IScrollableItem { - private static final String COUNT_TAG = "count"; private static final int NO_DAMAGE_ELYTRA_TICKS = 3; public RendingGaleItem() { @@ -64,9 +51,8 @@ public MutableComponent getName(ItemStack stack) { } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack rendingGale, @Nullable Level world, TooltipBuilder tooltipBuilder) { - tooltipBuilder.charge(this, ".tooltip2", getFeatherCount(rendingGale, true) / 100); + protected void addMoreInformation(ItemStack rendingGale, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { + tooltipBuilder.charge(this, ".tooltip2", getFeatherCount(rendingGale) / 100); tooltipBuilder.description(this, ".tooltip.controls"); if (isEnabled(rendingGale)) { tooltipBuilder.absorbActive(Items.FEATHER.getName(new ItemStack(Items.FEATHER)).getString()); @@ -81,31 +67,31 @@ protected boolean hasMoreInformation(ItemStack stack) { } private static int getChargeLimit() { - return Settings.COMMON.items.rendingGale.chargeLimit.get(); + return Config.COMMON.items.rendingGale.chargeLimit.get(); } public static int getChargeCost() { - return Settings.COMMON.items.rendingGale.castChargeCost.get(); + return Config.COMMON.items.rendingGale.castChargeCost.get(); } private static int getFeathersWorth() { - return Settings.COMMON.items.rendingGale.chargeFeatherWorth.get(); + return Config.COMMON.items.rendingGale.chargeFeatherWorth.get(); } private static int getBoltChargeCost() { - return Settings.COMMON.items.rendingGale.boltChargeCost.get(); + return Config.COMMON.items.rendingGale.boltChargeCost.get(); } private static int getBoltTargetRange() { - return Settings.COMMON.items.rendingGale.blockTargetRange.get(); + return Config.COMMON.items.rendingGale.blockTargetRange.get(); } private static int getRadialPushRadius() { - return Settings.COMMON.items.rendingGale.pushPullRadius.get(); + return Config.COMMON.items.rendingGale.pushPullRadius.get(); } - private void attemptFlight(LivingEntity entityLiving) { - if (!(entityLiving instanceof Player player)) { + private void attemptFlight(LivingEntity livingEntity) { + if (!(livingEntity instanceof Player player)) { return; } @@ -123,41 +109,29 @@ private void attemptFlight(LivingEntity entityLiving) { player.fallDistance = 0.0F; if (player.isFallFlying()) { - preventElytraDamage(player); - } - } - - private static final Field TICKS_ELYTRA_FLYING = ObfuscationReflectionHelper.findField(LivingEntity.class, "f_20937_"); - - @SuppressWarnings("java:S3011") //the reflection accessibility bypass here is the only way one can set the value - private static void preventElytraDamage(Player player) { - try { - TICKS_ELYTRA_FLYING.set(player, NO_DAMAGE_ELYTRA_TICKS); - } - catch (IllegalAccessException e) { - LogHelper.error("Error setting ticksElytraFlying on player ", e); + player.fallFlyTicks = NO_DAMAGE_ELYTRA_TICKS; } } @Override - public void inventoryTick(ItemStack rendingGale, Level world, Entity entity, int slotNumber, boolean isSelected) { - if (world.isClientSide || !(entity instanceof Player player) || world.getGameTime() % 10 != 0) { + public void inventoryTick(ItemStack rendingGale, Level level, Entity entity, int slotNumber, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || level.getGameTime() % 10 != 0) { return; } if (isEnabled(rendingGale)) { int currentFeatherCharge = getFeatherCount(rendingGale); consumeAndCharge(player, getChargeLimit() - currentFeatherCharge, getFeathersWorth(), Items.FEATHER, 16, - chargeToAdd -> setFeatherCount(rendingGale, currentFeatherCharge + chargeToAdd, !player.isUsingItem())); + chargeToAdd -> setFeatherCount(rendingGale, currentFeatherCharge + chargeToAdd)); } } public Mode getMode(ItemStack stack) { - return NBTHelper.getEnumConstant(stack, "mode", Mode::valueOf).orElse(Mode.FLIGHT); + return stack.getOrDefault(ModDataComponents.RENDING_GALE_MODE, Mode.FLIGHT); } private void setMode(ItemStack stack, Mode mode) { - NBTHelper.putString("mode", stack, mode.getSerializedName()); + stack.set(ModDataComponents.RENDING_GALE_MODE, mode); } private void cycleMode(ItemStack stack, boolean isRaining, boolean next) { @@ -179,15 +153,7 @@ public InteractionResult onMouseScrolled(ItemStack stack, Player player, double } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - ArrayList filteredStacks = new ArrayList<>(); - filteredStacks.add(new FilteredItemStack(Items.FEATHER, Settings.COMMON.items.rendingGale.chargeLimit.get(), - Settings.COMMON.items.rendingGale.chargeFeatherWorth.get(), false)); - return new FilteredItemHandlerProvider(filteredStacks); - } - - @Override - public int getUseDuration(ItemStack par1ItemStack) { + public int getUseDuration(ItemStack stack, LivingEntity livingEntity) { return 6000; } @@ -197,10 +163,10 @@ public UseAnim getUseAnimation(ItemStack stack) { } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack rendingGale = player.getItemInHand(hand); if (player.isShiftKeyDown()) { - super.use(world, player, hand); + super.use(level, player, hand); } else { player.startUsingItem(hand); } @@ -213,7 +179,7 @@ public void onUseTick(Level level, LivingEntity livingEntity, ItemStack rendingG return; } - if (getFeatherCount(rendingGale, player.level().isClientSide) <= 0) { + if (getFeatherCount(rendingGale) <= 0) { player.releaseUsingItem(); return; } @@ -232,7 +198,7 @@ public void onUseTick(Level level, LivingEntity livingEntity, ItemStack rendingG doRadialPush(player.level(), player.getX(), player.getY(), player.getZ(), player, true); } if (!player.level().isClientSide) { - setFeatherCount(rendingGale, Math.max(0, getFeatherCount(rendingGale) - getChargeCost()), false); + setFeatherCount(rendingGale, Math.max(0, getFeatherCount(rendingGale) - getChargeCost())); } } } @@ -251,51 +217,28 @@ private void spawnBolt(ItemStack rendingGale, Player player) { if (bolt != null) { bolt.moveTo(pos.getX(), pos.getY(), pos.getZ()); player.level().addFreshEntity(bolt); - setFeatherCount(rendingGale, Math.max(0, getFeatherCount(rendingGale) - (getBoltChargeCost())), false); + setFeatherCount(rendingGale, Math.max(0, getFeatherCount(rendingGale) - (getBoltChargeCost()))); } } } } - @Override - public void releaseUsing(ItemStack rendingGale, Level world, LivingEntity entityLiving, int timeLeft) { - if (world.isClientSide) { - return; - } - NBTHelper.putInt(COUNT_TAG, rendingGale, getFeatherCount(rendingGale)); - } - public boolean hasFlightCharge(ItemStack stack) { return getFeatherCount(stack) > 0; } public int getFeatherCount(ItemStack rendingGale) { - return getFeatherCount(rendingGale, false); + return getFromHandler(rendingGale, handler -> handler.getCountInSlot(0)); } - private int getFeatherCount(ItemStack rendingGale, boolean isClient) { - if (isClient) { - return NBTHelper.getInt(COUNT_TAG, rendingGale); - } - - return rendingGale.getCapability(ForgeCapabilities.ITEM_HANDLER, null) - .filter(FilteredItemStackHandler.class::isInstance).map(handler -> ((FilteredItemStackHandler) handler).getTotalAmount(0)).orElse(0); - } - - public void setFeatherCount(ItemStack stack, int featherCount, boolean updateNBT) { - stack.getCapability(ForgeCapabilities.ITEM_HANDLER, null).filter(FilteredItemStackHandler.class::isInstance) - .ifPresent(handler -> { - ((FilteredItemStackHandler) handler).setTotalCount(0, featherCount); - if (updateNBT) { - NBTHelper.putInt(COUNT_TAG, stack, featherCount); - } - }); + public void setFeatherCount(ItemStack stack, int featherCount) { + runOnHandler(stack, handler -> handler.setStackInSlot(0, new ItemStack(Items.FEATHER, featherCount))); } - public void doRadialPush(Level world, double posX, double posY, double posZ, @Nullable Player player, boolean pull) { + public void doRadialPush(Level level, double posX, double posY, double posZ, @Nullable Player player, boolean pull) { //push effect free at the moment, if you restore cost, remember to change this to getFeatherCount - spawnRadialHurricaneParticles(world, posX, posY, posZ, player, pull); - if (world.isClientSide) { + spawnRadialHurricaneParticles(level, posX, posY, posZ, player, pull); + if (level.isClientSide) { return; } @@ -306,7 +249,7 @@ public void doRadialPush(Level world, double posX, double posY, double posZ, @Nu double upperY = posY + getRadialPushRadius() / 5D; double upperZ = posZ + getRadialPushRadius(); - List entities = world.getEntitiesOfClass(Entity.class, new AABB(lowerX, lowerY, lowerZ, upperX, upperY, upperZ), + List entities = level.getEntitiesOfClass(Entity.class, new AABB(lowerX, lowerY, lowerZ, upperX, upperY, upperZ), e -> (e instanceof Mob || e instanceof Projectile)); for (Entity entity : entities) { @@ -331,15 +274,15 @@ public void doRadialPush(Level world, double posX, double posY, double posZ, @Nu private boolean isBlacklistedEntity(Entity entity) { String entityName = RegistryHelper.getRegistryName(entity).toString(); - return isBlacklistedLivingEntity(entity, entityName) || Settings.COMMON.items.rendingGale.canPushProjectiles.get() && isBlacklistedProjectile(entity, entityName); + return isBlacklistedLivingEntity(entity, entityName) || Config.COMMON.items.rendingGale.canPushProjectiles.get() && isBlacklistedProjectile(entity, entityName); } private boolean isBlacklistedProjectile(Entity entity, String entityName) { - return entity instanceof Projectile && Settings.COMMON.items.rendingGale.pushableProjectilesBlacklist.get().contains(entityName); + return entity instanceof Projectile && Config.COMMON.items.rendingGale.pushableProjectilesBlacklist.get().contains(entityName); } private boolean isBlacklistedLivingEntity(Entity entity, String entityName) { - return entity instanceof Mob && Settings.COMMON.items.rendingGale.pushableEntitiesBlacklist.get().contains(entityName); + return entity instanceof Mob && Config.COMMON.items.rendingGale.pushableEntitiesBlacklist.get().contains(entityName); } private float getDistanceToEntity(double posX, double posY, double posZ, Entity entityIn) { @@ -364,13 +307,13 @@ private void spawnFlightParticles(Level level, double x, double y, double z, Pla } } - private void spawnRadialHurricaneParticles(Level world, double posX, double posY, double posZ, @Nullable Player player, boolean pull) { + private void spawnRadialHurricaneParticles(Level level, double posX, double posY, double posZ, @Nullable Player player, boolean pull) { BlockParticleOption blockParticleData = new BlockParticleOption(ParticleTypes.BLOCK, Blocks.SNOW_BLOCK.defaultBlockState()); //spawn a whole mess of particles every tick. for (int i = 0; i < 3; ++i) { - float randX = world.random.nextFloat() - 0.5F; - float randZ = world.random.nextFloat() - 0.5F; + float randX = level.random.nextFloat() - 0.5F; + float randZ = level.random.nextFloat() - 0.5F; float motX = randX * 10F; float motZ = randZ * 10F; if (pull) { @@ -382,14 +325,14 @@ private void spawnRadialHurricaneParticles(Level world, double posX, double posY double posYAdjusted = player == null ? posY : (posY + player.getEyeHeight()) - (player.getBbHeight() / 2); - world.addParticle(blockParticleData, posX + randX, posYAdjusted, posZ + randZ, motX, 0.0D, motZ); + level.addParticle(blockParticleData, posX + randX, posYAdjusted, posZ + randZ, motX, 0.0D, motZ); } } public int getFeatherCountClient(ItemStack rendingGale, Player player) { - int featherCount = getFeatherCount(rendingGale, true); + int featherCount = getFeatherCount(rendingGale); Mode mode = getMode(rendingGale); - int ticksInUse = getUseDuration(rendingGale) - player.getUseItemRemainingTicks(); + int ticksInUse = getUseDuration(rendingGale, player) - player.getUseItemRemainingTicks(); if (player.isUsingItem()) { featherCount = Math.max(0, featherCount - (mode == Mode.BOLT ? getBoltChargeCost() * (ticksInUse / 8) : (getChargeCost() * ticksInUse))); } @@ -399,6 +342,9 @@ public int getFeatherCountClient(ItemStack rendingGale, Player player) { public enum Mode implements StringRepresentable { FLIGHT, PUSH, PULL, BOLT; + public static final Codec CODEC = StringRepresentable.fromEnum(Mode::values); + public static final StreamCodec STREAM_CODEC = NeoForgeStreamCodecs.enumCodec(Mode.class); + @Override public String getSerializedName() { return name(); diff --git a/src/main/java/reliquary/items/RodOfLyssaItem.java b/src/main/java/reliquary/items/RodOfLyssaItem.java index b78010f7..43ee6dc4 100644 --- a/src/main/java/reliquary/items/RodOfLyssaItem.java +++ b/src/main/java/reliquary/items/RodOfLyssaItem.java @@ -1,5 +1,7 @@ package reliquary.items; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; @@ -7,11 +9,14 @@ import net.minecraft.world.InteractionResultHolder; 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.item.enchantment.Enchantments; import net.minecraft.world.level.Level; +import net.neoforged.neoforge.common.ItemAbilities; +import net.neoforged.neoforge.common.ItemAbility; import reliquary.entities.LyssaHook; -import reliquary.util.NBTHelper; +import reliquary.init.ModDataComponents; public class RodOfLyssaItem extends ItemBase { public RodOfLyssaItem() { @@ -19,7 +24,7 @@ public RodOfLyssaItem() { } public static int getHookEntityId(ItemStack stack) { - return NBTHelper.getInt("hookEntityId", stack); + return stack.getOrDefault(ModDataComponents.HOOK_ENTITY_ID, 0); } @Override @@ -35,8 +40,9 @@ public InteractionResultHolder use(Level level, Player player, Intera if (!level.isClientSide) { - int lureLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.FISHING_SPEED, stack); - int luckOfTheSeaLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.FISHING_LUCK, stack); + HolderLookup.RegistryLookup registrylookup = level.registryAccess().lookupOrThrow(Registries.ENCHANTMENT); + int lureLevel = EnchantmentHelper.getEnchantmentLevel(registrylookup.getOrThrow(Enchantments.LURE), player); + int luckOfTheSeaLevel = EnchantmentHelper.getEnchantmentLevel(registrylookup.getOrThrow(Enchantments.LUCK_OF_THE_SEA), player); LyssaHook hook = new LyssaHook(level, player, lureLevel, luckOfTheSeaLevel); level.addFreshEntity(hook); @@ -51,6 +57,11 @@ public InteractionResultHolder use(Level level, Player player, Intera } private void setHookEntityId(ItemStack stack, int entityId) { - NBTHelper.putInt("hookEntityId", stack, entityId); + stack.set(ModDataComponents.HOOK_ENTITY_ID, entityId); + } + + @Override + public boolean canPerformAction(ItemStack stack, ItemAbility itemAbility) { + return ItemAbilities.DEFAULT_FISHING_ROD_ACTIONS.contains(itemAbility); } } diff --git a/src/main/java/reliquary/items/SalamanderEyeItem.java b/src/main/java/reliquary/items/SalamanderEyeItem.java index 204b342c..bec9dde8 100644 --- a/src/main/java/reliquary/items/SalamanderEyeItem.java +++ b/src/main/java/reliquary/items/SalamanderEyeItem.java @@ -4,41 +4,35 @@ import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.EntityTypeTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.entity.projectile.LargeFireball; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.entity.projectile.ProjectileDeflection; import net.minecraft.world.entity.projectile.SmallFireball; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseFireBlock; import net.minecraft.world.level.block.Blocks; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import reliquary.util.RandHelper; import java.util.List; public class SalamanderEyeItem extends ItemBase { public SalamanderEyeItem() { - super(new Properties().stacksTo(1)); + super(new Properties().stacksTo(1).rarity(Rarity.EPIC)); } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - - @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return true; } @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || !(entity instanceof Player player) || world.getGameTime() % 2 != 0) { + public void inventoryTick(ItemStack stack, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 2 != 0) { return; } @@ -62,13 +56,13 @@ private void doExtinguishEffect(Player player) { } private void doFireballEffect(Player player) { - List ghastFireballs = player.level().getEntitiesOfClass(LargeFireball.class, player.getBoundingBox().inflate(5)); - for (LargeFireball fireball : ghastFireballs) { - if (player.distanceTo(fireball) < 4) { - fireball.discard(); + List projectiles = player.level().getEntitiesOfClass(Projectile.class, player.getBoundingBox().inflate(5), projectile -> projectile.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE)); + for (Projectile projectile : projectiles) { + if (player.distanceTo(projectile) < 4) { + projectile.discard(); } - fireball.hurt(player.damageSources().playerAttack(player), 1); - player.level().playLocalSound(fireball.getX(), fireball.getY(), fireball.getZ(), SoundEvents.FIRE_EXTINGUISH, SoundSource.NEUTRAL, 0.5F, 2.6F + RandHelper.getRandomMinusOneToOne(player.level().random) * 0.8F, false); + projectile.deflect(ProjectileDeflection.AIM_DEFLECT, player, player, true); + player.level().playLocalSound(projectile.getX(), projectile.getY(), projectile.getZ(), SoundEvents.FIRE_EXTINGUISH, SoundSource.NEUTRAL, 0.5F, 2.6F + RandHelper.getRandomMinusOneToOne(player.level().random) * 0.8F, false); } List blazeFireballs = player.level().getEntitiesOfClass(SmallFireball.class, player.getBoundingBox().inflate(3)); for (SmallFireball fireball : blazeFireballs) { diff --git a/src/main/java/reliquary/items/SerpentStaffItem.java b/src/main/java/reliquary/items/SerpentStaffItem.java index 2075646b..1e794278 100644 --- a/src/main/java/reliquary/items/SerpentStaffItem.java +++ b/src/main/java/reliquary/items/SerpentStaffItem.java @@ -8,14 +8,13 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.UseAnim; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import reliquary.entities.KrakenSlimeEntity; +import reliquary.entities.KrakenSlime; public class SerpentStaffItem extends ItemBase { public SerpentStaffItem() { @@ -28,13 +27,12 @@ public MutableComponent getName(ItemStack stack) { } @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return true; } @Override - public UseAnim getUseAnimation(ItemStack par1ItemStack) { + public UseAnim getUseAnimation(ItemStack stack) { return UseAnim.BLOCK; } @@ -50,15 +48,15 @@ public void onUseTick(Level level, LivingEntity livingEntity, ItemStack serpentS private void shootKrakenSlime(ItemStack serpentStaff, Player player) { player.level().playSound(null, player.blockPosition(), SoundEvents.ARROW_SHOOT, SoundSource.NEUTRAL, 0.5F, 0.4F / (player.level().random.nextFloat() * 0.4F + 0.8F)); - KrakenSlimeEntity krakenSlime = new KrakenSlimeEntity(player.level(), player); + KrakenSlime krakenSlime = new KrakenSlime(player.level(), player); krakenSlime.shootFromRotation(player, player.getXRot(), player.getYRot(), 0F, 1.5F, 1.0F); player.level().addFreshEntity(krakenSlime); - serpentStaff.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(p.getUsedItemHand())); + serpentStaff.hurtAndBreak(1, player, player.getUsedItemHand() == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND); } @Override - public void releaseUsing(ItemStack serpentStaff, Level worldIn, LivingEntity entityLiving, int timeLeft) { - if (!entityLiving.level().isClientSide && timeLeft + 2 >= serpentStaff.getUseDuration() && entityLiving instanceof Player player) { + public void releaseUsing(ItemStack serpentStaff, Level level, LivingEntity livingEntity, int timeLeft) { + if (!livingEntity.level().isClientSide && timeLeft + 2 >= serpentStaff.getUseDuration(livingEntity) && livingEntity instanceof Player player) { shootKrakenSlime(serpentStaff, player); } } @@ -69,18 +67,18 @@ public boolean onLeftClickEntity(ItemStack stack, Player player, Entity entity) int drain = player.level().random.nextInt(4); if (entity.hurt(player.damageSources().playerAttack(player), drain)) { player.heal(drain); - stack.hurtAndBreak(1, player, p -> p.broadcastBreakEvent(p.getUsedItemHand())); + stack.hurtAndBreak(1, player, EquipmentSlot.MAINHAND); } return false; } @Override - public int getUseDuration(ItemStack stack) { + public int getUseDuration(ItemStack stack, LivingEntity livingEntity) { return 11; } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { player.startUsingItem(hand); return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand)); } diff --git a/src/main/java/reliquary/items/ShearsOfWinterItem.java b/src/main/java/reliquary/items/ShearsOfWinterItem.java index 3a081d9f..10dba5bc 100644 --- a/src/main/java/reliquary/items/ShearsOfWinterItem.java +++ b/src/main/java/reliquary/items/ShearsOfWinterItem.java @@ -2,6 +2,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.BlockParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; @@ -17,13 +18,9 @@ import net.minecraft.world.entity.Mob; 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.ShearsItem; -import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.item.UseAnim; +import net.minecraft.world.item.*; +import net.minecraft.world.item.component.Unbreakable; import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BeehiveBlock; import net.minecraft.world.level.block.Block; @@ -32,21 +29,18 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.IForgeShearable; -import reliquary.entities.EntityXRFakePlayer; +import net.neoforged.neoforge.common.IShearable; +import reliquary.entities.ReliquaryFakePlayer; +import reliquary.util.FakePlayerFactory; import reliquary.util.RandHelper; import reliquary.util.TooltipBuilder; -import reliquary.util.XRFakePlayerFactory; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; public class ShearsOfWinterItem extends ShearsItem implements ICreativeTabItemGenerator { public ShearsOfWinterItem() { - super(new Properties().durability(0)); + super(new Properties().component(DataComponents.UNBREAKABLE, new Unbreakable(true))); } @Override @@ -56,29 +50,29 @@ public void addCreativeTabItems(Consumer itemConsumer) { @Override public InteractionResult useOn(UseOnContext context) { - Level world = context.getLevel(); + Level level = context.getLevel(); BlockPos pos = context.getClickedPos(); - BlockState state = world.getBlockState(pos); + BlockState state = level.getBlockState(pos); Block block = state.getBlock(); if (block instanceof BeehiveBlock) { - shearBeehive(world, pos, state, context.getClickLocation(), context.getClickedFace()); + shearBeehive(level, pos, state, context.getClickLocation(), context.getClickedFace()); } return super.useOn(context); } - private void shearBeehive(Level world, BlockPos pos, BlockState state, Vec3 hitVec, Direction face) { - if (!(world instanceof ServerLevel)) { + private void shearBeehive(Level level, BlockPos pos, BlockState state, Vec3 hitVec, Direction face) { + if (!(level instanceof ServerLevel)) { return; } ItemStack fakeShears = new ItemStack(Items.SHEARS); - EntityXRFakePlayer fakePlayer = XRFakePlayerFactory.get((ServerLevel) world); + ReliquaryFakePlayer fakePlayer = FakePlayerFactory.get((ServerLevel) level); fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, fakeShears); - state.use(world, fakePlayer, InteractionHand.MAIN_HAND, new BlockHitResult(hitVec, face, pos, false)); + state.useItemOn(fakeShears, level, fakePlayer, InteractionHand.MAIN_HAND, new BlockHitResult(hitVec, face, pos, false)); } @Override - public int getUseDuration(ItemStack par1ItemStack) { + public int getUseDuration(ItemStack stack, LivingEntity livingEntity) { return 2500; } @@ -88,7 +82,7 @@ public UseAnim getUseAnimation(ItemStack stack) { } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { player.startUsingItem(hand); return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand)); } @@ -96,7 +90,7 @@ public InteractionResultHolder use(Level world, Player player, Intera @Override public void onUseTick(Level level, LivingEntity livingEntity, ItemStack stack, int remainingUseDuration) { //start the blizzard after a short delay, this prevents some abuse. - if (getUseDuration(stack) - remainingUseDuration <= 5 || !(livingEntity instanceof Player player)) { + if (getUseDuration(stack, livingEntity) - remainingUseDuration <= 5 || !(livingEntity instanceof Player player)) { return; } @@ -133,9 +127,8 @@ private void shearBlocks(Player player, Vec3 lookVector) { } @Override - @OnlyIn(Dist.CLIENT) - public void appendHoverText(ItemStack shears, @Nullable Level world, List tooltip, TooltipFlag flag) { - TooltipBuilder.of(tooltip).itemTooltip(this); + public void appendHoverText(ItemStack shears, TooltipContext context, List tooltip, TooltipFlag flag) { + TooltipBuilder.of(tooltip, context).itemTooltip(this); } private void checkAndShearBlockAt(Player player, BlockPos pos) { @@ -148,27 +141,27 @@ private void checkAndShearBlockAt(Player player, BlockPos pos) { } private void shearBlockAt(BlockPos pos, Player player) { - Level world = player.level(); - BlockState blockState = world.getBlockState(pos); + Level level = player.level(); + BlockState blockState = level.getBlockState(pos); Block block = blockState.getBlock(); - if (block instanceof IForgeShearable target) { + if (block instanceof IShearable target) { ItemStack dummyShears = new ItemStack(Items.SHEARS); - if (target.isShearable(dummyShears, world, pos) && removeBlock(player, pos, blockState.canHarvestBlock(world, pos, player))) { + if (target.isShearable(player, dummyShears, level, pos) && removeBlock(player, pos, blockState.canHarvestBlock(level, pos, player))) { player.awardStat(Stats.BLOCK_MINED.get(block)); player.causeFoodExhaustion(0.01F); - Block.dropResources(blockState, world, pos, null, player, dummyShears); + Block.dropResources(blockState, level, pos, null, player, dummyShears); } } else if (block instanceof BeehiveBlock) { - shearBeehive(world, pos, blockState, Vec3.ZERO, Direction.UP); + shearBeehive(level, pos, blockState, Vec3.ZERO, Direction.UP); } } @Override - public boolean mineBlock(ItemStack stack, Level worldIn, BlockState state, BlockPos pos, LivingEntity entityLiving) { - if (entityLiving instanceof Player player) { + public boolean mineBlock(ItemStack stack, Level level, BlockState state, BlockPos pos, LivingEntity livingEntity) { + if (livingEntity instanceof Player player) { shearBlockAt(pos, player); } - return super.mineBlock(stack, worldIn, state, pos, entityLiving); + return super.mineBlock(stack, level, state, pos, livingEntity); } private boolean removeBlock(Player player, BlockPos pos, boolean canHarvest) { @@ -201,17 +194,17 @@ private void doEntityShearableCheck(ItemStack stack, Player player, Vec3 lookVec if (!e.is(player)) { e.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 120, 1)); } - if (e instanceof IForgeShearable) { + if (e instanceof IShearable) { shearEntity(stack, player, rand, e); } } } private void shearEntity(ItemStack stack, Player player, RandomSource rand, Mob e) { - IForgeShearable target = (IForgeShearable) e; + IShearable target = (IShearable) e; BlockPos pos = e.blockPosition(); - if (target.isShearable(new ItemStack(Items.SHEARS), e.level(), pos)) { - List drops = target.onSheared(player, stack, e.level(), pos, stack.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE)); + if (target.isShearable(player, new ItemStack(Items.SHEARS), e.level(), pos)) { + List drops = target.onSheared(player, stack, e.level(), pos); drops.forEach(d -> { ItemEntity ent = e.spawnAtLocation(d, 1.0F); if (ent != null) { diff --git a/src/main/java/reliquary/items/SojournerStaffItem.java b/src/main/java/reliquary/items/SojournerStaffItem.java index d4a3b8fb..2b737b9d 100644 --- a/src/main/java/reliquary/items/SojournerStaffItem.java +++ b/src/main/java/reliquary/items/SojournerStaffItem.java @@ -2,21 +2,16 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.Rarity; +import net.minecraft.world.item.*; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; @@ -25,40 +20,28 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.registries.ForgeRegistries; +import reliquary.init.ModDataComponents; import reliquary.items.util.IScrollableItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; -import reliquary.util.NBTHelper; import reliquary.util.NoPlayerBlockItemUseContext; -import reliquary.util.RegistryHelper; import reliquary.util.TooltipBuilder; import javax.annotation.Nullable; +import java.util.HashSet; import java.util.StringJoiner; public class SojournerStaffItem extends ToggleableItem implements IScrollableItem { private static final int COOLDOWN = 10; - - private static final String ITEMS_TAG = "Items"; - private static final String QUANTITY_TAG = "Quantity"; - private static final String CURRENT_INDEX_TAG = "Current"; + public static final int TORCH_SLOT = 0; public SojournerStaffItem() { - super(new Properties().stacksTo(1)); + super(new Properties().stacksTo(1).rarity(Rarity.EPIC)); } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - - @Override - public void inventoryTick(ItemStack stack, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (world.isClientSide || world.getGameTime() % COOLDOWN != 0 || !(entity instanceof Player player)) { + public void inventoryTick(ItemStack stack, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % COOLDOWN != 0) { return; } @@ -76,32 +59,32 @@ public InteractionResult onMouseScrolled(ItemStack stack, Player player, double return InteractionResult.SUCCESS; } - private void scanForMatchingTorchesToFillInternalStorage(ItemStack stack, Player player) { - for (String torch : Settings.COMMON.items.sojournerStaff.torches.get()) { - consumeAndCharge(player, Settings.COMMON.items.sojournerStaff.maxCapacityPerItemType.get() - getInternalStorageItemCount(stack, torch), 1, ist -> RegistryHelper.getItemRegistryName(ist.getItem()).equals(torch), 16, - chargeToAdd -> addItemToInternalStorage(stack, torch, chargeToAdd)); + private void scanForMatchingTorchesToFillInternalStorage(ItemStack staff, Player player) { + HashSet remainingTorches = new HashSet<>(Config.COMMON.items.sojournerStaff.getTorchItems()); + runOnHandler(staff, handler -> { + for (int i = 0; i < handler.getSlots(); i++) { + ItemStack stackInSlot = handler.getStackInSlot(i); + if (!stackInSlot.isEmpty()) { + remainingTorches.remove(stackInSlot.getItem()); + consumeAndCharge(player, Config.COMMON.items.sojournerStaff.maxCapacityPerItemType.get() - stackInSlot.getCount(), 1, + stack -> stack.getItem() == stackInSlot.getItem(), 16, chargeToAdd -> addItemToContainer(staff, stackInSlot.getItem(), chargeToAdd)); + } + } + }); + + + for (Item torch : remainingTorches) { + consumeAndCharge(player, Config.COMMON.items.sojournerStaff.maxCapacityPerItemType.get(), 1, + stack -> stack.getItem() == torch, 16, chargeToAdd -> addItemToContainer(staff, torch, chargeToAdd)); } } public ItemStack getCurrentTorch(ItemStack stack) { - return getItem(getCurrentTorchTag(stack)); + return getFromHandler(stack, handler -> getCurrentTorchIndex(stack) < handler.getSlots() ? handler.getStackInSlot(getCurrentTorchIndex(stack)) : ItemStack.EMPTY); } public int getTorchCount(ItemStack stack) { - return getCurrentTorchTag(stack).getInt(QUANTITY_TAG); - } - - private CompoundTag getCurrentTorchTag(ItemStack stack) { - CompoundTag tagCompound = NBTHelper.getTag(stack); - - ListTag tagList = getItemListTag(tagCompound); - int current = getCurrentIndex(tagCompound, tagList); - - return tagList.getCompound(current); - } - - private ListTag getItemListTag(CompoundTag tagCompound) { - return tagCompound.getList(ITEMS_TAG, 10); + return getFromHandler(stack, handler -> getCurrentTorchIndex(stack) < handler.getSlots() ? handler.getCountInSlot(getCurrentTorchIndex(stack)) : 0); } private void cycleTorchMode(ItemStack stack, boolean next) { @@ -109,34 +92,31 @@ private void cycleTorchMode(ItemStack stack, boolean next) { if (currentTorch.isEmpty()) { return; } - CompoundTag tagCompound = NBTHelper.getTag(stack); - ListTag tagList = getItemListTag(tagCompound); - if (tagList.size() == 1) { - return; - } - - int current = getCurrentIndex(tagCompound, tagList); - - tagCompound.putInt(CURRENT_INDEX_TAG, Math.floorMod(current + (next ? 1 : -1), tagList.size())); + runOnHandler(stack, handler -> { + int slots = handler.getSlots(); + if (slots == 1) { + return; + } + int currentIndex = getCurrentTorchIndex(stack); + stack.set(ModDataComponents.TORCH_INDEX, (byte) Math.floorMod(currentIndex + (next ? 1 : -1), slots)); + }); } - private int getCurrentIndex(CompoundTag tagCompound, ListTag tagList) { - int current = tagCompound.getInt(CURRENT_INDEX_TAG); - if (tagList.size() <= current) { - tagCompound.putInt(CURRENT_INDEX_TAG, 0); - } - return current; + private int getCurrentTorchIndex(ItemStack stack) { + return stack.getOrDefault(ModDataComponents.TORCH_INDEX, (byte) 0); } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack staff, @Nullable Level world, TooltipBuilder tooltipBuilder) { + protected void addMoreInformation(ItemStack staff, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { StringJoiner joiner = new StringJoiner(";"); - iterateItems(staff, tag -> { - ItemStack containedItem = getItem(tag); - int quantity = tag.getInt(QUANTITY_TAG); - joiner.add(containedItem.getHoverName().getString() + ": " + quantity); - }, () -> false); + runOnHandler(staff, handler -> { + for (int i = 0; i < handler.getSlots(); i++) { + ItemStack stackInSlot = handler.getStackInSlot(i); + if (!stackInSlot.isEmpty()) { + joiner.add(stackInSlot.getHoverName().getString() + ": " + stackInSlot.getCount()); + } + } + }); if (getTorchCount(staff) > 0) { tooltipBuilder.data(this, ".tooltip.contents", joiner.toString()); @@ -155,10 +135,6 @@ protected boolean hasMoreInformation(ItemStack stack) { return true; } - private static ItemStack getItem(CompoundTag tagItemData) { - return new ItemStack(ForgeRegistries.ITEMS.getValue(new ResourceLocation(tagItemData.getString(ITEM_NAME_TAG)))); - } - @Override public InteractionResult useOn(UseOnContext context) { return placeTorch(context); @@ -167,14 +143,14 @@ public InteractionResult useOn(UseOnContext context) { private InteractionResult placeTorch(UseOnContext context) { Player player = context.getPlayer(); InteractionHand hand = context.getHand(); - Level world = context.getLevel(); + Level level = context.getLevel(); BlockPos pos = context.getClickedPos(); Direction face = context.getClickedFace(); ItemStack stack = context.getItemInHand(); - BlockPos placeBlockAt = pos.relative(face); + BlockPos placeBlockAt = context.getLevel().getBlockState(pos).canBeReplaced() ? pos : pos.relative(face); - if (world.isClientSide) { + if (level.isClientSide) { return InteractionResult.SUCCESS; } ItemStack torch = getCurrentTorch(stack); @@ -187,54 +163,58 @@ private InteractionResult placeTorch(UseOnContext context) { player.swing(hand); Block blockToPlace = ((BlockItem) torch.getItem()).getBlock(); - NoPlayerBlockItemUseContext placeContext = new NoPlayerBlockItemUseContext(world, placeBlockAt, new ItemStack(blockToPlace), face); + NoPlayerBlockItemUseContext placeContext = new NoPlayerBlockItemUseContext(level, placeBlockAt, new ItemStack(blockToPlace), face); if (!placeContext.canPlace() || !removeTorches(player, stack, torch, placeBlockAt)) { return InteractionResult.FAIL; } ((BlockItem) torch.getItem()).place(placeContext); - double gauss = 0.5D + world.random.nextFloat() / 2; - world.addParticle(ParticleTypes.ENTITY_EFFECT, placeBlockAt.getX() + 0.5D, placeBlockAt.getY() + 0.5D, placeBlockAt.getZ() + 0.5D, gauss, gauss, 0.0F); + float gauss = 0.5F + level.random.nextFloat() / 2; + level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, gauss, gauss, 0.0F), + placeBlockAt.getX() + 0.5D, placeBlockAt.getY() + 0.5D, placeBlockAt.getZ() + 0.5D, + 0, 0, 0); return InteractionResult.SUCCESS; } private boolean removeTorches(Player player, ItemStack staff, ItemStack torch, BlockPos placeBlockAt) { if (!player.isCreative()) { int distance = (int) player.getEyePosition(1).distanceTo(new Vec3(placeBlockAt.getX(), placeBlockAt.getY(), placeBlockAt.getZ())); - int cost = 1 + distance / Settings.COMMON.items.sojournerStaff.tilePerCostMultiplier.get(); + int cost = 1 + distance / Config.COMMON.items.sojournerStaff.tilePerCostMultiplier.get(); Item torchItem = torch.getItem(); - boolean result = removeItemFromInternalStorage(staff, torchItem, cost, false, player); - if (result && torchItem != Items.TORCH && getInternalStorageItemCount(staff, torchItem) <= 0) { - removeItemTagInInternalStorage(staff, torchItem); - cycleTorchMode(staff, false); + int torchIndex = getCurrentTorchIndex(staff); + if (torchItem == Items.TORCH) { + return getFromHandler(staff, handler -> handler.extractItem(torchIndex, cost, false)).getCount() > 0; + } else { + return getFromHandler(staff, handler -> handler.extractItemAndRemoveSlotIfEmpty(torchIndex, cost, + () -> cycleTorchMode(staff, false), false).getCount() > 0); } - return result; } return true; } + public boolean removeTorch(ItemStack stack) { + return getFromHandler(stack, handler -> !handler.extractItem(TORCH_SLOT, 1, false).isEmpty()); + } + @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { if (!player.isShiftKeyDown()) { - HitResult rayTraceResult = longRayTrace(world, player); + HitResult rayTraceResult = longRayTrace(level, player); if (rayTraceResult.getType() == HitResult.Type.BLOCK) { placeTorch(new UseOnContext(player, hand, (BlockHitResult) rayTraceResult)); } else { ItemStack staff = player.getItemInHand(hand); - CompoundTag torchTag = getCurrentTorchTag(staff); - ItemStack torch = getItem(torchTag); - int count = torchTag.getInt(QUANTITY_TAG); - torch.setCount(Math.min(count, torch.getMaxStackSize())); - player.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP).ifPresent(playerInventory -> { - int inserted = InventoryHelper.insertIntoInventory(torch, playerInventory); - removeItemFromInternalStorage(staff, torch.getItem(), inserted, false, player); - }); + ItemStack torch = getCurrentTorch(staff); + int inserted = InventoryHelper.insertIntoInventory(torch, InventoryHelper.getMainInventoryItemHandlerFrom(player)); + if (inserted > 0) { + runOnHandler(staff, handler -> handler.extractItemAndRemoveSlotIfEmpty(getCurrentTorchIndex(staff), inserted, false)); + } } } - return super.use(world, player, hand); + return super.use(level, player, hand); } - private HitResult longRayTrace(Level worldIn, Player player) { + private HitResult longRayTrace(Level level, Player player) { float f = player.getXRot(); float f1 = player.getYRot(); Vec3 vec3d = player.getEyePosition(1.0F); @@ -244,8 +224,24 @@ private HitResult longRayTrace(Level worldIn, Player player) { float f5 = Mth.sin(-f * ((float) Math.PI / 180F)); float f6 = f3 * f4; float f7 = f2 * f4; - double d0 = Settings.COMMON.items.sojournerStaff.maxRange.get(); + double d0 = Config.COMMON.items.sojournerStaff.maxRange.get(); Vec3 vec3d1 = vec3d.add(f6 * d0, f5 * d0, f7 * d0); - return worldIn.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.ANY, player)); + return level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.ANY, player)); + } + + @Override + protected boolean isItemValidForContainerSlot(int slot, ItemStack stack) { + if (stack.isEmpty()) { + return true; + } + if (slot == TORCH_SLOT) { + return stack.is(Items.TORCH); + } + return Config.COMMON.items.sojournerStaff.isTorch(stack); + } + + @Override + protected int getContainerSlotLimit(int slot) { + return Config.COMMON.items.sojournerStaff.maxCapacityPerItemType.get(); } } diff --git a/src/main/java/reliquary/items/ThrownPotionItem.java b/src/main/java/reliquary/items/ThrownPotionItem.java index f8753f66..e9847853 100644 --- a/src/main/java/reliquary/items/ThrownPotionItem.java +++ b/src/main/java/reliquary/items/ThrownPotionItem.java @@ -1,23 +1,27 @@ package reliquary.items; +import net.minecraft.core.Direction; +import net.minecraft.core.Position; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResultHolder; 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.ProjectileItem; import net.minecraft.world.level.Level; -import reliquary.entities.potion.ThrownXRPotionEntity; +import reliquary.entities.potion.ThrownPotion; -public class ThrownPotionItem extends PotionItemBase { +public class ThrownPotionItem extends PotionItemBase implements ProjectileItem { @Override public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); if (level.isClientSide) { return new InteractionResultHolder<>(InteractionResult.PASS, stack); } - ThrownXRPotionEntity e = new ThrownXRPotionEntity(level, player, stack.copy()); + ThrownPotion e = new ThrownPotion(level, player, stack.copy()); e.shootFromRotation(player, player.getXRot(), player.getYRot(), -20.0F, 0.5F, 1.0F); if (!player.isCreative()) { @@ -27,4 +31,9 @@ public InteractionResultHolder use(Level level, Player player, Intera level.addFreshEntity(e); return new InteractionResultHolder<>(InteractionResult.PASS, stack); } + + @Override + public Projectile asProjectile(Level level, Position position, ItemStack stack, Direction direction) { + return new ThrownPotion(level, position, stack.copy()); + } } diff --git a/src/main/java/reliquary/items/TippedArrowItem.java b/src/main/java/reliquary/items/TippedArrowItem.java index d59d0faf..bed29876 100644 --- a/src/main/java/reliquary/items/TippedArrowItem.java +++ b/src/main/java/reliquary/items/TippedArrowItem.java @@ -1,20 +1,21 @@ package reliquary.items; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.item.ArrowItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.alchemy.PotionContents; import net.minecraft.world.level.Level; -import reliquary.entities.XRTippedArrowEntity; +import reliquary.entities.TippedArrow; import reliquary.items.util.IPotionItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.TooltipBuilder; import reliquary.util.potions.PotionEssence; +import reliquary.util.potions.PotionHelper; import reliquary.util.potions.PotionMap; -import reliquary.util.potions.XRPotionHelper; import javax.annotation.Nullable; import java.util.List; @@ -26,33 +27,33 @@ public TippedArrowItem() { } @Override - public AbstractArrow createArrow(Level world, ItemStack stack, LivingEntity shooter) { - XRTippedArrowEntity entitytippedarrow = new XRTippedArrowEntity(world, shooter); - entitytippedarrow.setPotionEffect(stack); - return entitytippedarrow; + public AbstractArrow createArrow(Level level, ItemStack arrowStack, LivingEntity shooter, @Nullable ItemStack projectileWeaponStack) { + TippedArrow arrowEntity = new TippedArrow(level, shooter, arrowStack, projectileWeaponStack); + arrowEntity.setPotionEffect(arrowStack); + return arrowEntity; } @Override public void addCreativeTabItems(Consumer itemConsumer) { - if (Boolean.TRUE.equals(Settings.COMMON.disable.disablePotions.get())) { + if (Boolean.TRUE.equals(Config.COMMON.disable.disablePotions.get())) { return; } for (PotionEssence essence : PotionMap.uniquePotionEssences) { ItemStack tippedArrow = new ItemStack(this); - XRPotionHelper.addPotionEffectsToStack(tippedArrow, XRPotionHelper.changePotionEffectsDuration(essence.getEffects(), 0.125F)); + PotionHelper.addPotionContentsToStack(tippedArrow, PotionHelper.changePotionEffectsDuration(essence.getPotionContents(), 0.125F)); itemConsumer.accept(tippedArrow); } } @Override - public void appendHoverText(ItemStack arrow, @Nullable Level world, List tooltip, TooltipFlag flag) { - TooltipBuilder.of(tooltip).potionEffects(arrow); + public void appendHoverText(ItemStack arrow, TooltipContext context, List tooltip, TooltipFlag flag) { + TooltipBuilder.of(tooltip, context).potionEffects(arrow); } @Override - public List getEffects(ItemStack stack) { - return XRPotionHelper.getPotionEffectsFromStack(stack); + public PotionContents getPotionContents(ItemStack stack) { + return stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY); } } diff --git a/src/main/java/reliquary/items/ToggleableItem.java b/src/main/java/reliquary/items/ToggleableItem.java index d67352eb..842814b3 100644 --- a/src/main/java/reliquary/items/ToggleableItem.java +++ b/src/main/java/reliquary/items/ToggleableItem.java @@ -1,9 +1,5 @@ package reliquary.items; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.Tag; -import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.world.InteractionHand; @@ -13,28 +9,15 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import reliquary.init.ModDataComponents; +import reliquary.items.component.OversizedComponentItemHandler; import reliquary.util.InventoryHelper; -import reliquary.util.NBTHelper; import reliquary.util.RandHelper; -import reliquary.util.RegistryHelper; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.BooleanSupplier; -import java.util.function.Consumer; -import java.util.function.IntConsumer; -import java.util.function.Predicate; -import java.util.function.Supplier; +import java.util.function.*; public abstract class ToggleableItem extends ItemBase { - - protected static final String QUANTITY_TAG = "Quantity"; - protected static final String ITEM_NAME_TAG = "Name"; - private static final String ENABLED_TAG = "enabled"; - private static final String COOLDOWN_TAG = "coolDown"; - private static final String ITEMS_TAG = "Items"; + protected static final int FIRST_SLOT = 0; protected ToggleableItem(Properties properties, Supplier isDisabled) { super(properties, isDisabled); @@ -45,23 +28,59 @@ protected ToggleableItem(Properties properties) { } @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return isEnabled(stack); } - protected void setCooldown(ItemStack stack, Level world, int cooldown) { - NBTHelper.putLong(COOLDOWN_TAG, stack, world.getGameTime() + cooldown); + protected void setCooldown(ItemStack stack, Level level, int cooldown) { + stack.set(ModDataComponents.COOLDOWN_TIME, level.getGameTime() + cooldown); + } + + protected boolean isInCooldown(ItemStack stack, Level level) { + return stack.getOrDefault(ModDataComponents.COOLDOWN_TIME, 0L) > level.getGameTime(); + } + + protected T getFromHandler(ItemStack stack, Function getter) { + return getter.apply(createHandler(stack)); + } + + protected void runOnHandler(ItemStack stack, Consumer runner) { + runner.accept(createHandler(stack)); + } + + public OversizedComponentItemHandler createHandler(ItemStack stack) { + int size = Math.max(stack.has(ModDataComponents.OVERSIZED_ITEM_CONTAINER_CONTENTS) ? stack.get(ModDataComponents.OVERSIZED_ITEM_CONTAINER_CONTENTS).getSlots() : getContainerInitialSize(), getContainerInitialSize()); + return new OversizedComponentItemHandler(stack, ModDataComponents.OVERSIZED_ITEM_CONTAINER_CONTENTS.get(), size, this::getContainerSlotLimit, this::isItemValidForContainerSlot, this::getStackWorth); + } + + protected int getStackWorth(int slot) { + return 1; + } + + protected void removeContainerContents(ItemStack stack) { + stack.remove(ModDataComponents.OVERSIZED_ITEM_CONTAINER_CONTENTS); + } + + protected int getContainerInitialSize() { + return 1; } - protected boolean isInCooldown(ItemStack stack, Level world) { - return NBTHelper.getLong(COOLDOWN_TAG, stack) > world.getGameTime(); + protected int getContainerSlotLimit(ItemStack stack, int slot) { + return getContainerSlotLimit(slot); + } + + protected int getContainerSlotLimit(int slot) { + return 64; + } + + protected boolean isItemValidForContainerSlot(int slot, ItemStack stack) { + return true; } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack stack = player.getItemInHand(hand); - if (!world.isClientSide && player.isShiftKeyDown()) { + if (!level.isClientSide && player.isShiftKeyDown()) { toggleEnabled(stack); player.level().playSound(null, player.blockPosition(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.PLAYERS, 0.1F, 0.5F * (RandHelper.getRandomMinusOneToOne(player.level().random) * 0.7F + 1.2F)); @@ -76,20 +95,15 @@ public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStac } public boolean isEnabled(ItemStack stack) { - return NBTHelper.getBoolean(ENABLED_TAG, stack); + return stack.getOrDefault(ModDataComponents.ENABLED, false); } void toggleEnabled(ItemStack stack) { - NBTHelper.putBoolean(ENABLED_TAG, stack, !NBTHelper.getBoolean(ENABLED_TAG, stack)); - } - - public static boolean hasEnabledTag(ItemStack stack) { - CompoundTag tag = stack.getTag(); - return tag != null && tag.contains(ENABLED_TAG); + stack.set(ModDataComponents.ENABLED, !isEnabled(stack)); } protected void consumeAndCharge(Player player, int freeCapacity, int chargePerItem, Item item, int maxCount, IntConsumer addCharge) { - consumeAndCharge(player, freeCapacity, chargePerItem, ist -> ist.getItem() == item, maxCount, addCharge); + consumeAndCharge(player, freeCapacity, chargePerItem, stack -> stack.getItem() == item, maxCount, addCharge); } protected void consumeAndCharge(Player player, int freeCapacity, int chargePerItem, Predicate itemMatches, int maxCount, IntConsumer addCharge) { @@ -103,107 +117,17 @@ protected void consumeAndCharge(Player player, int freeCapacity, int chargePerIt } } - protected void addItemToInternalStorage(ItemStack stack, Item item, int chargeToAdd) { - addItemToInternalStorage(stack, RegistryHelper.getItemRegistryName(item), chargeToAdd); - } - - protected void addItemToInternalStorage(ItemStack stack, String itemRegistryName, int chargeToAdd) { - AtomicBoolean found = new AtomicBoolean(false); - updateItems(stack, tag -> { - String itemName = tag.getString(ITEM_NAME_TAG); - if (itemName.equals(itemRegistryName)) { - int quantity = tag.getInt(QUANTITY_TAG); - tag.putInt(QUANTITY_TAG, quantity + chargeToAdd); - found.set(true); - } - }, found::get, list -> { - if (!found.get()) { - CompoundTag newTagData = new CompoundTag(); - newTagData.putString(ITEM_NAME_TAG, itemRegistryName); - newTagData.putInt(QUANTITY_TAG, chargeToAdd); - list.add(newTagData); - } - }); - } - - private void updateItems(ItemStack stack, Consumer actOnItemTag, BooleanSupplier shouldExit, Consumer actOnListAfter) { - CompoundTag tag = NBTHelper.getTag(stack); - iterateItems(tag, actOnItemTag, shouldExit, itemList -> { - tag.put(ITEMS_TAG, itemList); - actOnListAfter.accept(itemList); - }); - stack.setTag(tag); - } - - protected void iterateItems(ItemStack stack, Consumer actOnItemTag, BooleanSupplier shouldExit) { - iterateItems(NBTHelper.getTag(stack), actOnItemTag, shouldExit, list -> { - }); - } - - private void iterateItems(CompoundTag tagCompound, Consumer actOnItemTag, BooleanSupplier shouldExit, Consumer actOnListAfter) { - ListTag tagList = tagCompound.getList(ITEMS_TAG, 10); - for (int i = 0; i < tagList.size(); ++i) { - actOnItemTag.accept(tagList.getCompound(i)); - if (shouldExit.getAsBoolean()) { - break; - } - } - actOnListAfter.accept(tagList); + protected boolean addItemToContainer(ItemStack container, Item item, int chargeToAdd) { + ItemStack stack = new ItemStack(item); + stack.setCount(chargeToAdd); + return getFromHandler(container, handler -> handler.insertItemOrAddIntoNewSlotIfNoStackMatches(stack)).isEmpty(); } - public boolean removeItemFromInternalStorage(ItemStack stack, Item item, int quantityToRemove, boolean simulate, Player player) { + public boolean removeItemFromInternalStorage(ItemStack stack, int slot, int quantityToRemove, boolean simulate, Player player) { if (player.isCreative()) { return true; } - AtomicBoolean updated = new AtomicBoolean(false); - updateItems(stack, tag -> { - String itemName = tag.getString(ITEM_NAME_TAG); - ResourceLocation itemRegistryName = RegistryHelper.getRegistryName(item); - if (itemName.equals(itemRegistryName.toString())) { - int originalQuantity = tag.getInt(QUANTITY_TAG); - if (originalQuantity - quantityToRemove < 0) { - updated.set(false); - return; - } - if (!simulate) { - tag.putInt(QUANTITY_TAG, originalQuantity - quantityToRemove); - } - updated.set(true); - } - }, updated::get, list -> { - }); - return updated.get(); - } - - public void removeItemTagInInternalStorage(ItemStack stack, Item item) { - String registryName = RegistryHelper.getItemRegistryName(item); - - ListTag tagList = NBTHelper.getTag(stack).getList(ITEMS_TAG, Tag.TAG_COMPOUND); - for (int i = 0; i < tagList.size(); ++i) { - CompoundTag itemCountTag = tagList.getCompound(i); - if (itemCountTag.getString(ITEM_NAME_TAG).equals(registryName)) { - tagList.remove(i); - return; - } - } - } - - public int getInternalStorageItemCount(ItemStack stack, Item item) { - return getInternalStorageItemCount(stack, RegistryHelper.getItemRegistryName(item)); - } - - public int getInternalStorageItemCount(ItemStack stack, String itemRegistryName) { - AtomicInteger ret = new AtomicInteger(-1); - iterateItems(stack, tag -> { - if (tag.getString(ITEM_NAME_TAG).equals(itemRegistryName)) { - ret.set(tag.getInt(QUANTITY_TAG)); - } - }, () -> ret.get() >= 0); - - return Math.max(ret.get(), 0); - } - protected boolean hasSpaceForItem(ItemStack stack, Item item, int quantityLimit) { - return getInternalStorageItemCount(stack, item) < quantityLimit; + return getFromHandler(stack, handler -> handler.extractItemAndRemoveSlotIfEmpty(slot, quantityToRemove, simulate)).getCount() == quantityToRemove; } } diff --git a/src/main/java/reliquary/items/TwilightCloakItem.java b/src/main/java/reliquary/items/TwilightCloakItem.java index 9dfd4a42..1ddd3a4e 100644 --- a/src/main/java/reliquary/items/TwilightCloakItem.java +++ b/src/main/java/reliquary/items/TwilightCloakItem.java @@ -9,11 +9,11 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; import net.minecraft.world.level.Level; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.living.LivingChangeTargetEvent; -import net.minecraftforge.event.entity.living.LivingEvent; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.entity.living.LivingChangeTargetEvent; +import net.neoforged.neoforge.event.tick.EntityTickEvent; import reliquary.items.util.ICuriosItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.InventoryHelper; import reliquary.util.MobHelper; @@ -21,19 +21,14 @@ public class TwilightCloakItem extends ToggleableItem implements ICuriosItem { public TwilightCloakItem() { - super(new Properties().stacksTo(1)); - MinecraftForge.EVENT_BUS.addListener(this::onEntityTargetedEvent); - MinecraftForge.EVENT_BUS.addListener(this::onLivingUpdate); + super(new Properties().stacksTo(1).rarity(Rarity.EPIC)); + NeoForge.EVENT_BUS.addListener(this::onEntityTargetedEvent); + NeoForge.EVENT_BUS.addListener(this::onLivingUpdate); } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - - @Override - public void inventoryTick(ItemStack twilightCloak, Level world, Entity entity, int itemSlot, boolean isSelected) { - if (!(entity instanceof Player)) { + public void inventoryTick(ItemStack twilightCloak, Level level, Entity entity, int itemSlot, boolean isSelected) { + if (level.isClientSide() || !(entity instanceof Player player) || player.isSpectator()) { return; } @@ -47,7 +42,7 @@ private void updateInvisibility(ItemStack twilightCloak, Player player) { //toggled effect, makes player invisible based on light level (configurable) - if (player.level().getMaxLocalRawBrightness(player.blockPosition()) > Settings.COMMON.items.twilightCloak.maxLightLevel.get()) { + if (player.level().getMaxLocalRawBrightness(player.blockPosition()) > Config.COMMON.items.twilightCloak.maxLightLevel.get()) { return; } @@ -68,16 +63,16 @@ public void onWornTick(ItemStack twilightCloak, LivingEntity player) { } private void onEntityTargetedEvent(LivingChangeTargetEvent event) { - if (shouldResetTarget(event.getNewTarget())) { + if (shouldResetTarget(event.getNewAboutToBeSetTarget())) { event.setCanceled(true); } } - private void onLivingUpdate(LivingEvent.LivingTickEvent event) { + private void onLivingUpdate(EntityTickEvent.Pre event) { doTwilightCloakCheck(event); } - private void doTwilightCloakCheck(LivingEvent event) { + private void doTwilightCloakCheck(EntityTickEvent.Pre event) { if (event.getEntity() instanceof Mob entityLiving && shouldResetTarget(entityLiving.getTarget())) { MobHelper.resetTarget(entityLiving); } @@ -88,6 +83,6 @@ private boolean shouldResetTarget(@Nullable Entity target) { return false; } - return InventoryHelper.playerHasItem(player, this, true, Type.BODY) && player.level().getMaxLocalRawBrightness(player.blockPosition()) <= Settings.COMMON.items.twilightCloak.maxLightLevel.get(); + return InventoryHelper.playerHasItem(player, this, true) && player.level().getMaxLocalRawBrightness(player.blockPosition()) <= Config.COMMON.items.twilightCloak.maxLightLevel.get(); } } diff --git a/src/main/java/reliquary/items/VoidTearItem.java b/src/main/java/reliquary/items/VoidTearItem.java index 99515913..53cc2d15 100644 --- a/src/main/java/reliquary/items/VoidTearItem.java +++ b/src/main/java/reliquary/items/VoidTearItem.java @@ -1,12 +1,15 @@ package reliquary.items; import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.Codec; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.HolderLookup; +import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.StreamCodec; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.RandomSource; @@ -24,41 +27,25 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.capabilities.ICapabilitySerializable; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.event.entity.player.EntityItemPickupEvent; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.common.util.TriState; +import net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; import reliquary.blocks.PedestalBlock; +import reliquary.init.ModDataComponents; +import reliquary.init.ModItems; import reliquary.items.util.IScrollableItem; -import reliquary.items.util.VoidTearItemStackHandler; -import reliquary.reference.Settings; -import reliquary.util.InventoryHelper; -import reliquary.util.NBTHelper; -import reliquary.util.NoPlayerBlockItemUseContext; -import reliquary.util.RandHelper; -import reliquary.util.TooltipBuilder; -import reliquary.util.TranslationHelper; -import reliquary.util.WorldHelper; - -import javax.annotation.Nonnull; +import reliquary.reference.Config; +import reliquary.util.*; + import javax.annotation.Nullable; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.function.Function; public class VoidTearItem extends ToggleableItem implements IScrollableItem { - private static final String CONTENTS_TAG = "contents"; - public VoidTearItem() { super(new Properties()); - MinecraftForge.EVENT_BUS.addListener(this::onItemPickup); + NeoForge.EVENT_BUS.addListener(this::onItemPickup); } @Override @@ -67,40 +54,15 @@ public int getMaxStackSize(ItemStack stack) { } @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) { - return new ICapabilitySerializable() { - final VoidTearItemStackHandler itemHandler = new VoidTearItemStackHandler(); - - @Override - public CompoundTag serializeNBT() { - return itemHandler.serializeNBT(); - } - - @Override - public void deserializeNBT(CompoundTag nbt) { - itemHandler.deserializeNBT(nbt); - } - - @Nonnull - @Override - public LazyOptional getCapability(Capability capability, @Nullable Direction side) { - return ForgeCapabilities.ITEM_HANDLER.orEmpty(capability, LazyOptional.of(() -> itemHandler)); - } - }; - } - - @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return !(Minecraft.getInstance().options.keyShift.isDown()) && super.isFoil(stack); } @Override - @OnlyIn(Dist.CLIENT) - protected void addMoreInformation(ItemStack voidTear, @Nullable Level world, TooltipBuilder tooltipBuilder) { - ItemStack contents = getTearContents(voidTear, true); + protected void addMoreInformation(ItemStack voidTear, @Nullable HolderLookup.Provider registries, TooltipBuilder tooltipBuilder) { + ItemStack contents = getTearContents(voidTear); - if (isEmpty(voidTear, true)) { + if (isEmpty(voidTear)) { return; } @@ -118,20 +80,20 @@ protected void addMoreInformation(ItemStack voidTear, @Nullable Level world, Too @Override protected boolean hasMoreInformation(ItemStack stack) { - return !isEmpty(stack, true); + return !isEmpty(stack); } @Override - public InteractionResultHolder use(Level world, Player player, InteractionHand hand) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack voidTear = player.getItemInHand(hand); - if (!world.isClientSide) { - BlockHitResult rayTraceResult = getPlayerPOVHitResult(world, player, ClipContext.Fluid.NONE); + if (!level.isClientSide) { + BlockHitResult rayTraceResult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.NONE); //not letting logic go through if player was sneak clicking inventory or was trying to place a block //noinspection ConstantConditions if (rayTraceResult != null && rayTraceResult.getType() == HitResult.Type.BLOCK && - (InventoryHelper.hasItemHandler(world, rayTraceResult.getBlockPos()) && player.isShiftKeyDown() || hasPlaceableBlock(voidTear))) { + (InventoryHelper.hasItemHandler(level, rayTraceResult.getBlockPos()) && player.isShiftKeyDown() || hasPlaceableBlock(voidTear))) { return new InteractionResultHolder<>(InteractionResult.PASS, voidTear); } @@ -145,10 +107,11 @@ public InteractionResultHolder use(Level world, Player player, Intera } if (player.isShiftKeyDown()) { - return super.use(world, player, hand); + return super.use(level, player, hand); } - if (Boolean.TRUE.equals(InventoryHelper.getItemHandlerFrom(player).map(h -> attemptToEmptyIntoInventory(voidTear, player, h)).orElse(false))) { + IItemHandler playerInventory = InventoryHelper.getMainInventoryItemHandlerFrom(player); + if (attemptToEmptyIntoInventory(voidTear, player, playerInventory)) { player.level().playSound(null, player.blockPosition(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.PLAYERS, 0.1F, 0.5F * (RandHelper.getRandomMinusOneToOne(player.level().random) * 0.7F + 1.2F)); setEmpty(voidTear); return new InteractionResultHolder<>(InteractionResult.SUCCESS, voidTear); @@ -158,31 +121,30 @@ public InteractionResultHolder use(Level world, Player player, Intera } private boolean hasPlaceableBlock(ItemStack voidTear) { - return !isEmpty(voidTear) && getTearContents(voidTear, false).getItem() instanceof BlockItem; + return !isEmpty(voidTear) && getTearContents(voidTear).getItem() instanceof BlockItem; } private InteractionResultHolder rightClickEmpty(ItemStack emptyVoidTear, Player player) { - return InventoryHelper.getItemHandlerFrom(player).map(playerInventory -> { - ItemStack target = InventoryHelper.getTargetItem(emptyVoidTear, playerInventory); - if (!target.isEmpty()) { - ItemStack filledTear; - if (emptyVoidTear.getCount() > 1) { - emptyVoidTear.shrink(1); - filledTear = new ItemStack(this); - } else { - filledTear = emptyVoidTear; - } - buildTear(filledTear, target, player, playerInventory, true); - player.level().playSound(null, player.blockPosition(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.PLAYERS, 0.1F, 0.5F * (RandHelper.getRandomMinusOneToOne(player.level().random) * 0.7F + 1.2F)); - if (emptyVoidTear.getCount() == 1) { - return new InteractionResultHolder<>(InteractionResult.SUCCESS, filledTear); - } else { - InventoryHelper.addItemToPlayerInventory(player, filledTear); - return new InteractionResultHolder<>(InteractionResult.SUCCESS, emptyVoidTear); - } + IItemHandler playerInventory = InventoryHelper.getMainInventoryItemHandlerFrom(player); + ItemStack target = InventoryHelper.getTargetItem(emptyVoidTear, playerInventory); + if (!target.isEmpty()) { + ItemStack filledTear; + if (emptyVoidTear.getCount() > 1) { + emptyVoidTear.shrink(1); + filledTear = new ItemStack(this); + } else { + filledTear = emptyVoidTear; + } + buildTear(filledTear, target, player, playerInventory, true); + player.level().playSound(null, player.blockPosition(), SoundEvents.EXPERIENCE_ORB_PICKUP, SoundSource.PLAYERS, 0.1F, 0.5F * (RandHelper.getRandomMinusOneToOne(player.level().random) * 0.7F + 1.2F)); + if (emptyVoidTear.getCount() == 1) { + return new InteractionResultHolder<>(InteractionResult.SUCCESS, filledTear); + } else { + InventoryHelper.addItemToPlayerInventory(player, filledTear); + return new InteractionResultHolder<>(InteractionResult.SUCCESS, emptyVoidTear); } - return new InteractionResultHolder<>(InteractionResult.PASS, emptyVoidTear); - }).orElse(new InteractionResultHolder<>(InteractionResult.PASS, emptyVoidTear)); + } + return new InteractionResultHolder<>(InteractionResult.PASS, emptyVoidTear); } private void buildTear(ItemStack voidTear, ItemStack target, Player player, IItemHandler inventory, boolean isPlayerInventory) { @@ -196,44 +158,44 @@ private void buildTear(ItemStack voidTear, ItemStack target, Player player, IIte quantity = 1; } } else { - quantity = InventoryHelper.tryToRemoveFromInventory(target, inventory, Settings.COMMON.items.voidTear.itemLimit.get()); + quantity = InventoryHelper.tryToRemoveFromInventory(target, inventory, Config.COMMON.items.voidTear.itemLimit.get()); } setItemStack(voidTear, target); setItemQuantity(voidTear, quantity); //configurable auto-drain when created. - NBTHelper.putBoolean("enabled", voidTear, Settings.COMMON.items.voidTear.absorbWhenCreated.get()); + if (Config.COMMON.items.voidTear.absorbWhenCreated.get()) { + toggleEnabled(voidTear); + } } @Override - public void inventoryTick(ItemStack voidTear, Level world, Entity entity, int slotNumber, boolean isSelected) { - if (!world.isClientSide && world.getGameTime() % 5 != 0) { - if (!(entity instanceof Player player)) { + public void inventoryTick(ItemStack voidTear, Level level, Entity entity, int slotNumber, boolean isSelected) { + if (level.isClientSide || !(entity instanceof Player player) || player.isSpectator() || level.getGameTime() % 5 != 0) { + return; + } + if (isEnabled(voidTear)) { + if (isEmpty(voidTear)) { + setEmpty(voidTear); //fixes issue when creative inventory is opened and active tear gets messed up return; } - if (isEnabled(voidTear)) { - if (isEmpty(voidTear)) { - setEmpty(voidTear); //fixes issue when creative inventory is opened and active tear gets messed up - return; - } - - ItemStack contents = getTearContents(voidTear); + ItemStack contents = getTearContents(voidTear); - if (!contents.isEmpty()) { - fillTear(voidTear, player, contents); - } else { - setEmpty(voidTear); - } + if (!contents.isEmpty()) { + fillTear(voidTear, player, contents); + } else { + setEmpty(voidTear); } } } private void fillTear(ItemStack voidTear, Player player, ItemStack contents) { - int itemQuantity = InventoryHelper.getItemHandlerFrom(player).map(h -> InventoryHelper.getItemQuantity(contents, h)).orElse(9); + IItemHandler playerInventory = InventoryHelper.getMainInventoryItemHandlerFrom(player); + int itemQuantity = InventoryHelper.getItemQuantity(contents, playerInventory); - //doesn't absorb in creative mode.. this is mostly for testing, it prevents the item from having unlimited *whatever* for eternity. - if (getItemQuantity(voidTear) <= Settings.COMMON.items.voidTear.itemLimit.get() && itemQuantity > getKeepQuantity(voidTear) && InventoryHelper.consumeItem(contents, player, getKeepQuantity(voidTear), itemQuantity - getKeepQuantity(voidTear)) && !player.isCreative()) { + //doesn't absorb in creative mode. this is mostly for testing, it prevents the item from having unlimited *whatever* for eternity. + if (getItemQuantity(voidTear) <= Config.COMMON.items.voidTear.itemLimit.get() && itemQuantity > getKeepQuantity(voidTear) && InventoryHelper.consumeItem(contents, player, getKeepQuantity(voidTear), itemQuantity - getKeepQuantity(voidTear)) && !player.isCreative()) { setItemQuantity(voidTear, getItemQuantity(voidTear) + itemQuantity - getKeepQuantity(voidTear)); } if (getMode(voidTear) != Mode.NO_REFILL) { @@ -242,7 +204,8 @@ private void fillTear(ItemStack voidTear, Player player, ItemStack contents) { } private void attemptToReplenish(Player player, ItemStack voidTear) { - if (Boolean.TRUE.equals(InventoryHelper.getItemHandlerFrom(player).map(h -> fillFirstFirstStackFound(voidTear, h)).orElse(false))) { + IItemHandler playerInventory = InventoryHelper.getMainInventoryItemHandlerFrom(player); + if (fillFirstFirstStackFound(voidTear, playerInventory)) { return; } @@ -263,7 +226,7 @@ private boolean fillFirstFirstStackFound(ItemStack voidTear, IItemHandler h) { for (int slot = 0; slot < h.getSlots(); slot++) { ItemStack stackFound = h.getStackInSlot(slot); - if (ItemHandlerHelper.canItemStacksStack(stackFound, getTearContents(voidTear))) { + if (ItemStack.isSameItemSameComponents(stackFound, getTearContents(voidTear))) { int quantityToDecrease = Math.min(stackFound.getMaxStackSize() - stackFound.getCount(), getItemQuantity(voidTear) - 1); stackFound.grow(quantityToDecrease); setItemQuantity(voidTear, getItemQuantity(voidTear) - quantityToDecrease); @@ -282,22 +245,22 @@ public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { return InteractionResult.PASS; } InteractionHand hand = context.getHand(); - Level world = context.getLevel(); + Level level = context.getLevel(); BlockPos pos = context.getClickedPos(); ItemStack voidTear = player.getItemInHand(hand); - if (world.getBlockState(pos).getBlock() instanceof PedestalBlock) { + if (level.getBlockState(pos).getBlock() instanceof PedestalBlock) { return InteractionResult.PASS; } - LazyOptional handler = WorldHelper.getBlockEntity(world, pos).map(InventoryHelper::getItemHandlerFrom).orElse(LazyOptional.empty()); - if (handler.isPresent()) { - return handler.map(h -> processItemHandlerInteraction(player, hand, world, voidTear, h)).orElse(InteractionResult.FAIL); - } else if (!world.isClientSide && hasPlaceableBlock(voidTear) && getItemQuantity(voidTear) > 0) { + IItemHandler handler = level.getCapability(Capabilities.ItemHandler.BLOCK, pos, null); + if (handler != null) { + return processItemHandlerInteraction(player, hand, level, voidTear, handler); + } else if (!level.isClientSide && hasPlaceableBlock(voidTear) && getItemQuantity(voidTear) > 0) { ItemStack containerItem = getTearContents(voidTear); BlockItem itemBlock = (BlockItem) containerItem.getItem(); Direction face = context.getClickedFace(); - NoPlayerBlockItemUseContext noPlayerBlockItemUseContext = new NoPlayerBlockItemUseContext(world, pos, new ItemStack(itemBlock), face); + NoPlayerBlockItemUseContext noPlayerBlockItemUseContext = new NoPlayerBlockItemUseContext(level, pos, new ItemStack(itemBlock), face); if (noPlayerBlockItemUseContext.canPlace() && itemBlock.place(noPlayerBlockItemUseContext).consumesAction()) { setItemQuantity(voidTear, getItemQuantity(voidTear) - 1); } @@ -305,8 +268,8 @@ public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { return InteractionResult.PASS; } - private InteractionResult processItemHandlerInteraction(Player player, InteractionHand hand, Level world, ItemStack voidTear, IItemHandler itemHandler) { - if (!world.isClientSide) { + private InteractionResult processItemHandlerInteraction(Player player, InteractionHand hand, Level level, ItemStack voidTear, IItemHandler itemHandler) { + if (!level.isClientSide) { if (isEmpty(voidTear)) { return onItemUseFirstEmpty(voidTear, itemHandler, player, hand); } @@ -376,7 +339,7 @@ private void drainInventory(ItemStack stack, Player player, IItemHandler invento ItemStack contents = getTearContents(stack); int quantity = getItemQuantity(stack); - int quantityDrained = InventoryHelper.tryToRemoveFromInventory(contents, inventory, Settings.COMMON.items.voidTear.itemLimit.get() - quantity); + int quantityDrained = InventoryHelper.tryToRemoveFromInventory(contents, inventory, Config.COMMON.items.voidTear.itemLimit.get() - quantity); if (quantityDrained <= 0) { return; @@ -387,61 +350,29 @@ private void drainInventory(ItemStack stack, Player player, IItemHandler invento setItemQuantity(stack, quantity + quantityDrained); } - @Nullable - @Override - public CompoundTag getShareTag(ItemStack voidTear) { - CompoundTag nbt = super.getShareTag(voidTear); - - if (isEmpty(voidTear)) { - return nbt; - } - - if (nbt == null) { - nbt = new CompoundTag(); - } - nbt.putInt("count", getItemQuantity(voidTear)); - nbt.put(CONTENTS_TAG, getTearContents(voidTear).save(new CompoundTag())); - - return nbt; - } - - public ItemStack getTearContents(ItemStack voidTear) { - return getTearContents(voidTear, false); + public static ItemStack getTearContents(ItemStack voidTear) { + return ModItems.VOID_TEAR.get().getFromHandler(voidTear, handler -> handler.getStackInSlot(FIRST_SLOT)); } - public static ItemStack getTearContents(ItemStack voidTear, boolean isClient) { - if (isClient) { - CompoundTag nbt = voidTear.getTag(); - if (nbt == null || !nbt.contains(CONTENTS_TAG)) { - return ItemStack.EMPTY; - } - ItemStack contents = ItemStack.of(nbt.getCompound(CONTENTS_TAG)); - contents.setCount(nbt.getInt("count")); - - return contents; - } - - return getFromHandler(voidTear, VoidTearItemStackHandler::getTotalAmountStack).orElse(ItemStack.EMPTY); - } - - private static Optional getFromHandler(ItemStack voidTear, Function get) { - return InventoryHelper.getFromHandler(voidTear, get, VoidTearItemStackHandler.class); - } - - private void runOnHandler(ItemStack voidTear, Consumer run) { - InventoryHelper.runOnItemHandler(voidTear, run, VoidTearItemStackHandler.class); + @Override + protected int getContainerSlotLimit(ItemStack stack, int slot) { + return getItemQuantity(stack) == 0 ? 0 : Config.COMMON.items.voidTear.itemLimit.get(); } private void setItemStack(ItemStack voidTear, ItemStack stack) { - runOnHandler(voidTear, h -> h.setContainedStack(stack)); + runOnHandler(voidTear, handler -> handler.setStackInSlot(FIRST_SLOT, stack)); } private void setItemQuantity(ItemStack voidTear, int quantity) { - runOnHandler(voidTear, h -> h.setContainedStackAmount(quantity)); + runOnHandler(voidTear, handler -> { + ItemStack stack = handler.getStackInSlot(FIRST_SLOT); + stack.setCount(quantity); + handler.setStackInSlot(FIRST_SLOT, stack); + }); } private int getItemQuantity(ItemStack voidTear) { - return getFromHandler(voidTear, VoidTearItemStackHandler::getContainedAmount).orElse(0); + return getFromHandler(voidTear, handler -> handler.getCountInSlot(FIRST_SLOT)); } @Override @@ -456,6 +387,9 @@ public InteractionResult onMouseScrolled(ItemStack voidTear, Player player, doub public enum Mode implements StringRepresentable { ONE_STACK, FULL_INVENTORY, NO_REFILL; + public static final Codec CODEC = StringRepresentable.fromEnum(Mode::values); + public static final StreamCodec STREAM_CODEC = NeoForgeStreamCodecs.enumCodec(Mode.class); + @Override public String getSerializedName() { return name(); @@ -481,14 +415,11 @@ public Mode previous() { } public Mode getMode(ItemStack voidTear) { - if (NBTHelper.getString("mode", voidTear).isEmpty()) { - setMode(voidTear, Mode.ONE_STACK); - } - return Mode.valueOf(NBTHelper.getString("mode", voidTear)); + return voidTear.getOrDefault(ModDataComponents.VOID_TEAR_MODE, Mode.ONE_STACK); } private void setMode(ItemStack voidTear, Mode mode) { - NBTHelper.putString("mode", voidTear, mode.toString()); + voidTear.set(ModDataComponents.VOID_TEAR_MODE, mode); } private void cycleMode(ItemStack voidTear, boolean next) { @@ -516,10 +447,10 @@ private int getKeepQuantity(ItemStack voidTear) { return Integer.MAX_VALUE; } - private void onItemPickup(EntityItemPickupEvent event) { - ItemStack pickedUpStack = event.getItem().getItem(); - Player player = event.getEntity(); - ItemEntity itemEntity = event.getItem(); + private void onItemPickup(ItemEntityPickupEvent.Pre event) { + ItemStack pickedUpStack = event.getItemEntity().getItem(); + Player player = event.getPlayer(); + ItemEntity itemEntity = event.getItemEntity(); for (int slot = 0; slot < player.getInventory().getContainerSize(); slot++) { ItemStack tearStack = player.getInventory().getItem(slot); @@ -529,10 +460,11 @@ private void onItemPickup(EntityItemPickupEvent event) { } } - private boolean tryToPickupWithTear(EntityItemPickupEvent event, ItemStack pickedUpStack, Player player, ItemEntity itemEntity, ItemStack tearStack) { + private boolean tryToPickupWithTear(ItemEntityPickupEvent.Pre event, ItemStack pickedUpStack, Player player, ItemEntity itemEntity, ItemStack tearStack) { int tearItemQuantity = getItemQuantity(tearStack); if (canAbsorbStack(pickedUpStack, tearStack)) { - int playerItemQuantity = InventoryHelper.getItemHandlerFrom(player).map(h -> InventoryHelper.getItemQuantity(pickedUpStack, h)).orElse(0); + IItemHandler playerInventory = InventoryHelper.getMainInventoryItemHandlerFrom(player); + int playerItemQuantity = InventoryHelper.getItemQuantity(pickedUpStack, playerInventory); if (playerItemQuantity + pickedUpStack.getCount() >= getKeepQuantity(tearStack) || player.getInventory().getFreeSlot() == -1) { setItemQuantity(tearStack, tearItemQuantity + pickedUpStack.getCount()); @@ -541,7 +473,7 @@ private boolean tryToPickupWithTear(EntityItemPickupEvent event, ItemStack picke itemEntity.level().playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ITEM_PICKUP, SoundSource.PLAYERS, 0.2F, (RandHelper.getRandomMinusOneToOne(rand) * 0.7F + 1.0F) * 2.0F); } itemEntity.discard(); - event.setCanceled(true); + event.setCanPickup(TriState.FALSE); return true; } } @@ -549,24 +481,15 @@ private boolean tryToPickupWithTear(EntityItemPickupEvent event, ItemStack picke } boolean canAbsorbStack(ItemStack pickedUpStack, ItemStack tearStack) { - return ItemHandlerHelper.canItemStacksStack(getTearContents(tearStack), pickedUpStack) && getItemQuantity(tearStack) + pickedUpStack.getCount() <= Settings.COMMON.items.voidTear.itemLimit.get(); + return ItemStack.isSameItemSameComponents(getTearContents(tearStack), pickedUpStack) && getItemQuantity(tearStack) + pickedUpStack.getCount() <= Config.COMMON.items.voidTear.itemLimit.get(); } public boolean isEmpty(ItemStack voidTear) { - return isEmpty(voidTear, false); - } - - public static boolean isEmpty(ItemStack voidTear, boolean isClient) { - if (isClient) { - return getTearContents(voidTear, true).isEmpty(); - } - - return !hasEnabledTag(voidTear) || getFromHandler(voidTear, h -> h.getStackSlots() <= 0 || h.getContainedAmount() <= 0).orElse(true); + return !voidTear.has(ModDataComponents.ENABLED) || getItemQuantity(voidTear) == 0; } private void setEmpty(ItemStack voidTear) { - voidTear.setTag(null); - setItemStack(voidTear, ItemStack.EMPTY); - setItemQuantity(voidTear, 0); + voidTear.remove(ModDataComponents.ENABLED); + removeContainerContents(voidTear); } } diff --git a/src/main/java/reliquary/items/WitchHatItem.java b/src/main/java/reliquary/items/WitchHatItem.java index 19f88913..788556ce 100644 --- a/src/main/java/reliquary/items/WitchHatItem.java +++ b/src/main/java/reliquary/items/WitchHatItem.java @@ -1,71 +1,16 @@ package reliquary.items; import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.HumanoidModel; -import net.minecraft.client.model.geom.EntityModelSet; import net.minecraft.network.chat.Component; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraftforge.client.extensions.common.IClientItemExtensions; -import reliquary.client.model.WitchHatModel; -import reliquary.handler.ClientEventHandler; -import reliquary.reference.Reference; +import reliquary.init.ModItems; -import javax.annotation.Nonnull; import java.util.function.Consumer; public class WitchHatItem extends ArmorItem implements ICreativeTabItemGenerator { - private static final ArmorMaterial hatMaterial = new ArmorMaterial() { - @Override - public int getDurabilityForType(Type pType) { - return 0; - } - - @Override - public int getDefenseForType(Type pType) { - return 0; - } - - @Override - public int getEnchantmentValue() { - return 0; - } - - @Override - public SoundEvent getEquipSound() { - return SoundEvents.ARMOR_EQUIP_GENERIC; - } - - @Override - public Ingredient getRepairIngredient() { - return Ingredient.EMPTY; - } - - @Override - public String getName() { - return Reference.MOD_ID + ":witch_hat"; - } - - @Override - public float getToughness() { - return 0; - } - - @Override - public float getKnockbackResistance() { - return 0; - } - }; - public WitchHatItem() { - super(hatMaterial, Type.HELMET, new Properties()); + super(ModItems.WITCH_HAT_MATERIAL, Type.HELMET, new Properties()); } @Override @@ -77,20 +22,4 @@ public void addCreativeTabItems(Consumer itemConsumer) { public Component getName(ItemStack stack) { return Component.translatable(getDescriptionId(stack)).withStyle(ChatFormatting.YELLOW); } - - @Override - public void initializeClient(Consumer consumer) { - consumer.accept(new IClientItemExtensions() { - private WitchHatModel hatModel = null; - - @Override - public @Nonnull HumanoidModel getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel original) { - if (hatModel == null) { - EntityModelSet entityModels = Minecraft.getInstance().getEntityModels(); - hatModel = new WitchHatModel(entityModels.bakeLayer(ClientEventHandler.WITCH_HAT_LAYER)); - } - return hatModel; - } - }); - } } diff --git a/src/main/java/reliquary/items/WitherlessRoseItem.java b/src/main/java/reliquary/items/WitherlessRoseItem.java index e2e8678a..833d9a95 100644 --- a/src/main/java/reliquary/items/WitherlessRoseItem.java +++ b/src/main/java/reliquary/items/WitherlessRoseItem.java @@ -1,5 +1,6 @@ package reliquary.items; +import net.minecraft.core.particles.ColorParticleOption; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.util.RandomSource; import net.minecraft.world.effect.MobEffects; @@ -8,55 +9,46 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Rarity; import net.minecraft.world.level.Level; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.living.LivingAttackEvent; -import net.minecraftforge.event.entity.living.MobEffectEvent; -import net.minecraftforge.eventbus.api.Event; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.entity.living.LivingDamageEvent; +import net.neoforged.neoforge.event.entity.living.MobEffectEvent; import reliquary.util.InventoryHelper; public class WitherlessRoseItem extends ItemBase { public WitherlessRoseItem() { - super(new Properties().stacksTo(1)); - MinecraftForge.EVENT_BUS.addListener(this::preventWither); - MinecraftForge.EVENT_BUS.addListener(this::preventWitherAttack); + super(new Properties().stacksTo(1).rarity(Rarity.EPIC)); + NeoForge.EVENT_BUS.addListener(this::preventWither); + NeoForge.EVENT_BUS.addListener(this::preventWitherAttack); } @Override - public Rarity getRarity(ItemStack stack) { - return Rarity.EPIC; - } - - @Override - @OnlyIn(Dist.CLIENT) public boolean isFoil(ItemStack stack) { return true; } private void preventWither(MobEffectEvent.Applicable event) { - LivingEntity entityLiving = event.getEntity(); - if (entityLiving instanceof Player player && event.getEffectInstance().getEffect() == MobEffects.WITHER && InventoryHelper.playerHasItem(player, this)) { - event.setResult(Event.Result.DENY); - addPreventParticles((Player) entityLiving); + LivingEntity livingEntity = event.getEntity(); + if (livingEntity instanceof Player player && event.getEffectInstance() != null && event.getEffectInstance().getEffect() == MobEffects.WITHER && InventoryHelper.playerHasItem(player, this)) { + event.setResult(MobEffectEvent.Applicable.Result.DO_NOT_APPLY); + addPreventParticles((Player) livingEntity); } } - private void preventWitherAttack(LivingAttackEvent event) { - LivingEntity entityLiving = event.getEntity(); - if (entityLiving instanceof Player player && event.getSource() == player.damageSources().wither() && InventoryHelper.playerHasItem(player, this)) { - entityLiving.removeEffect(MobEffects.WITHER); - event.setCanceled(true); - addPreventParticles((Player) entityLiving); + private void preventWitherAttack(LivingDamageEvent.Pre event) { + LivingEntity livingEntity = event.getEntity(); + if (livingEntity instanceof Player player && event.getSource() == player.damageSources().wither() && InventoryHelper.playerHasItem(player, this)) { + livingEntity.removeEffect(MobEffects.WITHER); + event.setNewDamage(0); + addPreventParticles((Player) livingEntity); } } private void addPreventParticles(Player entityLiving) { - Level world = entityLiving.level(); + Level level = entityLiving.level(); for (int particles = 0; particles < 10; particles++) { - double gauss1 = gaussian(world.random); - double gauss2 = gaussian(world.random); - world.addParticle(ParticleTypes.ENTITY_EFFECT, entityLiving.getX() + gauss1, entityLiving.getY() + entityLiving.getBbHeight() / 2, entityLiving.getZ() + gauss2, 0.0, 0.0, 1.0); + double gauss1 = gaussian(level.random); + double gauss2 = gaussian(level.random); + level.addParticle(ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, 0.0F, 0.0F, 1.0F), entityLiving.getX() + gauss1, entityLiving.getY() + entityLiving.getBbHeight() / 2, entityLiving.getZ() + gauss2, 0.0, 0.0, 0.0); } } diff --git a/src/main/java/reliquary/items/block/BlockItemBase.java b/src/main/java/reliquary/items/block/BlockItemBase.java index 4a1bcadd..e7155c15 100644 --- a/src/main/java/reliquary/items/block/BlockItemBase.java +++ b/src/main/java/reliquary/items/block/BlockItemBase.java @@ -5,13 +5,9 @@ import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import reliquary.items.ICreativeTabItemGenerator; -import javax.annotation.Nullable; import java.util.List; import java.util.function.Consumer; @@ -33,8 +29,7 @@ public BlockItemBase(Block block, Properties builder) { } @Override - @OnlyIn(Dist.CLIENT) - public void appendHoverText(ItemStack stack, @Nullable Level world, List tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, TooltipContext context, List tooltip, TooltipFlag flag) { tooltip.add(Component.translatable(getDescriptionId() + ".tooltip").withStyle(ChatFormatting.GRAY)); } } diff --git a/src/main/java/reliquary/items/block/FertileLilyPadItem.java b/src/main/java/reliquary/items/block/FertileLilyPadItem.java index 7a6fd221..239e9d4f 100644 --- a/src/main/java/reliquary/items/block/FertileLilyPadItem.java +++ b/src/main/java/reliquary/items/block/FertileLilyPadItem.java @@ -18,11 +18,11 @@ public FertileLilyPadItem() { } @Override - public InteractionResultHolder use(Level worldIn, Player playerIn, InteractionHand handIn) { - BlockHitResult blockraytraceresult = getPlayerPOVHitResult(worldIn, playerIn, ClipContext.Fluid.SOURCE_ONLY); - BlockHitResult blockraytraceresult1 = blockraytraceresult.withPosition(blockraytraceresult.getBlockPos().above()); - InteractionResult actionresulttype = super.useOn(new UseOnContext(playerIn, handIn, blockraytraceresult1)); - return new InteractionResultHolder<>(actionresulttype, playerIn.getItemInHand(handIn)); + public InteractionResultHolder use(Level level, Player playerIn, InteractionHand handIn) { + BlockHitResult hitResult = getPlayerPOVHitResult(level, playerIn, ClipContext.Fluid.SOURCE_ONLY); + BlockHitResult hitResultAbove = hitResult.withPosition(hitResult.getBlockPos().above()); + InteractionResult interactionResult = super.useOn(new UseOnContext(playerIn, handIn, hitResultAbove)); + return new InteractionResultHolder<>(interactionResult, playerIn.getItemInHand(handIn)); } @Override diff --git a/src/main/java/reliquary/items/component/OversizedComponentItemHandler.java b/src/main/java/reliquary/items/component/OversizedComponentItemHandler.java new file mode 100644 index 00000000..372d6f8d --- /dev/null +++ b/src/main/java/reliquary/items/component/OversizedComponentItemHandler.java @@ -0,0 +1,213 @@ +package reliquary.items.component; + +import com.google.common.base.Preconditions; +import net.minecraft.core.NonNullList; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.items.IItemHandlerModifiable; + +import java.util.function.BiFunction; +import java.util.function.BiPredicate; +import java.util.function.IntUnaryOperator; + +public class OversizedComponentItemHandler implements IItemHandlerModifiable { + protected final ItemStack parent; + protected final DataComponentType component; + protected final int size; + private final BiFunction getSlotLimit; + private final BiPredicate isItemValid; + private final IntUnaryOperator getSlotUnitWorth; + + public OversizedComponentItemHandler(ItemStack parent, DataComponentType component, int size, BiFunction getSlotLimit, BiPredicate isItemValid, IntUnaryOperator getSlotUnitWorth) { + this.parent = parent; + this.component = component; + this.size = size; + this.getSlotLimit = getSlotLimit; + this.isItemValid = isItemValid; + this.getSlotUnitWorth = getSlotUnitWorth; + Preconditions.checkArgument(size <= OversizedItemContainerContents.MAX_SIZE, "The max size of OversizedItemContainerContents is " + OversizedItemContainerContents.MAX_SIZE + " slots."); + } + + @Override + public int getSlots() { + return this.size; + } + + @Override + public ItemStack getStackInSlot(int slot) { + OversizedItemContainerContents contents = this.getContents(); + return this.getStackFromContents(contents, slot); + } + + public int getCountInSlot(int slot) { + OversizedItemContainerContents contents = this.getContents(); + return contents.getSlots() > slot ? contents.getCountInSlot(slot) : 0; + } + + @Override + public void setStackInSlot(int slot, ItemStack stack) { + this.validateSlotIndex(slot); + if (!this.isItemValid(slot, stack)) { + throw new RuntimeException("Invalid stack " + stack + " for slot " + slot + ")"); + } else { + OversizedItemContainerContents contents = this.getContents(); + ItemStack existing = this.getStackFromContents(contents, slot); + if (!ItemStack.matches(stack, existing)) { + if (getSlotUnitWorth.applyAsInt(slot) != 1) { + stack = stack.copy(); + stack.setCount(stack.getCount() * getSlotUnitWorth.applyAsInt(slot)); + } + this.updateContents(contents, stack, slot); + } + } + } + + public ItemStack insertItemOrAddIntoNewSlotIfNoStackMatches(ItemStack stack) { + if (stack.isEmpty()) { + return ItemStack.EMPTY; + } + + for (int slot = 0; slot < getSlots(); slot++) { + if (ItemStack.isSameItemSameComponents(stack, getStackInSlot(slot)) || (isItemValid(slot, stack) && getStackInSlot(slot).isEmpty())) { + return insertItem(slot, stack, false); + } + } + + OversizedItemContainerContents contents = this.getContents(); + int newSlot = this.getSlots(); + NonNullList list = NonNullList.withSize(Math.max(contents.getSlots(), this.getSlots() + 1), ItemStack.EMPTY); + if (!this.isItemValid(newSlot, stack)) { + return stack; + } + contents.copyInto(list); + int countToAdd = Math.min(stack.getCount(), getSlotLimit(list.size())); + ItemStack stackToAdd = stack.copyWithCount(countToAdd); + if (getSlotUnitWorth.applyAsInt(newSlot) != 1) { + stackToAdd = stackToAdd.copy(); + stackToAdd.setCount(stackToAdd.getCount() * getSlotUnitWorth.applyAsInt(newSlot)); + } + list.set(newSlot, stackToAdd); + this.parent.set(this.component, OversizedItemContainerContents.fromItems(list)); + this.onContentsChanged(newSlot, ItemStack.EMPTY, stackToAdd); + return countToAdd == stack.getCount() ? ItemStack.EMPTY : stack.copyWithCount(stack.getCount() - countToAdd); + } + + public ItemStack extractItemAndRemoveSlotIfEmpty(int slot, int amount, boolean simulate) { + return extractItemAndRemoveSlotIfEmpty(slot, amount, () -> { + }, simulate); + } + + public ItemStack extractItemAndRemoveSlotIfEmpty(int slot, int amount, Runnable onSlotRemoved, boolean simulate) { + ItemStack stack = this.extractItem(slot, amount, simulate); + if (!simulate && getStackInSlot(slot).isEmpty()) { + OversizedItemContainerContents contents = this.getContents(); + NonNullList list = NonNullList.withSize(Math.max(contents.getSlots(), this.getSlots()), ItemStack.EMPTY); + for (int i = 0; i < slot; i++) { + list.set(i, contents.getSlots() > i ? contents.getStackInSlot(i) : ItemStack.EMPTY); + } + for (int i = slot; i < list.size(); i++) { + list.set(i, contents.getSlots() > i + 1 ? contents.getStackInSlot(i + 1) : ItemStack.EMPTY); + } + this.parent.set(this.component, OversizedItemContainerContents.fromItems(list)); + this.onContentsChanged(slot, stack, ItemStack.EMPTY); + onSlotRemoved.run(); + } + return stack; + + } + + @Override + public ItemStack insertItem(int slot, ItemStack toInsert, boolean simulate) { + this.validateSlotIndex(slot); + if (toInsert.isEmpty()) { + return ItemStack.EMPTY; + } else if (!this.isItemValid(slot, toInsert)) { + return toInsert; + } else { + OversizedItemContainerContents contents = this.getContents(); + ItemStack existing = this.getStackFromContents(contents, slot); + int insertLimit = this.getSlotLimit(slot) / getSlotUnitWorth.applyAsInt(slot); + if (!existing.isEmpty()) { + if (!ItemStack.isSameItemSameComponents(toInsert, existing)) { + return toInsert; + } + + insertLimit -= existing.getCount(); + } + + if (insertLimit <= 0) { + return toInsert; + } else { + int inserted = Math.min(insertLimit, toInsert.getCount()); + if (!simulate) { + this.updateContents(contents, toInsert.copyWithCount(existing.getCount() + inserted * getSlotUnitWorth.applyAsInt(slot)), slot); + } + + return toInsert.copyWithCount(toInsert.getCount() - inserted); + } + } + } + + @Override + public ItemStack extractItem(int slot, int amount, boolean simulate) { + this.validateSlotIndex(slot); + if (amount == 0) { + return ItemStack.EMPTY; + } else { + OversizedItemContainerContents contents = this.getContents(); + ItemStack existing = this.getStackFromContents(contents, slot); + if (existing.isEmpty()) { + return ItemStack.EMPTY; + } else { + int toExtract = Math.min(Math.min(amount, existing.getMaxStackSize()), existing.getCount() / getSlotUnitWorth.applyAsInt(slot)); + if (!simulate) { + this.updateContents(contents, existing.copyWithCount(existing.getCount() - toExtract * getSlotUnitWorth.applyAsInt(slot)), slot); + } + + return existing.copyWithCount(toExtract); + } + } + } + + @Override + public int getSlotLimit(int slot) { + return getSlotLimit.apply(parent, slot); + } + + @Override + public boolean isItemValid(int slot, ItemStack stack) { + return isItemValid.test(slot, stack) && stack.getItem().canFitInsideContainerItems(); + } + + protected void onContentsChanged(int slot, ItemStack oldStack, ItemStack newStack) { + } + + protected OversizedItemContainerContents getContents() { + if (this.parent.has(this.component)) { + return this.parent.get(this.component); + } + + return OversizedItemContainerContents.fromSize(size); + } + + protected ItemStack getStackFromContents(OversizedItemContainerContents contents, int slot) { + this.validateSlotIndex(slot); + return contents.getSlots() <= slot ? ItemStack.EMPTY : contents.getStackInSlot(slot); + } + + protected void updateContents(OversizedItemContainerContents contents, ItemStack stack, int slot) { + this.validateSlotIndex(slot); + NonNullList list = NonNullList.withSize(Math.max(contents.getSlots(), this.getSlots()), ItemStack.EMPTY); + contents.copyInto(list); + ItemStack oldStack = list.get(slot); + list.set(slot, stack); + this.parent.set(this.component, OversizedItemContainerContents.fromItems(list)); + this.onContentsChanged(slot, oldStack, stack); + } + + protected final void validateSlotIndex(int slot) { + if (slot < 0 || slot >= this.getSlots()) { + throw new RuntimeException("Slot " + slot + " not in valid range - [0," + this.getSlots() + ")"); + } + } +} diff --git a/src/main/java/reliquary/items/component/OversizedItemContainerContents.java b/src/main/java/reliquary/items/component/OversizedItemContainerContents.java new file mode 100644 index 00000000..9596b542 --- /dev/null +++ b/src/main/java/reliquary/items/component/OversizedItemContainerContents.java @@ -0,0 +1,184 @@ +package reliquary.items.component; + +import com.google.common.collect.Iterables; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.NonNullList; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import reliquary.util.CodecHelper; + +import java.util.ArrayList; +import java.util.List; +import java.util.OptionalInt; +import java.util.stream.Stream; + +public final class OversizedItemContainerContents { + private static final int NO_SLOT = -1; + public static final int MAX_SIZE = 256; + public static final OversizedItemContainerContents EMPTY = new OversizedItemContainerContents(NonNullList.create()); + public static final Codec CODEC; + public static final StreamCodec STREAM_CODEC; + private final NonNullList items; + private final int hashCode; + + private OversizedItemContainerContents(NonNullList items) { + if (items.size() > MAX_SIZE) { + throw new IllegalArgumentException("Got " + items.size() + " items, but maximum is " + MAX_SIZE); + } else { + this.items = items; + this.hashCode = ItemStack.hashStackList(items); + } + } + + private OversizedItemContainerContents(int p_331689_) { + this(NonNullList.withSize(p_331689_, ItemStack.EMPTY)); + } + + private OversizedItemContainerContents(List items) { + this(items.size()); + + for (int i = 0; i < items.size(); ++i) { + this.items.set(i, items.get(i)); + } + + } + + private static OversizedItemContainerContents fromSlots(List slots) { + OptionalInt maxIndex = slots.stream().mapToInt(Slot::index).max(); + if (maxIndex.isEmpty()) { + return EMPTY; + } else { + OversizedItemContainerContents contents = new OversizedItemContainerContents(maxIndex.getAsInt() + 1); + slots.forEach((slot) -> contents.items.set(slot.index(), slot.item())); + return contents; + } + } + + public static OversizedItemContainerContents fromSize(int size) { + return new OversizedItemContainerContents(size); + } + + public static OversizedItemContainerContents fromItems(List p_340879_) { + int i = findLastNonEmptySlot(p_340879_); + if (i == NO_SLOT) { + return EMPTY; + } else { + OversizedItemContainerContents contents = new OversizedItemContainerContents(i + 1); + + for (int index = 0; index <= i; ++index) { + contents.items.set(index, p_340879_.get(index).copy()); + } + + return contents; + } + } + + private static int findLastNonEmptySlot(List items) { + for (int i = items.size() - 1; i >= 0; --i) { + if (!items.get(i).isEmpty()) { + return i; + } + } + + return NO_SLOT; + } + + private List asSlots() { + List list = new ArrayList<>(); + + for (int i = 0; i < this.items.size(); ++i) { + ItemStack itemstack = this.items.get(i); + if (!itemstack.isEmpty()) { + list.add(new Slot(i, itemstack)); + } + } + + return list; + } + + public void copyInto(NonNullList p_330513_) { + for (int i = 0; i < p_330513_.size(); ++i) { + ItemStack itemstack = i < this.items.size() ? this.items.get(i) : ItemStack.EMPTY; + p_330513_.set(i, itemstack.copy()); + } + + } + + public ItemStack copyOne() { + return this.items.isEmpty() ? ItemStack.EMPTY : this.items.getFirst().copy(); + } + + public Stream stream() { + return this.items.stream().map(ItemStack::copy); + } + + public Stream nonEmptyStream() { + return this.items.stream().filter((item) -> !item.isEmpty()).map(ItemStack::copy); + } + + public Iterable nonEmptyItems() { + return Iterables.filter(this.items, item -> !item.isEmpty()); + } + + public Iterable nonEmptyItemsCopy() { + return Iterables.transform(this.nonEmptyItems(), ItemStack::copy); + } + + public boolean equals(Object other) { + if (this == other) { + return true; + } else { + if (other instanceof OversizedItemContainerContents contents) { + return ItemStack.listMatches(this.items, contents.items); + } + + return false; + } + } + + public int hashCode() { + return this.hashCode; + } + + public int getSlots() { + return this.items.size(); + } + + public ItemStack getStackInSlot(int slot) { + this.validateSlotIndex(slot); + return this.items.get(slot).copy(); + } + + public int getCountInSlot(int slot) { + this.validateSlotIndex(slot); + return this.items.get(slot).getCount(); + } + + public Item getStackInSlotItem(int slot) { + this.validateSlotIndex(slot); + return this.items.get(slot).getItem(); + } + + private void validateSlotIndex(int slot) { + if (slot < 0 || slot >= this.getSlots()) { + throw new UnsupportedOperationException("Slot " + slot + " not in valid range - [0," + this.getSlots() + ")"); + } + } + + static { + CODEC = Slot.CODEC.sizeLimitedListOf(MAX_SIZE).xmap(OversizedItemContainerContents::fromSlots, OversizedItemContainerContents::asSlots); + STREAM_CODEC = ItemStack.OPTIONAL_STREAM_CODEC.apply(ByteBufCodecs.list(MAX_SIZE)).map(OversizedItemContainerContents::new, (contents) -> contents.items); + } + + record Slot(int index, ItemStack item) { + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> + instance.group( + Codec.intRange(0, 255).fieldOf("slot").forGetter(Slot::index), + CodecHelper.OVERSIZED_ITEM_STACK_CODEC.fieldOf("item").forGetter(Slot::item) + ).apply(instance, Slot::new)); + } +} diff --git a/src/main/java/reliquary/items/util/FilteredItemHandlerProvider.java b/src/main/java/reliquary/items/util/FilteredItemHandlerProvider.java deleted file mode 100644 index a28a3698..00000000 --- a/src/main/java/reliquary/items/util/FilteredItemHandlerProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -package reliquary.items.util; - -import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilitySerializable; -import net.minecraftforge.common.util.LazyOptional; - -import javax.annotation.Nullable; -import java.util.List; - -public class FilteredItemHandlerProvider implements ICapabilitySerializable { - private final FilteredItemStackHandler itemHandler; - - public FilteredItemHandlerProvider(List filteredItemStacks) { - itemHandler = new FilteredItemStackHandler(filteredItemStacks); - } - - @Override - public CompoundTag serializeNBT() { - return itemHandler.serializeNBT(); - } - - @Override - public void deserializeNBT(CompoundTag tagCompound) { - itemHandler.deserializeNBT(tagCompound); - } - - @Override - public LazyOptional getCapability(Capability capability, @Nullable Direction side) { - return ForgeCapabilities.ITEM_HANDLER.orEmpty(capability, LazyOptional.of(() -> itemHandler)); - } -} diff --git a/src/main/java/reliquary/items/util/FilteredItemStack.java b/src/main/java/reliquary/items/util/FilteredItemStack.java deleted file mode 100644 index 9103a258..00000000 --- a/src/main/java/reliquary/items/util/FilteredItemStack.java +++ /dev/null @@ -1,114 +0,0 @@ -package reliquary.items.util; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.items.ItemHandlerHelper; - -public class FilteredItemStack implements INBTSerializable { - private ItemStack filter; - - private ItemStack actualStack = ItemStack.EMPTY; - private int count = 0; - private final int amountLimit; - private final int unitWorth; - private final boolean canRemove; - - public FilteredItemStack(Item filter, int amountLimit, int unitWorth, boolean canRemove) { - this(new ItemStack(filter), amountLimit, unitWorth, canRemove); - } - - FilteredItemStack(int amountLimit, boolean canRemove) { - this(amountLimit, 1, canRemove); - } - - FilteredItemStack(ItemStack filter, int amountLimit, boolean canRemove) { - this(filter, amountLimit, 1, canRemove); - } - - private FilteredItemStack(ItemStack filter, int amountLimit, int unitWorth, boolean canRemove) { - this(amountLimit, unitWorth, canRemove); - this.filter = filter.copy(); - this.filter.setCount(1); - } - - private FilteredItemStack(int amountLimit, int unitWorth, boolean canRemove) { - this.amountLimit = amountLimit; - this.unitWorth = unitWorth; - this.canRemove = canRemove; - } - - public ItemStack getFilterStack() { - return filter; - } - - public ItemStack getStack() { - return actualStack; - } - - @Override - public CompoundTag serializeNBT() { - CompoundTag ret = new CompoundTag(); - ret.put("filter", filter.serializeNBT()); - ret.putInt("amount", count); - return ret; - } - - @Override - public void deserializeNBT(CompoundTag nbt) { - filter = ItemStack.of(nbt.getCompound("filter")); - count = nbt.getInt("amount"); - actualStack = filter.copy(); - actualStack.setCount(worthToUnits(count)); - } - - void setCount(int count) { - this.count = count; - int units = worthToUnits(this.count); - if (units == 0) { - actualStack = ItemStack.EMPTY; - return; - } - - if (units > 0 && actualStack.isEmpty()) { - actualStack = filter.copy(); - } - actualStack.setCount(units); - } - - ItemStack insertItem(ItemStack stack, boolean simulate) { - int remainingTotal = worthToUnits(amountLimit - count); - if (remainingTotal <= 0) { - return stack; - } - - boolean reachedLimit = stack.getCount() > remainingTotal; - - if (!simulate) { - setCount(count + unitsToWorth(reachedLimit ? remainingTotal : stack.getCount())); - } - - return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - remainingTotal) : ItemStack.EMPTY; - } - - public boolean isEmpty() { - return count <= 0; - } - - private int worthToUnits(int valueWorth) { - return valueWorth / unitWorth; - } - - int unitsToWorth(int valueUnits) { - return unitWorth * valueUnits; - } - - public int getCount() { - return count; - } - - public boolean canRemove() { - return canRemove; - } -} diff --git a/src/main/java/reliquary/items/util/FilteredItemStackHandler.java b/src/main/java/reliquary/items/util/FilteredItemStackHandler.java deleted file mode 100644 index 59883c3c..00000000 --- a/src/main/java/reliquary/items/util/FilteredItemStackHandler.java +++ /dev/null @@ -1,242 +0,0 @@ -package reliquary.items.util; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.Tag; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.util.INBTSerializable; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.IItemHandlerModifiable; -import net.minecraftforge.items.ItemHandlerHelper; - -import javax.annotation.Nonnull; -import java.util.List; - -public class FilteredItemStackHandler implements IItemHandler, IItemHandlerModifiable, INBTSerializable { - private boolean dynamicSlotNumber = false; - private final List filteredItemStacks; - private static final String NOT_IN_RANGE_ERROR = "%s %d not in valid range - (0, %d)"; - - FilteredItemStackHandler(List filteredItemStacks) { - this.filteredItemStacks = filteredItemStacks; - } - - public void setTotalCount(int stackSlot, int count) { - if (dynamicSlotNumber && count == 0 && filteredItemStacks.get(stackSlot).canRemove()) { - filteredItemStacks.remove(stackSlot); - } else { - filteredItemStacks.get(stackSlot).setCount(count); - } - } - - public int getTotalAmount(int stackSlot) { - validateStackSlot(stackSlot); - return filteredItemStacks.get(stackSlot).getCount(); - } - - private void validateStackSlot(int stackSlot) { - if (stackSlot < 0 || stackSlot >= filteredItemStacks.size()) { - throw new IllegalArgumentException(String.format(NOT_IN_RANGE_ERROR, "Big Stack Slot", stackSlot, filteredItemStacks.size() - 1)); - } - } - - public void markDirty() { - filteredItemStacks.removeIf(stack -> stack.isEmpty() && stack.canRemove()); - } - - @Override - public void setStackInSlot(int slot, ItemStack stack) { - validateSlotIndex(slot); - if (filteredItemStacks.size() > slot) { - if (!isValidForStackSlot(stack, slot)) { - return; - } - } else if (alreadyExistsInAnotherSlot(stack, slot)) { - return; - } - - if (isValidForDynamicStack(stack)) { - addDynamicStack(stack, slot); - } - - updateStack(slot, stack); - } - - protected boolean isValidForStackSlot(ItemStack stack, int stackSlot) { - return ItemHandlerHelper.canItemStacksStack(filteredItemStacks.get(stackSlot).getFilterStack(), stack); - } - - private void updateStack(int slot, ItemStack stack) { - FilteredItemStack filteredStack = filteredItemStacks.get(slot); - filteredStack.setCount(filteredStack.unitsToWorth(stack.getCount())); - - if (filteredStack.isEmpty() && filteredStack.canRemove()) { - filteredItemStacks.remove(slot); - } - } - - private void addDynamicStack(ItemStack stack, int stackSlot) { - if (dynamicSlotNumber && !stack.isEmpty() && stackSlot == filteredItemStacks.size()) { - ItemStack filter = stack.copy(); - filter.setCount(1); - filteredItemStacks.add(new FilteredItemStack(filter, getDynamicStackLimit(), true)); - } - } - - protected int getDynamicStackLimit() { - return Integer.MAX_VALUE; - } - - private boolean alreadyExistsInAnotherSlot(ItemStack stack, int stackSlot) { - for (int i = 0; i < filteredItemStacks.size(); i++) { - if (i != stackSlot && isValidForStackSlot(stack, i)) { - return true; - } - } - - return false; - } - - @Override - public int getSlots() { - return filteredItemStacks.size() + (dynamicSlotNumber ? 1 : 0); - } - - @Override - public int getSlotLimit(int slot) { - return 64; - } - - public int getStackSlots() { - return filteredItemStacks.size(); - } - - @Override - public boolean isItemValid(int slot, ItemStack stack) { - validateSlotIndex(slot); - return isValidForStackSlot(stack, slot); - } - - @Nonnull - @Override - public ItemStack getStackInSlot(int slot) { - validateSlotIndex(slot); - if (slot < filteredItemStacks.size()) { - return filteredItemStacks.get(slot).getStack(); - } else { - return ItemStack.EMPTY; - } - } - - void setFilteredStack(int stackSlot, FilteredItemStack filteredItemStack) { - if (stackSlot < 0 || stackSlot > filteredItemStacks.size()) { - throw new IllegalArgumentException(String.format(NOT_IN_RANGE_ERROR, "Filtered Stack Slot", stackSlot, filteredItemStacks.size())); - } else if (stackSlot == filteredItemStacks.size()) { - filteredItemStacks.add(filteredItemStack); - return; - } - filteredItemStacks.set(stackSlot, filteredItemStack); - } - - @Nonnull - @Override - public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) { - if (stack.isEmpty() || stack.getCount() == 0) { - return ItemStack.EMPTY; - } - - validateSlotIndex(slot); - - if (slot == filteredItemStacks.size()) { - if (!alreadyExistsInAnotherSlot(stack, slot) && isValidForDynamicStack(stack)) { - if (!simulate) { - addDynamicStack(stack, slot); - } else { - return ItemStack.EMPTY; - } - } else { - return stack; - } - } - - if (!isValidForStackSlot(stack, slot)) { - return stack; - } - - return filteredItemStacks.get(slot).insertItem(stack, simulate); - } - - @SuppressWarnings({"unused", "squid:S1172"}) - protected boolean isValidForDynamicStack(ItemStack stack) { - return true; - } - - @Nonnull - @Override - public ItemStack extractItem(int slot, int amount, boolean simulate) { - if (amount == 0) { - return ItemStack.EMPTY; - } else { - validateSlotIndex(slot); - - if (slot >= getSlots()) { - return ItemStack.EMPTY; - } - - ItemStack currentStack = filteredItemStacks.get(slot).getStack(); - - if (currentStack.isEmpty()) { - return ItemStack.EMPTY; - } - - int numberRemoved = Math.min(currentStack.getCount(), amount); - - ItemStack ret = ItemHandlerHelper.copyStackWithSize(currentStack, numberRemoved); - if (!simulate) { - ItemStack updatedStack = numberRemoved == currentStack.getCount() ? ItemStack.EMPTY : ItemHandlerHelper.copyStackWithSize(currentStack, currentStack.getCount() - numberRemoved); - updateStack(slot, updatedStack); - } - return ret; - } - } - - @Override - public CompoundTag serializeNBT() { - ListTag nbtTagList = new ListTag(); - for (FilteredItemStack filteredStack : filteredItemStacks) { - nbtTagList.add(filteredStack.serializeNBT()); - } - - CompoundTag nbt = new CompoundTag(); - nbt.put("Items", nbtTagList); - - return nbt; - } - - @Override - public void deserializeNBT(CompoundTag nbt) { - ListTag tagList = nbt.getList("Items", Tag.TAG_COMPOUND); - for (int i = 0; i < tagList.size(); i++) { - CompoundTag itemTags = tagList.getCompound(i); - - if (i < filteredItemStacks.size()) { - filteredItemStacks.get(i).deserializeNBT(itemTags); - } else { - FilteredItemStack filteredStack = new FilteredItemStack(getDynamicStackLimit(), true); - filteredStack.deserializeNBT(itemTags); - filteredItemStacks.add(filteredStack); - } - } - } - - void setDynamicSlotNumber() { - dynamicSlotNumber = true; - } - - private void validateSlotIndex(int slot) { - int slots = getSlots(); - if (slot < 0 || slot >= slots) { - throw new IllegalArgumentException(String.format(NOT_IN_RANGE_ERROR, "Slot", slot, filteredItemStacks.size() - 1)); - } - } -} diff --git a/src/main/java/reliquary/items/util/HarvestRodCache.java b/src/main/java/reliquary/items/util/HarvestRodCache.java index daba31e5..9ceff6de 100644 --- a/src/main/java/reliquary/items/util/HarvestRodCache.java +++ b/src/main/java/reliquary/items/util/HarvestRodCache.java @@ -2,50 +2,50 @@ import net.minecraft.core.BlockPos; +import javax.annotation.Nullable; import java.util.ArrayDeque; import java.util.Optional; import java.util.Queue; -public class HarvestRodCache implements IHarvestRodCache { - +public class HarvestRodCache { + @Nullable private BlockPos startBlockPos; private final Queue blockQueue; + private HarvestRodCache(Queue blockQueue, @Nullable BlockPos startBlockPos) { + this.blockQueue = blockQueue; + this.startBlockPos = startBlockPos; + } + public HarvestRodCache() { - blockQueue = new ArrayDeque<>(); + this(new ArrayDeque<>(), null); } - @Override public void setStartBlockPos(BlockPos pos) { startBlockPos = pos; } - @Override + @Nullable public BlockPos getStartBlockPos() { return startBlockPos; } - @Override public void addBlockToQueue(BlockPos pos) { blockQueue.add(pos); } - @Override public Optional getNextBlockInQueue() { return Optional.ofNullable(blockQueue.poll()); } - @Override public void clearBlockQueue() { blockQueue.clear(); } - @Override public boolean isQueueEmpty() { - return blockQueue.isEmpty(); + return blockQueue.isEmpty() || startBlockPos == null; } - @Override public void reset() { startBlockPos = null; blockQueue.clear(); diff --git a/src/main/java/reliquary/items/util/HarvestRodItemStackHandler.java b/src/main/java/reliquary/items/util/HarvestRodItemStackHandler.java deleted file mode 100644 index 2aa1eced..00000000 --- a/src/main/java/reliquary/items/util/HarvestRodItemStackHandler.java +++ /dev/null @@ -1,84 +0,0 @@ -package reliquary.items.util; - -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemNameBlockItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.level.block.BonemealableBlock; -import net.minecraftforge.common.IPlantable; -import reliquary.reference.Settings; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -public class HarvestRodItemStackHandler extends FilteredItemStackHandler { - public static final int BONEMEAL_SLOT = 0; - - private static List getDefaultStacks() { - List stacks = new ArrayList<>(); - stacks.add(new FilteredItemStack(Items.BONE_MEAL, Settings.COMMON.items.harvestRod.boneMealLimit.get(), - Settings.COMMON.items.harvestRod.boneMealWorth.get(), false)); - return stacks; - } - - public HarvestRodItemStackHandler() { - super(getDefaultStacks()); - setDynamicSlotNumber(); - } - - @Override - protected int getDynamicStackLimit() { - return Settings.COMMON.items.harvestRod.maxCapacityPerPlantable.get(); - } - - @Override - protected boolean isValidForStackSlot(ItemStack stack, int stackSlot) { - if (stackSlot == BONEMEAL_SLOT) { - return stack.getItem() == Items.BONE_MEAL; - } - return super.isValidForStackSlot(stack, stackSlot); - } - - @Override - protected boolean isValidForDynamicStack(ItemStack stack) { - return isPlantable(stack); - } - - private boolean isPlantable(ItemStack stack) { - Item item = stack.getItem(); - return item instanceof IPlantable || (item instanceof ItemNameBlockItem itemNameBlockItem && itemNameBlockItem.getBlock() instanceof BonemealableBlock); - } - - public int getBoneMealCount() { - return getTotalAmount(BONEMEAL_SLOT); - } - - public void setBoneMealCount(int boneMealCount) { - setTotalCount(BONEMEAL_SLOT, boneMealCount); - } - - public Optional insertPlantable(ItemStack stack) { - for (int slot = 1; slot < getSlots(); slot++) { - ItemStack result = insertItem(slot, stack, false); - if (result.getCount() < stack.getCount()) { - return Optional.of(new PlantableSlotInserted(slot, stack.getCount() - result.getCount())); - } - } - return Optional.empty(); - } - - public record PlantableSlotInserted(int slot, int countInserted) { - public int getSlot() { - return slot; - } - - public int getCountInserted() { - return countInserted; - } - } - - public int getCountPlantable() { - return getStackSlots() - 1; - } -} diff --git a/src/main/java/reliquary/items/util/IHarvestRodCache.java b/src/main/java/reliquary/items/util/IHarvestRodCache.java deleted file mode 100644 index 565d3b41..00000000 --- a/src/main/java/reliquary/items/util/IHarvestRodCache.java +++ /dev/null @@ -1,21 +0,0 @@ -package reliquary.items.util; - -import net.minecraft.core.BlockPos; - -import java.util.Optional; - -public interface IHarvestRodCache { - void setStartBlockPos(BlockPos pos); - - BlockPos getStartBlockPos(); - - void addBlockToQueue(BlockPos pos); - - Optional getNextBlockInQueue(); - - void clearBlockQueue(); - - boolean isQueueEmpty(); - - void reset(); -} diff --git a/src/main/java/reliquary/items/util/IPotionItem.java b/src/main/java/reliquary/items/util/IPotionItem.java index 24d96129..f3524a5b 100644 --- a/src/main/java/reliquary/items/util/IPotionItem.java +++ b/src/main/java/reliquary/items/util/IPotionItem.java @@ -1,10 +1,8 @@ package reliquary.items.util; -import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.item.ItemStack; - -import java.util.List; +import net.minecraft.world.item.alchemy.PotionContents; public interface IPotionItem { - List getEffects(ItemStack stack); + PotionContents getPotionContents(ItemStack stack); } diff --git a/src/main/java/reliquary/items/util/VoidTearItemStackHandler.java b/src/main/java/reliquary/items/util/VoidTearItemStackHandler.java deleted file mode 100644 index 154fba88..00000000 --- a/src/main/java/reliquary/items/util/VoidTearItemStackHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package reliquary.items.util; - -import net.minecraft.world.item.ItemStack; -import reliquary.reference.Settings; - -import java.util.ArrayList; - -public class VoidTearItemStackHandler extends FilteredItemStackHandler { - private static final int FIRST_SLOT = 0; - - public VoidTearItemStackHandler() { - super(new ArrayList<>()); - } - - public void setContainedStack(ItemStack stack) { - setFilteredStack(FIRST_SLOT, new FilteredItemStack(stack, Settings.COMMON.items.voidTear.itemLimit.get(), true)); - } - - public void setContainedStackAmount(int amount) { - setTotalCount(FIRST_SLOT, amount); - } - - public ItemStack getTotalAmountStack() { - return getStackInSlot(FIRST_SLOT); - } - - @Override - protected boolean isValidForStackSlot(ItemStack stack, int stackSlot) { - return stackSlot == FIRST_SLOT && super.isValidForStackSlot(stack, stackSlot); - } - - public int getContainedAmount() { - return getTotalAmount(FIRST_SLOT); - } -} diff --git a/src/main/java/reliquary/items/util/fluid/FluidHandlerEmperorChalice.java b/src/main/java/reliquary/items/util/fluid/FluidHandlerEmperorChalice.java index f6b19f90..6778abbd 100644 --- a/src/main/java/reliquary/items/util/fluid/FluidHandlerEmperorChalice.java +++ b/src/main/java/reliquary/items/util/fluid/FluidHandlerEmperorChalice.java @@ -1,20 +1,13 @@ package reliquary.items.util.fluid; -import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.material.Fluids; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidType; -import net.minecraftforge.fluids.capability.IFluidHandlerItem; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidType; +import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; import reliquary.init.ModItems; -import javax.annotation.Nullable; - -public class FluidHandlerEmperorChalice implements IFluidHandlerItem, ICapabilityProvider { +public class FluidHandlerEmperorChalice implements IFluidHandlerItem { public static final FluidStack BUCKET_OF_WATER = new FluidStack(Fluids.WATER, FluidType.BUCKET_VOLUME); private final ItemStack chalice; @@ -23,11 +16,6 @@ public FluidHandlerEmperorChalice(ItemStack chalice) { this.chalice = chalice; } - @Override - public LazyOptional getCapability(Capability cap, @Nullable Direction side) { - return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(cap, LazyOptional.of(() -> this)); - } - @Override public ItemStack getContainer() { return chalice; diff --git a/src/main/java/reliquary/items/util/fluid/FluidHandlerHeroMedallion.java b/src/main/java/reliquary/items/util/fluid/FluidHandlerHeroMedallion.java index c0b2dc20..457aedf2 100644 --- a/src/main/java/reliquary/items/util/fluid/FluidHandlerHeroMedallion.java +++ b/src/main/java/reliquary/items/util/fluid/FluidHandlerHeroMedallion.java @@ -1,20 +1,13 @@ package reliquary.items.util.fluid; -import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.IFluidHandlerItem; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.capability.IFluidHandlerItem; import reliquary.init.ModFluids; import reliquary.init.ModItems; import reliquary.util.XpHelper; -import javax.annotation.Nullable; - -public class FluidHandlerHeroMedallion implements IFluidHandlerItem, ICapabilityProvider { +public class FluidHandlerHeroMedallion implements IFluidHandlerItem { private static final int MAX_CAPACITY = Integer.MAX_VALUE; private final ItemStack heroMedallion; @@ -27,11 +20,6 @@ public ItemStack getContainer() { return heroMedallion; } - @Override - public LazyOptional getCapability(Capability cap, @Nullable Direction side) { - return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(cap, LazyOptional.of(() -> this)); - } - @Override public int getTanks() { return 1; @@ -39,7 +27,7 @@ public int getTanks() { @Override public FluidStack getFluidInTank(int tank) { - return new FluidStack(ModFluids.XP_JUICE_STILL.get(), XpHelper.experienceToLiquid(getMedallionXp())); + return new FluidStack(ModFluids.XP_STILL.get(), XpHelper.experienceToLiquid(getMedallionXp())); } @Override @@ -95,6 +83,6 @@ public FluidStack drain(FluidStack resource, FluidAction action) { @Override public FluidStack drain(int maxDrain, FluidAction action) { - return drain(new FluidStack(ModFluids.XP_JUICE_STILL.get(), maxDrain), action); + return drain(new FluidStack(ModFluids.XP_STILL.get(), maxDrain), action); } } diff --git a/src/main/java/reliquary/items/util/fluid/FluidHandlerInfernalChalice.java b/src/main/java/reliquary/items/util/fluid/FluidHandlerInfernalChalice.java index 6f0f7ffc..67bb80b0 100644 --- a/src/main/java/reliquary/items/util/fluid/FluidHandlerInfernalChalice.java +++ b/src/main/java/reliquary/items/util/fluid/FluidHandlerInfernalChalice.java @@ -1,19 +1,20 @@ package reliquary.items.util.fluid; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.core.component.DataComponentType; import net.minecraft.tags.FluidTags; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.material.Fluids; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.SimpleFluidContent; +import net.neoforged.neoforge.fluids.capability.templates.FluidHandlerItemStack; import reliquary.init.ModItems; -import reliquary.reference.Settings; +import reliquary.reference.Config; -public class FluidHandlerInfernalChalice extends FluidHandlerItemStack { - private static final String FLUID_STACKS_TAG = "fluidStacks"; +import java.util.function.Supplier; - public FluidHandlerInfernalChalice(ItemStack chalice) { - super(chalice, Settings.COMMON.items.infernalChalice.fluidLimit.get()); +public class FluidHandlerInfernalChalice extends FluidHandlerItemStack { + public FluidHandlerInfernalChalice(Supplier> componentType, ItemStack chalice) { + super(componentType, chalice, Config.COMMON.items.infernalChalice.fluidLimit.get()); } @Override @@ -21,32 +22,13 @@ public boolean canDrainFluidType(FluidStack fluid) { return !ModItems.INFERNAL_CHALICE.get().isEnabled(container) && fluid.getFluid().is(FluidTags.LAVA) && getFluid().getAmount() >= fluid.getAmount(); } - @Override - protected void setContainerToEmpty() { - setFluid(new FluidStack(Fluids.LAVA, 0)); - } - @Override public boolean canFillFluidType(FluidStack fluid) { return ModItems.INFERNAL_CHALICE.get().isEnabled(container) && fluid.getFluid() == Fluids.LAVA; } @Override - protected void setFluid(FluidStack fluid) { - if (!container.hasTag()) { - container.setTag(new CompoundTag()); - } - - //noinspection ConstantConditions - container.getTag().putInt(FLUID_STACKS_TAG, fluid.getAmount()); - } - - @Override - public FluidStack getFluid() { - CompoundTag tagCompound = container.getTag(); - if (tagCompound == null || !tagCompound.contains(FLUID_STACKS_TAG)) { - return new FluidStack(Fluids.LAVA, 0); - } - return new FluidStack(Fluids.LAVA, tagCompound.getInt(FLUID_STACKS_TAG)); + public boolean isFluidValid(int tank, FluidStack stack) { + return stack.getFluid() == Fluids.LAVA; } } diff --git a/src/main/java/reliquary/network/FortuneCoinTogglePressedPayload.java b/src/main/java/reliquary/network/FortuneCoinTogglePressedPayload.java new file mode 100644 index 00000000..35817fa0 --- /dev/null +++ b/src/main/java/reliquary/network/FortuneCoinTogglePressedPayload.java @@ -0,0 +1,87 @@ +package reliquary.network; + +import net.minecraft.ChatFormatting; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.network.codec.NeoForgeStreamCodecs; +import net.neoforged.neoforge.network.handling.IPayloadContext; +import reliquary.Reliquary; +import reliquary.compat.curios.CuriosCompat; +import reliquary.init.ModItems; +import reliquary.items.FortuneCoinItem; + +import java.util.function.Supplier; + +public record FortuneCoinTogglePressedPayload(InventoryType inventoryType, int slot, + String identifier) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(Reliquary.getRL("fortune_coin_toggle_pressed")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + InventoryType.STREAM_CODEC, + FortuneCoinTogglePressedPayload::inventoryType, + ByteBufCodecs.INT, + FortuneCoinTogglePressedPayload::slot, + ByteBufCodecs.STRING_UTF8, + FortuneCoinTogglePressedPayload::identifier, + FortuneCoinTogglePressedPayload::new); + + @Override + public Type type() { + return TYPE; + } + + public FortuneCoinTogglePressedPayload(InventoryType inventoryType, int slot) { + this(inventoryType, slot, ""); + } + + public static void handlePayload(FortuneCoinTogglePressedPayload payload, IPayloadContext context) { + Player player = context.player(); + switch (payload.inventoryType) { + case MAIN -> { + ItemStack stack2 = player.getInventory().items.get(payload.slot); + if (stack2.getItem() == ModItems.FORTUNE_COIN.get()) { + ModItems.FORTUNE_COIN.get().toggle(stack2); + showMessage(player, stack2); + } + } + case OFF_HAND -> { + ItemStack stack1 = player.getInventory().offhand.getFirst(); + if (stack1.getItem() == ModItems.FORTUNE_COIN.get()) { + ModItems.FORTUNE_COIN.get().toggle(stack1); + showMessage(player, stack1); + } + } + case CURIOS -> run(() -> () -> CuriosCompat.getStackInSlot(player, payload.identifier, payload.slot) + .ifPresent(stack -> { + if (stack.getItem() == ModItems.FORTUNE_COIN.get()) { + ModItems.FORTUNE_COIN.get().toggle(stack); + showMessage(player, stack); + CuriosCompat.setStackInSlot(player, payload.identifier, payload.slot, stack); + } + })); + } + } + + private static void showMessage(Player player, ItemStack fortuneCoin) { + player.displayClientMessage(Component.translatable("chat.reliquary.fortune_coin.toggle", + FortuneCoinItem.isEnabled(fortuneCoin) ? + Component.translatable("chat.reliquary.fortune_coin.on").withStyle(ChatFormatting.GREEN) + : Component.translatable("chat.reliquary.fortune_coin.off").withStyle(ChatFormatting.RED)) + , true); + } + + private static void run(Supplier toRun) { + toRun.get().run(); + } + + public enum InventoryType { + MAIN, + OFF_HAND, + CURIOS; + public static final StreamCodec STREAM_CODEC = NeoForgeStreamCodecs.enumCodec(InventoryType.class); + } +} diff --git a/src/main/java/reliquary/network/MobCharmDamagePayload.java b/src/main/java/reliquary/network/MobCharmDamagePayload.java new file mode 100644 index 00000000..97df80e5 --- /dev/null +++ b/src/main/java/reliquary/network/MobCharmDamagePayload.java @@ -0,0 +1,28 @@ +package reliquary.network; + +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.world.item.ItemStack; +import reliquary.Reliquary; +import reliquary.client.gui.hud.CharmPane; + +public record MobCharmDamagePayload(ItemStack mobCharm, int slot) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(Reliquary.getRL("mob_charm_damage")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ItemStack.STREAM_CODEC, + MobCharmDamagePayload::mobCharm, + ByteBufCodecs.INT, + MobCharmDamagePayload::slot, + MobCharmDamagePayload::new); + + public static void handlePayload(MobCharmDamagePayload payload) { + CharmPane.addCharmToDraw(payload.mobCharm, payload.slot); + } + + @Override + public Type type() { + return TYPE; + } +} diff --git a/src/main/java/reliquary/network/PacketFXConcussiveExplosion.java b/src/main/java/reliquary/network/PacketFXConcussiveExplosion.java deleted file mode 100644 index 038c3677..00000000 --- a/src/main/java/reliquary/network/PacketFXConcussiveExplosion.java +++ /dev/null @@ -1,50 +0,0 @@ -package reliquary.network; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkEvent; -import reliquary.entities.ConcussiveExplosion; - -import java.util.function.Supplier; - -public class PacketFXConcussiveExplosion { - private final float size; - private final Vec3 pos; - - public PacketFXConcussiveExplosion(float size, Vec3 pos) { - this.size = size; - this.pos = pos; - } - - static void encode(PacketFXConcussiveExplosion msg, FriendlyByteBuf packetBuffer) { - packetBuffer.writeFloat(msg.size); - packetBuffer.writeDouble(msg.pos.x()); - packetBuffer.writeDouble(msg.pos.y()); - packetBuffer.writeDouble(msg.pos.z()); - } - - static PacketFXConcussiveExplosion decode(FriendlyByteBuf packetBuffer) { - return new PacketFXConcussiveExplosion(packetBuffer.readFloat(), new Vec3(packetBuffer.readDouble(), packetBuffer.readDouble(), packetBuffer.readDouble())); - } - - static void onMessage(PacketFXConcussiveExplosion msg, Supplier contextSupplier) { - NetworkEvent.Context context = contextSupplier.get(); - context.enqueueWork(() -> handleMessage(msg)); - context.setPacketHandled(true); - } - - @OnlyIn(Dist.CLIENT) - private static void handleMessage(PacketFXConcussiveExplosion message) { - ClientLevel level = Minecraft.getInstance().level; - if (level == null) { - return; - } - - ConcussiveExplosion explosion = new ConcussiveExplosion(level, null, null, message.pos, message.size, false); - explosion.finalizeExplosion(false); - } -} diff --git a/src/main/java/reliquary/network/PacketFXThrownPotionImpact.java b/src/main/java/reliquary/network/PacketFXThrownPotionImpact.java deleted file mode 100644 index eacd385b..00000000 --- a/src/main/java/reliquary/network/PacketFXThrownPotionImpact.java +++ /dev/null @@ -1,73 +0,0 @@ -package reliquary.network; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.Particle; -import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.util.RandomSource; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkEvent; - -import java.util.function.Supplier; - -public class PacketFXThrownPotionImpact { - private final int color; - private final double posX; - private final double posY; - private final double posZ; - - public PacketFXThrownPotionImpact(int color, double x, double y, double z) { - this.color = color; - posX = x; - posY = y; - posZ = z; - } - - static void encode(PacketFXThrownPotionImpact msg, FriendlyByteBuf packetBuffer) { - packetBuffer.writeInt(msg.color); - packetBuffer.writeDouble(msg.posX); - packetBuffer.writeDouble(msg.posY); - packetBuffer.writeDouble(msg.posZ); - } - - static PacketFXThrownPotionImpact decode(FriendlyByteBuf packetBuffer) { - return new PacketFXThrownPotionImpact(packetBuffer.readInt(), packetBuffer.readDouble(), packetBuffer.readDouble(), packetBuffer.readDouble()); - } - - static void onMessage(PacketFXThrownPotionImpact msg, Supplier contextSupplier) { - NetworkEvent.Context context = contextSupplier.get(); - context.enqueueWork(() -> handleMessage(msg)); - context.setPacketHandled(true); - } - - @OnlyIn(Dist.CLIENT) - private static void handleMessage(PacketFXThrownPotionImpact message) { - Minecraft mc = Minecraft.getInstance(); - if (mc.level == null) { - return; - } - - int color = message.color; - RandomSource rand = mc.level.random; - - float red = (((color >> 16) & 255) / 256F); - float green = (((color >> 8) & 255) / 256F); - float blue = ((color & 255) / 256F); - - for (int i = 0; i < 100; ++i) { - double var39 = rand.nextDouble() * 4.0D; - double angle = rand.nextDouble() * Math.PI * 2.0D; - double xSpeed = Math.cos(angle) * var39; - double ySpeed = 0.01D + rand.nextDouble() * 0.5D; - double zSpeed = Math.sin(angle) * var39; - - Particle particle = mc.particleEngine.createParticle(ParticleTypes.EFFECT, message.posX + xSpeed * 0.1D, message.posY + 0.3D, message.posZ + zSpeed * 0.1D, xSpeed, ySpeed, zSpeed); - if (particle != null) { - float var32 = 0.75F + rand.nextFloat() * 0.25F; - particle.setColor(red * var32, green * var32, blue * var32); - particle.setPower((float) var39); - } - } - } -} diff --git a/src/main/java/reliquary/network/PacketFortuneCoinTogglePressed.java b/src/main/java/reliquary/network/PacketFortuneCoinTogglePressed.java deleted file mode 100644 index a195f6b0..00000000 --- a/src/main/java/reliquary/network/PacketFortuneCoinTogglePressed.java +++ /dev/null @@ -1,94 +0,0 @@ -package reliquary.network; - -import net.minecraft.ChatFormatting; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.network.chat.Component; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.network.NetworkEvent; -import reliquary.compat.curios.CuriosCompat; -import reliquary.init.ModItems; -import reliquary.items.FortuneCoinItem; - -import javax.annotation.Nullable; -import java.util.function.Supplier; - -public class PacketFortuneCoinTogglePressed { - - private final InventoryType inventoryType; - private final int slot; - private final String identifier; - - public PacketFortuneCoinTogglePressed(InventoryType inventoryType, int slot) { - this(inventoryType, "", slot); - } - public PacketFortuneCoinTogglePressed(InventoryType inventoryType, String identifier, int slot) { - this.inventoryType = inventoryType; - this.identifier = identifier; - this.slot = slot; - } - - static void encode(PacketFortuneCoinTogglePressed msg, FriendlyByteBuf packetBuffer) { - packetBuffer.writeByte(msg.inventoryType.ordinal()); - packetBuffer.writeUtf(msg.identifier); - packetBuffer.writeInt(msg.slot); - } - - static PacketFortuneCoinTogglePressed decode(FriendlyByteBuf packetBuffer) { - return new PacketFortuneCoinTogglePressed(InventoryType.values()[packetBuffer.readByte()], packetBuffer.readUtf(), packetBuffer.readInt()); - } - - static void onMessage(PacketFortuneCoinTogglePressed msg, Supplier contextSupplier) { - NetworkEvent.Context context = contextSupplier.get(); - context.enqueueWork(() -> handleMessage(msg, context.getSender())); - context.setPacketHandled(true); - } - - private static void handleMessage(PacketFortuneCoinTogglePressed message, @Nullable ServerPlayer player) { - if (player == null) { - return; - } - switch (message.inventoryType) { - case MAIN -> { - ItemStack stack2 = player.getInventory().items.get(message.slot); - if (stack2.getItem() == ModItems.FORTUNE_COIN.get()) { - ModItems.FORTUNE_COIN.get().toggle(stack2); - showMessage(player, stack2); - } - } - case OFF_HAND -> { - ItemStack stack1 = player.getInventory().offhand.get(0); - if (stack1.getItem() == ModItems.FORTUNE_COIN.get()) { - ModItems.FORTUNE_COIN.get().toggle(stack1); - showMessage(player, stack1); - } - } - case CURIOS -> run(() -> () -> CuriosCompat.getStackInSlot(player, message.identifier, message.slot) - .ifPresent(stack -> { - if (stack.getItem() == ModItems.FORTUNE_COIN.get()) { - ModItems.FORTUNE_COIN.get().toggle(stack); - showMessage(player, stack); - CuriosCompat.setStackInSlot(player, message.identifier, message.slot, stack); - } - })); - } - } - - private static void showMessage(ServerPlayer player, ItemStack fortuneCoin) { - player.displayClientMessage(Component.translatable("chat.reliquary.fortune_coin.toggle", - FortuneCoinItem.isEnabled(fortuneCoin) ? - Component.translatable("chat.reliquary.fortune_coin.on").withStyle(ChatFormatting.GREEN) - : Component.translatable("chat.reliquary.fortune_coin.off").withStyle(ChatFormatting.RED)) - , true); - } - - private static void run(Supplier toRun) { - toRun.get().run(); - } - - public enum InventoryType { - MAIN, - OFF_HAND, - CURIOS - } -} diff --git a/src/main/java/reliquary/network/PacketHandler.java b/src/main/java/reliquary/network/PacketHandler.java deleted file mode 100644 index cacd8c70..00000000 --- a/src/main/java/reliquary/network/PacketHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package reliquary.network; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerPlayer; -import net.minecraftforge.network.NetworkDirection; -import net.minecraftforge.network.NetworkRegistry; -import net.minecraftforge.network.PacketDistributor; -import net.minecraftforge.network.simple.SimpleChannel; -import reliquary.reference.Reference; - -public class PacketHandler { - private PacketHandler() {} - - private static SimpleChannel networkWrapper; - private static final String PROTOCOL = "1"; - - public static void init() { - networkWrapper = NetworkRegistry.newSimpleChannel(new ResourceLocation(Reference.MOD_ID, "channel"), - () -> PROTOCOL, PROTOCOL::equals, PROTOCOL::equals); - - int idx = 0; - networkWrapper.registerMessage(idx++, PacketFXThrownPotionImpact.class, PacketFXThrownPotionImpact::encode, PacketFXThrownPotionImpact::decode, PacketFXThrownPotionImpact::onMessage); - networkWrapper.registerMessage(idx++, PacketFXConcussiveExplosion.class, PacketFXConcussiveExplosion::encode, PacketFXConcussiveExplosion::decode, PacketFXConcussiveExplosion::onMessage); - networkWrapper.registerMessage(idx++, PacketMobCharmDamage.class, PacketMobCharmDamage::encode, PacketMobCharmDamage::decode, PacketMobCharmDamage::onMessage); - networkWrapper.registerMessage(idx++, PacketPedestalFishHook.class, PacketPedestalFishHook::encode, PacketPedestalFishHook::decode, PacketPedestalFishHook::onMessage); - networkWrapper.registerMessage(idx++, PacketFortuneCoinTogglePressed.class, PacketFortuneCoinTogglePressed::encode, PacketFortuneCoinTogglePressed::decode, PacketFortuneCoinTogglePressed::onMessage); - networkWrapper.registerMessage(idx++, SpawnAngelheartVialParticlesPacket.class, (msg, packetBuffer) -> SpawnAngelheartVialParticlesPacket.encode(), packetBuffer1 -> SpawnAngelheartVialParticlesPacket.decode(), (spawnAngelheartVialParticlesPacket, contextSupplier) -> SpawnAngelheartVialParticlesPacket.onMessage(contextSupplier)); - networkWrapper.registerMessage(idx++, SpawnPhoenixDownParticlesPacket.class, SpawnPhoenixDownParticlesPacket::encode, packetBuffer2 -> SpawnPhoenixDownParticlesPacket.decode(), SpawnPhoenixDownParticlesPacket::onMessage); - networkWrapper.registerMessage(idx, ScrolledItemPacket.class, ScrolledItemPacket::encode, ScrolledItemPacket::decode, ScrolledItemPacket::onMessage); - } - - public static void sendToClient(ServerPlayer player, M message) { - networkWrapper.sendTo(message, player.connection.connection, NetworkDirection.PLAY_TO_CLIENT); - } - - public static void sendToServer(M message) { - networkWrapper.sendToServer(message); - } - - public static void sendToAllAround(M message, PacketDistributor.TargetPoint targetPoint) { - networkWrapper.send(PacketDistributor.NEAR.with(() -> targetPoint), message); - } -} diff --git a/src/main/java/reliquary/network/PacketMobCharmDamage.java b/src/main/java/reliquary/network/PacketMobCharmDamage.java deleted file mode 100644 index bc7077ce..00000000 --- a/src/main/java/reliquary/network/PacketMobCharmDamage.java +++ /dev/null @@ -1,42 +0,0 @@ -package reliquary.network; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkEvent; -import reliquary.client.gui.hud.CharmPane; - -import java.util.function.Supplier; - -public class PacketMobCharmDamage { - private final ItemStack mobCharm; - private final int slot; - - public PacketMobCharmDamage(ItemStack mobCharm, int slot) { - this.mobCharm = mobCharm; - this.slot = slot; - } - - static void encode(PacketMobCharmDamage msg, FriendlyByteBuf packetBuffer) { - packetBuffer.writeNbt(msg.mobCharm.save(new CompoundTag())); - packetBuffer.writeByte(msg.slot); - } - - static PacketMobCharmDamage decode(FriendlyByteBuf packetBuffer) { - CompoundTag stackNbt = packetBuffer.readNbt(); - return new PacketMobCharmDamage(stackNbt == null ? ItemStack.EMPTY : ItemStack.of(stackNbt), packetBuffer.readByte()); - } - - static void onMessage(PacketMobCharmDamage msg, Supplier contextSupplier) { - NetworkEvent.Context context = contextSupplier.get(); - context.enqueueWork(() -> handleMessage(msg)); - context.setPacketHandled(true); - } - - @OnlyIn(Dist.CLIENT) - private static void handleMessage(PacketMobCharmDamage message) { - CharmPane.addCharmToDraw(message.mobCharm, message.slot); - } -} diff --git a/src/main/java/reliquary/network/PacketPedestalFishHook.java b/src/main/java/reliquary/network/PacketPedestalFishHook.java deleted file mode 100644 index d4977c07..00000000 --- a/src/main/java/reliquary/network/PacketPedestalFishHook.java +++ /dev/null @@ -1,63 +0,0 @@ -package reliquary.network; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.core.BlockPos; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkEvent; -import reliquary.api.IPedestal; -import reliquary.client.render.PedestalFishHookRenderer; -import reliquary.util.WorldHelper; - -import java.util.function.Supplier; - -public class PacketPedestalFishHook { - - private final BlockPos pedestalPos; - private final double hookX; - private final double hookY; - private final double hookZ; - - public PacketPedestalFishHook(BlockPos pedestalPos, double hookX, double hookY, double hookZ) { - - this.pedestalPos = pedestalPos; - this.hookX = hookX; - this.hookY = hookY; - this.hookZ = hookZ; - } - - static void encode(PacketPedestalFishHook msg, FriendlyByteBuf packetBuffer) { - packetBuffer.writeInt(msg.pedestalPos.getX()); - packetBuffer.writeInt(msg.pedestalPos.getY()); - packetBuffer.writeInt(msg.pedestalPos.getZ()); - packetBuffer.writeDouble(msg.hookX); - packetBuffer.writeDouble(msg.hookY); - packetBuffer.writeDouble(msg.hookZ); - } - - static PacketPedestalFishHook decode(FriendlyByteBuf packetBuffer) { - return new PacketPedestalFishHook(new BlockPos(packetBuffer.readInt(), packetBuffer.readInt(), packetBuffer.readInt()), - packetBuffer.readDouble(), packetBuffer.readDouble(), packetBuffer.readDouble()); - } - - static void onMessage(PacketPedestalFishHook msg, Supplier contextSupplier) { - NetworkEvent.Context context = contextSupplier.get(); - context.enqueueWork(() -> handleMessage(msg)); - context.setPacketHandled(true); - } - - @OnlyIn(Dist.CLIENT) - private static void handleMessage(PacketPedestalFishHook message) { - ClientLevel world = Minecraft.getInstance().level; - WorldHelper.getBlockEntity(world, message.pedestalPos, IPedestal.class).ifPresent(pedestal -> { - PedestalFishHookRenderer.HookRenderingData data = null; - if (message.hookY > 0) { - data = new PedestalFishHookRenderer.HookRenderingData(message.hookX, message.hookY, message.hookZ); - } - - pedestal.setItemData(data); - }); - } -} diff --git a/src/main/java/reliquary/network/PedestalFishHookPayload.java b/src/main/java/reliquary/network/PedestalFishHookPayload.java new file mode 100644 index 00000000..b7725fd3 --- /dev/null +++ b/src/main/java/reliquary/network/PedestalFishHookPayload.java @@ -0,0 +1,45 @@ +package reliquary.network; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.core.BlockPos; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import reliquary.Reliquary; +import reliquary.api.IPedestal; +import reliquary.client.render.PedestalFishHookRenderer; +import reliquary.util.WorldHelper; + +public record PedestalFishHookPayload(BlockPos pedestalPos, double hookX, double hookY, + double hookZ) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(Reliquary.getRL("pedestal_fish_hook")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + BlockPos.STREAM_CODEC, + PedestalFishHookPayload::pedestalPos, + ByteBufCodecs.DOUBLE, + PedestalFishHookPayload::hookX, + ByteBufCodecs.DOUBLE, + PedestalFishHookPayload::hookY, + ByteBufCodecs.DOUBLE, + PedestalFishHookPayload::hookZ, + PedestalFishHookPayload::new); + + public static void handlePayload(PedestalFishHookPayload payload) { + ClientLevel level = Minecraft.getInstance().level; + WorldHelper.getBlockEntity(level, payload.pedestalPos, IPedestal.class).ifPresent(pedestal -> { + PedestalFishHookRenderer.HookRenderingData data = null; + if (payload.hookY > 0) { + data = new PedestalFishHookRenderer.HookRenderingData(payload.hookX, payload.hookY, payload.hookZ); + } + + pedestal.setItemData(data); + }); + } + + @Override + public Type type() { + return TYPE; + } +} diff --git a/src/main/java/reliquary/network/ScrolledItemPacket.java b/src/main/java/reliquary/network/ScrolledItemPacket.java deleted file mode 100644 index 86490570..00000000 --- a/src/main/java/reliquary/network/ScrolledItemPacket.java +++ /dev/null @@ -1,40 +0,0 @@ -package reliquary.network; - -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.network.NetworkEvent; -import reliquary.items.util.IScrollableItem; - -import java.util.function.Supplier; - -public class ScrolledItemPacket { - private final double scrollDelta; - - public ScrolledItemPacket(double scrollDelta) { - this.scrollDelta = scrollDelta; - } - - static void encode(ScrolledItemPacket msg, FriendlyByteBuf buffer) { - buffer.writeDouble(msg.scrollDelta); - } - - static ScrolledItemPacket decode(FriendlyByteBuf packetBuffer) { - return new ScrolledItemPacket(packetBuffer.readDouble()); - } - - static void onMessage(ScrolledItemPacket msg, Supplier contextSupplier) { - NetworkEvent.Context context = contextSupplier.get(); - //noinspection ConstantConditions - always runs on server where sender is available - context.enqueueWork(() -> handleMessage(msg, contextSupplier.get().getSender())); - context.setPacketHandled(true); - } - - private static void handleMessage(ScrolledItemPacket msg, ServerPlayer sender) { - ItemStack stack = sender.getMainHandItem(); - - if (stack.getItem() instanceof IScrollableItem leftClickableItem) { - leftClickableItem.onMouseScrolled(stack, sender, msg.scrollDelta); - } - } -} diff --git a/src/main/java/reliquary/network/ScrolledItemPayload.java b/src/main/java/reliquary/network/ScrolledItemPayload.java new file mode 100644 index 00000000..d0e4e9bc --- /dev/null +++ b/src/main/java/reliquary/network/ScrolledItemPayload.java @@ -0,0 +1,34 @@ +package reliquary.network; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.network.handling.IPayloadContext; +import reliquary.Reliquary; +import reliquary.items.util.IScrollableItem; + +public record ScrolledItemPayload(double scrollDelta) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(Reliquary.getRL("scrolled_item")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.DOUBLE, + ScrolledItemPayload::scrollDelta, + ScrolledItemPayload::new); + + + public static void handlePayload(ScrolledItemPayload payload, IPayloadContext context) { + Player player = context.player(); + ItemStack stack = player.getMainHandItem(); + + if (stack.getItem() instanceof IScrollableItem leftClickableItem) { + leftClickableItem.onMouseScrolled(stack, player, payload.scrollDelta); + } + } + + @Override + public Type type() { + return TYPE; + } +} diff --git a/src/main/java/reliquary/network/SpawnAngelheartVialParticlesPacket.java b/src/main/java/reliquary/network/SpawnAngelheartVialParticlesPacket.java deleted file mode 100644 index cdd3ba2f..00000000 --- a/src/main/java/reliquary/network/SpawnAngelheartVialParticlesPacket.java +++ /dev/null @@ -1,70 +0,0 @@ -package reliquary.network; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.Particle; -import net.minecraft.client.player.LocalPlayer; -import net.minecraft.core.particles.ItemParticleOption; -import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.util.RandomSource; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkEvent; -import reliquary.init.ModItems; - -import java.util.function.Supplier; - -@SuppressWarnings({"java:S1118", "InstantiationOfUtilityClass"}) // need to instantiate this for its type to be used as identifier for this message -public class SpawnAngelheartVialParticlesPacket { - static void encode() { - //noop - } - - static SpawnAngelheartVialParticlesPacket decode() { - return new SpawnAngelheartVialParticlesPacket(); - } - - static void onMessage(Supplier contextSupplier) { - NetworkEvent.Context context = contextSupplier.get(); - context.enqueueWork(SpawnAngelheartVialParticlesPacket::handleMessage); - context.setPacketHandled(true); - } - - @OnlyIn(Dist.CLIENT) - private static void handleMessage() { - LocalPlayer player = Minecraft.getInstance().player; - if (player == null) { - return; - } - - double var8 = player.getX(); - double var10 = player.getY(); - double var12 = player.getZ(); - RandomSource var7 = player.level().random; - ItemParticleOption itemParticleData = new ItemParticleOption(ParticleTypes.ITEM, new ItemStack(ModItems.ANGELHEART_VIAL.get())); - for (int var15 = 0; var15 < 8; ++var15) { - player.level().addParticle(itemParticleData, var8, var10, var12, var7.nextGaussian() * 0.15D, var7.nextDouble() * 0.2D, var7.nextGaussian() * 0.15D); - } - - // purple, for reals. - float red = 1.0F; - float green = 0.0F; - float blue = 1.0F; - - for (int var20 = 0; var20 < 100; ++var20) { - double var39 = var7.nextDouble() * 4.0D; - double var23 = var7.nextDouble() * Math.PI * 2.0D; - double var25 = Math.cos(var23) * var39; - double var27 = 0.01D + var7.nextDouble() * 0.5D; - double var29 = Math.sin(var23) * var39; - if (player.level().isClientSide) { - Particle var31 = Minecraft.getInstance().particleEngine.createParticle(ParticleTypes.EFFECT, var8 + var25 * 0.1D, var10 + 0.3D, var12 + var29 * 0.1D, var25, var27, var29); - if (var31 != null) { - float var32 = 0.75F + var7.nextFloat() * 0.25F; - var31.setColor(red * var32, green * var32, blue * var32); - var31.setPower((float) var39); - } - } - } - } -} diff --git a/src/main/java/reliquary/network/SpawnAngelheartVialParticlesPayload.java b/src/main/java/reliquary/network/SpawnAngelheartVialParticlesPayload.java new file mode 100644 index 00000000..3626b0f5 --- /dev/null +++ b/src/main/java/reliquary/network/SpawnAngelheartVialParticlesPayload.java @@ -0,0 +1,63 @@ +package reliquary.network; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.core.particles.ItemParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.phys.Vec3; +import reliquary.Reliquary; +import reliquary.init.ModItems; +import reliquary.util.StreamCodecHelper; + +public record SpawnAngelheartVialParticlesPayload(Vec3 position) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(Reliquary.getRL("angelheart_vial_particles")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + StreamCodecHelper.VEC_3_STREAM_CODEC, + SpawnAngelheartVialParticlesPayload::position, + SpawnAngelheartVialParticlesPayload::new); + + public static void handlePayload(SpawnAngelheartVialParticlesPayload payload) { + LocalPlayer player = Minecraft.getInstance().player; + if (player == null) { + return; + } + + double x = payload.position.x; + double y = payload.position.y; + double z = payload.position.z; + RandomSource random = player.level().random; + ItemParticleOption itemParticleData = new ItemParticleOption(ParticleTypes.ITEM, new ItemStack(ModItems.ANGELHEART_VIAL.get())); + for (int i = 0; i < 8; ++i) { + player.level().addParticle(itemParticleData, x, y, z, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D); + } + + float red = 1.0F; + float green = 0.0F; + float blue = 1.0F; + + for (int i = 0; i < 100; ++i) { + double distance = random.nextDouble() * 4.0D; + double angle = random.nextDouble() * Math.PI * 2.0D; + double xSpeed = Math.cos(angle) * distance; + double ySpeed = 0.01D + random.nextDouble() * 0.5D; + double zSpeed = Math.sin(angle) * distance; + Particle particle = Minecraft.getInstance().particleEngine.createParticle(ParticleTypes.EFFECT, x + xSpeed * 0.1D, y + 0.3D, z + zSpeed * 0.1D, xSpeed, ySpeed, zSpeed); + if (particle != null) { + float colorMultiplier = 0.75F + random.nextFloat() * 0.25F; + particle.setColor(red * colorMultiplier, green * colorMultiplier, blue * colorMultiplier); + particle.setPower((float) distance); + } + } + } + + @Override + public Type type() { + return TYPE; + } +} diff --git a/src/main/java/reliquary/network/SpawnConcussiveExplosionParticlesPayload.java b/src/main/java/reliquary/network/SpawnConcussiveExplosionParticlesPayload.java new file mode 100644 index 00000000..1bb7b7a1 --- /dev/null +++ b/src/main/java/reliquary/network/SpawnConcussiveExplosionParticlesPayload.java @@ -0,0 +1,32 @@ +package reliquary.network; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.world.phys.Vec3; +import net.neoforged.neoforge.network.handling.IPayloadContext; +import reliquary.Reliquary; +import reliquary.entities.ConcussiveExplosion; +import reliquary.util.StreamCodecHelper; + +public record SpawnConcussiveExplosionParticlesPayload(float size, Vec3 pos) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(Reliquary.getRL("spawn_concussive_explosion_particles")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.FLOAT, + SpawnConcussiveExplosionParticlesPayload::size, + StreamCodecHelper.VEC_3_STREAM_CODEC, + SpawnConcussiveExplosionParticlesPayload::pos, + SpawnConcussiveExplosionParticlesPayload::new + ); + + public static void handlePayload(SpawnConcussiveExplosionParticlesPayload payload, IPayloadContext context) { + ConcussiveExplosion explosion = new ConcussiveExplosion(context.player().level(), null, null, payload.pos, payload.size, false); + explosion.finalizeExplosion(false); + } + + @Override + public Type type() { + return TYPE; + } +} diff --git a/src/main/java/reliquary/network/SpawnPhoenixDownParticlesPacket.java b/src/main/java/reliquary/network/SpawnPhoenixDownParticlesPacket.java deleted file mode 100644 index de7e2031..00000000 --- a/src/main/java/reliquary/network/SpawnPhoenixDownParticlesPacket.java +++ /dev/null @@ -1,40 +0,0 @@ -package reliquary.network; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; -import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.network.NetworkEvent; - -import java.util.function.Supplier; - -public class SpawnPhoenixDownParticlesPacket { - public static final SpawnPhoenixDownParticlesPacket INSTANCE = new SpawnPhoenixDownParticlesPacket(); - - private SpawnPhoenixDownParticlesPacket() {} - - static void encode(SpawnPhoenixDownParticlesPacket msg, FriendlyByteBuf packetBuffer) { - //noop - } - - static SpawnPhoenixDownParticlesPacket decode() { - return SpawnPhoenixDownParticlesPacket.INSTANCE; - } - - static void onMessage(SpawnPhoenixDownParticlesPacket msg, Supplier contextSupplier) { - NetworkEvent.Context context = contextSupplier.get(); - context.enqueueWork(() -> handleMessage(msg)); - context.setPacketHandled(true); - } - - @SuppressWarnings("ConstantConditions") // the player isn't null when particles are spawned - @OnlyIn(Dist.CLIENT) - private static void handleMessage(SpawnPhoenixDownParticlesPacket msg) { - LocalPlayer player = Minecraft.getInstance().player; - for (int particles = 0; particles <= 400; particles++) { - player.level().addParticle(ParticleTypes.FLAME, player.getX(), player.getY(), player.getZ(), player.level().random.nextGaussian() * 8, player.level().random.nextGaussian() * 8, player.level().random.nextGaussian() * 8); - } - } -} diff --git a/src/main/java/reliquary/network/SpawnPhoenixDownParticlesPayload.java b/src/main/java/reliquary/network/SpawnPhoenixDownParticlesPayload.java new file mode 100644 index 00000000..ea3bc55c --- /dev/null +++ b/src/main/java/reliquary/network/SpawnPhoenixDownParticlesPayload.java @@ -0,0 +1,37 @@ +package reliquary.network; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.util.RandomSource; +import net.minecraft.world.phys.Vec3; +import reliquary.Reliquary; +import reliquary.util.StreamCodecHelper; + +public record SpawnPhoenixDownParticlesPayload(Vec3 position) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(Reliquary.getRL("spawn_phoenix_down_particles")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + StreamCodecHelper.VEC_3_STREAM_CODEC, + SpawnPhoenixDownParticlesPayload::position, + SpawnPhoenixDownParticlesPayload::new); + + public static void handlePayload(SpawnPhoenixDownParticlesPayload payload) { + LocalPlayer player = Minecraft.getInstance().player; + if (player == null) { + return; + } + + for (int particles = 0; particles <= 400; particles++) { + RandomSource random = player.level().random; + player.level().addParticle(ParticleTypes.FLAME, payload.position.x, payload.position.y, payload.position.z, random.nextGaussian() * 8, random.nextGaussian() * 8, random.nextGaussian() * 8); + } + } + + @Override + public Type type() { + return TYPE; + } +} diff --git a/src/main/java/reliquary/network/SpawnThrownPotionImpactParticlesPayload.java b/src/main/java/reliquary/network/SpawnThrownPotionImpactParticlesPayload.java new file mode 100644 index 00000000..4e273f49 --- /dev/null +++ b/src/main/java/reliquary/network/SpawnThrownPotionImpactParticlesPayload.java @@ -0,0 +1,59 @@ +package reliquary.network; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.Particle; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.util.RandomSource; +import reliquary.Reliquary; + +public record SpawnThrownPotionImpactParticlesPayload(int color, double posX, double posY, + double posZ) implements CustomPacketPayload { + public static final Type TYPE = new Type<>(Reliquary.getRL("thrown_potion_impact_particles")); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.INT, + SpawnThrownPotionImpactParticlesPayload::color, + ByteBufCodecs.DOUBLE, + SpawnThrownPotionImpactParticlesPayload::posX, + ByteBufCodecs.DOUBLE, + SpawnThrownPotionImpactParticlesPayload::posY, + ByteBufCodecs.DOUBLE, + SpawnThrownPotionImpactParticlesPayload::posZ, + SpawnThrownPotionImpactParticlesPayload::new); + + public static void handlePayload(SpawnThrownPotionImpactParticlesPayload payload) { + Minecraft mc = Minecraft.getInstance(); + if (mc.level == null) { + return; + } + + RandomSource rand = mc.level.random; + + float red = (((payload.color >> 16) & 255) / 256F); + float green = (((payload.color >> 8) & 255) / 256F); + float blue = ((payload.color & 255) / 256F); + + for (int i = 0; i < 100; ++i) { + double var39 = rand.nextDouble() * 4.0D; + double angle = rand.nextDouble() * Math.PI * 2.0D; + double xSpeed = Math.cos(angle) * var39; + double ySpeed = 0.01D + rand.nextDouble() * 0.5D; + double zSpeed = Math.sin(angle) * var39; + + Particle particle = mc.particleEngine.createParticle(ParticleTypes.EFFECT, payload.posX + xSpeed * 0.1D, payload.posY + 0.3D, payload.posZ + zSpeed * 0.1D, xSpeed, ySpeed, zSpeed); + if (particle != null) { + float var32 = 0.75F + rand.nextFloat() * 0.25F; + particle.setColor(red * var32, green * var32, blue * var32); + particle.setPower((float) var39); + } + } + } + + @Override + public Type type() { + return TYPE; + } +} diff --git a/src/main/java/reliquary/pedestal/PedestalRegistry.java b/src/main/java/reliquary/pedestal/PedestalRegistry.java index 404f042d..486ead00 100644 --- a/src/main/java/reliquary/pedestal/PedestalRegistry.java +++ b/src/main/java/reliquary/pedestal/PedestalRegistry.java @@ -6,15 +6,10 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; -import net.minecraftforge.event.server.ServerStoppedEvent; +import net.neoforged.neoforge.event.server.ServerStoppedEvent; import reliquary.api.IPedestalItemWrapper; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; +import java.util.*; import java.util.function.Supplier; public class PedestalRegistry { diff --git a/src/main/java/reliquary/pedestal/wrappers/PedestalBucketWrapper.java b/src/main/java/reliquary/pedestal/wrappers/PedestalBucketWrapper.java index acccd4dc..855c41d8 100644 --- a/src/main/java/reliquary/pedestal/wrappers/PedestalBucketWrapper.java +++ b/src/main/java/reliquary/pedestal/wrappers/PedestalBucketWrapper.java @@ -9,20 +9,21 @@ 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.BucketPickup; import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.AABB; -import net.minecraftforge.common.ForgeMod; -import net.minecraftforge.common.util.FakePlayer; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidType; -import net.minecraftforge.fluids.IFluidBlock; -import net.minecraftforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.common.NeoForgeMod; +import net.neoforged.neoforge.common.util.FakePlayer; +import net.neoforged.neoforge.fluids.FluidStack; +import net.neoforged.neoforge.fluids.FluidType; +import net.neoforged.neoforge.fluids.capability.IFluidHandler; +import net.neoforged.neoforge.fluids.capability.wrappers.BucketPickupHandlerWrapper; import reliquary.api.IPedestal; import reliquary.api.IPedestalActionItemWrapper; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.ArrayList; import java.util.Iterator; @@ -39,14 +40,14 @@ public class PedestalBucketWrapper implements IPedestalActionItemWrapper { @Override public void update(ItemStack stack, Level level, IPedestal pedestal) { BlockPos pos = pedestal.getBlockPosition(); - int bucketRange = Settings.COMMON.blocks.pedestal.bucketWrapperRange.get(); + int bucketRange = Config.COMMON.blocks.pedestal.bucketWrapperRange.get(); if (!milkCows(level, pedestal, pos, bucketRange, stack) && !drainLiquid(level, pedestal, pos, bucketRange)) { - pedestal.setActionCoolDown(2 * Settings.COMMON.blocks.pedestal.bucketWrapperCooldown.get()); + pedestal.setActionCoolDown(2 * Config.COMMON.blocks.pedestal.bucketWrapperCooldown.get()); return; } - pedestal.setActionCoolDown(Settings.COMMON.blocks.pedestal.bucketWrapperCooldown.get()); + pedestal.setActionCoolDown(Config.COMMON.blocks.pedestal.bucketWrapperCooldown.get()); } @Override @@ -108,15 +109,15 @@ private boolean drainLiquid(Level level, IPedestal pedestal, BlockPos pos, int b return false; } - private void updateQueueToDrain(Level world, BlockPos pos, int bucketRange) { + private void updateQueueToDrain(Level level, BlockPos pos, int bucketRange) { for (int y = pos.getY() + bucketRange; y >= pos.getY() - bucketRange; y--) { for (int x = pos.getX() - bucketRange; x <= pos.getX() + bucketRange; x++) { for (int z = pos.getZ() - bucketRange; z <= pos.getZ() + bucketRange; z++) { BlockPos currentBlockPos = new BlockPos(x, y, z); - BlockState blockState = world.getBlockState(currentBlockPos); + BlockState blockState = level.getBlockState(currentBlockPos); Fluid fluid = blockState.getFluidState().getType(); - if (fluid != Fluids.EMPTY && canDrainBlock(world, currentBlockPos, blockState.getBlock(), blockState, fluid)) { + if (fluid != Fluids.EMPTY && canDrainBlock(level, currentBlockPos, blockState.getBlock(), blockState, fluid)) { queueToDrain.add(currentBlockPos); } } @@ -124,24 +125,22 @@ private void updateQueueToDrain(Level world, BlockPos pos, int bucketRange) { } } - private boolean canDrainBlock(Level world, BlockPos pos, Block block, BlockState blockState, Fluid fluid) { - return drainBlock(world, pos, block, blockState, fluid, IFluidHandler.FluidAction.SIMULATE).isPresent(); + private boolean canDrainBlock(Level level, BlockPos pos, Block block, BlockState blockState, Fluid fluid) { + return drainBlock(level, pos, block, blockState, fluid, IFluidHandler.FluidAction.SIMULATE).isPresent(); } - private Optional drainBlock(Level world, BlockPos pos, Block block, BlockState blockState, Fluid fluid, IFluidHandler.FluidAction action) { - if (block instanceof IFluidBlock fluidBlock) { - if (!fluidBlock.canDrain(world, pos)) { - return Optional.empty(); - } - return Optional.of(fluidBlock.drain(world, pos, action)); + private Optional drainBlock(Level level, BlockPos pos, Block block, BlockState blockState, Fluid fluid, IFluidHandler.FluidAction action) { + if (block instanceof BucketPickup bucketPickup) { + BucketPickupHandlerWrapper targetFluidHandler = new BucketPickupHandlerWrapper(null, bucketPickup, level, pos); + return Optional.of(targetFluidHandler.drain(new FluidStack(fluid, FluidType.BUCKET_VOLUME), action)); } else if (block instanceof LiquidBlock) { - int level = blockState.getValue(LiquidBlock.LEVEL); - if (level != 0) { + int fluidLevel = blockState.getValue(LiquidBlock.LEVEL); + if (fluidLevel != 0) { return Optional.empty(); } if (action == IFluidHandler.FluidAction.EXECUTE) { - world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); } return Optional.of(new FluidStack(fluid, FluidType.BUCKET_VOLUME)); @@ -177,7 +176,7 @@ private void milkCow(Level level, IPedestal pedestal, BlockPos pos, ItemStack st //put milk in the adjacent tanks if (fakePlayer.getItemInHand(InteractionHand.MAIN_HAND).getItem() == Items.MILK_BUCKET) { - int fluidAdded = pedestal.fillConnectedTank(new FluidStack(ForgeMod.MILK.get(), FluidType.BUCKET_VOLUME)); + int fluidAdded = pedestal.fillConnectedTank(new FluidStack(NeoForgeMod.MILK.get(), FluidType.BUCKET_VOLUME)); //replace bucket in the pedestals with milk one if the tanks can't hold it if (fluidAdded == 0) { if (stack.getCount() == 1) { diff --git a/src/main/java/reliquary/pedestal/wrappers/PedestalFishingRodWrapper.java b/src/main/java/reliquary/pedestal/wrappers/PedestalFishingRodWrapper.java index e4e15dcc..224fa39b 100644 --- a/src/main/java/reliquary/pedestal/wrappers/PedestalFishingRodWrapper.java +++ b/src/main/java/reliquary/pedestal/wrappers/PedestalFishingRodWrapper.java @@ -10,6 +10,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.projectile.FishingHook; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; @@ -17,30 +18,25 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; -import net.minecraftforge.network.PacketDistributor; +import net.neoforged.neoforge.network.PacketDistributor; import reliquary.api.IPedestal; import reliquary.api.IPedestalActionItemWrapper; -import reliquary.entities.EntityXRFakePlayer; -import reliquary.network.PacketHandler; -import reliquary.network.PacketPedestalFishHook; -import reliquary.reference.Settings; -import reliquary.util.LogHelper; +import reliquary.entities.ReliquaryFakePlayer; +import reliquary.network.PedestalFishHookPayload; +import reliquary.reference.Config; import javax.annotation.Nullable; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import java.util.Optional; public class PedestalFishingRodWrapper implements IPedestalActionItemWrapper { - private static final int PACKET_RANGE = 50; private static final int RANGE = 4; private static final int NO_WATER_COOLDOWN = 100; private static final int BAD_THROW_TIMEOUT = 60; private static final int ABSOLUTE_TIMEOUT = 1200; - private EntityXRFakePlayer fakePlayer; + private ReliquaryFakePlayer fakePlayer; private boolean badThrowChecked; private int ticksSinceLastThrow; private boolean retractFail = false; @@ -51,7 +47,7 @@ public void update(ItemStack stack, Level level, IPedestal pedestal) { if (fakePlayer != null && fakePlayer.fishing != null) { handleHookStates(stack, level, pedestal); - syncHookData(level, pedestal); + syncHookData(fakePlayer.serverLevel(), pedestal); } else { setupFakePlayer(level, pedestal.getBlockPosition()); Optional p = getBestWaterBlock(level, pedestal); @@ -70,7 +66,7 @@ public void update(ItemStack stack, Level level, IPedestal pedestal) { private void handleHookStates(ItemStack stack, Level level, IPedestal pedestal) { if (retractFail) { //take care of failed retract - if (getTicksCatchable(fakePlayer.fishing) == 0) { + if (fakePlayer != null && fakePlayer.fishing != null && fakePlayer.fishing.nibble == 0) { retractHook(pedestal, stack); retractFail = false; } @@ -78,7 +74,7 @@ private void handleHookStates(ItemStack stack, Level level, IPedestal pedestal) //when hook doesn't land in water retract it after some time FishingHook fishingHook = fakePlayer.fishing; //noinspection ConstantConditions - if (getCurrentState(fishingHook) != FishingHook.FishHookState.BOBBING) { + if (fishingHook.currentState != FishingHook.FishHookState.BOBBING) { retractHook(pedestal, stack); } else { badThrowChecked = true; @@ -87,8 +83,8 @@ private void handleHookStates(ItemStack stack, Level level, IPedestal pedestal) //sometimes hook can get stuck in a bad state so take care of that retractHook(pedestal, stack); } else //noinspection ConstantConditions - if (getTicksCatchable(fakePlayer.fishing) > 0 || fakePlayer.fishing.getHookedIn() != null) { - if (level.random.nextInt(100) <= Settings.COMMON.blocks.pedestal.fishingWrapperSuccessRate.get()) { + if (fakePlayer.fishing.nibble > 0 || fakePlayer.fishing.getHookedIn() != null) { + if (level.random.nextInt(100) <= Config.COMMON.blocks.pedestal.fishingWrapperSuccessRate.get()) { retractHook(pedestal, stack); } else { retractFail = true; @@ -111,13 +107,13 @@ private void retractHook(IPedestal pedestal, ItemStack stack) { //noinspection ConstantConditions int i = fakePlayer.fishing.retrieve(stack); fakePlayer.fishing = null; - stack.hurtAndBreak(i, fakePlayer, p -> {}); + stack.hurtAndBreak(i, fakePlayer.serverLevel(), fakePlayer, item -> {}); //destroy the item when it gets used up if (stack.getCount() == 0) { pedestal.destroyItem(); } - pedestal.setActionCoolDown(Settings.COMMON.blocks.pedestal.fishingWrapperRetractDelay.get() * 20); + pedestal.setActionCoolDown(Config.COMMON.blocks.pedestal.fishingWrapperRetractDelay.get() * 20); } private Optional getBestWaterBlock(Level level, IPedestal pedestal) { @@ -229,18 +225,6 @@ private void checkForWaterAndSearchNeighbors(Level level, IPedestal pedestal, Li } } - private static final Field BOBBER_CURRENT_STATE = ObfuscationReflectionHelper.findField(FishingHook.class, "f_37095_"); - - private FishingHook.FishHookState getCurrentState(FishingHook fishingHook) { - try { - return (FishingHook.FishHookState) BOBBER_CURRENT_STATE.get(fishingHook); - } - catch (IllegalAccessException e) { - LogHelper.error("Error getting fishing bobber state", e); - } - return FishingHook.FishHookState.FLYING; - } - private void addNeighboringWater(Level level, IPedestal pedestal, List visitedBlocks, List group, BlockPos pedestalPos, BlockPos blockPos) { if (!visitedBlocks.contains(blockPos)) { checkForWaterAndSearchNeighbors(level, pedestal, visitedBlocks, pedestalPos, blockPos, group); @@ -258,20 +242,22 @@ public Entity getOwner() { } @Override - public boolean broadcastToPlayer(ServerPlayer pPlayer) { + public boolean broadcastToPlayer(ServerPlayer player) { return false; } }); } - private void syncHookData(Level level, IPedestal pedestal) { + private void syncHookData(ServerLevel level, IPedestal pedestal) { FishingHook hook = fakePlayer.fishing; BlockPos pedestalPos = pedestal.getBlockPosition(); if (hook == null) { - PacketHandler.sendToAllAround(new PacketPedestalFishHook(pedestal.getBlockPosition(), -1, -1, -1), new PacketDistributor.TargetPoint(pedestalPos.getX(), pedestalPos.getY(), pedestalPos.getZ(), PACKET_RANGE, level.dimension())); + PacketDistributor.sendToPlayersTrackingChunk(level, new ChunkPos(pedestalPos), + new PedestalFishHookPayload(pedestal.getBlockPosition(), -1, -1, -1)); } else { - PacketHandler.sendToAllAround(new PacketPedestalFishHook(pedestal.getBlockPosition(), hook.getX(), hook.getY(), hook.getZ()), new PacketDistributor.TargetPoint(pedestalPos.getX(), pedestalPos.getY(), pedestalPos.getZ(), PACKET_RANGE, level.dimension())); + PacketDistributor.sendToPlayersTrackingChunk(level, new ChunkPos(pedestalPos), + new PedestalFishHookPayload(pedestal.getBlockPosition(), hook.getX(), hook.getY(), hook.getZ())); } } @@ -286,22 +272,17 @@ public void onRemoved(ItemStack stack, Level level, IPedestal pedestal) { public void stop(ItemStack stack, Level level, IPedestal pedestal) { if (fakePlayer != null && fakePlayer.fishing != null) { fakePlayer.fishing.discard(); - syncHookData(level, pedestal); + syncHookData(fakePlayer.serverLevel(), pedestal); } } - private void setupFakePlayer(Level world, BlockPos pos) { + private void setupFakePlayer(Level level, BlockPos pos) { if (fakePlayer == null) { - fakePlayer = new EntityXRFakePlayer((ServerLevel) world); - fakePlayer.setPos( pos.getX() + 0.5, (double) pos.getY() + 2, pos.getZ() + 0.5); + fakePlayer = new ReliquaryFakePlayer((ServerLevel) level); + fakePlayer.setPos(pos.getX() + 0.5, (double) pos.getY() + 2, pos.getZ() + 0.5); } } - private int getTicksCatchable(@Nullable FishingHook hook) { - //noinspection ConstantConditions - return ObfuscationReflectionHelper.getPrivateValue(FishingHook.class, hook, "f_37089_"); - } - private void setPitchYaw(BlockPos pos) { int x = pos.getX(); int y = pos.getY(); diff --git a/src/main/java/reliquary/pedestal/wrappers/PedestalHarvestRodWrapper.java b/src/main/java/reliquary/pedestal/wrappers/PedestalHarvestRodWrapper.java index eb8bcebd..b871227b 100644 --- a/src/main/java/reliquary/pedestal/wrappers/PedestalHarvestRodWrapper.java +++ b/src/main/java/reliquary/pedestal/wrappers/PedestalHarvestRodWrapper.java @@ -1,32 +1,24 @@ package reliquary.pedestal.wrappers; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.BlockTags; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BoneMealItem; 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.Blocks; -import net.minecraft.world.level.block.BonemealableBlock; -import net.minecraft.world.level.block.CropBlock; -import net.minecraft.world.level.block.NetherWartBlock; -import net.minecraft.world.level.block.SweetBerryBushBlock; +import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.common.IPlantable; -import net.minecraftforge.common.util.FakePlayer; +import net.neoforged.neoforge.common.util.FakePlayer; import reliquary.api.IPedestal; import reliquary.api.IPedestalActionItemWrapper; import reliquary.blocks.FertileLilyPadBlock; import reliquary.init.ModItems; import reliquary.items.HarvestRodItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.ItemHelper; import java.util.ArrayDeque; @@ -59,9 +51,9 @@ public PedestalHarvestRodWrapper() { @Override public void update(ItemStack stack, Level level, IPedestal pedestal) { BlockPos pos = pedestal.getBlockPosition(); - int cooldown = Settings.COMMON.items.harvestRod.pedestalCooldown.get(); + int cooldown = Config.COMMON.items.harvestRod.pedestalCooldown.get(); pedestal.getFakePlayer().ifPresent(fakePlayer -> { - int range = Settings.COMMON.items.harvestRod.pedestalRange.get(); + int range = Config.COMMON.items.harvestRod.pedestalRange.get(); hoeLand(level, fakePlayer, pos, range); @@ -77,9 +69,7 @@ public void update(ItemStack stack, Level level, IPedestal pedestal) { @Override public void onRemoved(ItemStack stack, Level level, IPedestal pedestal) { - if (!level.isClientSide) { - harvestRod.updateContainedStacks(stack); - } + //noop } @Override @@ -87,37 +77,37 @@ public void stop(ItemStack stack, Level level, IPedestal pedestal) { //noop } - private void breakCrops(Level world, Player player, BlockPos pos, ItemStack stack, int range) { + private void breakCrops(Level level, Player player, BlockPos pos, ItemStack stack, int range) { if (breakCoolDown > 0) { breakCoolDown--; } else { - if (!breakNext(world, player, pos, stack, range)) { + if (!breakNext(level, player, pos, stack, range)) { breakCoolDown = NO_JOB_COOL_DOWN_CYCLES; } } } - private boolean breakNext(Level world, Player player, BlockPos pos, ItemStack stack, int range) { - return getNextBlockToBreak(world, pos, range).map(nextBlockToBreak -> { - doHarvestBlockBreak(world, player, stack, nextBlockToBreak); + private boolean breakNext(Level level, Player player, BlockPos pos, ItemStack stack, int range) { + return getNextBlockToBreak(level, pos, range).map(nextBlockToBreak -> { + doHarvestBlockBreak(level, player, stack, nextBlockToBreak); return true; }).orElse(false); } - private void doHarvestBlockBreak(Level world, Player player, ItemStack stack, BlockPos pos) { - BlockState blockState = world.getBlockState(pos); - List drops = Block.getDrops(blockState, (ServerLevel) world, pos, null, player, stack); + private void doHarvestBlockBreak(Level level, Player player, ItemStack stack, BlockPos pos) { + BlockState blockState = level.getBlockState(pos); + List drops = Block.getDrops(blockState, (ServerLevel) level, pos, null, player, stack); for (ItemStack drop : drops) { float f = 0.7F; - double d = (world.random.nextFloat() * f) + (1.0F - f) * 0.5D; - double d1 = (world.random.nextFloat() * f) + (1.0F - f) * 0.5D; - double d2 = (world.random.nextFloat() * f) + (1.0F - f) * 0.5D; - ItemEntity entityitem = new ItemEntity(world, pos.getX() + d, pos.getY() + d1, pos.getZ() + d2, drop); + double d = (level.random.nextFloat() * f) + (1.0F - f) * 0.5D; + double d1 = (level.random.nextFloat() * f) + (1.0F - f) * 0.5D; + double d2 = (level.random.nextFloat() * f) + (1.0F - f) * 0.5D; + ItemEntity entityitem = new ItemEntity(level, pos.getX() + d, pos.getY() + d1, pos.getZ() + d2, drop); entityitem.setPickUpDelay(10); - world.addFreshEntity(entityitem); + level.addFreshEntity(entityitem); } - world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); } private void boneMealCrops(Level level, FakePlayer fakePlayer, BlockPos pos, ItemStack stack, int range) { @@ -131,38 +121,37 @@ private void boneMealCrops(Level level, FakePlayer fakePlayer, BlockPos pos, Ite } } - private boolean boneMealNext(Level world, FakePlayer fakePlayer, BlockPos pos, ItemStack stack, int range) { - return getNextBlockToBoneMeal(world, pos, range).map(blockToBoneMeal -> { - boneMealBlock(stack, fakePlayer, world, blockToBoneMeal); + private boolean boneMealNext(Level level, FakePlayer fakePlayer, BlockPos pos, ItemStack stack, int range) { + return getNextBlockToBoneMeal(level, pos, range).map(blockToBoneMeal -> { + boneMealBlock(stack, fakePlayer, level, blockToBoneMeal); return true; }).orElse(false); } - private void boneMealBlock(ItemStack stack, FakePlayer fakePlayer, Level world, BlockPos pos) { + private void boneMealBlock(ItemStack stack, FakePlayer fakePlayer, Level level, BlockPos pos) { ItemStack fakeItemStack = new ItemStack(Items.BONE_MEAL); boolean boneMealUsed = false; for (int repeatedUses = 0; repeatedUses <= harvestRod.getLuckRolls(); repeatedUses++) { - if ((repeatedUses == 0 || world.random.nextInt(100) <= harvestRod.getLuckPercent()) && BoneMealItem.applyBonemeal(fakeItemStack, world, pos, fakePlayer)) { + if ((repeatedUses == 0 || level.random.nextInt(100) <= harvestRod.getLuckPercent()) && BoneMealItem.applyBonemeal(fakeItemStack, level, pos, fakePlayer)) { boneMealUsed = true; } } if (boneMealUsed) { - world.levelEvent(2005, pos, 0); + level.levelEvent(2005, pos, 0); harvestRod.setBoneMealCount(stack, harvestRod.getBoneMealCount(stack) - harvestRod.getBonemealCost()); } } - private void plantSeeds(Level world, Player player, BlockPos pos, ItemStack stack, int range) { + private void plantSeeds(Level level, Player player, BlockPos pos, ItemStack stack, int range) { if (plantCoolDown > 0) { plantCoolDown--; } else { byte plantableSlot = 1; - if (harvestRod.getCountPlantable(stack) > 0) { - harvestRod.clearPlantableIfNoLongerValid(stack, plantableSlot); + if (harvestRod.getCountOfPlantables(stack) > 0) { int quantity = harvestRod.getPlantableQuantity(stack, plantableSlot); - if (quantity > 0 && plantNext(world, player, pos, stack, range, plantableSlot)) { + if (quantity > 0 && plantNext(level, player, pos, stack, range, plantableSlot)) { return; } } @@ -170,8 +159,8 @@ private void plantSeeds(Level world, Player player, BlockPos pos, ItemStack stac } } - private boolean plantNext(Level world, Player player, BlockPos pos, ItemStack stack, int range, byte plantableSlot) { - return getNextBlockToPlantOn(world, pos, range, (IPlantable) ((BlockItem) harvestRod.getPlantableInSlot(stack, plantableSlot).getItem()).getBlock()).map(blockToPlantOn -> { + private boolean plantNext(Level level, Player player, BlockPos pos, ItemStack stack, int range, byte plantableSlot) { + return getNextBlockToPlantOn(level, pos, range, harvestRod.getPlantableInSlot(stack, plantableSlot)).map(blockToPlantOn -> { plantItem(player, blockToPlantOn, stack, plantableSlot); return true; }).orElse(false); @@ -182,23 +171,23 @@ private void plantItem(Player player, BlockPos pos, ItemStack stack, byte idx) { fakePlantableStack.setCount(1); player.setItemInHand(InteractionHand.MAIN_HAND, fakePlantableStack); - if (fakePlantableStack.useOn(ItemHelper.getItemUseContext(pos, player)) == InteractionResult.SUCCESS) { - harvestRod.setPlantableQuantityAndGetPlantableStack(stack, idx, harvestRod.getPlantableQuantity(stack, idx) - 1); + if (fakePlantableStack.useOn(ItemHelper.getItemUseContext(pos, player)).consumesAction()) { + harvestRod.decrementPlantable(stack, idx, 1); } } - private void hoeLand(Level world, Player player, BlockPos pos, int range) { + private void hoeLand(Level level, Player player, BlockPos pos, int range) { if (hoeCoolDown > 0) { hoeCoolDown--; } else { - if (!hoeNext(world, player, pos, range)) { + if (!hoeNext(level, player, pos, range)) { hoeCoolDown = NO_JOB_COOL_DOWN_CYCLES; } } } - private boolean hoeNext(Level world, Player player, BlockPos pos, int range) { - return getNextBlockToHoe(world, pos, range).map(blockToHoe -> { + private boolean hoeNext(Level level, Player player, BlockPos pos, int range) { + return getNextBlockToHoe(level, pos, range).map(blockToHoe -> { ItemStack fakeHoe = new ItemStack(Items.WOODEN_HOE); player.setItemInHand(InteractionHand.MAIN_HAND, fakeHoe); Items.WOODEN_HOE.useOn(ItemHelper.getItemUseContext(blockToHoe, player)); @@ -206,23 +195,23 @@ private boolean hoeNext(Level world, Player player, BlockPos pos, int range) { }).orElse(false); } - private Optional getNextBlockToBreak(Level world, BlockPos pos, int range) { + private Optional getNextBlockToBreak(Level level, BlockPos pos, int range) { if (queueToBreak.isEmpty()) { - fillQueueToBreak(world, pos, range); + fillQueueToBreak(level, pos, range); } return Optional.ofNullable(queueToBreak.poll()); } - private void fillQueueToBreak(Level world, BlockPos pos, int range) { + private void fillQueueToBreak(Level level, BlockPos pos, int range) { BlockPos.betweenClosedStream(pos.offset(-range, -range, -range), pos.offset(range, range, range)).forEach( p -> { BlockPos currentPos = p.immutable(); - BlockState state = world.getBlockState(currentPos); + BlockState state = level.getBlockState(currentPos); Block block = state.getBlock(); - if (block instanceof IPlantable || block == Blocks.MELON || block == Blocks.PUMPKIN) { + if (state.is(BlockTags.CROPS) || block instanceof BushBlock || block == Blocks.MELON || block == Blocks.PUMPKIN) { if (block instanceof FertileLilyPadBlock || block == Blocks.PUMPKIN_STEM || block == Blocks.MELON_STEM - || block instanceof CropBlock cropBlock && cropBlock.isValidBonemealTarget(world, currentPos, state, false) + || block instanceof CropBlock cropBlock && cropBlock.isValidBonemealTarget(level, currentPos, state) || block instanceof NetherWartBlock && state.getValue(NetherWartBlock.AGE) < 3 || block instanceof SweetBerryBushBlock && state.getValue(SweetBerryBushBlock.AGE) < 3) { return; @@ -233,44 +222,44 @@ private void fillQueueToBreak(Level world, BlockPos pos, int range) { }); } - private Optional getNextBlockToHoe(Level world, BlockPos pos, int range) { + private Optional getNextBlockToHoe(Level level, BlockPos pos, int range) { if (queueToHoe.isEmpty()) { - fillQueueToHoe(world, pos, range); + fillQueueToHoe(level, pos, range); } return Optional.ofNullable(queueToHoe.poll()); } - private void fillQueueToHoe(Level world, BlockPos pos, int range) { + private void fillQueueToHoe(Level level, BlockPos pos, int range) { queueToHoe.clear(); BlockPos.betweenClosedStream(pos.offset(-range, -range, -range), pos.offset(range, range, range)).forEach( p -> { BlockPos currentPos = p.immutable(); - BlockState blockState = world.getBlockState(currentPos); + BlockState blockState = level.getBlockState(currentPos); Block block = blockState.getBlock(); - if (world.isEmptyBlock(currentPos.above()) && (block == Blocks.GRASS_BLOCK || block == Blocks.DIRT_PATH || block == Blocks.DIRT || block == Blocks.COARSE_DIRT)) { + if (level.isEmptyBlock(currentPos.above()) && (block == Blocks.GRASS_BLOCK || block == Blocks.DIRT_PATH || block == Blocks.DIRT || block == Blocks.COARSE_DIRT)) { queueToHoe.add(currentPos); } } ); } - private Optional getNextBlockToPlantOn(Level world, BlockPos pos, int range, IPlantable plantable) { + private Optional getNextBlockToPlantOn(Level level, BlockPos pos, int range, ItemStack plantable) { if (queueToPlant.isEmpty()) { - fillQueueToPlant(world, pos, range, plantable); + fillQueueToPlant(level, pos, range, plantable); } return Optional.ofNullable(queueToPlant.poll()); } - private void fillQueueToPlant(Level world, BlockPos pos, int range, IPlantable plantable) { + private void fillQueueToPlant(Level level, BlockPos pos, int range, ItemStack plantable) { queueToPlant.clear(); boolean checkerboard = false; boolean bothOddOrEven = false; - if (plantable == Items.PUMPKIN_SEEDS || plantable == Items.MELON_SEEDS) { + if (plantable.getItem() == Items.PUMPKIN_SEEDS || plantable.getItem() == Items.MELON_SEEDS) { checkerboard = true; boolean xEven = pos.getX() % 2 == 0; boolean zEven = pos.getZ() % 2 == 0; @@ -282,29 +271,30 @@ private void fillQueueToPlant(Level world, BlockPos pos, int range, IPlantable p BlockPos.betweenClosedStream(pos.offset(-range, -range, -range), pos.offset(range, range, range)).forEach( p -> { BlockPos currentPos = p.immutable(); - BlockState blockState = world.getBlockState(currentPos); - if ((!finalCheckerboard || (finalBothOddOrEven == ((currentPos.getX() % 2 == 0) == (currentPos.getZ() % 2 == 0)))) && blockState.getBlock().canSustainPlant(blockState, world, pos, Direction.UP, plantable) && world.isEmptyBlock(currentPos.above())) { + BlockState blockState = level.getBlockState(currentPos); + if ((!finalCheckerboard || (finalBothOddOrEven == ((currentPos.getX() % 2 == 0) == (currentPos.getZ() % 2 == 0)))) + && HarvestRodItem.canPlacePlantableAt(level, currentPos.above(), plantable) && level.isEmptyBlock(currentPos.above())) { queueToPlant.add(currentPos); } }); } - private Optional getNextBlockToBoneMeal(Level world, BlockPos pos, int range) { + private Optional getNextBlockToBoneMeal(Level level, BlockPos pos, int range) { if (queueToBoneMeal.isEmpty()) { - fillQueueToBoneMeal(world, pos, range); + fillQueueToBoneMeal(level, pos, range); } return Optional.ofNullable(queueToBoneMeal.poll()); } - private void fillQueueToBoneMeal(Level world, BlockPos pos, int range) { + private void fillQueueToBoneMeal(Level level, BlockPos pos, int range) { queueToBoneMeal.clear(); BlockPos.betweenClosedStream(pos.offset(-range, -range, -range), pos.offset(range, range, range)).forEach( p -> { BlockPos currentPos = p.immutable(); - BlockState blockState = world.getBlockState(currentPos); - if (blockState.getBlock() != Blocks.GRASS_BLOCK && blockState.getBlock() instanceof BonemealableBlock bonemealableBlock && bonemealableBlock.isValidBonemealTarget(world, currentPos, blockState, world.isClientSide)) { + BlockState blockState = level.getBlockState(currentPos); + if (blockState.getBlock() != Blocks.GRASS_BLOCK && blockState.getBlock() instanceof BonemealableBlock bonemealableBlock && bonemealableBlock.isValidBonemealTarget(level, currentPos, blockState)) { queueToBoneMeal.add(currentPos); } }); diff --git a/src/main/java/reliquary/pedestal/wrappers/PedestalMeleeWeaponWrapper.java b/src/main/java/reliquary/pedestal/wrappers/PedestalMeleeWeaponWrapper.java index e1691e2f..d7c30cc5 100644 --- a/src/main/java/reliquary/pedestal/wrappers/PedestalMeleeWeaponWrapper.java +++ b/src/main/java/reliquary/pedestal/wrappers/PedestalMeleeWeaponWrapper.java @@ -10,10 +10,10 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; -import net.minecraftforge.common.util.FakePlayer; +import net.neoforged.neoforge.common.util.FakePlayer; import reliquary.api.IPedestal; import reliquary.api.IPedestalActionItemWrapper; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.List; @@ -21,13 +21,13 @@ public class PedestalMeleeWeaponWrapper implements IPedestalActionItemWrapper { private final int cooldownAfterSwing; public PedestalMeleeWeaponWrapper() { - cooldownAfterSwing = Settings.COMMON.blocks.pedestal.meleeWrapperCooldown.get(); + cooldownAfterSwing = Config.COMMON.blocks.pedestal.meleeWrapperCooldown.get(); } @Override public void update(ItemStack stack, Level level, IPedestal pedestal) { BlockPos pos = pedestal.getBlockPosition(); - int meleeRange = Settings.COMMON.blocks.pedestal.meleeWrapperRange.get(); + int meleeRange = Config.COMMON.blocks.pedestal.meleeWrapperRange.get(); List entities = level.getEntitiesOfClass(Mob.class, new AABB((double) pos.getX() - meleeRange, (double) pos.getY() - meleeRange, (double) pos.getZ() - meleeRange, (double) pos.getX() + meleeRange, (double) pos.getY() + meleeRange, (double) pos.getZ() + meleeRange)); diff --git a/src/main/java/reliquary/pedestal/wrappers/PedestalRedstoneWrapper.java b/src/main/java/reliquary/pedestal/wrappers/PedestalRedstoneWrapper.java index 00fd187d..d125749e 100644 --- a/src/main/java/reliquary/pedestal/wrappers/PedestalRedstoneWrapper.java +++ b/src/main/java/reliquary/pedestal/wrappers/PedestalRedstoneWrapper.java @@ -5,7 +5,7 @@ import net.minecraft.world.level.Level; import reliquary.api.IPedestal; import reliquary.api.IPedestalRedstoneItemWrapper; -import reliquary.reference.Settings; +import reliquary.reference.Config; import reliquary.util.WorldHelper; import java.util.List; @@ -31,7 +31,7 @@ private PedestalRedstoneWrapper(boolean powered) { @Override public void updateRedstone(ItemStack stack, Level level, IPedestal pedestal) { - List pedestalsInRange = pedestal.getPedestalsInRange(level, Settings.COMMON.blocks.pedestal.redstoneWrapperRange.get()); + List pedestalsInRange = pedestal.getPedestalsInRange(level, Config.COMMON.blocks.pedestal.redstoneWrapperRange.get()); BlockPos thisPos = pedestal.getBlockPosition(); boolean buttonEnabled = pedestal.switchedOn(); @@ -53,7 +53,7 @@ public void updateRedstone(ItemStack stack, Level level, IPedestal pedestal) { @Override public void onRemoved(ItemStack stack, Level level, IPedestal pedestal) { - List pedestalsInRange = pedestal.getPedestalsInRange(level, Settings.COMMON.blocks.pedestal.redstoneWrapperRange.get()); + List pedestalsInRange = pedestal.getPedestalsInRange(level, Config.COMMON.blocks.pedestal.redstoneWrapperRange.get()); BlockPos thisPos = pedestal.getBlockPosition(); for (BlockPos pos : pedestalsInRange) { diff --git a/src/main/java/reliquary/pedestal/wrappers/PedestalRendingGaleWrapper.java b/src/main/java/reliquary/pedestal/wrappers/PedestalRendingGaleWrapper.java index 97841162..45b98293 100644 --- a/src/main/java/reliquary/pedestal/wrappers/PedestalRendingGaleWrapper.java +++ b/src/main/java/reliquary/pedestal/wrappers/PedestalRendingGaleWrapper.java @@ -8,10 +8,10 @@ import net.minecraft.world.phys.AABB; import reliquary.api.IPedestal; import reliquary.api.IPedestalActionItemWrapper; +import reliquary.init.ModEffects; import reliquary.init.ModItems; -import reliquary.init.ModPotions; import reliquary.items.RendingGaleItem; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.List; @@ -50,22 +50,22 @@ public void update(ItemStack stack, Level level, IPedestal pedestal) { } } - private void pushEntities(ItemStack stack, Level world, BlockPos pos, RendingGaleItem rendingGale, boolean b) { - rendingGale.doRadialPush(world, pos.getX(), pos.getY(), pos.getZ(), null, b); - ModItems.RENDING_GALE.get().setFeatherCount(stack, ModItems.RENDING_GALE.get().getFeatherCount(stack) - (int) (TICKS_BETWEEN_PUSH_PULL_CHECKS / 20F * Settings.COMMON.items.rendingGale.pedestalCostPerSecond.get()), true); + private void pushEntities(ItemStack stack, Level level, BlockPos pos, RendingGaleItem rendingGale, boolean b) { + rendingGale.doRadialPush(level, pos.getX(), pos.getY(), pos.getZ(), null, b); + ModItems.RENDING_GALE.get().setFeatherCount(stack, ModItems.RENDING_GALE.get().getFeatherCount(stack) - (int) (TICKS_BETWEEN_PUSH_PULL_CHECKS / 20F * Config.COMMON.items.rendingGale.pedestalCostPerSecond.get())); } - private void buffPlayersWithFlight(ItemStack stack, Level world, BlockPos pos) { - int flightRange = Settings.COMMON.items.rendingGale.pedestalFlightRange.get(); + private void buffPlayersWithFlight(ItemStack stack, Level level, BlockPos pos) { + int flightRange = Config.COMMON.items.rendingGale.pedestalFlightRange.get(); if (ModItems.RENDING_GALE.get().getFeatherCount(stack) >= (RendingGaleItem.getChargeCost() * SECONDS_BETWEEN_BUFF_CHECKS)) { - List players = world.getEntitiesOfClass(Player.class, new AABB((double) pos.getX() - flightRange, (double) pos.getY() - flightRange, (double) pos.getZ() - flightRange, (double) pos.getX() + flightRange, (double) pos.getY() + flightRange, (double) pos.getZ() + flightRange)); + List players = level.getEntitiesOfClass(Player.class, new AABB((double) pos.getX() - flightRange, (double) pos.getY() - flightRange, (double) pos.getZ() - flightRange, (double) pos.getX() + flightRange, (double) pos.getY() + flightRange, (double) pos.getZ() + flightRange)); if (!players.isEmpty()) { for (Player player : players) { - player.addEffect(new MobEffectInstance(ModPotions.FLIGHT_POTION.get(), 20 * 20)); + player.addEffect(new MobEffectInstance(ModEffects.FLIGHT, 20 * 20, 0, false, false, true)); } - ModItems.RENDING_GALE.get().setFeatherCount(stack, ModItems.RENDING_GALE.get().getFeatherCount(stack) - (SECONDS_BETWEEN_BUFF_CHECKS * Settings.COMMON.items.rendingGale.pedestalCostPerSecond.get()), true); + ModItems.RENDING_GALE.get().setFeatherCount(stack, ModItems.RENDING_GALE.get().getFeatherCount(stack) - (SECONDS_BETWEEN_BUFF_CHECKS * Config.COMMON.items.rendingGale.pedestalCostPerSecond.get())); } } } diff --git a/src/main/java/reliquary/pedestal/wrappers/PedestalShearsWrapper.java b/src/main/java/reliquary/pedestal/wrappers/PedestalShearsWrapper.java index f1ee90a6..d06042d8 100644 --- a/src/main/java/reliquary/pedestal/wrappers/PedestalShearsWrapper.java +++ b/src/main/java/reliquary/pedestal/wrappers/PedestalShearsWrapper.java @@ -1,6 +1,7 @@ package reliquary.pedestal.wrappers; 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.InteractionHand; @@ -13,11 +14,11 @@ import net.minecraft.world.level.block.entity.BeehiveBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import net.minecraftforge.common.IForgeShearable; -import net.minecraftforge.common.util.FakePlayer; +import net.neoforged.neoforge.common.IShearable; +import net.neoforged.neoforge.common.util.FakePlayer; import reliquary.api.IPedestal; import reliquary.api.IPedestalActionItemWrapper; -import reliquary.reference.Settings; +import reliquary.reference.Config; import java.util.ArrayDeque; import java.util.List; @@ -31,14 +32,14 @@ public class PedestalShearsWrapper implements IPedestalActionItemWrapper { @Override public void update(ItemStack stack, Level level, IPedestal pedestal) { BlockPos pos = pedestal.getBlockPosition(); - int shearsRange = Settings.COMMON.blocks.pedestal.shearsWrapperRange.get(); + int shearsRange = Config.COMMON.blocks.pedestal.shearsWrapperRange.get(); if (shearAnimals(stack, level, pedestal, pos, shearsRange)) { return; } if (!isShearingBlock) { - pedestal.setActionCoolDown(Settings.COMMON.blocks.pedestal.shearsWrapperCooldown.get()); + pedestal.setActionCoolDown(Config.COMMON.blocks.pedestal.shearsWrapperCooldown.get()); } if (stack.getCount() == 0) { @@ -66,34 +67,38 @@ public void stop(ItemStack stack, Level level, IPedestal pedestal) { //noop } - private boolean shearBlocks(ItemStack stack, Level world, IPedestal pedestal, FakePlayer fakePlayer, BlockPos pos, int shearsRange) { + private boolean shearBlocks(ItemStack stack, Level level, IPedestal pedestal, FakePlayer fakePlayer, BlockPos pos, int shearsRange) { if (!isShearingBlock) { if (blockQueue.isEmpty()) { - updateQueue(stack, world, pos, shearsRange); + updateQueue(stack, level, pos, shearsRange); if (blockQueue.isEmpty()) { return false; } } blockPosBeingSheared = blockQueue.remove(); - BlockState blockState = world.getBlockState(blockPosBeingSheared); - if (isShearableBlock(stack, world, blockState)) { - float hardness = blockState.getDestroySpeed(world, blockPosBeingSheared); + BlockState blockState = level.getBlockState(blockPosBeingSheared); + if (isShearableBlock(stack, level, blockState)) { + float hardness = blockState.getDestroySpeed(level, blockPosBeingSheared); float digSpeed = stack.getItem().getDestroySpeed(stack, blockState); pedestal.setActionCoolDown((int) ((hardness * 1.5f * 20f) / digSpeed)); isShearingBlock = true; } } else { - stack.getItem().onBlockStartBreak(stack, blockPosBeingSheared, fakePlayer); - BlockState blockState = world.getBlockState(blockPosBeingSheared); - if (blockState.getBlock() instanceof BeehiveBlock) { - shearBeehive(world, blockPosBeingSheared, blockState, stack); - } else { - if (world.removeBlock(blockPosBeingSheared, false)) { - Block.dropResources(blockState, world, pos, null, fakePlayer, new ItemStack(Items.SHEARS)); - world.levelEvent(2001, blockPosBeingSheared, Block.getId(blockState)); - stack.hurt(1, world.getRandom(), null); + BlockState blockState = level.getBlockState(blockPosBeingSheared); + if (stack.getItem().canAttackBlock(blockState, level, blockPosBeingSheared, fakePlayer)) { + if (blockState.getBlock() instanceof BeehiveBlock) { + shearBeehive(level, blockPosBeingSheared, blockState, stack); + } else { + if (level.removeBlock(blockPosBeingSheared, false)) { + Block.dropResources(blockState, level, blockPosBeingSheared, null, fakePlayer, new ItemStack(Items.SHEARS)); + level.levelEvent(2001, blockPosBeingSheared, Block.getId(blockState)); + if (level instanceof ServerLevel serverLevel) { + stack.hurtAndBreak(1, serverLevel, null, item -> { + }); + } + } } } @@ -102,29 +107,32 @@ private boolean shearBlocks(ItemStack stack, Level world, IPedestal pedestal, Fa return true; } - private boolean isShearableBlock(ItemStack stack, Level world, BlockState blockState) { + private boolean isShearableBlock(ItemStack stack, Level level, BlockState blockState) { Block block = blockState.getBlock(); - return (block instanceof IForgeShearable shearable && shearable.isShearable(stack, world, blockPosBeingSheared)) + return (block instanceof IShearable shearable && shearable.isShearable(null, stack, level, blockPosBeingSheared)) || (block instanceof BeehiveBlock && blockState.getValue(BeehiveBlock.HONEY_LEVEL) >= 5); } - private void shearBeehive(Level world, BlockPos pos, BlockState blockState, ItemStack stack) { + private void shearBeehive(Level level, BlockPos pos, BlockState blockState, ItemStack stack) { int honeyLevel = blockState.getValue(BeehiveBlock.HONEY_LEVEL); if (honeyLevel >= 5) { - world.playSound(null, pos, SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); - BeehiveBlock.dropHoneycomb(world, pos); - ((BeehiveBlock) blockState.getBlock()).releaseBeesAndResetHoneyLevel(world, blockState, pos, null, BeehiveBlockEntity.BeeReleaseStatus.BEE_RELEASED); - stack.hurt(1, world.getRandom(), null); + level.playSound(null, pos, SoundEvents.BEEHIVE_SHEAR, SoundSource.BLOCKS, 1.0F, 1.0F); + BeehiveBlock.dropHoneycomb(level, pos); + ((BeehiveBlock) blockState.getBlock()).releaseBeesAndResetHoneyLevel(level, blockState, pos, null, BeehiveBlockEntity.BeeReleaseStatus.BEE_RELEASED); + if (level instanceof ServerLevel serverLevel) { + stack.hurtAndBreak(1, serverLevel, null, item -> { + }); + } } } - private void updateQueue(ItemStack stack, Level world, BlockPos pos, int shearsRange) { + private void updateQueue(ItemStack stack, Level level, BlockPos pos, int shearsRange) { for (int y = pos.getY() - shearsRange; y <= pos.getY() + shearsRange; y++) { for (int x = pos.getX() - shearsRange; x <= pos.getX() + shearsRange; x++) { for (int z = pos.getZ() - shearsRange; z <= pos.getZ() + shearsRange; z++) { BlockPos currentBlockPos = new BlockPos(x, y, z); - BlockState blockState = world.getBlockState(currentBlockPos); - if (isShearableBlock(stack, world, blockState)) { + BlockState blockState = level.getBlockState(currentBlockPos); + if (isShearableBlock(stack, level, blockState)) { blockQueue.add(currentBlockPos); } } @@ -132,12 +140,12 @@ private void updateQueue(ItemStack stack, Level world, BlockPos pos, int shearsR } } - private boolean shearAnimals(ItemStack stack, Level world, FakePlayer fakePlayer, BlockPos pos, int shearsRange) { - List entities = world.getEntitiesOfClass(Animal.class, - new AABB(pos.offset(-shearsRange, -shearsRange, -shearsRange), pos.offset(shearsRange, shearsRange, shearsRange))); + private boolean shearAnimals(ItemStack stack, Level level, FakePlayer fakePlayer, BlockPos pos, int shearsRange) { + List entities = level.getEntitiesOfClass(Animal.class, + AABB.encapsulatingFullBlocks(pos.offset(-shearsRange, -shearsRange, -shearsRange), pos.offset(shearsRange, shearsRange, shearsRange))); for (Animal animal : entities) { - if (animal instanceof IForgeShearable shearable && shearable.isShearable(stack, world, animal.blockPosition())) { + if (animal instanceof IShearable shearable && shearable.isShearable(null, stack, level, animal.blockPosition())) { fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack); fakePlayer.interactOn(animal, InteractionHand.MAIN_HAND); return true; diff --git a/src/main/java/reliquary/potions/CureEffect.java b/src/main/java/reliquary/potions/CureEffect.java new file mode 100644 index 00000000..e971eaac --- /dev/null +++ b/src/main/java/reliquary/potions/CureEffect.java @@ -0,0 +1,34 @@ +package reliquary.potions; + +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.ZombieVillager; +import reliquary.init.ModEffects; + +public class CureEffect extends MobEffect { + + public CureEffect() { + super(MobEffectCategory.BENEFICIAL, 15723850); + } + + @Override + public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) { + return true; + } + + @Override + public boolean applyEffectTick(LivingEntity livingEntity, int potency) { + if (livingEntity instanceof ZombieVillager zombieVillager) { + if (!zombieVillager.isConverting() && livingEntity.hasEffect(MobEffects.WEAKNESS)) { + zombieVillager.startConverting(null, (livingEntity.level().random.nextInt(2401) + 3600) / (potency + 2)); + livingEntity.removeEffect(ModEffects.CURE); + } + return true; + } else { + livingEntity.removeEffect(ModEffects.CURE); + return false; + } + } +} diff --git a/src/main/java/reliquary/potions/CurePotion.java b/src/main/java/reliquary/potions/CurePotion.java deleted file mode 100644 index e7b2a4c8..00000000 --- a/src/main/java/reliquary/potions/CurePotion.java +++ /dev/null @@ -1,50 +0,0 @@ -package reliquary.potions; - -import net.minecraft.world.effect.MobEffect; -import net.minecraft.world.effect.MobEffectCategory; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.monster.ZombieVillager; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; -import reliquary.init.ModPotions; -import reliquary.util.LogHelper; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.UUID; - -public class CurePotion extends MobEffect { - - public CurePotion() { - super(MobEffectCategory.BENEFICIAL, 15723850); - } - - @Override - public boolean isDurationEffectTick(int duration, int amplifier) { - return true; - } - - private static final Method START_CONVERTING = ObfuscationReflectionHelper - .findMethod(ZombieVillager.class, "m_34383_", UUID.class, int.class); - - private static void startConverting(ZombieVillager zombieVillager, int conversionTime) { - try { - START_CONVERTING.invoke(zombieVillager, null, conversionTime); - } - catch (InvocationTargetException | IllegalAccessException e) { - LogHelper.error("Error running startConverting on zombie villager", e); - } - } - - @Override - public void applyEffectTick(LivingEntity entityLivingBase, int potency) { - if (entityLivingBase instanceof ZombieVillager zombieVillager) { - if (!zombieVillager.isConverting() && entityLivingBase.hasEffect(MobEffects.WEAKNESS)) { - startConverting(zombieVillager, (entityLivingBase.level().random.nextInt(2401) + 3600) / (potency + 2)); - entityLivingBase.removeEffect(ModPotions.CURE_POTION.get()); - } - } else { - entityLivingBase.removeEffect(ModPotions.CURE_POTION.get()); - } - } -} diff --git a/src/main/java/reliquary/potions/FlightEffect.java b/src/main/java/reliquary/potions/FlightEffect.java new file mode 100644 index 00000000..8ff23e31 --- /dev/null +++ b/src/main/java/reliquary/potions/FlightEffect.java @@ -0,0 +1,81 @@ +package reliquary.potions; + +import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.AttributeMap; +import net.minecraft.world.entity.player.Player; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.common.NeoForgeMod; +import net.neoforged.neoforge.event.entity.living.MobEffectEvent; +import org.jetbrains.annotations.Nullable; +import reliquary.init.ModEffects; + +public class FlightEffect extends MobEffect { + + public FlightEffect() { + super(MobEffectCategory.BENEFICIAL, 0xFFFFFF); + NeoForge.EVENT_BUS.addListener(this::onEffectExpired); + NeoForge.EVENT_BUS.addListener(this::onEffectRemoved); + } + + @Override + public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) { + return true; + } + + @Override + public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { + if (livingEntity.level().isClientSide) { + return true; + } + + if (!(livingEntity instanceof Player player)) { + return false; + } + + AttributeInstance creativeFlightAttribute = player.getAttribute(NeoForgeMod.CREATIVE_FLIGHT); + if (creativeFlightAttribute != null && creativeFlightAttribute.getValue() == 0) { + creativeFlightAttribute.setBaseValue(1); + ((ServerPlayer) player).connection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); + } + player.fallDistance = 0; + return true; + } + + @Override + public void removeAttributeModifiers(AttributeMap attributeMap) { + super.removeAttributeModifiers(attributeMap); + } + + private void onEffectExpired(MobEffectEvent.Expired event) { + removeFlight(event.getEntity(), event.getEffectInstance()); + } + + private void onEffectRemoved(MobEffectEvent.Remove event) { + removeFlight(event.getEntity(), event.getEffectInstance()); + } + + private static void removeFlight(LivingEntity entity, @Nullable MobEffectInstance effectInstance) { + if (effectInstance == null || !effectInstance.getEffect().value().equals(ModEffects.FLIGHT.value())) { + return; + } + + if (!(entity instanceof ServerPlayer serverPlayer)) { + return; + } + + if (!serverPlayer.isCreative()) { + AttributeInstance creativeFlightAttribute = serverPlayer.getAttribute(NeoForgeMod.CREATIVE_FLIGHT); + if (creativeFlightAttribute != null) { + creativeFlightAttribute.setBaseValue(0); + } + serverPlayer.getAbilities().flying = false; + serverPlayer.connection.send(new ClientboundPlayerAbilitiesPacket(serverPlayer.getAbilities())); + } + } +} diff --git a/src/main/java/reliquary/potions/FlightPotion.java b/src/main/java/reliquary/potions/FlightPotion.java deleted file mode 100644 index d46fa956..00000000 --- a/src/main/java/reliquary/potions/FlightPotion.java +++ /dev/null @@ -1,54 +0,0 @@ -package reliquary.potions; - -import net.minecraft.network.protocol.game.ClientboundPlayerAbilitiesPacket; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.effect.MobEffect; -import net.minecraft.world.effect.MobEffectCategory; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.ai.attributes.AttributeMap; -import net.minecraft.world.entity.player.Player; -import reliquary.init.ModPotions; - -public class FlightPotion extends MobEffect { - - public FlightPotion() { - super(MobEffectCategory.BENEFICIAL, 0); - } - - @Override - public boolean isDurationEffectTick(int duration, int amplifier) { - return true; - } - - @Override - public void applyEffectTick(LivingEntity entityLivingBase, int amplifier) { - if (entityLivingBase.level().isClientSide || !(entityLivingBase instanceof Player player)) { - return; - } - - if (!player.getAbilities().mayfly) { - player.getAbilities().mayfly = true; - ((ServerPlayer) player).connection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); - } - player.fallDistance = 0; - } - - @Override - public void removeAttributeModifiers(LivingEntity entityLivingBase, AttributeMap attributeMap, int amplifier) { - super.removeAttributeModifiers(entityLivingBase, attributeMap, amplifier); - - if (!(entityLivingBase instanceof Player player)) { - return; - } - - if (player.hasEffect(ModPotions.FLIGHT_POTION.get())) { - return; - } - - if (!player.isCreative()) { - player.getAbilities().mayfly = false; - player.getAbilities().flying = false; - ((ServerPlayer) player).connection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); - } - } -} diff --git a/src/main/java/reliquary/potions/PacificationPotion.java b/src/main/java/reliquary/potions/PacificationEffect.java similarity index 58% rename from src/main/java/reliquary/potions/PacificationPotion.java rename to src/main/java/reliquary/potions/PacificationEffect.java index f2a21b42..8b1f9b71 100644 --- a/src/main/java/reliquary/potions/PacificationPotion.java +++ b/src/main/java/reliquary/potions/PacificationEffect.java @@ -6,25 +6,26 @@ import net.minecraft.world.entity.Mob; import reliquary.util.MobHelper; -public class PacificationPotion extends MobEffect { +public class PacificationEffect extends MobEffect { - public PacificationPotion() { + public PacificationEffect() { super(MobEffectCategory.BENEFICIAL, 0); } @Override - public boolean isDurationEffectTick(int duration, int amplifier) { + public boolean shouldApplyEffectTickThisTick(int duration, int amplifier) { return true; } @Override - public void applyEffectTick(LivingEntity entityLivingBase, int amplifier) { - if (entityLivingBase.level().isClientSide || !(entityLivingBase instanceof Mob entityLiving)) { - return; + public boolean applyEffectTick(LivingEntity livingEntity, int amplifier) { + if (livingEntity.level().isClientSide || !(livingEntity instanceof Mob entityLiving)) { + return false; } if (entityLiving.getTarget() != null || entityLiving.getLastHurtByMob() != null) { MobHelper.resetTarget(entityLiving, true); } + return true; } } diff --git a/src/main/java/reliquary/reference/ClientReference.java b/src/main/java/reliquary/reference/ClientReference.java index 1c0e9a42..a7ad2858 100644 --- a/src/main/java/reliquary/reference/ClientReference.java +++ b/src/main/java/reliquary/reference/ClientReference.java @@ -1,27 +1,17 @@ package reliquary.reference; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import reliquary.Reliquary; public class ClientReference { - @OnlyIn(Dist.CLIENT) - public static final ResourceLocation NEUTRAL = new ResourceLocation(Reference.MOD_ID, Reference.ART_PATH_ENTITIES + "neutral_shot.png"); - @OnlyIn(Dist.CLIENT) - public static final ResourceLocation EXORCISM = new ResourceLocation(Reference.MOD_ID, Reference.ART_PATH_ENTITIES + "exorcism_shot.png"); - @OnlyIn(Dist.CLIENT) - public static final ResourceLocation BLAZE = new ResourceLocation(Reference.MOD_ID, Reference.ART_PATH_ENTITIES + "blaze_shot.png"); - @OnlyIn(Dist.CLIENT) - public static final ResourceLocation ENDER = new ResourceLocation(Reference.MOD_ID, Reference.ART_PATH_ENTITIES + "ender_shot.png"); - @OnlyIn(Dist.CLIENT) - public static final ResourceLocation CONCUSSIVE = new ResourceLocation(Reference.MOD_ID, Reference.ART_PATH_ENTITIES + "concussive_shot.png"); - @OnlyIn(Dist.CLIENT) - public static final ResourceLocation BUSTER = new ResourceLocation(Reference.MOD_ID, Reference.ART_PATH_ENTITIES + "buster_shot.png"); - @OnlyIn(Dist.CLIENT) - public static final ResourceLocation SEEKER = new ResourceLocation(Reference.MOD_ID, Reference.ART_PATH_ENTITIES + "seeker_shot.png"); - @OnlyIn(Dist.CLIENT) - public static final ResourceLocation SAND = new ResourceLocation(Reference.MOD_ID, Reference.ART_PATH_ENTITIES + "sand_shot.png"); - @OnlyIn(Dist.CLIENT) - public static final ResourceLocation STORM = new ResourceLocation(Reference.MOD_ID, Reference.ART_PATH_ENTITIES + "storm_shot.png"); + public static final ResourceLocation NEUTRAL = Reliquary.getRL(Reference.ART_PATH_ENTITIES + "neutral_shot.png"); + public static final ResourceLocation EXORCISM = Reliquary.getRL(Reference.ART_PATH_ENTITIES + "exorcism_shot.png"); + public static final ResourceLocation BLAZE = Reliquary.getRL(Reference.ART_PATH_ENTITIES + "blaze_shot.png"); + public static final ResourceLocation ENDER = Reliquary.getRL(Reference.ART_PATH_ENTITIES + "ender_shot.png"); + public static final ResourceLocation CONCUSSIVE = Reliquary.getRL(Reference.ART_PATH_ENTITIES + "concussive_shot.png"); + public static final ResourceLocation BUSTER = Reliquary.getRL(Reference.ART_PATH_ENTITIES + "buster_shot.png"); + public static final ResourceLocation SEEKER = Reliquary.getRL(Reference.ART_PATH_ENTITIES + "seeker_shot.png"); + public static final ResourceLocation SAND = Reliquary.getRL(Reference.ART_PATH_ENTITIES + "sand_shot.png"); + public static final ResourceLocation STORM = Reliquary.getRL(Reference.ART_PATH_ENTITIES + "storm_shot.png"); } diff --git a/src/main/java/reliquary/reference/Colors.java b/src/main/java/reliquary/reference/Colors.java index 090e4333..bd0bb824 100644 --- a/src/main/java/reliquary/reference/Colors.java +++ b/src/main/java/reliquary/reference/Colors.java @@ -13,12 +13,10 @@ public static int get(String s) { public static final String RED = "CC3024"; public static final String LIGHT_GRAY = "C9C9C9"; public static final String BLUE = "3B64DC"; - public static final String DARKER = "666666"; public static final String DARKEST = "333333"; public static final String NEUTRAL_SHOT_COLOR = "888888"; public static final String EXORCISM_SHOT_COLOR = "DDDD00"; public static final String BLAZE_SHOT_COLOR = "DD2222"; - public static final String BLOOD_RED_COLOR = "AA0000"; public static final String ENDER_SHOT_COLOR = "9900EE"; public static final String CONCUSSIVE_SHOT_COLOR = "00BB00"; public static final String BUSTER_SHOT_COLOR = "444444"; diff --git a/src/main/java/reliquary/reference/Settings.java b/src/main/java/reliquary/reference/Config.java similarity index 87% rename from src/main/java/reliquary/reference/Settings.java rename to src/main/java/reliquary/reference/Config.java index c645babb..407ec371 100644 --- a/src/main/java/reliquary/reference/Settings.java +++ b/src/main/java/reliquary/reference/Config.java @@ -1,41 +1,44 @@ package reliquary.reference; import com.google.common.collect.Lists; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; -import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; -import net.minecraftforge.common.ForgeConfigSpec.DoubleValue; -import net.minecraftforge.common.ForgeConfigSpec.EnumValue; -import net.minecraftforge.common.ForgeConfigSpec.IntValue; -import net.minecraftforge.fml.event.config.ModConfigEvent; -import net.minecraftforge.registries.ForgeRegistries; +import net.minecraft.world.level.block.Blocks; +import net.neoforged.fml.event.config.ModConfigEvent; +import net.neoforged.neoforge.common.ModConfigSpec; +import net.neoforged.neoforge.common.ModConfigSpec.*; import org.apache.commons.lang3.tuple.Pair; import reliquary.client.gui.hud.HUDPosition; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; import static reliquary.util.RegistryHelper.getItemRegistryName; @SuppressWarnings("squid:S1192") //no issue repeating the same string literal as they are independent -public class Settings { - private Settings() {} +public class Config { + private Config() { + } private static final int ITEM_CAP = 9999; - @SuppressWarnings("unused") // parameter needs to stay for addListener logic to recognize what this method is listening to + public static T getOrDefault(ModConfigSpec.ConfigValue value, ModConfigSpec configSpec) { + return configSpec.isLoaded() ? value.get() : value.getDefault(); + } + + @SuppressWarnings("unused") + // parameter needs to stay for addListener logic to recognize what this method is listening to public static void onFileChange(ModConfigEvent.Reloading configEvent) { COMMON.items.infernalTear.resetCache(); + COMMON.items.mobCharm.resetCache(); + COMMON.items.sojournerStaff.resetCache(); } public static class Client { @@ -59,7 +62,7 @@ public static class HudPos { public final EnumValue rendingGale; public final EnumValue mobCharm; - HudPos(ForgeConfigSpec.Builder builder) { + HudPos(ModConfigSpec.Builder builder) { builder.comment("Position of mode and/or item display on the screen - used by some of the tools and weapons.") .push("hudPositions"); @@ -113,21 +116,19 @@ public static class HudPos { } } - Client(ForgeConfigSpec.Builder builder) { - builder.comment("Client Settings").push("client"); + Client(ModConfigSpec.Builder builder) { hudPositions = new HudPos(builder); wailaShiftForInfo = builder .comment("Whether player has to sneak to see additional info in waila") .define("waila_shift_for_info", false); - builder.pop(); } } public static final Client CLIENT; - public static final ForgeConfigSpec CLIENT_SPEC; + public static final ModConfigSpec CLIENT_SPEC; static { - final Pair specPair = new ForgeConfigSpec.Builder().configure(Client::new); + final Pair specPair = new ModConfigSpec.Builder().configure(Client::new); CLIENT_SPEC = specPair.getRight(); CLIENT = specPair.getLeft(); } @@ -149,7 +150,7 @@ public static class DisableSettings { public final BooleanValue disablePassivePedestal; public final BooleanValue disableSpawnEggRecipes; - DisableSettings(ForgeConfigSpec.Builder builder) { + DisableSettings(ModConfigSpec.Builder builder) { builder.comment("Disable sections of the mod") .push("disable"); @@ -187,7 +188,7 @@ public static class DisableSettings { } } - Common(ForgeConfigSpec.Builder builder) { + Common(ModConfigSpec.Builder builder) { chestLootEnabled = builder .comment("Determines whether Reliquary items will be generated in chest loot (mostly mob drops, very rarely some lower level items)") .worldRestart() @@ -215,7 +216,7 @@ public static class PotionSettings { public final BooleanValue differentDurations; public final BooleanValue redstoneAndGlowstone; - PotionSettings(ForgeConfigSpec.Builder builder) { + PotionSettings(ModConfigSpec.Builder builder) { builder.comment("Potions related settings").push("potions"); potionMap = builder @@ -243,7 +244,7 @@ public static class PotionSettings { } public static class ItemSettings { - ItemSettings(ForgeConfigSpec.Builder builder) { + ItemSettings(ModConfigSpec.Builder builder) { builder.push("items"); alkahestryTome = new AlkahestryTomeSettings(builder); @@ -283,7 +284,7 @@ public static class ItemSettings { public static class AlkahestryTomeSettings { public final IntValue chargeLimit; - AlkahestryTomeSettings(ForgeConfigSpec.Builder builder) { + AlkahestryTomeSettings(ModConfigSpec.Builder builder) { builder.comment("Alkahestry Tome settings") .push("alkahestryTome"); @@ -299,7 +300,7 @@ public static class MobCharmFragmentSettings { public final DoubleValue dropChance; public final DoubleValue lootingMultiplier; - MobCharmFragmentSettings(ForgeConfigSpec.Builder builder) { + MobCharmFragmentSettings(ModConfigSpec.Builder builder) { builder.comment("Mob Charm Fragment Settings") .push("mobCharmFragment"); @@ -316,7 +317,7 @@ public static class AngelicFeatherSettings { public final IntValue hungerCostPercent; public final IntValue leapingPotency; - AngelicFeatherSettings(ForgeConfigSpec.Builder builder) { + AngelicFeatherSettings(ModConfigSpec.Builder builder) { builder.comment("Angelic Feather settings").push("angelicFeather"); hungerCostPercent = builder @@ -336,7 +337,7 @@ public static class AngelHeartVialSettings { public final IntValue healPercentageOfMaxLife; public final BooleanValue removeNegativeStatus; - AngelHeartVialSettings(ForgeConfigSpec.Builder builder) { + AngelHeartVialSettings(ModConfigSpec.Builder builder) { builder.comment("Angelheart Vial settings").push("angelheartVial"); healPercentageOfMaxLife = builder @@ -362,29 +363,12 @@ public static class DestructionCatalystSettings { public final BooleanValue centeredExplosion; public final BooleanValue perfectCube; - DestructionCatalystSettings(ForgeConfigSpec.Builder builder) { + DestructionCatalystSettings(ModConfigSpec.Builder builder) { builder.comment("Destruction Catalyst settings").push("destructionCatalyst"); mundaneBlocks = builder .comment("List of mundane blocks the catalyst will break") - .define("mundaneBlocks", Lists.newArrayList( - "minecraft:dirt", - "minecraft:coarse_dirt", - "minecraft:podzol", - "minecraft:mycelium", - "minecraft:grass_block", - "minecraft:gravel", - "minecraft:cobblestone", - "minecraft:stone", - "minecraft:granite", - "minecraft:diorite", - "minecraft:andesite", - "minecraft:sand", - "minecraft:sandstone", - "minecraft:snow", - "minecraft:soul_sand", - "minecraft:netherrack", - "minecraft:end_stone")); + .define("mundaneBlocks", getMundaneBlocksDefault()); gunpowderCost = builder .comment("Number of gunpowder it costs per catalyst use") @@ -412,6 +396,30 @@ public static class DestructionCatalystSettings { builder.pop(); } + + private static List getMundaneBlocksDefault() { + return Stream.of( + Blocks.DIRT, + Blocks.COARSE_DIRT, + Blocks.PODZOL, + Blocks.MYCELIUM, + Blocks.GRASS_BLOCK, + Blocks.GRAVEL, + Blocks.COBBLESTONE, + Blocks.STONE, + Blocks.GRANITE, + Blocks.DIORITE, + Blocks.ANDESITE, + Blocks.SAND, + Blocks.SANDSTONE, + Blocks.SNOW, + Blocks.SOUL_SAND, + Blocks.NETHERRACK, + Blocks.END_STONE, + Blocks.DEEPSLATE, + Blocks.TUFF + ).map(b -> BuiltInRegistries.BLOCK.getKey(b).toString()).toList(); + } } public final EmperorChaliceSettings emperorChalice; @@ -419,7 +427,7 @@ public static class DestructionCatalystSettings { public static class EmperorChaliceSettings { public final IntValue hungerSatiationMultiplier; - EmperorChaliceSettings(ForgeConfigSpec.Builder builder) { + EmperorChaliceSettings(ModConfigSpec.Builder builder) { builder.comment("Emperor Chalice settings").push("emperorChalice"); hungerSatiationMultiplier = builder @@ -439,7 +447,7 @@ public static class EnderStaffSettings { public final IntValue enderPearlLimit; public final IntValue nodeWarpCastTime; - EnderStaffSettings(ForgeConfigSpec.Builder builder) { + EnderStaffSettings(ModConfigSpec.Builder builder) { builder.comment("Ender Staff settings").push("enderStaff"); enderPearlCastCost = builder @@ -472,7 +480,7 @@ public static class FortuneCoinSettings { public final IntValue standardPullDistance; public final IntValue longRangePullDistance; - FortuneCoinSettings(ForgeConfigSpec.Builder builder) { + FortuneCoinSettings(ModConfigSpec.Builder builder) { builder.comment("Fortune Coin settings").push("fortuneCoin"); standardPullDistance = builder @@ -497,7 +505,7 @@ public static class GlacialStaffSettings { public final IntValue snowballDamageBonusFireImmune; public final IntValue snowballDamageBonusBlaze; - GlacialStaffSettings(ForgeConfigSpec.Builder builder) { + GlacialStaffSettings(ModConfigSpec.Builder builder) { builder.comment("Glacial Staff settings").push("glacialStaff"); snowballLimit = builder @@ -533,7 +541,7 @@ public static class GlacialStaffSettings { public static class HandgunSettings { public final IntValue maxSkillLevel; - public HandgunSettings(ForgeConfigSpec.Builder builder) { + public HandgunSettings(ModConfigSpec.Builder builder) { builder.comment("Handgun settings").push("handgun"); maxSkillLevel = builder @@ -558,7 +566,7 @@ public static class HarvestRodSettings { public final IntValue pedestalRange; public final IntValue pedestalCooldown; - HarvestRodSettings(ForgeConfigSpec.Builder builder) { + HarvestRodSettings(ModConfigSpec.Builder builder) { builder.comment("Harvest Rod settings").push("harvestRod"); boneMealLimit = builder @@ -608,24 +616,24 @@ public static class HarvestRodSettings { public final HeroMedallionSettings heroMedallion; public static class HeroMedallionSettings { - public final IntValue pedestalCoolDown; + public final IntValue repairCoolDown; public final IntValue pedestalRange; - public final IntValue pedestalRepairStepXP; + public final IntValue repairStepXP; - HeroMedallionSettings(ForgeConfigSpec.Builder builder) { + HeroMedallionSettings(ModConfigSpec.Builder builder) { builder.comment("Hero Medallion settings").push("heroMedallion"); - pedestalCoolDown = builder - .comment("Cooldown between hero medallion tries to fix mending items in nearby pedestals") - .defineInRange("pedestalCoolDown", 20, 1, 100); + repairCoolDown = builder + .comment("Cooldown between tries to fix items repaired with xp") + .defineInRange("repairCoolDown", 20, 1, 100); pedestalRange = builder .comment("Range in which pedestals are checked for items with mending enchant that need fixing") .defineInRange("pedestalRange", 5, 1, 20); - pedestalRepairStepXP = builder + repairStepXP = builder .comment("Maximum amount of xp that is used each time medallion repairs items") - .defineInRange("pedestalRepairStepXP", 5, 1, 20); + .defineInRange("repairStepXP", 5, 1, 20); builder.pop(); } @@ -641,7 +649,7 @@ public static class IceMagusRodSettings { public final IntValue snowballDamageBonusFireImmune; public final IntValue snowballDamageBonusBlaze; - IceMagusRodSettings(ForgeConfigSpec.Builder builder) { + IceMagusRodSettings(ModConfigSpec.Builder builder) { builder.comment("Ice Magus Rod settings").push("iceMagusRod"); snowballLimit = builder @@ -678,7 +686,7 @@ public static class InfernalChaliceSettings { public final IntValue hungerCostPercent; public final IntValue fluidLimit; - InfernalChaliceSettings(ForgeConfigSpec.Builder builder) { + InfernalChaliceSettings(ModConfigSpec.Builder builder) { builder.comment("Infernal Chalice settings").push("infernalChalice"); hungerCostPercent = builder @@ -698,7 +706,7 @@ public static class InfernalChaliceSettings { public static class InfernalClawsSettings { public final IntValue hungerCostPercent; - InfernalClawsSettings(ForgeConfigSpec.Builder builder) { + InfernalClawsSettings(ModConfigSpec.Builder builder) { builder.comment("Infernal Claws settings").push("infernalClaws"); hungerCostPercent = builder @@ -714,22 +722,27 @@ public static class InfernalClawsSettings { public static class InfernalTearSettings { private static final String ITEM_EXPERIENCE_MATCHER = "([a-z1-9_.-]+:[a-z1-9_/.-]+)\\|\\d+"; public final BooleanValue absorbWhenCreated; - @SuppressWarnings("java:S4968") // ? extends String is the type parameter returned from defineList so it can't be just String here - public final ForgeConfigSpec.ConfigValue> itemExperienceList; + @SuppressWarnings("java:S4968") + // ? extends String is the type parameter returned from defineList so it can't be just String here + public final ModConfigSpec.ConfigValue> itemExperienceList; @Nullable private Map itemExperience = null; - InfernalTearSettings(ForgeConfigSpec.Builder builder) { + InfernalTearSettings(ModConfigSpec.Builder builder) { builder.comment("Infernal Tear settings").push("infernalTear"); absorbWhenCreated = builder .comment("Whether the infernal tear starts absorbing immediately after it is set to item type") .define("absorbWhenCreated", false); itemExperienceList = builder.comment("List of items that can be consumed by infernal tear with their experience point value") - .defineList("itemExperienceList", this::getDefaultInfernalTearMappings, mapping -> ((String) mapping).matches(ITEM_EXPERIENCE_MATCHER)); + .defineList("itemExperienceList", this::getDefaultInfernalTearMappings, this::getNewMapping, mapping -> ((String) mapping).matches(ITEM_EXPERIENCE_MATCHER)); builder.pop(); } + private String getNewMapping() { + return "example_mod:example_item|1"; + } + private List getDefaultInfernalTearMappings() { List ret = new ArrayList<>(); ret.add("minecraft:emerald|63"); @@ -780,7 +793,7 @@ public void resetCache() { public static class KrakenShellSettings { public final IntValue hungerCostPercent; - KrakenShellSettings(ForgeConfigSpec.Builder builder) { + KrakenShellSettings(ModConfigSpec.Builder builder) { builder.comment("Kraken Shell settings").push("krakenShell"); hungerCostPercent = builder @@ -798,7 +811,7 @@ public static class LanternOfParanoiaSettings { public final IntValue minLightLevel; public final IntValue placementScanRadius; - LanternOfParanoiaSettings(ForgeConfigSpec.Builder builder) { + LanternOfParanoiaSettings(ModConfigSpec.Builder builder) { builder.comment("Lantern of Paranoia settings").push("lanternOfParanoia"); torches = builder @@ -824,7 +837,7 @@ public static class MidasTouchstoneSettings { public final IntValue glowstoneWorth; public final IntValue glowstoneLimit; - MidasTouchstoneSettings(ForgeConfigSpec.Builder builder) { + MidasTouchstoneSettings(ModConfigSpec.Builder builder) { builder.comment("Midas Touchstone settings").push("midasTouchstone"); goldItems = builder @@ -858,10 +871,14 @@ public static class MobCharmSettings { public final IntValue maxCharmsToDisplay; public final IntValue pedestalRange; public final BooleanValue keepAlmostDestroyedDisplayed; - @SuppressWarnings("java:S4968") // ? extends String is the type parameter returned from defineList so it can't be just String here + @SuppressWarnings("java:S4968") + // ? extends String is the type parameter returned from defineList so it can't be just String here public final ConfigValue> entityBlockList; - MobCharmSettings(ForgeConfigSpec.Builder builder) { + @Nullable + private Set entityBlockListCache = null; + + MobCharmSettings(ModConfigSpec.Builder builder) { builder.comment("Mob Charm settings").push("mobCharm"); durability = builder @@ -889,16 +906,34 @@ public static class MobCharmSettings { .define("keepAlmostDestroyedDisplayed", true); entityBlockList = builder .comment("List of hostile entities that are not supposed to have mob charms registered for them") - .defineList("entityBlockList", this::getDefaultEntityBlockList, entityName -> ((String) entityName).matches(REGISTRY_NAME_MATCHER)); + .defineList("entityBlockList", this::getDefaultEntityBlockList, this::getNewElement, entityName -> ((String) entityName).matches(REGISTRY_NAME_MATCHER)); builder.pop(); } + private String getNewElement() { + return "example_mod:example_entity"; + } + private List getDefaultEntityBlockList() { List ret = new ArrayList<>(); ret.add("minecraft:ender_dragon"); ret.add("minecraft:wither"); return ret; } + + public boolean isBlockedEntity(ResourceLocation registryName) { + if (entityBlockListCache == null) { + entityBlockListCache = new HashSet<>(); + for (String entityName : entityBlockList.get()) { + entityBlockListCache.add(ResourceLocation.parse(entityName)); + } + } + return entityBlockListCache.contains(registryName); + } + + public void resetCache() { + entityBlockListCache = null; + } } public final PhoenixDownSettings phoenixDown; @@ -913,7 +948,7 @@ public static class PhoenixDownSettings { public final BooleanValue giveTemporaryFireResistanceIfFireDamageKilledYou; public final BooleanValue giveTemporaryWaterBreathingIfDrowningKilledYou; - PhoenixDownSettings(ForgeConfigSpec.Builder builder) { + PhoenixDownSettings(ModConfigSpec.Builder builder) { builder.comment("Phoenix Down settings").push("PhoenixDown"); hungerCostPercent = builder @@ -964,7 +999,7 @@ public static class PyromancerStaffSettings { public final IntValue blazePowderWorth; public final IntValue blazeAbsorbWorth; - PyromancerStaffSettings(ForgeConfigSpec.Builder builder) { + PyromancerStaffSettings(ModConfigSpec.Builder builder) { builder.comment("Pyromancer Staff settings").push("pyromancerStaff"); fireChargeLimit = builder @@ -1018,7 +1053,7 @@ public static class RendingGaleSettings { public final ConfigValue> pushableEntitiesBlacklist; public final ConfigValue> pushableProjectilesBlacklist; - RendingGaleSettings(ForgeConfigSpec.Builder builder) { + RendingGaleSettings(ModConfigSpec.Builder builder) { builder.comment("Rending Gale settings").push("rendingGale"); chargeLimit = builder @@ -1055,7 +1090,7 @@ public static class RendingGaleSettings { pedestalCostPerSecond = builder .comment("Cost per second of buffing players with flight") - .defineInRange("pedestalCostPerSecond", 5, 1, 20); + .defineInRange("pedestalCostPerSecond", 2, 1, 20); pushableEntitiesBlacklist = builder .comment("List of entities that are banned from being pushed by the Rending Gale") @@ -1080,12 +1115,13 @@ public static class RodOfLyssaSettings { public final BooleanValue angerOnStealFailure; public final BooleanValue stealFromPlayers; private static final String ENTITY_NAME_MATCHER = "[a-z1-9_.-]+:[a-z1-9_/.-]+"; - @SuppressWarnings("java:S4968") // ? extends String is the type parameter returned from defineList so it can't be just String here - public final ForgeConfigSpec.ConfigValue> entityBlockList; + @SuppressWarnings("java:S4968") + // ? extends String is the type parameter returned from defineList so it can't be just String here + public final ModConfigSpec.ConfigValue> entityBlockList; @Nullable private Set> blockedEntities = null; - RodOfLyssaSettings(ForgeConfigSpec.Builder builder) { + RodOfLyssaSettings(ModConfigSpec.Builder builder) { builder.comment("Rod of Lyssa settings").push("rodOfLyssa"); useLeveledFailureRate = builder @@ -1117,12 +1153,16 @@ public static class RodOfLyssaSettings { .define("stealFromPlayers", true); entityBlockList = builder.comment("List of entities on which lyssa rod doesn't work - full registry name is required here") - .defineList("entityBlockList", new ArrayList<>(), mapping -> ((String) mapping).matches(ENTITY_NAME_MATCHER)); + .defineList("entityBlockList", new ArrayList<>(), this::getNewElement, mapping -> ((String) mapping).matches(ENTITY_NAME_MATCHER)); builder.pop(); } + private String getNewElement() { + return "example_mod:example_entity"; + } + public boolean canStealFromEntity(Entity entity) { - if(blockedEntities == null) { + if (blockedEntities == null) { initBlockedEntityTypes(); } return !blockedEntities.contains(entity.getType()); @@ -1131,10 +1171,8 @@ public boolean canStealFromEntity(Entity entity) { private void initBlockedEntityTypes() { blockedEntities = new HashSet<>(); for (var entityName : entityBlockList.get()) { - EntityType entityType = ForgeRegistries.ENTITY_TYPES.getValue(new ResourceLocation(entityName)); - if (entityType != null) { - blockedEntities.add(entityType); - } + BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.parse(entityName)) + .ifPresent(entityType -> blockedEntities.add(entityType)); } } } @@ -1144,7 +1182,7 @@ private void initBlockedEntityTypes() { public static class SeekerShotSettings { public final ConfigValue> huntableEntitiesBlacklist; - SeekerShotSettings(ForgeConfigSpec.Builder builder) { + SeekerShotSettings(ModConfigSpec.Builder builder) { builder.comment("Seeker Shot settings").push("seekerShot"); huntableEntitiesBlacklist = builder @@ -1163,7 +1201,10 @@ public static class SojournerStaffSettings { public final IntValue maxRange; public final IntValue tilePerCostMultiplier; - SojournerStaffSettings(ForgeConfigSpec.Builder builder) { + @Nullable + private Set torchItems = null; + + SojournerStaffSettings(ModConfigSpec.Builder builder) { builder.comment("Sojourner Staff settings").push("sojournerStaff"); torches = builder @@ -1186,6 +1227,17 @@ public static class SojournerStaffSettings { } + public Set getTorchItems() { + if (torchItems == null) { + torchItems = getTorchItemsFromRegistryNames(); + } + return torchItems; + } + + private Set getTorchItemsFromRegistryNames() { + return torches.get().stream().map(torchRegistryName -> BuiltInRegistries.ITEM.get(ResourceLocation.parse(torchRegistryName))).collect(Collectors.toSet()); + } + private ArrayList getDefaultTorches() { return Lists.newArrayList( getItemRegistryName(Items.TORCH), @@ -1199,6 +1251,14 @@ private ArrayList getDefaultTorches() { getItemRegistryName(Items.END_ROD) ); } + + public boolean isTorch(ItemStack stack) { + return getTorchItems().contains(stack.getItem()); + } + + private void resetCache() { + torchItems = null; + } } public final TwilightCloakSettings twilightCloak; @@ -1206,7 +1266,7 @@ private ArrayList getDefaultTorches() { public static class TwilightCloakSettings { public final IntValue maxLightLevel; - TwilightCloakSettings(ForgeConfigSpec.Builder builder) { + TwilightCloakSettings(ModConfigSpec.Builder builder) { builder.comment("Twilight Cloak settings").push("twilightCloak"); maxLightLevel = builder @@ -1223,7 +1283,7 @@ public static class VoidTearSettings { public final IntValue itemLimit; public final BooleanValue absorbWhenCreated; - VoidTearSettings(ForgeConfigSpec.Builder builder) { + VoidTearSettings(ModConfigSpec.Builder builder) { builder.comment("Void Tear settings").push("voidTear"); itemLimit = builder @@ -1240,7 +1300,7 @@ public static class VoidTearSettings { } public static class BlockSettings { - BlockSettings(ForgeConfigSpec.Builder builder) { + BlockSettings(ModConfigSpec.Builder builder) { builder.push("blocks"); altar = new AltarSettings(builder); apothecaryCauldron = new ApothecaryCauldronSettings(builder); @@ -1258,7 +1318,7 @@ public static class AltarSettings { public final IntValue maximumTimeVarianceInMinutes; public final IntValue outputLightLevelWhileActive; - AltarSettings(ForgeConfigSpec.Builder builder) { + AltarSettings(ModConfigSpec.Builder builder) { builder.comment("Altar of Light settings").push("altar"); redstoneCost = builder @@ -1289,7 +1349,7 @@ public static class ApothecaryCauldronSettings { public final ConfigValue> heatSources; public final IntValue glowstoneLimit; - ApothecaryCauldronSettings(ForgeConfigSpec.Builder builder) { + ApothecaryCauldronSettings(ModConfigSpec.Builder builder) { builder.comment("Apothecary Cauldron settings").push("apothecaryCauldron"); redstoneLimit = builder @@ -1319,7 +1379,7 @@ public static class FertileLilypadSettings { public final IntValue tileRange; public final IntValue fullPotencyRange; - FertileLilypadSettings(ForgeConfigSpec.Builder builder) { + FertileLilypadSettings(ModConfigSpec.Builder builder) { builder.comment("Lilypad of Fertility settings").push("fertileLilypad"); secondsBetweenGrowthTicks = builder @@ -1346,7 +1406,7 @@ public static class InterdictionTorchSettings { public final ConfigValue> pushableEntitiesBlacklist; public final ConfigValue> pushableProjectilesBlacklist; - InterdictionTorchSettings(ForgeConfigSpec.Builder builder) { + InterdictionTorchSettings(ModConfigSpec.Builder builder) { builder.comment("Interdiction Torch settings").push("interdictionTorch"); pushRadius = builder @@ -1382,7 +1442,7 @@ public static class PedestalSettings { public final IntValue fishingWrapperSuccessRate; public final IntValue fishingWrapperRetractDelay; - PedestalSettings(ForgeConfigSpec.Builder builder) { + PedestalSettings(ModConfigSpec.Builder builder) { builder.comment("Pedestal related settings").push("pedestal"); meleeWrapperRange = builder @@ -1428,10 +1488,10 @@ public static class PedestalSettings { } public static final Common COMMON; - public static final ForgeConfigSpec COMMON_SPEC; + public static final ModConfigSpec COMMON_SPEC; static { - final Pair specPair = new ForgeConfigSpec.Builder().configure(Common::new); + final Pair specPair = new ModConfigSpec.Builder().configure(Common::new); COMMON_SPEC = specPair.getRight(); COMMON = specPair.getLeft(); } diff --git a/src/main/java/reliquary/reference/Reference.java b/src/main/java/reliquary/reference/Reference.java index b5f7cdcd..d7f125ac 100644 --- a/src/main/java/reliquary/reference/Reference.java +++ b/src/main/java/reliquary/reference/Reference.java @@ -1,13 +1,8 @@ package reliquary.reference; -public class Reference { - // class for all the mod related constants - public static final String VERSION = "@MOD_VERSION@"; - - public static final String MOD_ID = "reliquary"; - public static final String DOMAIN = MOD_ID.toLowerCase() + ":"; - public static final String MOD_NAME = "Reliquary"; +import reliquary.Reliquary; +public class Reference { public static final String ART_PATH_ENTITIES = "textures/entities/"; //minecraft under-the-hood potion names @@ -36,5 +31,6 @@ public class Reference { public static final String BLIND = "blindness"; //reliquary potion names - public static final String CURE = MOD_ID + ":cure"; + public static final String CURE = Reliquary.MOD_ID + ":cure"; + public static final String FLIGHT = Reliquary.MOD_ID + ":flight"; } diff --git a/src/main/java/reliquary/util/CodecHelper.java b/src/main/java/reliquary/util/CodecHelper.java new file mode 100644 index 00000000..745bdde3 --- /dev/null +++ b/src/main/java/reliquary/util/CodecHelper.java @@ -0,0 +1,26 @@ +package reliquary.util; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.component.DataComponentPatch; +import net.minecraft.world.item.ItemStack; + +import java.util.Set; + +public class CodecHelper { + public static final Codec OVERSIZED_ITEM_STACK_CODEC = Codec.lazyInitialized( + () -> RecordCodecBuilder.create( + instance -> instance.group( + ItemStack.ITEM_NON_AIR_CODEC.fieldOf("id").forGetter(ItemStack::getItemHolder), + Codec.INT.fieldOf("count").orElse(1).forGetter(ItemStack::getCount), + DataComponentPatch.CODEC + .optionalFieldOf("components", DataComponentPatch.EMPTY) + .forGetter(ItemStack::getComponentsPatch) + ) + .apply(instance, ItemStack::new))); + + + public static Codec> setOf(Codec elementCodec) { + return new SetCodec<>(elementCodec); + } +} diff --git a/src/main/java/reliquary/util/CombinedItemHandler.java b/src/main/java/reliquary/util/CombinedItemHandler.java index 18154deb..d099bd04 100644 --- a/src/main/java/reliquary/util/CombinedItemHandler.java +++ b/src/main/java/reliquary/util/CombinedItemHandler.java @@ -1,8 +1,8 @@ package reliquary.util; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.wrapper.EmptyHandler; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.wrapper.EmptyItemHandler; import org.jetbrains.annotations.NotNull; // combines multiple IItemHandler into one interface @@ -25,7 +25,9 @@ public CombinedItemHandler(IItemHandler... itemHandler) { // returns the handler index for the slot protected int getIndexForSlot(int slot) { - if (slot < 0) {return -1;} + if (slot < 0) { + return -1; + } for (int i = 0; i < baseIndex.length; i++) { if (slot - baseIndex[i] < 0) { @@ -37,7 +39,7 @@ protected int getIndexForSlot(int slot) { protected IItemHandler getHandlerFromIndex(int index) { if (index < 0 || index >= itemHandler.length) { - return EmptyHandler.INSTANCE; + return EmptyItemHandler.INSTANCE; } return itemHandler[index]; } diff --git a/src/main/java/reliquary/util/FakePlayerFactory.java b/src/main/java/reliquary/util/FakePlayerFactory.java new file mode 100644 index 00000000..343b8d38 --- /dev/null +++ b/src/main/java/reliquary/util/FakePlayerFactory.java @@ -0,0 +1,25 @@ +package reliquary.util; + +import net.minecraft.server.level.ServerLevel; +import reliquary.entities.ReliquaryFakePlayer; + +public class FakePlayerFactory { + private FakePlayerFactory() {} + + private static ReliquaryFakePlayer fakePlayer; + + public static ReliquaryFakePlayer get(ServerLevel level) { + if (fakePlayer == null) { + fakePlayer = new ReliquaryFakePlayer(level); + } + + return fakePlayer; + } + + public static void unloadWorld(ServerLevel level) { + if (fakePlayer != null && fakePlayer.level() == level) { + fakePlayer = null; + } + } + +} diff --git a/src/main/java/reliquary/util/InventoryHelper.java b/src/main/java/reliquary/util/InventoryHelper.java index ad7abf39..5f2c56ee 100644 --- a/src/main/java/reliquary/util/InventoryHelper.java +++ b/src/main/java/reliquary/util/InventoryHelper.java @@ -11,37 +11,24 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraftforge.common.capabilities.ForgeCapabilities; -import net.minecraftforge.common.util.LazyOptional; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.ItemHandlerHelper; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.capabilities.Capabilities; +import net.neoforged.neoforge.items.IItemHandler; +import net.neoforged.neoforge.items.wrapper.PlayerMainInvWrapper; import reliquary.items.ToggleableItem; -import reliquary.items.util.ICuriosItem; import javax.annotation.Nullable; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.function.BiFunction; +import java.util.*; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; public class InventoryHelper { - private InventoryHelper() {} - - private static final Set> baublesItemHandlerFactories = new HashSet<>(); - - public static void addBaublesItemHandlerFactory(BiFunction factory) { - baublesItemHandlerFactories.add(factory); + private InventoryHelper() { } - public static void spawnItemStack(Level world, BlockPos pos, ItemStack stack) { - Containers.dropItemStack(world, pos.getX(), pos.getY(), pos.getZ(), stack); + public static void spawnItemStack(Level level, BlockPos pos, ItemStack stack) { + Containers.dropItemStack(level, pos.getX(), pos.getY(), pos.getZ(), stack); } public static ItemStack getTargetItem(ItemStack self, IItemHandler inventory) { @@ -53,7 +40,7 @@ public static ItemStack getTargetItem(ItemStack self, IItemHandler inventory) { int itemQuantity = 0; for (int slot = 0; slot < inventory.getSlots(); slot++) { ItemStack stack = inventory.getStackInSlot(slot); - if (ItemHandlerHelper.canItemStacksStack(self, stack) || stack.getMaxStackSize() == 1) { + if (ItemStack.isSameItemSameComponents(self, stack) || stack.getMaxStackSize() == 1) { continue; } if (getItemQuantity(stack, inventory) > itemQuantity) { @@ -72,7 +59,7 @@ public static int getItemQuantity(ItemStack stack, IItemHandler inventory) { int itemQuantity = 0; for (int slot = 0; slot < inventory.getSlots(); slot++) { ItemStack newStack = inventory.getStackInSlot(slot); - if (ItemHandlerHelper.canItemStacksStack(stack, newStack)) { + if (ItemStack.isSameItemSameComponents(stack, newStack)) { itemQuantity += newStack.getCount(); } } @@ -80,9 +67,7 @@ public static int getItemQuantity(ItemStack stack, IItemHandler inventory) { } public static ItemStack consumeItemStack(Predicate itemMatches, Player player, int count) { - return player.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP) - .map(inventory -> extractFromInventory(itemMatches, count, inventory, false)) - .orElse(ItemStack.EMPTY); + return extractFromInventory(itemMatches, count, getMainInventoryItemHandlerFrom(player), false); } public static ItemStack extractFromInventory(Predicate itemMatches, int count, IItemHandler inventory, boolean simulate) { @@ -90,7 +75,7 @@ public static ItemStack extractFromInventory(Predicate itemMatches, i int slots = inventory.getSlots(); for (int slot = 0; slot < slots && ret.getCount() < count; slot++) { ItemStack slotStack = inventory.getStackInSlot(slot); - if (itemMatches.test(slotStack) && (ret.isEmpty() || ItemHandlerHelper.canItemStacksStack(ret, slotStack))) { + if (itemMatches.test(slotStack) && (ret.isEmpty() || ItemStack.isSameItemSameComponents(ret, slotStack))) { int toExtract = Math.min(slotStack.getCount(), count - ret.getCount()); ItemStack extractedStack = inventory.extractItem(slot, toExtract, simulate); if (ret.isEmpty()) { @@ -116,7 +101,7 @@ public static boolean consumeItem(ItemStack itemStack, Player player, int minCou List> slotCounts = new ArrayList<>(); for (int slot = 0; slot < player.getInventory().items.size(); slot++) { ItemStack slotStack = player.getInventory().items.get(slot); - if (ItemHandlerHelper.canItemStacksStack(slotStack, itemStack)) { + if (ItemStack.isSameItemSameComponents(slotStack, itemStack)) { int stackSize = slotStack.getCount(); itemCount += stackSize; slotCounts.add(new AbstractMap.SimpleEntry<>(slot, stackSize)); @@ -166,7 +151,7 @@ public static int tryToRemoveFromInventory(ItemStack contents, IItemHandler inve } //storage drawers compatibility loop - while (inventory.getStackInSlot(slot).getCount() > 0 && ItemHandlerHelper.canItemStacksStack(inventory.getStackInSlot(slot), contents) && remaining > 0) { + while (inventory.getStackInSlot(slot).getCount() > 0 && ItemStack.isSameItemSameComponents(inventory.getStackInSlot(slot), contents) && remaining > 0) { ItemStack extractedStack = inventory.extractItem(slot, Math.min(maxToRemove, inventory.getStackInSlot(slot).getCount()), false); if (extractedStack.getCount() == 0) { break; //just in case some item handler shows stacks that can't be extracted @@ -186,34 +171,63 @@ public static int tryToRemoveFromInventory(ItemStack contents, IItemHandler inve return maxToRemove - remaining; } - public static LazyOptional getInventoryAtPos(Level world, BlockPos pos) { - return getInventoryAtPos(world, pos, null); + public static void runOnInventoryAt(Level level, BlockPos pos, Consumer run) { + IItemHandler itemHandler = getInventoryAtPos(level, pos, null); + if (itemHandler == null) { + return; + } + run.accept(itemHandler); + } + + @Nullable + public static IItemHandler getInventoryAtPos(Level level, BlockPos pos, @Nullable Direction side) { + return level.getCapability(Capabilities.ItemHandler.BLOCK, pos, side); } - public static LazyOptional getInventoryAtPos(Level world, BlockPos pos, @Nullable Direction side) { - return WorldHelper.getBlockEntity(world, pos).map(te -> InventoryHelper.getItemHandlerFrom(te, side)).orElse(LazyOptional.empty()); + @Nullable + public static IItemHandler getItemHandlerFrom(Player player) { + return player.getCapability(Capabilities.ItemHandler.ENTITY); } - public static LazyOptional getItemHandlerFrom(Player player, @Nullable Direction side) { - return player.getCapability(ForgeCapabilities.ITEM_HANDLER, side); + public static IItemHandler getMainInventoryItemHandlerFrom(Player player) { + return new PlayerMainInvWrapper(player.getInventory()); } - public static LazyOptional getItemHandlerFrom(Player player) { - return getItemHandlerFrom(player, Direction.UP); + public static void executeOnItemHandlerAt(Level level, BlockPos pos, BlockState state, BlockEntity blockEntity, Consumer run) { + executeOnItemHandlerAt(level, pos, state, blockEntity, handler -> { + run.accept(handler); + return null; + }, null); } - public static LazyOptional getItemHandlerFrom(BlockEntity te) { - return getItemHandlerFrom(te, null); + public static T executeOnItemHandlerAt(Level level, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, Function run, @Nullable T defaultReturnValue) { + return executeOnItemHandlerAt(level, pos, state, blockEntity, null, run, defaultReturnValue); } - private static LazyOptional getItemHandlerFrom(BlockEntity te, @Nullable Direction side) { - return te.getCapability(ForgeCapabilities.ITEM_HANDLER, side); + private static T executeOnItemHandlerAt(Level level, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, @Nullable Direction side, Function run, @Nullable T defaultReturnValue) { + IItemHandler itemHandler = level.getCapability(Capabilities.ItemHandler.BLOCK, pos, state, blockEntity, side); + + if (itemHandler != null) { + return run.apply(itemHandler); + } + + //noinspection DataFlowIssue - sometimes null may be produced based on default value being null, ignoring here not to have to deal with nullability check everywhere this is used + return defaultReturnValue; } public static int insertIntoInventory(ItemStack contents, IItemHandler inventory) { return tryToAddToInventory(contents, inventory, contents.getCount()); } + public static int tryToAddToInventoryAtPos(ItemStack contents, Level level, BlockPos pos, Direction side, int maxToAdd) { + IItemHandler inventory = getInventoryAtPos(level, pos, side); + if (inventory == null) { + return 0; + } + + return tryToAddToInventory(contents, inventory, maxToAdd); + } + public static int tryToAddToInventory(ItemStack contents, IItemHandler inventory, int maxToAdd) { int inventorySize = inventory.getSlots(); @@ -240,16 +254,16 @@ public static int tryToAddToInventory(ItemStack contents, IItemHandler inventory return maxToAdd - remaining; } - public static void tryRemovingLastStack(IItemHandler inventory, Level world, BlockPos pos) { + public static void tryRemovingLastStack(IItemHandler inventory, Level level, BlockPos pos) { for (int i = inventory.getSlots() - 1; i >= 0; i--) { if (!inventory.getStackInSlot(i).isEmpty()) { ItemStack stack = inventory.getStackInSlot(i).copy(); inventory.extractItem(i, stack.getCount(), false); - if (world.isClientSide) { + if (level.isClientSide) { return; } - ItemEntity itemEntity = new ItemEntity(world, pos.getX() + 0.5D, pos.getY() + 1D, pos.getZ() + 0.5D, stack); - world.addFreshEntity(itemEntity); + ItemEntity itemEntity = new ItemEntity(level, pos.getX() + 0.5D, pos.getY() + 1D, pos.getZ() + 0.5D, stack); + level.addFreshEntity(itemEntity); break; } } @@ -277,34 +291,16 @@ public static boolean tryAddingPlayerCurrentItem(Player player, IItemHandler inv } public static boolean playerHasItem(Player player, Item item) { - return playerHasItem(player, item, false, ICuriosItem.Type.NONE); + return playerHasItem(player, item, false); } - public static boolean playerHasItem(Player player, Item item, boolean checkEnabled, ICuriosItem.Type baubleType) { - for (ItemStack stack : player.getInventory().items) { + public static boolean playerHasItem(Player player, Item item, boolean checkEnabled) { + return PlayerInventoryProvider.get().getFromPlayerInventoryHandlers(player, (stack, result) -> { if (stack.isEmpty()) { - continue; - } - if (stack.getItem() == item && (!(checkEnabled && stack.getItem() instanceof ToggleableItem) || ((ToggleableItem) stack.getItem()).isEnabled(stack))) { - return true; + return false; } - } - - return baubleType != ICuriosItem.Type.NONE && hasItemInBaubleInventories(player, item, checkEnabled, baubleType); - } - - private static boolean hasItemInBaubleInventories(Player player, Item item, boolean checkEnabled, ICuriosItem.Type baubleType) { - for (BiFunction factory : baublesItemHandlerFactories) { - IItemHandler handler = factory.apply(player, baubleType); - for (int i = 0; i < handler.getSlots(); i++) { - ItemStack baubleStack = handler.getStackInSlot(i); - if (!baubleStack.isEmpty() && baubleStack.getItem() == item && - (!(checkEnabled && baubleStack.getItem() instanceof ToggleableItem) || ((ToggleableItem) baubleStack.getItem()).isEnabled(baubleStack))) { - return true; - } - } - } - return false; + return stack.getItem() == item && (!(checkEnabled && stack.getItem() instanceof ToggleableItem) || ((ToggleableItem) stack.getItem()).isEnabled(stack)); + }, result -> result, () -> false); } public static ItemStack getCorrectItemFromEitherHand(Player player, Item item) { @@ -341,37 +337,21 @@ public static NonNullList getItemStacks(IItemHandler inventory) { return ret; } - public static void dropInventoryItems(Level world, BlockPos pos, IItemHandler inventory) { - dropInventoryItems(world, pos.getX(), pos.getY(), pos.getZ(), inventory); + public static void dropInventoryItems(Level level, BlockPos pos, IItemHandler inventory) { + dropInventoryItems(level, pos.getX(), pos.getY(), pos.getZ(), inventory); } - private static void dropInventoryItems(Level world, double x, double y, double z, IItemHandler inventory) { + private static void dropInventoryItems(Level level, double x, double y, double z, IItemHandler inventory) { for (int i = 0; i < inventory.getSlots(); ++i) { ItemStack itemstack = inventory.getStackInSlot(i); if (!itemstack.isEmpty()) { - Containers.dropItemStack(world, x, y, z, itemstack); + Containers.dropItemStack(level, x, y, z, itemstack); } } } - public static boolean hasItemHandler(Level world, BlockPos pos) { - return WorldHelper.getBlockEntity(world, pos).map(InventoryHelper::hasItemHandler).orElse(false); - } - - private static boolean hasItemHandler(BlockEntity te) { - return te.getCapability(ForgeCapabilities.ITEM_HANDLER, null).isPresent(); - } - - public static void runOnItemHandler(ItemStack stack, Consumer run, Class itemHandlerClass) { - getItemHandler(stack, itemHandlerClass).ifPresent(run); - } - - private static Optional getItemHandler(ItemStack stack, Class itemHandlerClass) { - return stack.getCapability(ForgeCapabilities.ITEM_HANDLER, null).filter(itemHandlerClass::isInstance).map(itemHandlerClass::cast); - } - - public static Optional getFromHandler(ItemStack stack, Function get, Class itemHandlerClass) { - return getItemHandler(stack, itemHandlerClass).map(get); + public static boolean hasItemHandler(Level level, BlockPos pos) { + return executeOnItemHandlerAt(level, pos, level.getBlockState(pos), null, handler -> true, false); } } diff --git a/src/main/java/reliquary/util/LogHelper.java b/src/main/java/reliquary/util/LogHelper.java index 0429a889..024d63a1 100644 --- a/src/main/java/reliquary/util/LogHelper.java +++ b/src/main/java/reliquary/util/LogHelper.java @@ -1,17 +1,13 @@ package reliquary.util; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.Marker; -import org.apache.logging.log4j.MarkerManager; +import org.apache.logging.log4j.*; import org.apache.logging.log4j.message.Message; -import reliquary.reference.Reference; +import reliquary.Reliquary; @SuppressWarnings({"unused", "WeakerAccess"}) public class LogHelper { - private static final Marker MOD_MARKER = MarkerManager.getMarker(Reference.MOD_ID); - private static final Logger logger = LogManager.getLogger(Reference.MOD_ID); + private static final Marker MOD_MARKER = MarkerManager.getMarker(Reliquary.MOD_ID); + private static final Logger logger = LogManager.getLogger(Reliquary.MOD_ID); public static void log(Level level, Marker marker, Message message) { logger.log(level, marker, message); @@ -22,7 +18,7 @@ public static void log(Level level, Marker marker, Object object) { } public static void log(Level level, Marker marker, String message) { - logger.log(level, marker, "[{}] {}", Reference.MOD_ID, message); + logger.log(level, marker, "[{}] {}", Reliquary.MOD_ID, message); } public static void log(Level level, Marker marker, String format, Object... params) { diff --git a/src/main/java/reliquary/util/NBTHelper.java b/src/main/java/reliquary/util/NBTHelper.java deleted file mode 100644 index cfd359a7..00000000 --- a/src/main/java/reliquary/util/NBTHelper.java +++ /dev/null @@ -1,220 +0,0 @@ -package reliquary.util; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.Tag; -import net.minecraft.world.item.ItemStack; - -import javax.annotation.Nullable; -import java.util.Optional; -import java.util.function.BiFunction; -import java.util.function.Function; - -@SuppressWarnings("SameParameterValue") -public class NBTHelper { - - private static final String SLOTS_TAG = "Slots"; - private static final String STACK_TAG = "Stack"; - private static final String COUNT_TAG = "Count"; - - private NBTHelper() {} - - public static short getShort(String s, ItemStack stack) { - CompoundTag tagCompound = getTag(stack); - return tagCompound.getShort(s); - } - - public static void putShort(String s, ItemStack stack, short i) { - CompoundTag tagCompound = getTag(stack); - tagCompound.putShort(s, i); - stack.setTag(tagCompound); - } - - public static int getInt(String s, ItemStack stack) { - CompoundTag tagCompound = getTag(stack); - return tagCompound.getInt(s); - } - - public static void putInt(String s, ItemStack stack, int i) { - CompoundTag tagCompound = getTag(stack); - tagCompound.putInt(s, i); - stack.setTag(tagCompound); - } - - public static long getLong(String s, ItemStack stack) { - CompoundTag tagCompound = getTag(stack); - return tagCompound.getLong(s); - } - - public static void putLong(String s, ItemStack stack, long i) { - CompoundTag tagCompound = getTag(stack); - tagCompound.putLong(s, i); - stack.setTag(tagCompound); - } - - public static boolean getBoolean(String s, ItemStack stack) { - CompoundTag tagCompound = getTag(stack); - return tagCompound.getBoolean(s); - } - - public static void putBoolean(String s, ItemStack stack, boolean b) { - CompoundTag tagCompound = getTag(stack); - tagCompound.putBoolean(s, b); - stack.setTag(tagCompound); - } - - public static String getString(String s, ItemStack stack) { - CompoundTag tagCompound = getTag(stack); - return tagCompound.getString(s); - - } - - public static void putString(String s, ItemStack stack, String s1) { - CompoundTag tagCompound = getTag(stack); - tagCompound.putString(s, s1); - stack.setTag(tagCompound); - } - - public static CompoundTag getTag(ItemStack stack) { - if (stack.getTag() == null) { - return new CompoundTag(); - } - return stack.getTag(); - } - - public static void putTagCompound(String s, ItemStack stack, CompoundTag tc) { - CompoundTag tagCompound = getTag(stack); - tagCompound.put(s, tc); - stack.setTag(tagCompound); - } - - public static CompoundTag getTagCompound(String s, ItemStack stack) { - CompoundTag tagCompound = getTag(stack); - return tagCompound.getCompound(s); - } - - public static void remove(@Nullable CompoundTag nbt, String tagName) { - if (nbt != null) { - nbt.remove(tagName); - } - } - - public static void removeContainedStacks(ItemStack container) { - remove(container.getTag(), SLOTS_TAG); - } - - public static void updateContainedStack(ItemStack container, short slot, ItemStack stackToSave, int count) { - updateContainedStack(container, slot, stackToSave, count, false); - } - - public static void updateContainedStack(ItemStack container, short slot, ItemStack stackToSave, int count, boolean updateCountOnly) { - CompoundTag tag = getTag(container); - - ListTag slots = tag.getList(SLOTS_TAG, Tag.TAG_COMPOUND); - - while (slot > slots.size()) { - slots.add(getEmptyStackNBT()); - } - - CompoundTag slotTag; - if (slot == slots.size()) { - if (updateCountOnly) { - return; - } - slotTag = new CompoundTag(); - slots.add(slotTag); - } else { - slotTag = (CompoundTag) slots.get(slot); - } - - if (!updateCountOnly) { - slotTag.put(STACK_TAG, stackToSave.save(new CompoundTag())); - } - slotTag.putInt(COUNT_TAG, count); - slots.set(slot, slotTag); - - tag.put(SLOTS_TAG, slots); - container.setTag(tag); - } - - public static int getContainedStackCount(ItemStack container, int slot) { - CompoundTag tag = getTag(container); - - ListTag slots = tag.getList(SLOTS_TAG, Tag.TAG_COMPOUND); - - if (slot < slots.size()) { - CompoundTag slotTag = (CompoundTag) slots.get(slot); - return slotTag.getInt(COUNT_TAG); - } - - return 0; - } - - public static int getCountContainedStacks(ItemStack container) { - CompoundTag tag = getTag(container); - - ListTag slots = tag.getList(SLOTS_TAG, Tag.TAG_COMPOUND); - - return slots.size(); - } - - public static ItemStack getContainedStack(ItemStack container, int slot) { - CompoundTag tag = getTag(container); - - ListTag slots = tag.getList(SLOTS_TAG, Tag.TAG_COMPOUND); - - if (slot < slots.size()) { - CompoundTag slotTag = (CompoundTag) slots.get(slot); - ItemStack ret = ItemStack.of(slotTag.getCompound(STACK_TAG)); - ret.setCount(slotTag.getInt(COUNT_TAG)); - return ret; - } - return ItemStack.EMPTY; - } - - private static Tag getEmptyStackNBT() { - CompoundTag slotTag = new CompoundTag(); - slotTag.put(STACK_TAG, ItemStack.EMPTY.save(new CompoundTag())); - slotTag.putInt(COUNT_TAG, 0); - - return slotTag; - } - - public static > Optional getEnumConstant(ItemStack stack, String key, Function deserialize) { - return getTagValue(stack, key, (t, k) -> deserialize.apply(t.getString(k))); - } - - private static Optional getTagValue(ItemStack stack, String key, BiFunction getValue) { - return getTagValue(stack, "", key, getValue); - } - - public static Optional getTagValue(ItemStack stack, String parentKey, String key, BiFunction getValue) { - CompoundTag tag = stack.getTag(); - - if (tag == null) { - return Optional.empty(); - } - - if (!parentKey.isEmpty()) { - Tag parentTag = tag.get(parentKey); - if (!(parentTag instanceof CompoundTag)) { - return Optional.empty(); - } - tag = (CompoundTag) parentTag; - } - - return getTagValue(tag, key, getValue); - } - - private static Optional getTagValue(CompoundTag tag, String key, BiFunction getValue) { - if (!tag.contains(key)) { - return Optional.empty(); - } - - return Optional.of(getValue.apply(tag, key)); - } - - public static Optional getInt(ItemStack stack, String key) { - return getTagValue(stack, key, CompoundTag::getInt); - } -} diff --git a/src/main/java/reliquary/util/NoPlayerBlockItemUseContext.java b/src/main/java/reliquary/util/NoPlayerBlockItemUseContext.java index 915e17fc..b06ed90b 100644 --- a/src/main/java/reliquary/util/NoPlayerBlockItemUseContext.java +++ b/src/main/java/reliquary/util/NoPlayerBlockItemUseContext.java @@ -10,8 +10,8 @@ import net.minecraft.world.phys.Vec3; public class NoPlayerBlockItemUseContext extends BlockPlaceContext { - public NoPlayerBlockItemUseContext(Level world, BlockPos pos, ItemStack stack, Direction face) { - super(world, null, InteractionHand.MAIN_HAND, stack, new BlockHitResult(new Vec3(pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D), face, pos, false)); + public NoPlayerBlockItemUseContext(Level level, BlockPos pos, ItemStack stack, Direction face) { + super(level, null, InteractionHand.MAIN_HAND, stack, new BlockHitResult(new Vec3(pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D), face, pos, false)); } @Override diff --git a/src/main/java/reliquary/util/PlayerInventoryHandler.java b/src/main/java/reliquary/util/PlayerInventoryHandler.java new file mode 100644 index 00000000..cbea4df3 --- /dev/null +++ b/src/main/java/reliquary/util/PlayerInventoryHandler.java @@ -0,0 +1,42 @@ +package reliquary.util; + +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; + +import java.util.Collections; +import java.util.Set; +import java.util.function.Supplier; + +public class PlayerInventoryHandler { + public static final Set SINGLE_IDENTIFIER = Collections.singleton(""); + private final Supplier> identifiersGetter; + private final SlotCountGetter slotCountGetter; + private final SlotStackGetter slotStackGetter; + + public PlayerInventoryHandler(Supplier> identifiersGetter, SlotCountGetter slotCountGetter, SlotStackGetter slotStackGetter) { + this.identifiersGetter = identifiersGetter; + this.slotCountGetter = slotCountGetter; + this.slotStackGetter = slotStackGetter; + } + + public int getSlotCount(Player player, String identifier) { + return slotCountGetter.getSlotCount(player, identifier); + } + + public ItemStack getStackInSlot(Player player, String identifier, int slot) { + return slotStackGetter.getStackInSlot(player, identifier, slot); + } + + public Set getIdentifiers() { + return identifiersGetter.get(); + } + + public interface SlotCountGetter { + int getSlotCount(Player player, String identifier); + } + + public interface SlotStackGetter { + ItemStack getStackInSlot(Player player, String identifier, int slot); + } + +} diff --git a/src/main/java/reliquary/util/PlayerInventoryProvider.java b/src/main/java/reliquary/util/PlayerInventoryProvider.java new file mode 100644 index 00000000..ede3488e --- /dev/null +++ b/src/main/java/reliquary/util/PlayerInventoryProvider.java @@ -0,0 +1,84 @@ +package reliquary.util; + +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.fml.loading.FMLEnvironment; + +import java.util.*; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.function.Supplier; + +public class PlayerInventoryProvider { + public static final String MAIN_INVENTORY = "main"; + public static final String OFFHAND_INVENTORY = "offhand"; + public static final String ARMOR_INVENTORY = "armor"; + + private final Map playerInventoryHandlers = new LinkedHashMap<>(); + private final List renderedHandlers = new ArrayList<>(); + + private static final PlayerInventoryProvider serverProvider = new PlayerInventoryProvider(); + private static final PlayerInventoryProvider clientProvider = new PlayerInventoryProvider(); + + public static PlayerInventoryProvider get() { + if (FMLEnvironment.dist == Dist.CLIENT) { + return clientProvider; + } else { + return serverProvider; + } + } + + private PlayerInventoryProvider() { + addPlayerInventoryHandler(MAIN_INVENTORY, () -> PlayerInventoryHandler.SINGLE_IDENTIFIER, (player, identifier) -> player.getInventory().items.size(), + (player, identifier, slot) -> player.getInventory().items.get(slot), false); + addPlayerInventoryHandler(OFFHAND_INVENTORY, () -> PlayerInventoryHandler.SINGLE_IDENTIFIER, (player, identifier) -> player.getInventory().offhand.size(), + (player, identifier, slot) -> player.getInventory().offhand.get(slot), false); + addPlayerInventoryHandler(ARMOR_INVENTORY, () -> PlayerInventoryHandler.SINGLE_IDENTIFIER, (player, identifier) -> 1, + (player, identifier, slot) -> player.getInventory().armor.get(EquipmentSlot.CHEST.getIndex()), true); + } + + public void addPlayerInventoryHandler(String name, Supplier> identifiersGetter, PlayerInventoryHandler.SlotCountGetter slotCountGetter, PlayerInventoryHandler.SlotStackGetter slotStackGetter, boolean rendered) { + Map temp = new LinkedHashMap<>(playerInventoryHandlers); + playerInventoryHandlers.clear(); + playerInventoryHandlers.put(name, new PlayerInventoryHandler(identifiersGetter, slotCountGetter, slotStackGetter)); + playerInventoryHandlers.putAll(temp); + + if (rendered) { + ArrayList tempRendered = new ArrayList<>(renderedHandlers); + renderedHandlers.clear(); + renderedHandlers.add(name); + renderedHandlers.addAll(tempRendered); + } + } + + private Map getPlayerInventoryHandlers() { + return playerInventoryHandlers; + } + + public void runOnPlayerInventoryHandlers(Player player, Consumer run) { + getFromPlayerInventoryHandlers(player, (stack, result) -> { + run.accept(stack); + return result; + }, result -> false, () -> true); + } + + public T getFromPlayerInventoryHandlers(Player player, BiFunction get, Predicate shouldExit, Supplier defaultValue) { + T result = defaultValue.get(); + for (var handler : playerInventoryHandlers.values()) { + Set identifiers = handler.getIdentifiers(); + for (String identifier : identifiers) { + int slots = handler.getSlotCount(player, identifier); + for (int slot = 0; slot < slots; slot++) { + result = get.apply(handler.getStackInSlot(player, identifier, slot), result); + if (shouldExit.test(result)) { + return result; + } + } + } + } + return result; + } +} diff --git a/src/main/java/reliquary/util/RegistryHelper.java b/src/main/java/reliquary/util/RegistryHelper.java index c5dbe5eb..638a6b45 100644 --- a/src/main/java/reliquary/util/RegistryHelper.java +++ b/src/main/java/reliquary/util/RegistryHelper.java @@ -1,30 +1,25 @@ package reliquary.util; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; -import net.minecraftforge.registries.ForgeRegistries; import java.util.Objects; public class RegistryHelper { - private RegistryHelper() {} + private RegistryHelper() { + } public static String getItemRegistryName(Item item) { - ResourceLocation rl = ForgeRegistries.ITEMS.getKey(item); - //null check because some mods don't properly register items they use in recipes - if (rl != null) { - return rl.toString(); - } - - return ""; + return BuiltInRegistries.ITEM.getKey(item).toString(); } public static ResourceLocation getRegistryName(Item item) { - return Objects.requireNonNull(ForgeRegistries.ITEMS.getKey(item)); + return BuiltInRegistries.ITEM.getKey(item); } public static ResourceLocation getRegistryName(Entity entity) { @@ -32,11 +27,11 @@ public static ResourceLocation getRegistryName(Entity entity) { } public static ResourceLocation getRegistryName(Block block) { - return Objects.requireNonNull(ForgeRegistries.BLOCKS.getKey(block)); + return BuiltInRegistries.BLOCK.getKey(block); } public static ResourceLocation getRegistryName(EntityType entityType) { - return Objects.requireNonNull(ForgeRegistries.ENTITY_TYPES.getKey(entityType)); + return BuiltInRegistries.ENTITY_TYPE.getKey(entityType); } public static boolean registryNamesEqual(Item itemA, Item itemB) { @@ -44,6 +39,6 @@ public static boolean registryNamesEqual(Item itemA, Item itemB) { } public static ResourceLocation getRegistryName(MobEffect effect) { - return Objects.requireNonNull(ForgeRegistries.MOB_EFFECTS.getKey(effect)); + return Objects.requireNonNull(BuiltInRegistries.MOB_EFFECT.getKey(effect)); } } diff --git a/src/main/java/reliquary/util/SetCodec.java b/src/main/java/reliquary/util/SetCodec.java new file mode 100644 index 00000000..42c848da --- /dev/null +++ b/src/main/java/reliquary/util/SetCodec.java @@ -0,0 +1,60 @@ +package reliquary.util; + +import com.mojang.datafixers.util.Pair; +import com.mojang.datafixers.util.Unit; +import com.mojang.serialization.*; + +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Stream; + +public record SetCodec(Codec elementCodec) implements Codec> { + @Override + public DataResult encode(final Set input, final DynamicOps ops, final T prefix) { + final ListBuilder builder = ops.listBuilder(); + for (final E element : input) { + builder.add(elementCodec.encodeStart(ops, element)); + } + return builder.build(prefix); + } + + @Override + public DataResult, T>> decode(final DynamicOps ops, final T input) { + return ops.getList(input).setLifecycle(Lifecycle.stable()).flatMap(stream -> { + final DecoderState decoder = new DecoderState<>(ops); + stream.accept(decoder::accept); + return decoder.build(); + }); + } + + @Override + public String toString() { + return "SetCodec[" + elementCodec + ']'; + } + + private class DecoderState { + private static final DataResult INITIAL_RESULT = DataResult.success(Unit.INSTANCE, Lifecycle.stable()); + + private final DynamicOps ops; + private final Set elements = new HashSet<>(); + private final Stream.Builder failed = Stream.builder(); + private DataResult result = INITIAL_RESULT; + + private DecoderState(final DynamicOps ops) { + this.ops = ops; + } + + public void accept(final T value) { + final DataResult> elementResult = elementCodec.decode(ops, value); + elementResult.error().ifPresent(error -> failed.add(value)); + elementResult.resultOrPartial().ifPresent(pair -> elements.add(pair.getFirst())); + result = result.apply2stable((result, element) -> result, elementResult); + } + + public DataResult, T>> build() { + final T errors = ops.createList(failed.build()); + final Pair, T> pair = Pair.of(Set.copyOf(elements), errors); + return result.map(ignored -> pair).setPartial(pair); + } + } +} diff --git a/src/main/java/reliquary/util/StackHelper.java b/src/main/java/reliquary/util/StackHelper.java deleted file mode 100644 index 7e8a4c78..00000000 --- a/src/main/java/reliquary/util/StackHelper.java +++ /dev/null @@ -1,20 +0,0 @@ -package reliquary.util; - -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.registries.ForgeRegistries; - -import java.util.Optional; - -public class StackHelper { - private StackHelper() {} - - public static Optional getItemStackFromName(String name) { - Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(name)); - if (item == null) { - return Optional.empty(); - } - return Optional.of(new ItemStack(item)); - } -} diff --git a/src/main/java/reliquary/util/StreamCodecHelper.java b/src/main/java/reliquary/util/StreamCodecHelper.java new file mode 100644 index 00000000..22a6f6dc --- /dev/null +++ b/src/main/java/reliquary/util/StreamCodecHelper.java @@ -0,0 +1,17 @@ +package reliquary.util; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.phys.Vec3; + +public class StreamCodecHelper { + public static final StreamCodec VEC_3_STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.DOUBLE, + Vec3::x, + ByteBufCodecs.DOUBLE, + Vec3::y, + ByteBufCodecs.DOUBLE, + Vec3::z, + Vec3::new); +} diff --git a/src/main/java/reliquary/util/TooltipBuilder.java b/src/main/java/reliquary/util/TooltipBuilder.java index 008acc00..376c4920 100644 --- a/src/main/java/reliquary/util/TooltipBuilder.java +++ b/src/main/java/reliquary/util/TooltipBuilder.java @@ -1,32 +1,26 @@ package reliquary.util; -import com.google.common.collect.Lists; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; -import net.minecraft.client.resources.language.I18n; +import net.minecraft.core.component.DataComponents; import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; -import net.minecraft.util.Tuple; -import net.minecraft.world.effect.MobEffect; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffectUtil; -import net.minecraft.world.entity.ai.attributes.Attribute; -import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.alchemy.PotionContents; +import reliquary.Reliquary; import reliquary.items.EnderStaffItem; -import reliquary.reference.Reference; -import reliquary.util.potions.XRPotionHelper; import java.util.List; -import java.util.Map; import java.util.function.UnaryOperator; public class TooltipBuilder { + private static Item.TooltipContext context; private final List tooltip; - public static TooltipBuilder of(List tooltip) { + public static TooltipBuilder of(List tooltip, Item.TooltipContext context) { + TooltipBuilder.context = context; return new TooltipBuilder(tooltip); } @@ -34,69 +28,12 @@ private TooltipBuilder(List tooltip) { this.tooltip = tooltip; } - public void potionEffects(List effects) { - if (!effects.isEmpty()) { - List> attributeModifiers = Lists.newArrayList(); - for (MobEffectInstance potioneffect : effects) { - String s1 = I18n.get(potioneffect.getDescriptionId()).trim(); - MobEffect potion = potioneffect.getEffect(); - Map map = potion.getAttributeModifiers(); - - if (!map.isEmpty()) { - for (Map.Entry entry : map.entrySet()) { - AttributeModifier attributemodifier = entry.getValue(); - AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.getAttributeModifierValue(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation()); - attributeModifiers.add(new Tuple<>(entry.getKey().getDescriptionId(), attributemodifier1)); - } - } - - if (potioneffect.getAmplifier() > 0) { - s1 = s1 + " " + I18n.get("potion.potency." + potioneffect.getAmplifier()).trim(); - } - - if (potioneffect.getDuration() > 20) { - s1 = s1 + " (" + MobEffectUtil.formatDuration(potioneffect, 1.0F).getString() + ")"; - } - - if (potion.isBeneficial()) { - tooltip.add(Component.literal(ChatFormatting.BLUE + s1)); - } else { - tooltip.add(Component.literal(ChatFormatting.RED + s1)); - } - } - - addAttributeModifierTooltip(tooltip, attributeModifiers); - } - } - - private static void addAttributeModifierTooltip(List list, List> list1) { - if (!list1.isEmpty()) { - list.add(Component.literal("")); - list.add(Component.literal(ChatFormatting.DARK_PURPLE + I18n.get("potion.whenDrank"))); - - for (Tuple tuple : list1) { - AttributeModifier attributemodifier2 = tuple.getB(); - double d0 = attributemodifier2.getAmount(); - double d1; - - if (attributemodifier2.getOperation() != AttributeModifier.Operation.MULTIPLY_BASE && attributemodifier2.getOperation() != AttributeModifier.Operation.MULTIPLY_TOTAL) { - d1 = attributemodifier2.getAmount(); - } else { - d1 = attributemodifier2.getAmount() * 100.0D; - } - - if (d0 > 0.0D) { - list.add((Component.translatable("attribute.modifier.plus." + attributemodifier2.getOperation().toValue(), ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1), Component.translatable(tuple.getA()))).withStyle(ChatFormatting.BLUE)); - } else if (d0 < 0.0D) { - d1 = d1 * -1.0D; - list.add((Component.translatable("attribute.modifier.take." + attributemodifier2.getOperation().toValue(), ItemStack.ATTRIBUTE_MODIFIER_FORMAT.format(d1), Component.translatable(tuple.getA()))).withStyle(ChatFormatting.RED)); - } - } - } + public void potionEffects(PotionContents potionContents) { + potionContents.addPotionTooltip(tooltip::add, 1, context.tickRate()); } public void potionEffects(ItemStack stack) { - potionEffects(XRPotionHelper.getPotionEffectsFromStack(stack)); + potionEffects(stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY)); } public TooltipBuilder itemTooltip(Item item) { @@ -159,15 +96,15 @@ public TooltipBuilder charge(Item item, String langSuffix, int charge) { public TooltipBuilder showMoreInfo() { if (!Screen.hasShiftDown()) { - tooltip.add(Component.translatable("tooltip." + Reference.MOD_ID + ".hold_for_more_info", - Component.translatable("tooltip." + Reference.MOD_ID + ".shift").withStyle(ChatFormatting.AQUA) + tooltip.add(Component.translatable("tooltip." + Reliquary.MOD_ID + ".hold_for_more_info", + Component.translatable("tooltip." + Reliquary.MOD_ID + ".shift").withStyle(ChatFormatting.AQUA) ).withStyle(ChatFormatting.DARK_GRAY)); } return this; } public TooltipBuilder absorb() { - tooltip.add(Component.translatable("tooltip." + Reference.MOD_ID + ".absorb").withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(Component.translatable("tooltip." + Reliquary.MOD_ID + ".absorb").withStyle(ChatFormatting.DARK_GRAY)); return this; } @@ -176,7 +113,7 @@ public TooltipBuilder absorbActive(String itemName) { } public TooltipBuilder absorbActive(Component thingName) { - tooltip.add(Component.translatable("tooltip." + Reference.MOD_ID + ".absorb_active", thingName).withStyle(ChatFormatting.DARK_GRAY)); + tooltip.add(Component.translatable("tooltip." + Reliquary.MOD_ID + ".absorb_active", thingName).withStyle(ChatFormatting.DARK_GRAY)); return this; } diff --git a/src/main/java/reliquary/util/TranslationHelper.java b/src/main/java/reliquary/util/TranslationHelper.java index a4c1ae29..16e7acaa 100644 --- a/src/main/java/reliquary/util/TranslationHelper.java +++ b/src/main/java/reliquary/util/TranslationHelper.java @@ -1,12 +1,12 @@ package reliquary.util; import net.minecraft.world.item.Item; -import reliquary.reference.Reference; +import reliquary.Reliquary; public class TranslationHelper { private TranslationHelper() {} - private static final String ITEM_PREFIX = "item." + Reference.MOD_ID + "."; + private static final String ITEM_PREFIX = "item." + Reliquary.MOD_ID + "."; public static String transl(Item item) { return ITEM_PREFIX + RegistryHelper.getRegistryName(item).getPath().replace('/', '_'); diff --git a/src/main/java/reliquary/util/WorldHelper.java b/src/main/java/reliquary/util/WorldHelper.java index 1ca1f5ff..6bdd0aab 100644 --- a/src/main/java/reliquary/util/WorldHelper.java +++ b/src/main/java/reliquary/util/WorldHelper.java @@ -12,16 +12,12 @@ public class WorldHelper { private WorldHelper() {} - public static Optional getBlockEntity(@Nullable BlockGetter world, BlockPos pos) { - return getBlockEntity(world, pos, BlockEntity.class); - } - - public static Optional getBlockEntity(@Nullable BlockGetter world, BlockPos pos, Class teClass) { - if (world == null) { + public static Optional getBlockEntity(@Nullable BlockGetter level, BlockPos pos, Class teClass) { + if (level == null) { return Optional.empty(); } - BlockEntity te = world.getBlockEntity(pos); + BlockEntity te = level.getBlockEntity(pos); if (teClass.isInstance(te)) { return Optional.of(teClass.cast(te)); @@ -30,13 +26,13 @@ public static Optional getBlockEntity(@Nullable BlockGetter world, BlockP return Optional.empty(); } - private static void notifyBlockUpdate(@Nullable Level world, BlockPos pos) { - if (world == null) { + private static void notifyBlockUpdate(@Nullable Level level, BlockPos pos) { + if (level == null) { return; } - BlockState state = world.getBlockState(pos); - world.sendBlockUpdated(pos, state, state, 3); + BlockState state = level.getBlockState(pos); + level.sendBlockUpdated(pos, state, state, 3); } public static void notifyBlockUpdate(BlockEntity tile) { diff --git a/src/main/java/reliquary/util/XRFakePlayerFactory.java b/src/main/java/reliquary/util/XRFakePlayerFactory.java deleted file mode 100644 index d88cf84b..00000000 --- a/src/main/java/reliquary/util/XRFakePlayerFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -package reliquary.util; - -import net.minecraft.server.level.ServerLevel; -import reliquary.entities.EntityXRFakePlayer; - -public class XRFakePlayerFactory { - private XRFakePlayerFactory() {} - - private static EntityXRFakePlayer fakePlayer; - - public static EntityXRFakePlayer get(ServerLevel world) { - if (fakePlayer == null) { - fakePlayer = new EntityXRFakePlayer(world); - } - - return fakePlayer; - } - - public static void unloadWorld(ServerLevel world) { - if (fakePlayer != null && fakePlayer.level() == world) { - fakePlayer = null; - } - } - -} diff --git a/src/main/java/reliquary/util/potions/PotionEssence.java b/src/main/java/reliquary/util/potions/PotionEssence.java index 149f783e..c2274b18 100644 --- a/src/main/java/reliquary/util/potions/PotionEssence.java +++ b/src/main/java/reliquary/util/potions/PotionEssence.java @@ -1,7 +1,6 @@ package reliquary.util.potions; -import com.google.common.collect.Lists; -import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.item.alchemy.PotionContents; import java.util.ArrayList; import java.util.Arrays; @@ -9,21 +8,23 @@ public class PotionEssence { - private PotionEssence(List ingredients, List effects, int redstoneCount, int glowstoneCount) { - this.ingredients = ingredients; - this.effects = effects; - this.redstoneCount = redstoneCount; - this.glowstoneCount = glowstoneCount; - } - private final List ingredients; + private int redstoneCount; private int glowstoneCount; - private List effects; + private PotionContents potionContents; public int getRedstoneCount() { return redstoneCount; } + + private PotionEssence(List ingredients, PotionContents potionContents, int redstoneCount, int glowstoneCount) { + this.ingredients = ingredients; + this.potionContents = potionContents; + this.redstoneCount = redstoneCount; + this.glowstoneCount = glowstoneCount; + } + @SuppressWarnings("SameParameterValue") public void setRedstoneCount(int redstoneCount) { this.redstoneCount = redstoneCount; @@ -32,59 +33,49 @@ public void setRedstoneCount(int redstoneCount) { public int getGlowstoneCount() { return glowstoneCount; } + @SuppressWarnings("SameParameterValue") public void setGlowstoneCount(int glowstoneCount) { this.glowstoneCount = glowstoneCount; } - public List getEffects() { - return effects; + public PotionContents getPotionContents() { + return potionContents; } public PotionEssence copy() { - return new Builder().setIngredients(ingredients).setEffects(effects).build(); + return new Builder().setIngredients(ingredients).setPotionContents(potionContents).build(); } public List getIngredients() { return ingredients; } - public void setEffects(List effects) { - this.effects = effects; + public void setPotionContents(PotionContents potionContents) { + this.potionContents = potionContents; } public static class Builder { private List ingredients = new ArrayList<>(); - private int redstoneCount = 0; - private int glowstoneCount = 0; - private List effects = Lists.newArrayList(); + private PotionContents potionContents = PotionContents.EMPTY; public Builder setIngredients(PotionIngredient... ingredients) { this.ingredients.addAll(Arrays.asList(ingredients)); return this; } + public Builder setIngredients(List ingredients) { this.ingredients = ingredients; return this; } - public Builder setRedstoneCount(int redstoneCount) { - this.redstoneCount = redstoneCount; - return this; - } - - public Builder setGlowstoneCount(int glowstoneCount) { - this.glowstoneCount = glowstoneCount; - return this; - } - - public Builder setEffects(List effects) { - this.effects = effects; + public Builder setPotionContents(PotionContents potionContents) { + this.potionContents = potionContents; return this; } public PotionEssence build() { - return new PotionEssence(ingredients, effects, redstoneCount, glowstoneCount); + return new PotionEssence(ingredients, potionContents, 0, 0); } } } diff --git a/src/main/java/reliquary/util/potions/PotionEssenceComparator.java b/src/main/java/reliquary/util/potions/PotionEssenceComparator.java index 3cd24e2a..dfaf42f7 100644 --- a/src/main/java/reliquary/util/potions/PotionEssenceComparator.java +++ b/src/main/java/reliquary/util/potions/PotionEssenceComparator.java @@ -1,22 +1,29 @@ package reliquary.util.potions; +import net.minecraft.world.effect.MobEffectInstance; +import org.apache.commons.lang3.stream.Streams; + import java.util.Comparator; +import java.util.List; public class PotionEssenceComparator implements Comparator { @Override - public int compare(PotionEssence o1, PotionEssence o2) { + public int compare(PotionEssence potionEssence1, PotionEssence potionEssence2) { int ret = 0; - for(int i = 0; i < Math.min(o1.getEffects().size(), o2.getEffects().size()); i++) { - ret = new EffectComparator().compare(o1.getEffects().get(i), o2.getEffects().get(i)); - if(ret != 0) { + List effects1 = Streams.of(potionEssence1.getPotionContents().getAllEffects()).toList(); + List effects2 = Streams.of(potionEssence2.getPotionContents().getAllEffects()).toList(); + + for (int i = 0; i < Math.min(effects1.size(), effects2.size()); i++) { + ret = new EffectComparator().compare(effects1.get(i), effects2.get(i)); + if (ret != 0) { break; } } - if(ret == 0) { - ret = Integer.compare(o1.getEffects().size(), o2.getEffects().size()); + if (ret == 0) { + ret = Integer.compare(effects1.size(), effects2.size()); } return ret; diff --git a/src/main/java/reliquary/util/potions/PotionHelper.java b/src/main/java/reliquary/util/potions/PotionHelper.java new file mode 100644 index 00000000..c055389b --- /dev/null +++ b/src/main/java/reliquary/util/potions/PotionHelper.java @@ -0,0 +1,273 @@ +package reliquary.util.potions; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.alchemy.PotionContents; +import org.apache.commons.lang3.stream.Streams; +import reliquary.items.PotionEssenceItem; +import reliquary.util.RegistryHelper; + +import javax.annotation.Nullable; +import java.util.*; + +public class PotionHelper { + + public static final String EFFECTS_TAG = "effects"; + + private PotionHelper() { + } + + private static final int MAX_DURATION = 36000; + private static final int MAX_AMPLIFIER = 4; + + public static boolean isItemEssence(ItemStack stack) { + // essence not quite a thing just yet. + return stack.getItem() instanceof PotionEssenceItem; + } + + public static boolean isIngredient(ItemStack stack) { + for (PotionIngredient ingredient : PotionMap.ingredients) { + if (RegistryHelper.registryNamesEqual(ingredient.getItem().getItem(), stack.getItem())) { + return true; + } + } + return false; + } + + public static Optional getIngredient(ItemStack stack) { + if (stack.getItem() instanceof PotionEssenceItem) { + return Optional.of(new PotionIngredient(stack, Streams.of(getPotionEffectsFromStack(stack)).toList())); + } + for (PotionIngredient ingredient : PotionMap.ingredients) { + if (RegistryHelper.registryNamesEqual(ingredient.getItem().getItem(), stack.getItem())) { + return Optional.of(ingredient); + } + } + return Optional.empty(); + } + + private static final Set> nonAugmentableEffects = Set.of( + MobEffects.BLINDNESS, + MobEffects.CONFUSION, + MobEffects.INVISIBILITY, + MobEffects.NIGHT_VISION, + MobEffects.WATER_BREATHING + ); + + private static boolean isAugmentablePotionEffect(MobEffectInstance effect) { + return !nonAugmentableEffects.contains(effect.getEffect()); + } + + public static void addPotionContentsToCompoundTag(CompoundTag tag, PotionContents potionContents) { + if (!potionContents.hasEffects()) { + return; + } + + tag.put(EFFECTS_TAG, DataComponents.POTION_CONTENTS.codec().encode(potionContents, NbtOps.INSTANCE, new CompoundTag()).getOrThrow()); + } + + public static void addPotionContentsToStack(ItemStack itemstack, PotionContents potionContents) { + itemstack.set(DataComponents.POTION_CONTENTS, potionContents); + } + + public static void cleanPotionEffects(ItemStack stack) { + stack.remove(DataComponents.POTION_CONTENTS); + } + + public static PotionContents changePotionEffectsDuration(PotionContents potionContents, float factor) { + List ret = Lists.newArrayList(); + + for (MobEffectInstance effect : potionContents.getAllEffects()) { + int newDuration = (int) (effect.getEffect().value().isInstantenous() ? 1 : effect.getDuration() * factor); + ret.add(new MobEffectInstance(effect.getEffect(), newDuration, effect.getAmplifier(), effect.isAmbient(), effect.isVisible())); + } + + return new PotionContents(potionContents.potion(), potionContents.customColor(), ret); + } + + public static PotionContents augmentPotionContents(PotionContents potionContents, int redstoneCount, int glowstoneCount) { + return addRedstone(addGlowstone(potionContents, glowstoneCount), redstoneCount); + } + + private static PotionContents addRedstone(PotionContents potionContents, int redstoneCount) { + if (redstoneCount <= 0) { + return potionContents; + } + + List newEffects = new ArrayList<>(); + + int effectCnt = Iterables.size(potionContents.getAllEffects()); + double multiplier = 1.0; + + for (int redstoneLevel = 1; redstoneLevel <= redstoneCount; redstoneLevel++) { + multiplier *= (((double) (8 + effectCnt)) / ((double) (3 + effectCnt)) - (1.0 / (3 + effectCnt) * (redstoneLevel - 1.0))); + } + + for (MobEffectInstance effect : potionContents.getAllEffects()) { + int newDuration = (int) (effect.getDuration() * multiplier); + newDuration = Math.min(newDuration, MAX_DURATION * 2); + + MobEffectInstance newEffect = new MobEffectInstance(effect.getEffect(), newDuration, effect.getAmplifier(), effect.isAmbient(), effect.isVisible()); + newEffects.add(newEffect); + } + + return new PotionContents(potionContents.potion(), potionContents.customColor(), newEffects); + } + + private static PotionContents addGlowstone(PotionContents potionContents, int glowstoneCount) { + if (glowstoneCount <= 0) { + return potionContents; + } + + List newEffects = new ArrayList<>(); + + int effectCnt = Iterables.size(potionContents.getAllEffects()); + double multiplier = 1.0; + + for (int glowstoneLevel = 1; glowstoneLevel <= glowstoneCount; glowstoneLevel++) { + multiplier *= (((double) (11 + effectCnt)) / ((double) (6 + effectCnt)) - (1.0 / (6 + effectCnt) * glowstoneLevel) - 1.0); + } + + for (MobEffectInstance effect : potionContents.getAllEffects()) { + int newAmplifier = effect.getAmplifier(); + + if (PotionHelper.isAugmentablePotionEffect(effect)) { + newAmplifier = Math.min(effect.getAmplifier() + glowstoneCount, MAX_AMPLIFIER + 1); + } + + MobEffectInstance newEffect = new MobEffectInstance(effect.getEffect(), (int) (effect.getDuration() * multiplier), newAmplifier, effect.isAmbient(), effect.isVisible()); + newEffects.add(newEffect); + } + return new PotionContents(potionContents.potion(), potionContents.customColor(), newEffects); + } + + static PotionContents combineIngredients(PotionIngredient... ingredients) { + return combineIngredients(Arrays.asList(ingredients)); + } + + //this handles the actual combining of two or more ingredients, including other essences. + public static PotionContents combineIngredients(Collection ingredients) { + + //helper list to store what we have, altogether + Map, List> potionEffectCounterList = new HashMap<>(); + + //actual list to store what we have two or more of, these are the actual final effects + Set> potionEffectList = new HashSet<>(); + + //add each effect to the counter list. if it appears twice, add it to the potionEffectList too. + for (PotionIngredient ingredient : ingredients) { + for (MobEffectInstance effect : ingredient.getEffects()) { + if (potionEffectCounterList.containsKey(effect.getEffect().getKey())) { + potionEffectList.add(effect.getEffect().getKey()); + potionEffectCounterList.get(effect.getEffect().getKey()).add(effect); + } else { + ArrayList effects = new ArrayList<>(); + effects.add(effect); + potionEffectCounterList.put(effect.getEffect().getKey(), effects); + } + } + } + + List combinedEffects = Lists.newArrayList(); + + //iterate through common effects + for (ResourceKey potionKey : potionEffectList) { + List effects = potionEffectCounterList.get(potionKey); + + int duration = getCombinedDuration(effects); + int amplifier = getCombinedAmplifier(potionKey, effects); + + if (duration == 0) { + continue; + } + + BuiltInRegistries.MOB_EFFECT.getHolder(potionKey).ifPresent(mobEffect -> combinedEffects.add(new MobEffectInstance(mobEffect, duration, amplifier))); + } + combinedEffects.sort(new EffectComparator()); + + return new PotionContents(Optional.empty(), Optional.empty(), combinedEffects); + } + + private static int getCombinedAmplifier(ResourceKey potionKey, List effects) { + int amplifier = 0; + for (MobEffectInstance effect : effects) { + amplifier += effect.getAmplifier(); + } + + if (!MobEffects.SATURATION.is(potionKey)) { + amplifier = Math.min(amplifier, PotionHelper.MAX_AMPLIFIER); + } + + return amplifier; + } + + private static int getCombinedDuration(List effects) { + int count = 0; + int duration = 0; + for (MobEffectInstance effect : effects) { + if (effect.getEffect().value().isInstantenous()) { + return 1; + } + + count++; + + duration += effect.getDuration(); + } + + duration = (int) (duration / 1.2); + if (count == 3) { + duration = (int) (duration / 1.1); + } + + return Math.min(duration, PotionHelper.MAX_DURATION); + } + + public static void applyEffectsToEntity(PotionContents potionContents, Entity source, + @Nullable Entity indirectSource, LivingEntity livingEntity) { + applyEffectsToEntity(potionContents, source, indirectSource, livingEntity, 1.0); + } + + public static void applyEffectsToEntity(PotionContents potionContents, Entity source, + @Nullable Entity indirectSource, LivingEntity livingEntity, double amplifier) { + + potionContents.forEachEffect(effectInstance -> { + if (effectInstance.getEffect().value().isInstantenous()) { + effectInstance.getEffect().value().applyInstantenousEffect(source, indirectSource, livingEntity, effectInstance.getAmplifier(), amplifier); + } else { + int j = (int) (amplifier * effectInstance.getDuration() + 0.5D); + + if (j > 20) { + livingEntity.addEffect(new MobEffectInstance(effectInstance.getEffect(), j, effectInstance.getAmplifier(), false, false)); + } + } + }); + } + + public static PotionContents getPotionContentsFromCompoundTag(CompoundTag tag) { + if (!tag.contains(EFFECTS_TAG)) { + return PotionContents.EMPTY; + } + + return DataComponents.POTION_CONTENTS.codec().parse(NbtOps.INSTANCE, tag.get(EFFECTS_TAG)).getOrThrow(); + } + + public static boolean hasPotionContents(ItemStack stack) { + return stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).hasEffects(); + } + + public static Iterable getPotionEffectsFromStack(ItemStack stack) { + return stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY).getAllEffects(); + } +} diff --git a/src/main/java/reliquary/util/potions/PotionIngredient.java b/src/main/java/reliquary/util/potions/PotionIngredient.java index 9399f97b..81f1e1c6 100644 --- a/src/main/java/reliquary/util/potions/PotionIngredient.java +++ b/src/main/java/reliquary/util/potions/PotionIngredient.java @@ -1,10 +1,9 @@ package reliquary.util.potions; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.registries.ForgeRegistries; import reliquary.util.LogHelper; import java.util.ArrayList; @@ -24,13 +23,9 @@ public PotionIngredient(ItemStack item, List effects) { } void addEffect(String potionName, int durationWeight, int ampWeight) { - MobEffect mobEffect = ForgeRegistries.MOB_EFFECTS.getValue(new ResourceLocation(potionName)); - - if (mobEffect == null) { - LogHelper.error("Potion name " + potionName + " is not registered. Please fix the name or remove it from potion map."); - return; - } - effects.add(new MobEffectInstance(mobEffect, durationWeight * 300, ampWeight, true, false)); + BuiltInRegistries.MOB_EFFECT.getHolder(ResourceLocation.parse(potionName)) + .ifPresentOrElse(mobEffect -> effects.add(new MobEffectInstance(mobEffect, durationWeight * 300, ampWeight, true, false)), + () -> LogHelper.error("Potion name " + potionName + " is not registered. Please fix the name or remove it from potion map.")); } public List getEffects() { diff --git a/src/main/java/reliquary/util/potions/PotionMap.java b/src/main/java/reliquary/util/potions/PotionMap.java index fd81856a..506d0c18 100644 --- a/src/main/java/reliquary/util/potions/PotionMap.java +++ b/src/main/java/reliquary/util/potions/PotionMap.java @@ -1,23 +1,26 @@ package reliquary.util.potions; +import com.google.common.collect.Iterables; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; +import net.minecraft.world.item.alchemy.PotionContents; +import org.apache.commons.lang3.stream.Streams; import reliquary.init.ModItems; +import reliquary.reference.Config; import reliquary.reference.Reference; -import reliquary.reference.Settings; import reliquary.util.LogHelper; import reliquary.util.RegistryHelper; -import reliquary.util.StackHelper; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.StringJoiner; +import java.util.*; import java.util.regex.Pattern; public class PotionMap { - private PotionMap() {} + private PotionMap() { + } protected static final List ingredients = new ArrayList<>(); public static final List potionCombinations = new ArrayList<>(); @@ -34,8 +37,8 @@ public static void initPotionMap() { } private static void setDefaultInConfigIfEmpty() { - if (Settings.COMMON.potions.potionMap.get().isEmpty()) { - Settings.COMMON.potions.potionMap.set(getDefaultConfigPotionMap()); + if (Config.COMMON.potions.potionMap.get().isEmpty()) { + Config.COMMON.potions.potionMap.set(getDefaultConfigPotionMap()); } } @@ -46,7 +49,7 @@ private static void loadUniquePotions() { for (PotionEssence essence : potionCombinations) { boolean found = false; for (PotionEssence uniqueEssence : uniquePotionEssences) { - if (effectsEqual(essence.getEffects(), uniqueEssence.getEffects())) { + if (effectsEqual(essence.getPotionContents(), uniqueEssence.getPotionContents())) { found = true; break; } @@ -64,19 +67,19 @@ private static void loadUniquePotions() { private static void addUniquePotions(PotionEssence essence) { uniquePotions.add(essence); - if (Boolean.TRUE.equals(Settings.COMMON.potions.redstoneAndGlowstone.get())) { + if (Boolean.TRUE.equals(Config.COMMON.potions.redstoneAndGlowstone.get())) { PotionEssence redstone = essence.copy(); - redstone.setEffects(XRPotionHelper.augmentPotionEffects(redstone.getEffects(), 1, 0)); + redstone.setPotionContents(PotionHelper.augmentPotionContents(redstone.getPotionContents(), 1, 0)); redstone.setRedstoneCount(1); uniquePotions.add(redstone); PotionEssence glowstone = essence.copy(); - glowstone.setEffects(XRPotionHelper.augmentPotionEffects(redstone.getEffects(), 0, 1)); + glowstone.setPotionContents(PotionHelper.augmentPotionContents(redstone.getPotionContents(), 0, 1)); glowstone.setGlowstoneCount(1); uniquePotions.add(glowstone); PotionEssence redstoneGlowstone = essence.copy(); - redstoneGlowstone.setEffects(XRPotionHelper.augmentPotionEffects(redstone.getEffects(), 1, 1)); + redstoneGlowstone.setPotionContents(PotionHelper.augmentPotionContents(redstone.getPotionContents(), 1, 1)); redstoneGlowstone.setRedstoneCount(1); redstoneGlowstone.setGlowstoneCount(1); uniquePotions.add(redstoneGlowstone); @@ -91,16 +94,16 @@ private static void loadPotionCombinations() { for (PotionIngredient ingredient1 : ingredients) { for (PotionIngredient ingredient2 : ingredients) { if (ingredient1.getItem().getItem() != ingredient2.getItem().getItem()) { - PotionEssence twoEssence = new PotionEssence.Builder().setIngredients(ingredient1, ingredient2).setEffects(XRPotionHelper.combineIngredients(ingredient1, ingredient2)).build(); - if (!twoEssence.getEffects().isEmpty() && twoEssence.getEffects().size() <= Settings.COMMON.potions.maxEffectCount.get()) { + PotionEssence twoEssence = new PotionEssence.Builder().setIngredients(ingredient1, ingredient2).setPotionContents(PotionHelper.combineIngredients(ingredient1, ingredient2)).build(); + if (twoEssence.getPotionContents().hasEffects() && Iterables.size(twoEssence.getPotionContents().getAllEffects()) <= Config.COMMON.potions.maxEffectCount.get()) { addPotionCombination(twoEssence); - if (Boolean.TRUE.equals(Settings.COMMON.potions.threeIngredients.get())) { + if (Boolean.TRUE.equals(Config.COMMON.potions.threeIngredients.get())) { for (PotionIngredient ingredient3 : ingredients) { if ((ingredient3.getItem().getItem() != ingredient1.getItem().getItem()) && ingredient3.getItem().getItem() != ingredient2.getItem().getItem()) { - PotionEssence threeEssence = new PotionEssence.Builder().setIngredients(ingredient1, ingredient2, ingredient3).setEffects(XRPotionHelper.combineIngredients(ingredient1, ingredient2, ingredient3)).build(); + PotionEssence threeEssence = new PotionEssence.Builder().setIngredients(ingredient1, ingredient2, ingredient3).setPotionContents(PotionHelper.combineIngredients(ingredient1, ingredient2, ingredient3)).build(); - if (!effectsEqual(twoEssence.getEffects(), threeEssence.getEffects())) { + if (!effectsEqual(twoEssence.getPotionContents(), threeEssence.getPotionContents())) { addPotionCombination(threeEssence); } } @@ -119,7 +122,7 @@ private static void addPotionCombination(PotionEssence newEssence) { return; } //the same effect potion id with different duration is turned on by config option - if (effectsEqual(essence.getEffects(), newEssence.getEffects(), Settings.COMMON.potions.differentDurations.get()) && !effectsEqual(essence.getEffects(), newEssence.getEffects())) { + if (effectsEqual(essence.getPotionContents(), newEssence.getPotionContents(), Config.COMMON.potions.differentDurations.get()) && !effectsEqual(essence.getPotionContents(), newEssence.getPotionContents())) { return; } } @@ -146,18 +149,21 @@ private static boolean ingredientsEqual(List a, List a, List b) { - return effectsEqual(a, b, true); + private static boolean effectsEqual(PotionContents contents1, PotionContents contents2) { + return effectsEqual(contents1, contents2, true); } - private static boolean effectsEqual(List a, List b, boolean compareDuration) { - if (a.size() != b.size()) { + private static boolean effectsEqual(PotionContents contents1, PotionContents contents2, boolean compareDuration) { + List effects1 = Streams.of(contents1.getAllEffects()).toList(); + List effects2 = Streams.of(contents2.getAllEffects()).toList(); + + if (effects1.size() != effects2.size()) { return false; } - for (MobEffectInstance effectA : a) { + for (MobEffectInstance effectA : effects1) { boolean found = false; - for (MobEffectInstance effectB : b) { + for (MobEffectInstance effectB : effects2) { if (effectA.getDescriptionId().equals(effectB.getDescriptionId()) && (!compareDuration || effectA.getDuration() == effectB.getDuration()) && (effectA.getAmplifier() == effectB.getAmplifier())) { found = true; break; @@ -175,7 +181,7 @@ private static void loadPotionMapFromSettings() { ingredients.clear(); Pattern validEntry = Pattern.compile("[a-z_:0-9]+=[a-z_0-9:.|;]+"); - for (String entry : Settings.COMMON.potions.potionMap.get()) { + for (String entry : Config.COMMON.potions.potionMap.get()) { if (validEntry.matcher(entry).matches()) { String[] entryParts = entry.split("="); @@ -193,7 +199,7 @@ private static void loadPotionMapFromSettings() { } private static void addItemEffectsToPotionMap(String name, String[] effects) { - StackHelper.getItemStackFromName(name).ifPresent(stack -> { + getItemStackFromName(name).ifPresent(stack -> { PotionIngredient ingredient = new PotionIngredient(stack); for (String effect : effects) { String[] effectValues = effect.split("\\|"); @@ -217,7 +223,7 @@ public static List getDefaultConfigPotionMap() { addPotionIngredient(potionMap, Items.SUGAR, speed(3, 0), haste(3, 0)); addPotionIngredient(potionMap, Items.APPLE, heal(0), hboost(3, 0), cure(0)); addPotionIngredient(potionMap, Items.COAL, blind(1), absorb(3, 0), invis(1), wither(0, 0)); - addPotionIngredient(potionMap, Items.FEATHER, jump(3, 0), weak(1, 0)); + addPotionIngredient(potionMap, Items.FEATHER, jump(3, 0), weak(1, 0), flight(1)); addPotionIngredient(potionMap, Items.WHEAT_SEEDS, harm(0), hboost(3, 0)); addPotionIngredient(potionMap, Items.WHEAT, heal(0), hboost(3, 0)); addPotionIngredient(potionMap, Items.FLINT, harm(0), dboost(3, 0)); @@ -240,7 +246,7 @@ public static List getDefaultConfigPotionMap() { //TIER TWO INGREDIENTS, one of the effects of each will always be a one, slightly increased duration vs. TIER ONE addPotionIngredient(potionMap, Items.SPIDER_EYE, vision(4), poison(2)); - addPotionIngredient(potionMap, Items.BLAZE_POWDER, dboost(4, 0), harm(0)); + addPotionIngredient(potionMap, Items.BLAZE_POWDER, dboost(4, 0), harm(0), flight(1)); addPotionIngredient(potionMap, Items.IRON_INGOT, resist(4, 0), slow(2, 0)); addPotionIngredient(potionMap, Items.STRING, slow(2, 0), fatigue(2, 0)); addPotionIngredient(potionMap, Items.BREAD, hboost(4, 0), satur(5)); @@ -264,7 +270,7 @@ public static List getDefaultConfigPotionMap() { addPotionIngredient(potionMap, Items.PUMPKIN_PIE, invis(1), fireres(1), speed(3, 0), haste(3, 0), absorb(3, 0), regen(0, 0)); //combination of ingredients, strong. addPotionIngredient(potionMap, Items.MAGMA_CREAM, dboost(4, 0), harm(0), resist(4, 0), fireres(2)); //also a combo, strong. addPotionIngredient(potionMap, Items.GLISTERING_MELON_SLICE, dboost(3, 0), haste(3, 0), heal(0), speed(4, 0)); //combo - addPotionIngredient(potionMap, Items.GHAST_TEAR, regen(3, 0), absorb(5, 0)); + addPotionIngredient(potionMap, Items.GHAST_TEAR, regen(3, 0), absorb(5, 0), flight(2)); addPotionIngredient(potionMap, Items.FERMENTED_SPIDER_EYE, vision(4), poison(2), speed(3, 0), haste(3, 0)); //combo addPotionIngredient(potionMap, Items.GOLDEN_CARROT, dboost(3, 0), haste(3, 0), hboost(3, 0), vision(3)); //combo addPotionIngredient(potionMap, Items.GOLD_INGOT, dboost(4, 0), haste(4, 0), cure(0)); //combo @@ -276,12 +282,12 @@ public static List getDefaultConfigPotionMap() { addPotionIngredient(potionMap, ModItems.CHELICERAE.get(), poison(3), weak(3, 0)); addPotionIngredient(potionMap, ModItems.SLIME_PEARL.get(), resist(5, 0), absorb(5, 0)); addPotionIngredient(potionMap, ModItems.KRAKEN_SHELL_FRAGMENT.get(), absorb(5, 0), breath(5)); - addPotionIngredient(potionMap, ModItems.BAT_WING.get(), jump(5, 0), weak(3, 0)); + addPotionIngredient(potionMap, ModItems.BAT_WING.get(), jump(5, 0), weak(3, 0), flight(2)); addPotionIngredient(potionMap, Items.GOLDEN_APPLE, cure(1)); addPotionIngredient(potionMap, Items.GOLDEN_APPLE, cure(2)); //TIER FOUR INGREDIENTS, these carry multiple one-potency effects and have the most duration for any given effect. - addPotionIngredient(potionMap, Items.DIAMOND, resist(6, 1), absorb(6, 1), fireres(6), cure(0)); + addPotionIngredient(potionMap, Items.DIAMOND, resist(6, 1), absorb(6, 1), fireres(6), cure(0), flight(1)); addPotionIngredient(potionMap, ModItems.WITHERED_RIB.get(), wither(2, 1), weak(3, 1), slow(3, 1), fatigue(3, 1), cure(0)); addPotionIngredient(potionMap, Items.ENDER_EYE, dboost(6, 1), invis(6), speed(6, 1), harm(1)); addPotionIngredient(potionMap, Items.EMERALD, haste(6, 1), speed(6, 1), hboost(6, 1), cure(1)); @@ -364,6 +370,10 @@ private static String jump(int duration, int potency) { return effectString(Reference.JUMP, Integer.toString(duration), Integer.toString(potency)); } + private static String flight(int duration) { + return effectString(Reference.FLIGHT, Integer.toString(duration), Integer.toString(0)); + } + private static String nausea(int duration) { return effectString(Reference.NAUSEA, Integer.toString(duration), Integer.toString(0)); } @@ -406,4 +416,8 @@ private static void addPotionIngredient(List potionMap, String itemRegis potionMap.add(String.format("%s=%s", itemRegistryName, effectsString)); } + + public static Optional getItemStackFromName(String name) { + return BuiltInRegistries.ITEM.getOptional(ResourceLocation.parse(name)).map(ItemStack::new); + } } diff --git a/src/main/java/reliquary/util/potions/XRPotionHelper.java b/src/main/java/reliquary/util/potions/XRPotionHelper.java deleted file mode 100644 index adf5ceed..00000000 --- a/src/main/java/reliquary/util/potions/XRPotionHelper.java +++ /dev/null @@ -1,317 +0,0 @@ -package reliquary.util.potions; - -import com.google.common.base.MoreObjects; -import com.google.common.collect.Lists; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.nbt.Tag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.effect.MobEffect; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.registries.ForgeRegistries; -import reliquary.items.PotionEssenceItem; -import reliquary.util.RegistryHelper; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -public class XRPotionHelper { - - public static final String EFFECTS_TAG = "effects"; - - private XRPotionHelper() {} - - private static final int MAX_DURATION = 36000; - private static final int MAX_AMPLIFIER = 4; - - public static boolean isItemEssence(ItemStack stack) { - // essence not quite a thing just yet. - return stack.getItem() instanceof PotionEssenceItem; - } - - public static boolean isIngredient(ItemStack stack) { - for (PotionIngredient ingredient : PotionMap.ingredients) { - if (RegistryHelper.registryNamesEqual(ingredient.getItem().getItem(), stack.getItem())) { - return true; - } - } - return false; - } - - public static Optional getIngredient(ItemStack stack) { - if (stack.getItem() instanceof PotionEssenceItem) { - return Optional.of(new PotionIngredient(stack, getPotionEffectsFromStack(stack))); - } - for (PotionIngredient ingredient : PotionMap.ingredients) { - if (RegistryHelper.registryNamesEqual(ingredient.getItem().getItem(), stack.getItem())) { - return Optional.of(ingredient); - } - } - return Optional.empty(); - } - - private static final MobEffect[] nonAugmentableEffects = new MobEffect[] {MobEffects.BLINDNESS, - MobEffects.CONFUSION, - MobEffects.INVISIBILITY, - MobEffects.NIGHT_VISION, - MobEffects.WATER_BREATHING}; - - private static boolean isAugmentablePotionEffect(MobEffectInstance effect) { - for (MobEffect nonAugmentableEffect : nonAugmentableEffects) { - if (nonAugmentableEffect == effect.getEffect()) { - return false; - } - } - - return true; - } - - public static void addPotionEffectsToCompoundTag(CompoundTag tag, Collection effects) { - if (effects.isEmpty()) { - return; - } - - ListTag effectList = tag.getList(EFFECTS_TAG, 10); - for (MobEffectInstance object : effects) { - CompoundTag effect = new CompoundTag(); - effect.putString("name", RegistryHelper.getRegistryName(object.getEffect()).toString()); - effect.putInt("duration", object.getEffect().isInstantenous() ? 1 : object.getDuration()); - effect.putInt("potency", object.getAmplifier()); - effectList.add(effect); - } - tag.put(EFFECTS_TAG, effectList); - } - - public static void addPotionEffectsToStack(ItemStack itemstack, List effects) { - CompoundTag tag = MoreObjects.firstNonNull(itemstack.getTag(), new CompoundTag()); - addPotionEffectsToCompoundTag(tag, effects); - itemstack.setTag(tag); - } - - public static void cleanPotionEffects(ItemStack stack) { - CompoundTag tag = stack.getTag(); - - if (tag == null) { - return; - } - - if (tag.contains(EFFECTS_TAG)) { - tag.remove(EFFECTS_TAG); - } - } - - @SuppressWarnings("SameParameterValue") - public static List changePotionEffectsDuration(Collection effects, float factor) { - List ret = Lists.newArrayList(); - - for (MobEffectInstance effect : effects) { - int newDuration = (int) (effect.getEffect().isInstantenous() ? 1 : effect.getDuration() * factor); - ret.add(new MobEffectInstance(effect.getEffect(), newDuration, effect.getAmplifier(), effect.isAmbient(), effect.isVisible())); - } - - return ret; - } - - public static List augmentPotionEffects(List effects, int redstoneCount, int glowstoneCount) { - return addRedstone(addGlowstone(effects, glowstoneCount), redstoneCount); - } - - private static List addRedstone(List effects, int redstoneCount) { - if (redstoneCount <= 0) { - return effects; - } - - List newEffects = new ArrayList<>(); - - int effectCnt = effects.size(); - double multiplier = 1.0; - - for (int redstoneLevel = 1; redstoneLevel <= redstoneCount; redstoneLevel++) { - multiplier *= (((double) (8 + effectCnt)) / ((double) (3 + effectCnt)) - (1.0 / (3 + effectCnt) * (redstoneLevel - 1.0))); - } - - for (MobEffectInstance effect : effects) { - int newDuration = (int) (effect.getDuration() * multiplier); - newDuration = Math.min(newDuration, MAX_DURATION * 2); - - MobEffectInstance newEffect = new MobEffectInstance(effect.getEffect(), newDuration, effect.getAmplifier(), effect.isAmbient(), effect.isVisible()); - newEffects.add(newEffect); - } - - return newEffects; - } - - private static List addGlowstone(List effects, int glowstoneCount) { - if (glowstoneCount <= 0) { - return effects; - } - - List newEffects = new ArrayList<>(); - - int effectCnt = effects.size(); - double multiplier = 1.0; - - for (int glowstoneLevel = 1; glowstoneLevel <= glowstoneCount; glowstoneLevel++) { - multiplier *= (((double) (11 + effectCnt)) / ((double) (6 + effectCnt)) - (1.0 / (6 + effectCnt) * glowstoneLevel) - 1.0); - } - - for (MobEffectInstance effect : effects) { - int newAmplifier = effect.getAmplifier(); - - if (XRPotionHelper.isAugmentablePotionEffect(effect)) { - newAmplifier = Math.min(effect.getAmplifier() + glowstoneCount, MAX_AMPLIFIER + 1); - } - - MobEffectInstance newEffect = new MobEffectInstance(effect.getEffect(), (int) (effect.getDuration() * multiplier), newAmplifier, effect.isAmbient(), effect.isVisible()); - newEffects.add(newEffect); - } - return newEffects; - } - - static List combineIngredients(PotionIngredient... ingredients) { - return combineIngredients(Arrays.asList(ingredients)); - } - - //this handles the actual combining of two or more ingredients, including other essences. - public static List combineIngredients(Collection ingredients) { - - //helper list to store what we have, altogether - Map> potionEffectCounterList = new HashMap<>(); - - //actual list to store what we have two or more of, these are the actual final effects - List potionEffectList = new ArrayList<>(); - - //add each effect to the counter list. if it appears twice, add it to the potionEffectList too. - for (PotionIngredient ingredient : ingredients) { - for (MobEffectInstance effect : ingredient.getEffects()) { - if (potionEffectCounterList.containsKey(RegistryHelper.getRegistryName(effect.getEffect()))) { - if (!potionEffectList.contains(RegistryHelper.getRegistryName(effect.getEffect()))) { - potionEffectList.add(RegistryHelper.getRegistryName(effect.getEffect())); - } - potionEffectCounterList.get(RegistryHelper.getRegistryName(effect.getEffect())).add(effect); - } else { - ArrayList effects = new ArrayList<>(); - effects.add(effect); - potionEffectCounterList.put(RegistryHelper.getRegistryName(effect.getEffect()), effects); - } - } - } - - List combinedEffects = Lists.newArrayList(); - - //iterate through common effects - for (ResourceLocation potionName : potionEffectList) { - List effects = potionEffectCounterList.get(potionName); - - int duration = getCombinedDuration(effects); - int amplifier = getCombinedAmplifier(potionName, effects); - - if (duration == 0) { - continue; - } - - MobEffect potion = ForgeRegistries.MOB_EFFECTS.getValue(potionName); - if (potion != null) { - combinedEffects.add(new MobEffectInstance(potion, duration, amplifier)); - } - } - combinedEffects.sort(new EffectComparator()); - - return combinedEffects; - } - - private static int getCombinedAmplifier(ResourceLocation potionName, List effects) { - int amplifier = 0; - for (MobEffectInstance effect : effects) { - amplifier += effect.getAmplifier(); - } - - if (!potionName.equals(RegistryHelper.getRegistryName(MobEffects.SATURATION))) { - amplifier = Math.min(amplifier, XRPotionHelper.MAX_AMPLIFIER); - } - - return amplifier; - } - - private static int getCombinedDuration(List effects) { - int count = 0; - int duration = 0; - for (MobEffectInstance effect : effects) { - if (effect.getEffect().isInstantenous()) { - return 1; - } - - count++; - - duration += effect.getDuration(); - } - - duration = (int) (duration / 1.2); - if (count == 3) { - duration = (int) (duration / 1.1); - } - - return Math.min(duration, XRPotionHelper.MAX_DURATION); - } - - public static void applyEffectsToEntity(Collection effects, Entity source, - @Nullable Entity indirectSource, LivingEntity entitylivingbase) { - applyEffectsToEntity(effects, source, indirectSource, entitylivingbase, 1.0); - } - - public static void applyEffectsToEntity(Collection effects, Entity source, - @Nullable Entity indirectSource, LivingEntity entitylivingbase, double amplifier) { - for (MobEffectInstance potioneffect : effects) { - if (potioneffect.getEffect().isInstantenous()) { - potioneffect.getEffect().applyInstantenousEffect(source, indirectSource, entitylivingbase, potioneffect.getAmplifier(), amplifier); - } else { - int j = (int) (amplifier * potioneffect.getDuration() + 0.5D); - - if (j > 20) { - entitylivingbase.addEffect(new MobEffectInstance(potioneffect.getEffect(), j, potioneffect.getAmplifier(), false, false)); - } - } - } - } - - public static List getPotionEffectsFromCompoundTag(CompoundTag tag) { - if (!tag.contains(EFFECTS_TAG)) { - return Lists.newArrayList(); - } - - ListTag effectList = tag.getList(EFFECTS_TAG, 10); - - List ret = Lists.newArrayList(); - for (Tag effectTag : effectList) { - CompoundTag effect = (CompoundTag) effectTag; - - String registryName = effect.getString("name"); - int duration = effect.getInt("duration"); - int potency = effect.getInt("potency"); - //noinspection ConstantConditions - ret.add(new MobEffectInstance(ForgeRegistries.MOB_EFFECTS.getValue(new ResourceLocation(registryName)), duration, potency)); - } - - return ret; - } - - public static List getPotionEffectsFromStack(ItemStack stack) { - if (!stack.hasTag()) { - return Collections.emptyList(); - } - - //noinspection ConstantConditions - return getPotionEffectsFromCompoundTag(stack.getTag()); - } -} diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 70a36268..551574bb 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -1,10 +1,17 @@ -public net.minecraft.world.entity.projectile.Projectile (Lnet/minecraft/entity/EntityType;Lnet/minecraft/world/World;)V -protected net.minecraft.world.entity.Entity f_19825_ #positionVec -protected net.minecraft.world.entity.Entity f_19826_ #position -public net.minecraft.world.entity.projectile.FishingHook$FishHookState +protected net.minecraft.world.entity.Entity position +protected net.minecraft.world.entity.Entity blockPosition +public net.minecraft.world.entity.LivingEntity fallFlyTicks +public net.minecraft.world.entity.Mob handDropChances +public net.minecraft.world.entity.Mob armorDropChances +public net.minecraft.world.entity.projectile.FishingHook currentState +public net.minecraft.world.entity.projectile.FishingHook nibble protected net.minecraft.world.entity.projectile.FishingHook (Lnet/minecraft/world/entity/EntityType;Lnet/minecraft/world/level/Level;II)V -protected net.minecraft.world.entity.projectile.FishingHook m_37136_(Lnet/minecraft/world/entity/player/Player;)Z #shouldStopFishing -public net.minecraft.world.item.context.UseOnContext m_43718_()Lnet/minecraft/world/phys/BlockHitResult; # getHitResult -public net.minecraft.world.item.crafting.ShapelessRecipe f_44243_ # result -public net.minecraft.world.item.crafting.ShapedRecipe f_44149_ # result -public net.minecraft.world.damagesource.DamageSources m_268998_(Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/entity/Entity;)Lnet/minecraft/world/damagesource/DamageSource; # source \ No newline at end of file +protected net.minecraft.world.entity.projectile.FishingHook shouldStopFishing(Lnet/minecraft/world/entity/player/Player;)Z +public net.minecraft.world.entity.monster.ZombieVillager startConverting(Ljava/util/UUID;I)V +public net.minecraft.world.item.crafting.ShapelessRecipe result +public net.minecraft.world.item.crafting.ShapedRecipe result +public net.minecraft.world.item.crafting.ShapedRecipe pattern +public net.minecraft.world.entity.projectile.FishingHook$FishHookState +public-f net.minecraft.world.inventory.Slot x +public-f net.minecraft.world.inventory.Slot y +public net.minecraft.world.item.context.UseOnContext getHitResult()Lnet/minecraft/world/phys/BlockHitResult; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml deleted file mode 100644 index b49f5968..00000000 --- a/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,58 +0,0 @@ -# There are several mandatory fields (#mandatory), and many more that are optional (#optional). -# The overall format is standard TOML format, v0.5.0. -# Note that there are a couple of TOML lists in this file. -# Find more information on toml format here: https://github.com/toml-lang/toml - -# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml -modLoader="javafml" #mandatory - -# A version range to match for said mod loader - for regular FML @Mod it will be the minecraft version (without the 1.) -loaderVersion="${loader_version_range}" #mandatory - -# A URL to query for updates for this mod. See the JSON update specification -#updateJSONURL="" #optional - -# A URL to refer people to when problems occur with this mod -issueTrackerURL="https://github.com/p3pp3rF1y/reliquary/issues" #optional - -# A URL for the "homepage" for this mod, displayed in the mod UI -displayURL="https://www.curseforge.com/minecraft/mc-mods/reliquary-reincarnations" #optional - -# License -license="GNU General Public License v3.0" - -# A file name (in the root of the mod JAR) containing a logo for display -logoFile="xrlogo.png" #optional - -# A text field displayed in the mod UI -credits="Originally made by x3n0ph0b3 and TheMike, now maintained by P3pp3rF1y." #optional - -# A text field displayed in the mod UI -authors="x3n0ph0b3, TheMike, P3pp3rF1y" #optional - -# A list of mods - how many allowed here is determined by the individual mod loader -[[mods]] #mandatory - -# The modid of the mod -modId="reliquary" #mandatory - -# The version number of the mod -version="${mod_full_version}" #mandatory - -# A display name for the mod -displayName="Reliquary" #mandatory - -# The description text for the mod (multi line!) (#mandatory) -description=''' -Two words: magical swag. Oh, and a gun. -''' - -# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies.reliquary]] - modId="forge" #mandatory - mandatory=true #mandatory - versionRange="${neo_version_range}" #mandatory - # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory - ordering="NONE" - # Side this dependency is applied on - BOTH, CLIENT or SERVER - side="BOTH" \ No newline at end of file diff --git a/src/main/resources/assets/reliquary/lang/en_us.json b/src/main/resources/assets/reliquary/lang/en_us.json index 86f36447..6f351981 100644 --- a/src/main/resources/assets/reliquary/lang/en_us.json +++ b/src/main/resources/assets/reliquary/lang/en_us.json @@ -92,7 +92,7 @@ "item.reliquary.ender_staff.tooltip": "Uses ender pearls to let player teleport around", "item.reliquary.ender_staff.tooltip2": "Shift + Scroll to cycle modes:\n[Cast, Long Cast, Node Warp or Bind]", "item.reliquary.ender_staff.tooltip.charge": "Ender Pearls: %s", - "item.reliquary.ender_staff.tooltip.position": "Currently bound to X:%s Y:%s Z:%s", + "item.reliquary.ender_staff.tooltip.position": "Currently bound to %s, %s, %s in %s", "item.reliquary.ender_staff.tooltip.position.nowhere": "Currently bound to nowhere.", "item.reliquary.ender_staff.tooltip.position.out_of_range": "Out of range!", "item.reliquary.fertile_potion": "Fertile Potion", @@ -236,6 +236,7 @@ "item.reliquary.witch_hat": "Witch Hat", "item.reliquary.witherless_rose": "Witherless Rose", "item.reliquary.witherless_rose.tooltip": "With the Nether Stars enchanting this rose the holder is protected from Withering.", + "item.reliquary.xp_bucket": "Bucket of Experience", "tooltip.reliquary.hold_for_more_info": "Hold <%s> for more info", "tooltip.reliquary.shift": "Shift", @@ -351,7 +352,7 @@ "jei.reliquary.description.witch_hat": "Dropped by witches. Allows you to craft the Tome of Aklahestry. Also you can wear it if you want to look like a leprechaun.", "jei.reliquary.description.witherless_rose": "While this is in your inventory, you are immune to the wither ailment.", "jei.reliquary.description.wraith_node": "Right-click it with the Ender Staff and it will bind your Ender Staff to it, allowing you to return there at will for a price of Ender Pearls.\n\nNote that it will not work across different dimensions.", - "jei.reliquary.description.pedestal": "Pedestal is a fancy way of displaying your items, but at the same time it also allows some automation.\n\nCoin of fortune - When active picks up items and XP and puts these in containers beside the pedestal, when inactive prevents players and pedestals with fortune coin from picking up items in its range\nHero's medallion - Acts as a tank for XP also when activated searches nearby pedestals for mending items and repairs those with its XP\nSword - Attacks mobs in its range (ignores bosses, tamed and child animals)\nBucket - milks cows and picks up fluids in the world and puts these in containers beside the pedestal\nShears - shears all shearable blocks and entities in its range\nFishing Rod - fishes for the player, doesn't pick up items or xp, you need to use something else for that\nTo turn on pedestal functionality either empty hand right click the switch or provide redstone signal or provide power remotely using redstone block or dust in another pedestal", + "jei.reliquary.description.pedestal": "Pedestal is a fancy way of displaying your items, but at the same time it also allows some automation.\n\nCoin of fortune - When active picks up items and XP and puts these in containers beside the pedestal, when inactive prevents players and pedestals with fortune coin from picking up items in its range\nHero's medallion - Acts as a tank for XP also when activated searches nearby pedestals for mending items and repairs those with its XP\nSword - Attacks mobs in its range (ignores bosses, tamed and child animals)\nBucket - milks cows and picks up fluids in the level and puts these in containers beside the pedestal\nShears - shears all shearable blocks and entities in its range\nFishing Rod - fishes for the player, doesn't pick up items or xp, you need to use something else for that\nTo turn on pedestal functionality either empty hand right click the switch or provide redstone signal or provide power remotely using redstone block or dust in another pedestal", "jei.reliquary.description.passive_pedestal": "Display only pedestal is exactly that - fancy way of displaying items, but doesn't have any of the regular pedestal's functionality for the items put into it", "keybind.reliquary.category": "Reliquary", @@ -372,8 +373,8 @@ "enchantment.reliquary.severing": "Severing", "enchantment.reliquary.severing.desc": "Significantly increases chance of Reliquary drops", - "fluid.reliquary.xp_juice_still": "Experience", - "fluid_type.reliquary.xp_juice": "Experience", + "fluid.reliquary.xp_still": "Experience", + "fluid_type.reliquary.experience": "Experience", "waila.reliquary.cauldron.lingering": "Lingering potion", "waila.reliquary.cauldron.splash": "Splash potion", diff --git a/src/main/resources/assets/reliquary/lang/ko_kr.json b/src/main/resources/assets/reliquary/lang/ko_kr.json index 66bd1bab..9bf5a7d1 100644 --- a/src/main/resources/assets/reliquary/lang/ko_kr.json +++ b/src/main/resources/assets/reliquary/lang/ko_kr.json @@ -369,8 +369,8 @@ "tooltip.reliquary.xp": "경험치", "enchantment.reliquary.severing": "절단", "enchantment.reliquary.severing.desc": "성물 드롭 확률을 크게 증가시킵니다", - "fluid.reliquary.xp_juice_still": "경험치", - "fluid_type.reliquary.xp_juice": "경험치", + "fluid.reliquary.xp_still": "경험치", + "fluid_type.reliquary.experience": "경험치", "waila.reliquary.cauldron.lingering": "잔여 물약", "waila.reliquary.cauldron.splash": "폭발 물약", "waila.reliquary.cauldron.potion": "물약", diff --git a/src/main/resources/assets/reliquary/lang/old/en_US.full.json b/src/main/resources/assets/reliquary/lang/old/en_US.full.json deleted file mode 100644 index a919b9a2..00000000 --- a/src/main/resources/assets/reliquary/lang/old/en_US.full.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - - "reliquary.waila.reliquary.mortar.ingredients": "Ingredients:", - "reliquary.waila.reliquary.mortar.result": "Resulting potion effects:", - "reliquary.waila.reliquary.cauldron.missing_netherwart": "Missing Nether Wart", - "reliquary.waila.reliquary.cauldron.missing_gunpowder": "Missing Gunpowder", - "reliquary.waila.reliquary.cauldron.lingering": "Lingering potion", - "reliquary.waila.reliquary.cauldron.splash": "Splash potion", - "reliquary.waila.reliquary.cauldron.potion": "Potion", - "reliquary.waila.reliquary.altar.inactive": "Inactive", - "reliquary.waila.reliquary.altar.active": "Active", - "reliquary.waila.reliquary.altar.time_remaining": "Time remaining: %s", - "reliquary.waila.reliquary.shift_for_more": "Hold shift for more info", - - "fluid.reliquary.xpjuice": "XP Juice", - "fluid.milk": "Milk", - - "reliquary.potion.flight": "Flight" -} \ No newline at end of file diff --git a/src/main/resources/assets/reliquary/lang/old/ru_RU.full.json b/src/main/resources/assets/reliquary/lang/old/ru_RU.full.json deleted file mode 100644 index 2ddb5fb9..00000000 --- a/src/main/resources/assets/reliquary/lang/old/ru_RU.full.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "_comment": "Translated by TimeConqueror", - - - - - - - - - "reliquary.title1": "Настройки Reliquary", - - "jei.reliquary.recipe.cauldron_splash": "Аптекарский котел", - - - "reliquary.waila.reliquary.mortar.ingredients": "Ингредиенты:", - "reliquary.waila.reliquary.mortar.result": "Результирующие эффекты зелья:", - "reliquary.waila.reliquary.cauldron.missing_netherwart": "Отсутствует нарост из Незера", - "reliquary.waila.reliquary.cauldron.missing_gunpowder": "Отсутствует порох", - "reliquary.waila.reliquary.cauldron.lingering": "Затяжное зелье", - "reliquary.waila.reliquary.cauldron.splash": "Взрывное зелье", - "reliquary.waila.reliquary.cauldron.potion": "Зелье", - "reliquary.waila.reliquary.altar.inactive": "Неактивен", - "reliquary.waila.reliquary.altar.active": "Активен", - "reliquary.waila.reliquary.altar.time_remaining": "Времени осталось: %s", - "reliquary.waila.reliquary.shift_for_more": "Удерживайте Shift для большей информации", - - - - "fluid.reliquary.xpjuice": "XP-Сок", - "fluid.milk": "Молоко", - - "reliquary.potion.flight": "Полет" -} \ No newline at end of file diff --git a/src/main/resources/assets/reliquary/lang/old/zh_CN.full.json b/src/main/resources/assets/reliquary/lang/old/zh_CN.full.json deleted file mode 100644 index 4f14f984..00000000 --- a/src/main/resources/assets/reliquary/lang/old/zh_CN.full.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - - - - - - - - "reliquary.title1": "圣遗物设置", - - "jei.reliquary.recipe.cauldron_splash": "药师坩埚", - - - "reliquary.waila.reliquary.mortar.ingredients": "配方:", - "reliquary.waila.reliquary.mortar.result": "导致药水效果:", - "reliquary.waila.reliquary.cauldron.missing_netherwart": "缺少地狱疣", - "reliquary.waila.reliquary.cauldron.missing_gunpowder": "缺少火药", - "reliquary.waila.reliquary.cauldron.lingering": "滞留型药水", - "reliquary.waila.reliquary.cauldron.splash": "喷溅型药水", - "reliquary.waila.reliquary.cauldron.potion": "药水", - "reliquary.waila.reliquary.altar.inactive": "闲置", - "reliquary.waila.reliquary.altar.active": "运行中", - "reliquary.waila.reliquary.altar.time_remaining": "持续时间:%s", - "reliquary.waila.reliquary.shift_for_more": "按住 Shift 查看更多详细信息", - - - - "fluid.reliquary.xpjuice": "经验汁", - "fluid.milk": "牛奶", - - "reliquary.potion.flight": "漂浮" -} \ No newline at end of file diff --git a/src/main/resources/assets/reliquary/lang/uk_ua.json b/src/main/resources/assets/reliquary/lang/uk_ua.json index ee8dad2f..ec55cf03 100644 --- a/src/main/resources/assets/reliquary/lang/uk_ua.json +++ b/src/main/resources/assets/reliquary/lang/uk_ua.json @@ -358,7 +358,7 @@ "enchantment.reliquary.severing": "Розрив", "enchantment.reliquary.severing.desc": "Значно збільшує ймовірність дропу з Reliquary", - "fluid.reliquary.xp_juice_still": "Досвід", + "fluid.reliquary.xp_still": "Досвід", "waila.reliquary.cauldron.lingering": "Туманне зілля", "waila.reliquary.cauldron.splash": "Вибухове зілля", diff --git a/src/main/resources/assets/reliquary/lang/zh_cn.json b/src/main/resources/assets/reliquary/lang/zh_cn.json index 82894800..887d4830 100644 --- a/src/main/resources/assets/reliquary/lang/zh_cn.json +++ b/src/main/resources/assets/reliquary/lang/zh_cn.json @@ -372,8 +372,8 @@ "enchantment.reliquary.severing": "切割", "enchantment.reliquary.severing.desc": "大幅增加击杀生物获得对应遗物的概率。", - "fluid.reliquary.xp_juice_still": "液态经验", - "fluid_type.reliquary.xp_juice": "液态经验", + "fluid.reliquary.xp_still": "液态经验", + "fluid_type.reliquary.experience": "液态经验", "waila.reliquary.cauldron.lingering": "滞留型药水", "waila.reliquary.cauldron.splash": "喷溅型药水", diff --git a/src/main/resources/assets/reliquary/models/item/xp_bucket.json b/src/main/resources/assets/reliquary/models/item/xp_bucket.json new file mode 100644 index 00000000..f8176bca --- /dev/null +++ b/src/main/resources/assets/reliquary/models/item/xp_bucket.json @@ -0,0 +1 @@ +{"parent":"neoforge:item/bucket","fluid":"sophisticatedcore:xp_still","loader":"neoforge:fluid_container"} \ No newline at end of file diff --git a/src/main/resources/assets/reliquary/textures/block/xp_juice_flowing.png b/src/main/resources/assets/reliquary/textures/block/xp_flowing.png similarity index 100% rename from src/main/resources/assets/reliquary/textures/block/xp_juice_flowing.png rename to src/main/resources/assets/reliquary/textures/block/xp_flowing.png diff --git a/src/main/resources/assets/reliquary/textures/block/xp_juice_flowing.png.mcmeta b/src/main/resources/assets/reliquary/textures/block/xp_flowing.png.mcmeta similarity index 100% rename from src/main/resources/assets/reliquary/textures/block/xp_juice_flowing.png.mcmeta rename to src/main/resources/assets/reliquary/textures/block/xp_flowing.png.mcmeta diff --git a/src/main/resources/assets/reliquary/textures/block/xp_juice_still.png b/src/main/resources/assets/reliquary/textures/block/xp_still.png similarity index 100% rename from src/main/resources/assets/reliquary/textures/block/xp_juice_still.png rename to src/main/resources/assets/reliquary/textures/block/xp_still.png diff --git a/src/main/resources/assets/reliquary/textures/block/xp_juice_still.png.mcmeta b/src/main/resources/assets/reliquary/textures/block/xp_still.png.mcmeta similarity index 100% rename from src/main/resources/assets/reliquary/textures/block/xp_juice_still.png.mcmeta rename to src/main/resources/assets/reliquary/textures/block/xp_still.png.mcmeta diff --git a/src/main/resources/assets/reliquary/textures/item/fortune_coin - Copy.png b/src/main/resources/assets/reliquary/textures/item/fortune_coin - Copy.png deleted file mode 100644 index 55a94573..00000000 Binary files a/src/main/resources/assets/reliquary/textures/item/fortune_coin - Copy.png and /dev/null differ diff --git a/src/main/resources/data/curios/tags/items/belt.json b/src/main/resources/data/curios/tags/item/belt.json similarity index 100% rename from src/main/resources/data/curios/tags/items/belt.json rename to src/main/resources/data/curios/tags/item/belt.json diff --git a/src/main/resources/data/curios/tags/items/body.json b/src/main/resources/data/curios/tags/item/body.json similarity index 100% rename from src/main/resources/data/curios/tags/items/body.json rename to src/main/resources/data/curios/tags/item/body.json diff --git a/src/main/resources/data/curios/tags/items/necklace.json b/src/main/resources/data/curios/tags/item/necklace.json similarity index 100% rename from src/main/resources/data/curios/tags/items/necklace.json rename to src/main/resources/data/curios/tags/item/necklace.json diff --git a/src/main/resources/data/reliquary/curios/entities/entities.json b/src/main/resources/data/reliquary/curios/entities/entities.json new file mode 100644 index 00000000..6c8fcd7e --- /dev/null +++ b/src/main/resources/data/reliquary/curios/entities/entities.json @@ -0,0 +1,10 @@ +{ + "entities": [ + "minecraft:player" + ], + "slots": [ + "body", + "belt", + "necklace" + ] +} \ No newline at end of file diff --git a/src/main/resources/xrlogo.png b/src/main/resources/logo.png similarity index 100% rename from src/main/resources/xrlogo.png rename to src/main/resources/logo.png diff --git a/src/main/templates/META-INF/neoforge.mods.toml b/src/main/templates/META-INF/neoforge.mods.toml new file mode 100644 index 00000000..5b36c88c --- /dev/null +++ b/src/main/templates/META-INF/neoforge.mods.toml @@ -0,0 +1,32 @@ +modLoader="javafml" #mandatory +loaderVersion="${loader_version_range}" #mandatory + +license="${mod_license}" +issueTrackerURL="${mod_issue_tracker_url}" + +[[mods]] +modId="${mod_id}" +version="${mod_version}" +displayName="${mod_name}" +displayURL="${mod_display_url}" +logoFile="${mod_logo_file}" +credits="${mod_credits}" +authors="${mod_authors}" +description='''${mod_description}''' + +[[accessTransformers]] +file="META-INF/accesstransformer.cfg" + +[[dependencies.${mod_id}]] #optional +modId="neoforge" #mandatory +type="required" #mandatory +versionRange="${neo_version_range}" #mandatory +ordering="NONE" +side="BOTH" + +[[dependencies.${mod_id}]] +modId="minecraft" +type="required" +versionRange="${minecraft_version_range}" +ordering="NONE" +side="BOTH" \ No newline at end of file diff --git a/src/test/java/reliquary/items/util/FilteredItemStackHandlerTest.java b/src/test/java/reliquary/items/util/FilteredItemStackHandlerTest.java index fec253af..9f2ba0dd 100644 --- a/src/test/java/reliquary/items/util/FilteredItemStackHandlerTest.java +++ b/src/test/java/reliquary/items/util/FilteredItemStackHandlerTest.java @@ -10,7 +10,7 @@ import net.minecraft.nbt.NBTTagInt; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.NonNullList; -import net.minecraftforge.items.ItemHandlerHelper; +import net.neoforged.neoforge.items.ItemHandlerHelper; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; @@ -309,7 +309,7 @@ public ItemStack answer(InvocationOnMock invocation) throws Throwable { when(handler.getParentSlotLimit(anyInt())).thenReturn(1000); PowerMockito.mockStatic(ItemHandlerHelper.class); - PowerMockito.when(ItemHandlerHelper.canItemStacksStack(any(ItemStack.class), any(ItemStack.class))).thenReturn(true); + PowerMockito.when(ItemStack.isSameItemSameComponents(any(ItemStack.class), any(ItemStack.class))).thenReturn(true); handler.setDynamicSlotNumber(true); handler.setTotalAmount(0, 55); handler.setTotalAmount(1, 1000); @@ -403,7 +403,7 @@ public ItemStack answer(InvocationOnMock invocation) throws Throwable { doReturn(true).when(handler).isItemStackValidForParentSlot(any(ItemStack.class), anyInt()); PowerMockito.mockStatic(ItemHandlerHelper.class); - PowerMockito.when(ItemHandlerHelper.canItemStacksStack(any(ItemStack.class), any(ItemStack.class))).thenReturn(true); + PowerMockito.when(ItemStack.isSameItemSameComponents(any(ItemStack.class), any(ItemStack.class))).thenReturn(true); handler.setDynamicSlotNumber(true); handler.setTotalAmount(0, 55); handler.setTotalAmount(1, 1000); diff --git a/web/cf_description.html b/web/cf_description.html index f75b9861..ae556667 100644 --- a/web/cf_description.html +++ b/web/cf_description.html @@ -3,7 +3,7 @@

Reliquary mod

Reliquary is a collection of magical items and blocks that may be challenging to get, but make player's life easier in many different areas

There is a lot more information on the mod's wiki, but just briefly these are a few of the most notable things included in the mod.

Some of the items and blocks:

-

Coin of Fortune - magnet that teleports items and experience to player
Hunter's Handgun - handgun that can be loaded with a variety of different shots (like shots that seek their target, or make creepers explode, ...)
Infernal Chalice - a portable lava storage, but also an item that prevents the player from being hurt in lava (in exchange for some hunger)
Interdiction Torch - torch that pushes mobs in its range away
Lilypad of Fertility - lilypad that makes nearby crops grow faster and that can be put side by side with other lilypads for even greated effect
Nian Zhus - item that makes mobs ignore player (each of them specific to a mob type - creeper Nian Zhu, zombie Nian Zhu, ...)
Sojourner's Staff - staff that can hold multiple stacks of torches and then place these in world, close to the player as usual or even at great distance for additional cost
Void Tear - item that can hold a huge number of stacks of a specific item (no more cobble clutter)
Witherless Rose - flower that prevents player who has it in their inventory from being withered

+

Coin of Fortune - magnet that teleports items and experience to player
Hunter's Handgun - handgun that can be loaded with a variety of different shots (like shots that seek their target, or make creepers explode, ...)
Infernal Chalice - a portable lava storage, but also an item that prevents the player from being hurt in lava (in exchange for some hunger)
Interdiction Torch - torch that pushes mobs in its range away
Lilypad of Fertility - lilypad that makes nearby crops grow faster and that can be put side by side with other lilypads for even greated effect
Nian Zhus - item that makes mobs ignore player (each of them specific to a mob type - creeper Nian Zhu, zombie Nian Zhu, ...)
Sojourner's Staff - staff that can hold multiple stacks of torches and then place these in level, close to the player as usual or even at great distance for additional cost
Void Tear - item that can hold a huge number of stacks of a specific item (no more cobble clutter)
Witherless Rose - flower that prevents player who has it in their inventory from being withered

Pedestal


Pedestal model by Yulife @@ -13,7 +13,7 @@

Pedestal

  • Picks up items and xp orbs - coin of fortune
  • Works as a tank for xp - hero's medallion (charges the medallion with the xp)
  • Attacks mobs - sword (many different kinds work including Tinker's)
  • -
  • Gets milk from cows or picks up liquid from the world around - bucket
  • +
  • Gets milk from cows or picks up liquid from the level around - bucket
  • Shears sheep or shearable blocks - shears
  • Buffs players within range with localized creative flight - Rending Gale in flight mode
  • Pushes/pulls mobs in range - Rending Gale in appropriate mode