diff --git a/.gitattributes b/.gitattributes index f811f6a..b7bbcc4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ # Disable autocrlf on generated files, they always generate with LF # Add any extra files or paths here to make git stop saying they # are changed when only line endings change. -src/generated/**/.cache/cache text eol=lf +src/generated/**/.cache/* text eol=lf src/generated/**/*.json text eol=lf diff --git a/.gitignore b/.gitignore index 12f8644..fee2f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,40 @@ -# eclipse -bin -*.launch -.settings -.metadata -.classpath -.project +### Gradle ### +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/**/build/ -# idea -out -*.ipr +### IntelliJ IDEA ### +.idea/ *.iws *.iml -.idea +*.ipr +out/ +!**/src/**/out/ -# gradle -build -.gradle +.run/ + +### Eclipse ### +.apt_generated +.classpath +.eclipse/ +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/**/bin/ + +### VS Code ### +.vscode/ -# other -eclipse -run +### Mac OS ### +.DS_Store -# Files from Forge MDK -forge*changelog.txt +### Minecraft Modding ### +run/ +!**/src/**/run/ +**/src/generated/**/.cache/ +repo/ +!**/src/**/repo/ diff --git a/build.gradle b/build.gradle index 26962f5..15c9e54 100644 --- a/build.gradle +++ b/build.gradle @@ -1,185 +1,192 @@ plugins { - id 'eclipse' - id 'idea' + id 'java-library' id 'maven-publish' - id 'net.minecraftforge.gradle' version '[6.0,6.2)' - id 'org.spongepowered.mixin' version '0.7.+' + id 'net.neoforged.moddev' version '2.0.141' + id 'idea' +} + +tasks.named('wrapper', Wrapper).configure { + // Define wrapper values here so as to not have to always do so when updating gradlew.properties. + // Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with + // documentation attached on cursor hover of gradle classes and methods. However, this comes with increased + // file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards. + // (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`) + distributionType = Wrapper.DistributionType.BIN } version = mod_version group = mod_group_id +sourceSets.main.resources { + // Include resources generated by data generators. + srcDir('src/generated/resources') + + // Exclude common development only resources from finalized outputs + exclude("**/*.bbmodel") // BlockBench project files + exclude("src/generated/**/.cache") // datagen cache files +} + +repositories { + // Add here additional repositories if required by some of the dependencies below. + maven { + name = 'GeckoLib' + url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' + content { + includeGroupByRegex("software\\.bernie.*") + includeGroup("com.eliotlash.mclib") + } + } +} + base { archivesName = mod_id } -// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. -java.toolchain.languageVersion = JavaLanguageVersion.of(17) - -println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" -minecraft { - // The mappings can be changed at any time and must be in the following format. - // Channel: Version: - // official MCVersion Official field/method names from Mojang mapping files - // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official - // - // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. - // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md - // - // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge - // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started - // - // Use non-default mappings at your own risk. They may not always work. - // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: mapping_channel, version: mapping_version - - // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. - // In most cases, it is not necessary to enable. - // enableEclipsePrepareRuns = true - // enableIdeaPrepareRuns = true - - // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game. - // It is REQUIRED to be set to true for this template to function. - // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html - copyIdeResources = true - - // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations. - // The folder name can be set on a run configuration using the "folderName" property. - // By default, the folder name of a run configuration is the name of the Gradle project containing it. - // generateRunFolders = true - - // This property enables access transformers for use in development. - // They will be applied to the Minecraft artifact. - // The access transformer file can be anywhere in the project. - // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge. - // This default location is a best practice to automatically put the file in the right place in the final jar. - // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information. - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - - // Default run configurations. - // These can be tweaked, removed, or duplicated as needed. - runs { - // applies to all the run configs below - configureEach { - workingDirectory project.file('run') +// Mojang ships Java 21 to end users in 1.21.1, so mods should target Java 21. +java.toolchain.languageVersion = JavaLanguageVersion.of(21) - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' +neoForge { + // Specify the version of NeoForge to use. + version = project.neo_version - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' + parchment { + mappingsVersion = project.parchment_mappings_version + minecraftVersion = project.parchment_minecraft_version + } - mods { - "${mod_id}" { - source sourceSets.main - } - } - } + // This line is optional. Access Transformers are automatically detected +// accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg') + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. + runs { client { + client() + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', mod_id + systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id } server { - property 'forge.enabledGameTestNamespaces', mod_id - args '--nogui' + server() + programArgument '--nogui' + systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id } // This run config launches GameTestServer and runs all registered gametests, then exits. // By default, the server will crash when no gametests are provided. // The gametest system is also enabled by default for other run configs under the /test command. gameTestServer { - property 'forge.enabledGameTestNamespaces', mod_id + type = "gameTestServer" + systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id } data { - // example of overriding the workingDirectory set in configureEach above - workingDirectory project.file('run-data') + data() + + // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it + // gameDirectory = project.file('run-data') // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() + } + + // applies to all the run configs above + configureEach { + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + systemProperty 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + logLevel = org.slf4j.event.Level.DEBUG } } -} -// Include resources generated by data generators. -sourceSets.main.resources { srcDir 'src/generated/resources' } + mods { + // define mod <-> source bindings + // these are used to tell the game which sources are for which mod + // multi mod projects should define one per mod + "${mod_id}" { + sourceSet(sourceSets.main) + } + } +} -repositories { - maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' } +// Sets up a dependency configuration called 'localRuntime'. +// This configuration should be used instead of 'runtimeOnly' to declare +// a dependency that will be present for runtime testing but that is +// "optional", meaning it will not be pulled by dependents of this mod. +configurations { + runtimeClasspath.extendsFrom localRuntime } dependencies { - // Specify the version of Minecraft to use. - // Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact. - // The "userdev" classifier will be requested and setup by ForgeGradle. - // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], - // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - - implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.20.1:4.4.9') - annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' + // Example optional mod dependency with JEI + // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime + // compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}" + // compileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}" + // We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it + // localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}" + + // Example mod dependency using a mod jar from ./libs with a flat dir repository + // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar + // The group id is ignored when searching -- in this case, it is "blank" + // implementation "blank:coolmod-${mc_version}:${coolmod_version}" + + // Example mod dependency using a file as dependency + // implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar") + + implementation "software.bernie.geckolib:geckolib-neoforge-${minecraft_version}:${geckolib_version}" + // Example project dependency using a sister or child project: + // implementation project(":myproject") + + // For more info: + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html } // This block of code expands all declared replace properties in the specified resource targets. // A missing property will result in an error. Properties are expanded using ${} Groovy notation. -// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. -// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -tasks.named('processResources', ProcessResources).configure { +var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) { var replaceProperties = [ - minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, - forge_version: forge_version, forge_version_range: forge_version_range, - loader_version_range: loader_version_range, - mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, - mod_authors: mod_authors, mod_description: mod_description, + minecraft_version : minecraft_version, + minecraft_version_range: minecraft_version_range, + neo_version : neo_version, + geckolib_version : geckolib_version, + loader_version_range : loader_version_range, + mod_authors : mod_authors, + mod_description : mod_description, + mod_id : mod_id, + mod_name : mod_name, + mod_license : mod_license, + mod_version : mod_version, ] inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { - expand replaceProperties + [project: project] - } -} - -// Example for how to get properties into the manifest for reading at runtime. -tasks.named('jar', Jar).configure { - manifest { - attributes([ - 'Specification-Title' : mod_id, - 'Specification-Vendor' : mod_authors, - 'Specification-Version' : '1', // We are version 1 of ourselves - 'Implementation-Title' : project.name, - 'Implementation-Version' : project.jar.archiveVersion, - 'Implementation-Vendor' : mod_authors, - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) - } - - // This is the preferred method to reobfuscate your jar file - finalizedBy 'reobfJar' + expand replaceProperties + from "src/main/templates" + into "build/generated/sources/modMetadata" } - -// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing: -// tasks.named('publish').configure { -// dependsOn 'reobfJar' -// } +// 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 // Example configuration to allow publishing using the maven-publish plugin publishing { publications { register('mavenJava', MavenPublication) { - artifact jar + from components.java } } repositories { maven { - url "file://${project.projectDir}/mcmodsrepo" + url "file://${project.projectDir}/repo" } } } @@ -187,3 +194,11 @@ publishing { tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } + +// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. +idea { + module { + downloadSources = true + downloadJavadoc = true + } +} diff --git a/gradle.properties b/gradle.properties index 671b1cf..0ffb793 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,43 +1,28 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. -# This is required to provide enough memory for the Minecraft decompilation process. -org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false +org.gradle.jvmargs=-Xmx1G +org.gradle.daemon=true +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.configuration-cache=true - -## Environment Properties - -# The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=1.20.1 +#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment +# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started +parchment_minecraft_version=1.21.1 +parchment_mappings_version=2024.11.17 +# Environment Properties +# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge +# The Minecraft version must agree with the Neo version to get a valid artifact +minecraft_version=1.21.1 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.20.1,1.21) -# The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=47.2.0 -# The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[47,) -# The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[47,) -# The mapping channel to use for mappings. -# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. -# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. -# -# | Channel | Version | | -# |-----------|----------------------|--------------------------------------------------------------------------------| -# | official | MCVersion | Official field/method names from Mojang mapping files | -# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official | -# -# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. -# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md -# -# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge. -# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started -mapping_channel=official -# The mapping version to query from the mapping channel. -# This must match the format required by the mapping channel. -mapping_version=1.20.1 - +minecraft_version_range=[1.21.1] +# The Neo version must agree with the Minecraft version to get a valid artifact +neo_version=21.1.233 +# The loader version range can only use the major version of FML as bounds +loader_version_range=[1,) +geckolib_version=4.8.4 ## Mod Properties # The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63} @@ -48,12 +33,12 @@ mod_name=Unusual Fish Mod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=LGPLv3 # The mod version. See https://semver.org/ -mod_version=1.1.10 +mod_version=1.21.1-1.1.13 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html mod_group_id=codyhuh.unusualfishmod # The authors of the mod. This is a simple text string that is used for display purposes in the mod list. -mod_authors=codyhuh (code), OmayPaty (art), Peeko (former author) +mod_authors=codyhuh (code), OmayPaty (art), Peeko (former author), Chakyl (1.21.1 port) # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. -mod_description=A mod that adds a variety of new aquatic creatures, both useful and aesthetic! +mod_description=A mod that adds a variety of new aquatic creatures, both useful and aesthetic! \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..1b33c55 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d..23449a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..23d15a9 100644 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,10 +85,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -133,10 +133,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,16 +200,20 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..db3a6ac 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,22 +59,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/settings.gradle b/settings.gradle index dc88667..7a488e3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,14 +1,9 @@ pluginManagement { repositories { gradlePluginPortal() - maven { - name = 'MinecraftForge' - url = 'https://maven.minecraftforge.net/' - } - maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } } } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' -} \ No newline at end of file + id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' +} diff --git a/src/main/java/codyhuh/unusualfishmod/UnusualFishMod.java b/src/main/java/codyhuh/unusualfishmod/UnusualFishMod.java index bd677d5..380755a 100644 --- a/src/main/java/codyhuh/unusualfishmod/UnusualFishMod.java +++ b/src/main/java/codyhuh/unusualfishmod/UnusualFishMod.java @@ -1,29 +1,28 @@ package codyhuh.unusualfishmod; import codyhuh.unusualfishmod.core.registry.*; -import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.ItemStack; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; @Mod(UnusualFishMod.MOD_ID) public class UnusualFishMod { - public static final String MOD_ID = "unusualfishmod"; + public static final String MOD_ID = "unusualfishmod"; - public UnusualFishMod() { - IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); + public UnusualFishMod(IEventBus bus, ModContainer modContainer) { - UFItems.ITEMS.register(bus); - UFEntities.ENTITIES.register(bus); - UFBlocks.BLOCKS.register(bus); - UFEnchantments.ENCHANTMENTS.register(bus); - UFSounds.SOUND_EVENTS.register(bus); - UFBlockEntities.BLOCK_ENTITIES.register(bus); - UFLootModifiers.LOOT_MODIFIERS.register(bus); - UFTabs.CREATIVE_TABS.register(bus); + UFSounds.SOUND_EVENTS.register(bus); + UFBlocks.BLOCKS.register(bus); + UFBlockEntities.BLOCK_ENTITIES.register(bus); + UFEntities.ENTITIES.register(bus); + UFItems.ITEMS.register(bus); + UFTabs.CREATIVE_TABS.register(bus); + UFLootModifiers.LOOT_MODIFIERS.register(bus); + } - MinecraftForge.EVENT_BUS.register(this); - } + public static ResourceLocation loc(String path) { + return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); + } } + diff --git a/src/main/java/codyhuh/unusualfishmod/client/ClientEvents.java b/src/main/java/codyhuh/unusualfishmod/client/ClientEvents.java index 1503637..653f574 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/ClientEvents.java +++ b/src/main/java/codyhuh/unusualfishmod/client/ClientEvents.java @@ -2,179 +2,191 @@ import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.client.geo.*; -import codyhuh.unusualfishmod.client.misc.render.AbyssalBlastRenderer; -import codyhuh.unusualfishmod.client.misc.render.FallingTreeBlockRenderer; -import codyhuh.unusualfishmod.client.misc.render.SeaSpikeRenderer; -import codyhuh.unusualfishmod.client.misc.render.ThrownPrismarineSpearRenderer; -import codyhuh.unusualfishmod.client.misc.render.model.RootballModel; +import codyhuh.unusualfishmod.client.misc.render.*; import codyhuh.unusualfishmod.client.misc.render.model.PrismarineSpearModel; -import codyhuh.unusualfishmod.client.misc.render.RootballRenderer; +import codyhuh.unusualfishmod.client.misc.render.model.RootballModel; import codyhuh.unusualfishmod.common.entity.*; import codyhuh.unusualfishmod.core.registry.UFEntities; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.core.component.DataComponents; +import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.EntityRenderersEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; +import net.neoforged.neoforge.client.event.EntityRenderersEvent; import java.util.ArrayList; -@Mod.EventBusSubscriber(modid = UnusualFishMod.MOD_ID, bus = Bus.MOD, value = Dist.CLIENT) +import static codyhuh.unusualfishmod.UnusualFishMod.loc; + +@EventBusSubscriber(modid = UnusualFishMod.MOD_ID, value = Dist.CLIENT) public final class ClientEvents { - @SubscribeEvent - public static void clientSetup(FMLClientSetupEvent e) { - ItemProperties.register(UFItems.CLEMENT_SHELL.get(), new ResourceLocation("blowing"), (p_234978_, p_234979_, p_234980_, p_234981_) -> p_234980_ != null && p_234980_.isUsingItem() && p_234980_.getUseItem() == p_234978_ ? 1.0F : 0.0F); - ItemProperties.register(UFItems.FLUVIAL_SHELL.get(), new ResourceLocation("blowing"), (p_234978_, p_234979_, p_234980_, p_234981_) -> p_234980_ != null && p_234980_.isUsingItem() && p_234980_.getUseItem() == p_234978_ ? 1.0F : 0.0F); - ItemProperties.register(UFItems.THUNDEROUS_SHELL.get(), new ResourceLocation("blowing"), (p_234978_, p_234979_, p_234980_, p_234981_) -> p_234980_ != null && p_234980_.isUsingItem() && p_234980_.getUseItem() == p_234978_ ? 1.0F : 0.0F); - ItemProperties.register(UFItems.PRISMARINE_SPEAR.get(), new ResourceLocation("using"), (p_234978_, p_234979_, p_234980_, p_234981_) -> p_234980_ != null && p_234980_.isUsingItem() && p_234980_.getUseItem() == p_234978_ ? 1.0F : 0.0F); - ///ItemProperties.register(UFItems.RIPSAW.get(), new ResourceLocation("sawing"), (stack, level, player, i) -> player != null && player.isUsingItem() && stack.hasTag() ? stack.getOrCreateTag().getFloat("SawingProgress") : 0.0F); - ItemProperties.register(UFItems.CORAL_SKRIMP_BUCKET.get(), new ResourceLocation(UnusualFishMod.MOD_ID, "variant"), (stack, world, player, i) -> stack.hasTag() ? stack.getOrCreateTag().getInt("Variant") : 0); - ItemProperties.register(UFItems.COPPERFLAME_BUCKET.get(), new ResourceLocation(UnusualFishMod.MOD_ID, "variant"), (stack, world, player, i) -> stack.hasTag() ? stack.getOrCreateTag().getInt("Variant") : 0); - ItemProperties.register(UFItems.DEMON_HERRING_BUCKET.get(), new ResourceLocation(UnusualFishMod.MOD_ID, "variant"), (stack, world, player, i) -> stack.hasTag() ? stack.getOrCreateTag().getInt("Variant") : 0); - } - - private static void make(EntityType type, String name){ - EntityRenderers.register(type, (ctx) -> new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>(name), false)); - } - - @SubscribeEvent - public static void registerRenderers(EntityRenderersEvent.RegisterRenderers e) { - EntityType[] simpleEntities = new EntityType[]{ - UFEntities.AERO_MONO.get(), UFEntities.AMBER_GOBY.get(), UFEntities.BARK_ANGELFISH.get(), UFEntities.BEAKED_HERRING.get(), - UFEntities.BLACKCAP_SNAIL.get(), UFEntities.BLIND_SAILFIN.get(), UFEntities.BLIZZARDFIN_TUNA.get(), UFEntities.BRICK_SNAIL.get(), - UFEntities.CIRCUS_FISH.get(), UFEntities.CLOWNTHORN_SHARK.get(), UFEntities.CRIMSONSHELL_SQUID.get(), UFEntities.DEEP_CRAWLER.get(), - UFEntities.DROOPING_GOURAMI.get(), UFEntities.FORKFISH.get(), UFEntities.FRESHWATER_MANTIS.get(), UFEntities.KALAPPA.get(), - UFEntities.LOBED_SKIPPER.get(), UFEntities.MOSSTHORN.get(), UFEntities.MUDDYTOP_SNAIL.get(), UFEntities.PINKFIN.get(), - UFEntities.PORCUPINE_LOBSTA.get(), UFEntities.PRAWN.get(), UFEntities.RHINO_TETRA.get(), UFEntities.RIPPER.get(), - UFEntities.ROUGHBACK.get(), UFEntities.SAILOR_BARB.get(), UFEntities.SEA_MOSQUITO.get(), - UFEntities.SEA_PANCAKE.get(), UFEntities.SEA_SPIDER.get(), UFEntities.SNEEPSNORP.get(), UFEntities.SNOWFLAKE.get(), - UFEntities.SPINDLEFISH.get(), UFEntities.SPOON_SHARK.get(), UFEntities.SQUODDLE.get(), UFEntities.STOUT_BICHIR.get(), - UFEntities.TIGER_JUNGLE_SHARK.get(), UFEntities.TIGER_PUFFER.get(), UFEntities.TRIBBLE.get(), UFEntities.TRUMPET_SQUID.get(), - UFEntities.ZEBRA_CORNETFISH.get(), UFEntities.TRIPLE_TWIRL_PLECO.get(), // todo - triple twirl pleco variants - }; - for (EntityType type : simpleEntities) { - make(type, type.getDescriptionId().substring("entity.unusualfishmod.".length())); - } - - e.registerEntityRenderer(UFEntities.DUALITY_DAMSELFISH.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { - TextureVariantModel model = new TextureVariantModel<>("duality_damselfish"); - ArrayList textures = new ArrayList<>(); - for (int i = 1; i <= 2; i++) { - textures.add(new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/duality_damselfish/duality_damselfish_" + i + ".png")); - } - model.setTextures(DualityDamselfish::getVariant, textures); - return model; - }, false); - return render; - }); - - e.registerEntityRenderer(UFEntities.CELESTIAL_FISH.get(), (ctx) -> new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("celestial_fish"), true)); - - e.registerEntityRenderer(UFEntities.COPPERFLAME.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { - TextureVariantModel model = new TextureVariantModel<>("copperflame"); - ArrayList textures = new ArrayList<>(); - for (int i = 1; i <= 2; i++) { - textures.add(new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/copperflame_anthias/copperflame_" + i + ".png")); - } - model.setTextures(CopperflameAnthias::getVariant, textures); - return model; - }, true); - return render; - }); - - e.registerEntityRenderer(UFEntities.DEMON_HERRING.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { - TextureVariantModel model = new TextureVariantModel<>("demon_herring"); - ArrayList textures = new ArrayList<>(); - for (int i = 1; i <= 3; i++) { - textures.add(new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/demon_herring/demon_herring_" + i + ".png")); - } - model.setTextures(DemonHerring::getVariant, textures); - return model; - }, false); - render.addRenderLayer(new DemonHerringGlowRenderLayer<>(render)); - return render; - }); - - e.registerEntityRenderer(UFEntities.GNASHER.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("gnasher"), false); - render.addRenderLayer(new UFGlowRenderLayer<>(render, new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/glow/gnasher.png"))); - return render; - }); - - e.registerEntityRenderer(UFEntities.EYELASH.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { - TextureVariantModel model = new TextureVariantModel<>("eyelash_fish"); - ArrayList textures = new ArrayList<>(); - for (int i = 1; i <= 15; i++) { - textures.add(new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/eyelash_fish/eyelash_fish_" + i + ".png")); - } - model.setTextures(EyelashFish::getVariant, textures); - return model; - }, false); - return render; - }); - - e.registerEntityRenderer(UFEntities.HATCHET_FISH.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("hatchet_fish"), false); - render.addRenderLayer(new UFGlowRenderLayer<>(render, new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/glow/hatchet_fish.png"))); - return render; - }); - - e.registerEntityRenderer(UFEntities.WIZARD_JELLY.get(), (ctx) -> new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("mana_jellyfish"), true)); - - e.registerEntityRenderer(UFEntities.PICKLEFISH.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("picklefish"), false); - render.addRenderLayer(new UFGlowRenderLayer<>(render, new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/glow/picklefish.png"))); - return render; - }); - - e.registerEntityRenderer(UFEntities.CORAL_SKRIMP.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { - TextureVariantModel model = new TextureVariantModel<>("skrimp"); - ArrayList textures = new ArrayList<>(); - for (int i = 1; i <= 15; i++) { - textures.add(new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/skrimp/skrimp_" + i + ".png")); - } - model.setTextures(Skrimp::getVariant, textures); - return model; - }, false); - return render; - }); - - e.registerEntityRenderer(UFEntities.SHOCKCAT.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("shockcat"), false); - render.addRenderLayer(new UFGlowRenderLayer<>(render, new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/glow/shockcat.png"))); - return render; - }); - - e.registerEntityRenderer(UFEntities.VOLT_ANGLER.get(), (ctx) -> { - GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("volt_angler"), false); - render.addRenderLayer(new UFGlowRenderLayer<>(render, new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/glow/volt_angler.png"))); - return render; - }); - - e.registerEntityRenderer(UFEntities.ABYSSAL_BLAST.get(), AbyssalBlastRenderer::new); - e.registerEntityRenderer(UFEntities.PRISMARINE_SPEAR.get(), ThrownPrismarineSpearRenderer::new); - e.registerEntityRenderer(UFEntities.SEA_SPIKE.get(), SeaSpikeRenderer::new); - e.registerEntityRenderer(UFEntities.FALLING_TREE.get(), FallingTreeBlockRenderer::new); - e.registerEntityRenderer(UFEntities.ROOTBALL.get(), RootballRenderer::new); - } - - @SubscribeEvent - public static void registerLayers(EntityRenderersEvent.RegisterLayerDefinitions e) { - e.registerLayerDefinition(UFModelLayers.PRISMARINE_SPEAR, PrismarineSpearModel::createBodyLayer); - e.registerLayerDefinition(UFModelLayers.ROOTBALL, RootballModel::createBodyLayer); - } + @SubscribeEvent + public static void clientSetup(FMLClientSetupEvent e) { + ItemProperties.register(UFItems.CLEMENT_SHELL.get(), loc("blowing"), (p_234978_, p_234979_, p_234980_, p_234981_) -> p_234980_ != null && p_234980_.isUsingItem() && p_234980_.getUseItem() == p_234978_ ? 1.0F : 0.0F); + ItemProperties.register(UFItems.FLUVIAL_SHELL.get(), loc("blowing"), (p_234978_, p_234979_, p_234980_, p_234981_) -> p_234980_ != null && p_234980_.isUsingItem() && p_234980_.getUseItem() == p_234978_ ? 1.0F : 0.0F); + ItemProperties.register(UFItems.THUNDEROUS_SHELL.get(), loc("blowing"), (p_234978_, p_234979_, p_234980_, p_234981_) -> p_234980_ != null && p_234980_.isUsingItem() && p_234980_.getUseItem() == p_234978_ ? 1.0F : 0.0F); + ItemProperties.register(UFItems.PRISMARINE_SPEAR.get(), loc("using"), (p_234978_, p_234979_, p_234980_, p_234981_) -> p_234980_ != null && p_234980_.isUsingItem() && p_234980_.getUseItem() == p_234978_ ? 1.0F : 0.0F); + ///ItemProperties.register(UFItems.RIPSAW.get(), new ResourceLocation("sawing"), (stack, level, player, i) -> player != null && player.isUsingItem() && stack.hasTag() ? stack.getOrCreateTag().getFloat("SawingProgress") : 0.0F); + ItemProperties.register(UFItems.CORAL_SKRIMP_BUCKET.get(), loc("variant"), (stack, level, entity, seed) -> getBucketVariant(stack)); + ItemProperties.register(UFItems.COPPERFLAME_BUCKET.get(), loc("variant"), (stack, level, entity, seed) -> getBucketVariant(stack)); + ItemProperties.register(UFItems.DEMON_HERRING_BUCKET.get(), loc("variant"), (stack, level, entity, seed) -> getBucketVariant(stack)); + } + + private static int getBucketVariant(ItemStack stack) { + CustomData customData = stack.get(DataComponents.BUCKET_ENTITY_DATA); + if (customData != null) { + CompoundTag tag = customData.copyTag(); + if (customData.contains("Variant")) { + return tag.getInt("Variant"); + } + } + return 0; + } + + private static void make(EntityType type, String name) { + EntityRenderers.register(type, (ctx) -> new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>(name), false)); + } + + @SubscribeEvent + public static void registerRenderers(EntityRenderersEvent.RegisterRenderers e) { + EntityType[] simpleEntities = new EntityType[]{ + UFEntities.AERO_MONO.get(), UFEntities.AMBER_GOBY.get(), UFEntities.BARK_ANGELFISH.get(), UFEntities.BEAKED_HERRING.get(), + UFEntities.BLACKCAP_SNAIL.get(), UFEntities.BLIND_SAILFIN.get(), UFEntities.BLIZZARDFIN_TUNA.get(), UFEntities.BRICK_SNAIL.get(), + UFEntities.CIRCUS_FISH.get(), UFEntities.CLOWNTHORN_SHARK.get(), UFEntities.CRIMSONSHELL_SQUID.get(), UFEntities.DEEP_CRAWLER.get(), + UFEntities.DROOPING_GOURAMI.get(), UFEntities.FORKFISH.get(), UFEntities.FRESHWATER_MANTIS.get(), UFEntities.KALAPPA.get(), + UFEntities.LOBED_SKIPPER.get(), UFEntities.MOSSTHORN.get(), UFEntities.MUDDYTOP_SNAIL.get(), UFEntities.PINKFIN.get(), + UFEntities.PORCUPINE_LOBSTA.get(), UFEntities.PRAWN.get(), UFEntities.RHINO_TETRA.get(), UFEntities.RIPPER.get(), + UFEntities.ROUGHBACK.get(), UFEntities.SAILOR_BARB.get(), UFEntities.SEA_MOSQUITO.get(), + UFEntities.SEA_PANCAKE.get(), UFEntities.SEA_SPIDER.get(), UFEntities.SNEEPSNORP.get(), UFEntities.FROSTY_FIN.get(), + UFEntities.SPINDLEFISH.get(), UFEntities.SPOON_SHARK.get(), UFEntities.SQUODDLE.get(), UFEntities.STOUT_BICHIR.get(), + UFEntities.TIGER_JUNGLE_SHARK.get(), UFEntities.TIGER_PUFFER.get(), UFEntities.TRIBBLE.get(), UFEntities.TRUMPET_SQUID.get(), + UFEntities.ZEBRA_CORNETFISH.get(), UFEntities.TRIPLE_TWIRL_PLECO.get(), // todo - triple twirl pleco variants + }; + for (EntityType type : simpleEntities) { + make(type, type.getDescriptionId().substring("entity.unusualfishmod.".length())); + } + + e.registerEntityRenderer(UFEntities.DUALITY_DAMSELFISH.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { + TextureVariantModel model = new TextureVariantModel<>("duality_damselfish"); + ArrayList textures = new ArrayList<>(); + for (int i = 1; i <= 2; i++) { + textures.add(loc("textures/entity/duality_damselfish/duality_damselfish_" + i + ".png")); + } + model.setTextures(DualityDamselfish::getVariant, textures); + return model; + }, false); + return render; + }); + + e.registerEntityRenderer(UFEntities.CELESTIAL_FISH.get(), (ctx) -> new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("celestial_fish"), true)); + + e.registerEntityRenderer(UFEntities.COPPERFLAME.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { + TextureVariantModel model = new TextureVariantModel<>("copperflame"); + ArrayList textures = new ArrayList<>(); + for (int i = 1; i <= 2; i++) { + textures.add(loc("textures/entity/copperflame_anthias/copperflame_" + i + ".png")); + } + model.setTextures(CopperflameAnthias::getVariant, textures); + return model; + }, true); + return render; + }); + + e.registerEntityRenderer(UFEntities.DEMON_HERRING.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { + TextureVariantModel model = new TextureVariantModel<>("demon_herring"); + ArrayList textures = new ArrayList<>(); + for (int i = 1; i <= 3; i++) { + textures.add(loc("textures/entity/demon_herring/demon_herring_" + i + ".png")); + } + model.setTextures(DemonHerring::getVariant, textures); + return model; + }, false); + render.addRenderLayer(new DemonHerringGlowRenderLayer<>(render)); + return render; + }); + + e.registerEntityRenderer(UFEntities.GNASHER.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("gnasher"), false); + render.addRenderLayer(new UFGlowRenderLayer<>(render, loc("textures/entity/glow/gnasher.png"))); + return render; + }); + + e.registerEntityRenderer(UFEntities.EYELASH.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { + TextureVariantModel model = new TextureVariantModel<>("eyelash_fish"); + ArrayList textures = new ArrayList<>(); + for (int i = 1; i <= 15; i++) { + textures.add(loc("textures/entity/eyelash_fish/eyelash_fish_" + i + ".png")); + } + model.setTextures(EyelashFish::getVariant, textures); + return model; + }, false); + return render; + }); + + e.registerEntityRenderer(UFEntities.HATCHET_FISH.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("hatchet_fish"), false); + render.addRenderLayer(new UFGlowRenderLayer<>(render, loc("textures/entity/glow/hatchet_fish.png"))); + return render; + }); + + e.registerEntityRenderer(UFEntities.WIZARD_JELLY.get(), (ctx) -> new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("mana_jellyfish"), true)); + + e.registerEntityRenderer(UFEntities.PICKLEFISH.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("picklefish"), false); + render.addRenderLayer(new UFGlowRenderLayer<>(render, loc("textures/entity/glow/picklefish.png"))); + return render; + }); + + e.registerEntityRenderer(UFEntities.CORAL_SKRIMP.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> { + TextureVariantModel model = new TextureVariantModel<>("skrimp"); + ArrayList textures = new ArrayList<>(); + for (int i = 1; i <= 15; i++) { + textures.add(loc("textures/entity/skrimp/skrimp_" + i + ".png")); + } + model.setTextures(Skrimp::getVariant, textures); + return model; + }, false); + return render; + }); + + e.registerEntityRenderer(UFEntities.SHOCKCAT.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("shockcat"), false); + render.addRenderLayer(new UFGlowRenderLayer<>(render, loc("textures/entity/glow/shockcat.png"))); + return render; + }); + + e.registerEntityRenderer(UFEntities.VOLT_ANGLER.get(), (ctx) -> { + GenericGeoRenderer render = new GenericGeoRenderer<>(ctx, () -> new GenericGeoModel<>("volt_angler"), false); + render.addRenderLayer(new UFGlowRenderLayer<>(render, loc("textures/entity/glow/volt_angler.png"))); + return render; + }); + + e.registerEntityRenderer(UFEntities.ABYSSAL_BLAST.get(), AbyssalBlastRenderer::new); + e.registerEntityRenderer(UFEntities.PRISMARINE_SPEAR.get(), ThrownPrismarineSpearRenderer::new); + e.registerEntityRenderer(UFEntities.SEA_SPIKE.get(), SeaSpikeRenderer::new); + e.registerEntityRenderer(UFEntities.FALLING_TREE.get(), FallingTreeBlockRenderer::new); + e.registerEntityRenderer(UFEntities.ROOTBALL.get(), RootballRenderer::new); + } + + @SubscribeEvent + public static void registerLayers(EntityRenderersEvent.RegisterLayerDefinitions e) { + e.registerLayerDefinition(UFModelLayers.PRISMARINE_SPEAR, PrismarineSpearModel::createBodyLayer); + e.registerLayerDefinition(UFModelLayers.ROOTBALL, RootballModel::createBodyLayer); + } } diff --git a/src/main/java/codyhuh/unusualfishmod/client/UFModelLayers.java b/src/main/java/codyhuh/unusualfishmod/client/UFModelLayers.java index e937c63..88fdf3a 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/UFModelLayers.java +++ b/src/main/java/codyhuh/unusualfishmod/client/UFModelLayers.java @@ -1,15 +1,15 @@ package codyhuh.unusualfishmod.client; -import codyhuh.unusualfishmod.UnusualFishMod; import net.minecraft.client.model.geom.ModelLayerLocation; -import net.minecraft.resources.ResourceLocation; + +import static codyhuh.unusualfishmod.UnusualFishMod.loc; public class UFModelLayers { public static final ModelLayerLocation ROOTBALL = create("rootball"); public static final ModelLayerLocation PRISMARINE_SPEAR = create("prismarine_spear"); private static ModelLayerLocation create(String name) { - return new ModelLayerLocation(new ResourceLocation(UnusualFishMod.MOD_ID, name), "main"); + return new ModelLayerLocation(loc(name), "main"); } } diff --git a/src/main/java/codyhuh/unusualfishmod/client/geo/DemonHerringGlowRenderLayer.java b/src/main/java/codyhuh/unusualfishmod/client/geo/DemonHerringGlowRenderLayer.java index d01686d..eccfcf7 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/geo/DemonHerringGlowRenderLayer.java +++ b/src/main/java/codyhuh/unusualfishmod/client/geo/DemonHerringGlowRenderLayer.java @@ -1,19 +1,19 @@ package codyhuh.unusualfishmod.client.geo; -import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.common.entity.DemonHerring; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.LivingEntityRenderer; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.LivingEntity; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.cache.object.BakedGeoModel; import software.bernie.geckolib.renderer.GeoRenderer; import software.bernie.geckolib.renderer.layer.GeoRenderLayer; +import static codyhuh.unusualfishmod.UnusualFishMod.loc; +import static net.minecraft.util.FastColor.ARGB32.color; + public class DemonHerringGlowRenderLayer extends GeoRenderLayer { public DemonHerringGlowRenderLayer(GeoRenderer layer) { @@ -23,10 +23,10 @@ public DemonHerringGlowRenderLayer(GeoRenderer layer) { @Override public void render(PoseStack poseStack, T animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) { int i = animatable.getVariant() + 1; - VertexConsumer vertexconsumer = bufferSource.getBuffer(RenderType.dragonExplosionAlpha(new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/glow/demon_herring_" + i + ".png"))); + VertexConsumer vertexconsumer = bufferSource.getBuffer(RenderType.dragonExplosionAlpha(loc("textures/entity/glow/demon_herring_" + i + ".png"))); if (!animatable.isInvisible()) { - this.getRenderer().reRender(bakedModel, poseStack, bufferSource, animatable, renderType, vertexconsumer, partialTick, packedLight, LivingEntityRenderer.getOverlayCoords(animatable, 0.0F), 1.0F, 1.0F, 1.0F, 1.0F); + this.getRenderer().reRender(bakedModel, poseStack, bufferSource, animatable, renderType, vertexconsumer, partialTick, packedLight, LivingEntityRenderer.getOverlayCoords(animatable, 0.0F), color(255, 255, 255, 255)); } } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoModel.java b/src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoModel.java index f966b03..f817c6b 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoModel.java +++ b/src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoModel.java @@ -1,11 +1,12 @@ package codyhuh.unusualfishmod.client.geo; -import codyhuh.unusualfishmod.UnusualFishMod; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.model.GeoModel; +import static codyhuh.unusualfishmod.UnusualFishMod.loc; + public class GenericGeoModel extends GeoModel { private final String model; private final String texture; @@ -24,16 +25,16 @@ public GenericGeoModel(String model, String texture, String anim) { @Override public ResourceLocation getModelResource(E object) { - return new ResourceLocation(UnusualFishMod.MOD_ID, "geo/entity/" + model + ".geo.json"); + return loc("geo/entity/" + model + ".geo.json"); } @Override public ResourceLocation getTextureResource(E object) { - return new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/" + texture + ".png"); + return loc("textures/entity/" + texture + ".png"); } @Override public ResourceLocation getAnimationResource(E object) { - return new ResourceLocation(UnusualFishMod.MOD_ID, "animations/entity/" + anim + ".animation.json"); + return loc("animations/entity/" + anim + ".animation.json"); } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoRenderer.java b/src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoRenderer.java index d7e9a98..b3afb4b 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoRenderer.java +++ b/src/main/java/codyhuh/unusualfishmod/client/geo/GenericGeoRenderer.java @@ -2,7 +2,6 @@ import codyhuh.unusualfishmod.common.entity.util.base.BreedableWaterAnimal; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRendererProvider; @@ -11,57 +10,56 @@ import net.minecraft.world.entity.AgeableMob; import net.minecraft.world.entity.LivingEntity; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.cache.object.BakedGeoModel; import software.bernie.geckolib.model.GeoModel; import software.bernie.geckolib.renderer.GeoEntityRenderer; import java.util.function.Supplier; public class GenericGeoRenderer extends GeoEntityRenderer { - private float scale = 1F; - private boolean glow; + private float scale = 1F; + private final boolean glow; - public GenericGeoRenderer(EntityRendererProvider.Context renderManager, Supplier> model, boolean glow) { - super(renderManager, model.get()); - this.shadowRadius = 0.3F; - this.glow = glow; - } + public GenericGeoRenderer(EntityRendererProvider.Context renderManager, Supplier> model, boolean glow) { + super(renderManager, model.get()); + this.shadowRadius = 0.3F; + this.glow = glow; + } - public GenericGeoRenderer(EntityRendererProvider.Context renderManager, Supplier> model, float scale) { - this(renderManager, model.get(), scale); - this.scale = scale; - } - - public GenericGeoRenderer(EntityRendererProvider.Context mgr, GeoModel modelProvider, boolean glow) { - super(mgr, modelProvider); - this.glow = glow; - } + public GenericGeoRenderer(EntityRendererProvider.Context renderManager, Supplier> model, float scale) { + this(renderManager, model.get(), scale); + this.scale = scale; + } - public GenericGeoRenderer(EntityRendererProvider.Context mgr, GeoModel modelProvider, float scale) { - this(mgr, modelProvider, false); - this.scale = scale; - } - - @Override - public void render(T entity, float entityYaw, float partialTicks, PoseStack stack, MultiBufferSource bufferIn, int packedLightIn) { - if (scale != 1F) { - stack.scale(scale, scale, scale); - } + public GenericGeoRenderer(EntityRendererProvider.Context mgr, GeoModel modelProvider, boolean glow) { + super(mgr, modelProvider); + this.glow = glow; + } - if ((entity instanceof AgeableMob mob && mob.isBaby()) || entity instanceof BreedableWaterAnimal bwa && bwa.isBaby()) { - stack.scale(0.5F, 0.5F, 0.5F); - } + public GenericGeoRenderer(EntityRendererProvider.Context mgr, GeoModel modelProvider, float scale) { + this(mgr, modelProvider, false); + this.scale = scale; + } - super.render(entity, entityYaw, partialTicks, stack, bufferIn, packedLightIn); - } + @Override + public void render(T entity, float entityYaw, float partialTicks, PoseStack stack, MultiBufferSource bufferIn, int packedLightIn) { + if (scale != 1F) { + stack.scale(scale, scale, scale); + } - @Override - protected int getBlockLightLevel(T p_114496_, BlockPos p_114497_) { - return glow ? 15 : super.getBlockLightLevel(p_114496_, p_114497_); - } + if ((entity instanceof AgeableMob mob && mob.isBaby()) || entity instanceof BreedableWaterAnimal bwa && bwa.isBaby()) { + stack.scale(0.5F, 0.5F, 0.5F); + } - @Override - public RenderType getRenderType(T animatable, ResourceLocation texture, @org.jetbrains.annotations.Nullable MultiBufferSource bufferSource, float partialTick) { - return RenderType.entityTranslucent(texture); - } + super.render(entity, entityYaw, partialTicks, stack, bufferIn, packedLightIn); + } + + @Override + protected int getBlockLightLevel(T p_114496_, BlockPos p_114497_) { + return glow ? 15 : super.getBlockLightLevel(p_114496_, p_114497_); + } + + @Override + public RenderType getRenderType(T animatable, ResourceLocation texture, @org.jetbrains.annotations.Nullable MultiBufferSource bufferSource, float partialTick) { + return RenderType.entityTranslucent(texture); + } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/client/geo/TextureVariantModel.java b/src/main/java/codyhuh/unusualfishmod/client/geo/TextureVariantModel.java index fd75183..38c47cb 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/geo/TextureVariantModel.java +++ b/src/main/java/codyhuh/unusualfishmod/client/geo/TextureVariantModel.java @@ -15,7 +15,7 @@ public TextureVariantModel(String name) { super(name); } - public TextureVariantModel setTextures(Function whichTexture, List textures){ + public TextureVariantModel setTextures(Function whichTexture, List textures) { this.whichTexture = whichTexture; this.textures = textures; return this; diff --git a/src/main/java/codyhuh/unusualfishmod/client/geo/UFGlowRenderLayer.java b/src/main/java/codyhuh/unusualfishmod/client/geo/UFGlowRenderLayer.java index bb76002..c04c352 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/geo/UFGlowRenderLayer.java +++ b/src/main/java/codyhuh/unusualfishmod/client/geo/UFGlowRenderLayer.java @@ -12,6 +12,8 @@ import software.bernie.geckolib.renderer.GeoRenderer; import software.bernie.geckolib.renderer.layer.GeoRenderLayer; +import static net.minecraft.util.FastColor.ARGB32.color; + public class UFGlowRenderLayer extends GeoRenderLayer { private final ResourceLocation glowLayer; @@ -25,7 +27,7 @@ public void render(PoseStack poseStack, T animatable, BakedGeoModel bakedModel, VertexConsumer vertexconsumer = bufferSource.getBuffer(RenderType.dragonExplosionAlpha(glowLayer)); if (!animatable.isInvisible()) { - this.getRenderer().reRender(bakedModel, poseStack, bufferSource, animatable, renderType, vertexconsumer, partialTick, packedLight, LivingEntityRenderer.getOverlayCoords(animatable, 0.0F), 1.0F, 1.0F, 1.0F, 1.0F); + this.getRenderer().reRender(bakedModel, poseStack, bufferSource, animatable, renderType, vertexconsumer, partialTick, packedLight, LivingEntityRenderer.getOverlayCoords(animatable, 0.0F), color(255, 255, 255, 255)); } } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/client/misc/render/AbyssalBlastRenderer.java b/src/main/java/codyhuh/unusualfishmod/client/misc/render/AbyssalBlastRenderer.java index c7afbcc..78ce239 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/misc/render/AbyssalBlastRenderer.java +++ b/src/main/java/codyhuh/unusualfishmod/client/misc/render/AbyssalBlastRenderer.java @@ -1,6 +1,5 @@ package codyhuh.unusualfishmod.client.misc.render; -import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.common.entity.item.AbyssalBlast; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; @@ -12,14 +11,15 @@ 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 static codyhuh.unusualfishmod.UnusualFishMod.loc; + public class AbyssalBlastRenderer extends EntityRenderer { - private static final ResourceLocation TEXTURE_0 = new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/abyssalblast/abyssal_blast_0.png"); - private static final ResourceLocation TEXTURE_1 = new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/abyssalblast/abyssal_blast_1.png"); - private static final ResourceLocation TEXTURE_2 = new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/abyssalblast/abyssal_blast_2.png"); - private static final ResourceLocation TEXTURE_3 = new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/abyssalblast/abyssal_blast_3.png"); + private static final ResourceLocation TEXTURE_0 = loc("textures/entity/abyssalblast/abyssal_blast_0.png"); + private static final ResourceLocation TEXTURE_1 = loc("textures/entity/abyssalblast/abyssal_blast_1.png"); + private static final ResourceLocation TEXTURE_2 = loc("textures/entity/abyssalblast/abyssal_blast_2.png"); + private static final ResourceLocation TEXTURE_3 = loc("textures/entity/abyssalblast/abyssal_blast_3.png"); public AbyssalBlastRenderer(EntityRendererProvider.Context renderManagerIn) { super(renderManagerIn); @@ -33,7 +33,7 @@ public void render(AbyssalBlast entityIn, float entityYaw, float partialTicks, P int arcs = Mth.clamp(Mth.floor(entityIn.tickCount / 5F), 1, 4); matrixStackIn.translate(0.0D, 0.0F, 0.4D); - for(int i = 0; i < arcs; i++){ + for (int i = 0; i < arcs; i++) { matrixStackIn.pushPose(); matrixStackIn.translate(0, 0, -0.5F * i); renderArc(matrixStackIn, bufferIn, (i + 1) * 5, entityIn.isFasterAnimation()); @@ -49,18 +49,16 @@ private void renderArc(PoseStack matrixStackIn, MultiBufferSource bufferIn, int ResourceLocation res; if (fast) { res = getEntityTextureFaster(age); - } - else { + } else { res = getEntityTexture(age); } VertexConsumer ivertexbuilder = bufferIn.getBuffer(RenderType.entityCutoutNoCull(res)); - PoseStack.Pose lvt_19_1_ = matrixStackIn.last(); - Matrix4f lvt_20_1_ = lvt_19_1_.pose(); - Matrix3f lvt_21_1_ = lvt_19_1_.normal(); - this.drawVertex(lvt_20_1_, lvt_21_1_, ivertexbuilder, -1, 0, -1, 0, 0, 1, 0, 1, 240); - this.drawVertex(lvt_20_1_, lvt_21_1_, ivertexbuilder, -1, 0, 1, 0, 1, 1, 0, 1, 240); - this.drawVertex(lvt_20_1_, lvt_21_1_, ivertexbuilder, 1, 0, 1, 1, 1, 1, 0, 1, 240); - this.drawVertex(lvt_20_1_, lvt_21_1_, ivertexbuilder, 1, 0, -1, 1, 0, 1, 0, 1, 240); + PoseStack.Pose pose = matrixStackIn.last(); + Matrix4f matrix4f = pose.pose(); + this.drawVertex(matrix4f, pose, ivertexbuilder, -1, 0, -1, 0, 0, 1, 0, 1, 240); + this.drawVertex(matrix4f, pose, ivertexbuilder, -1, 0, 1, 0, 1, 1, 0, 1, 240); + this.drawVertex(matrix4f, pose, ivertexbuilder, 1, 0, 1, 1, 1, 1, 0, 1, 240); + this.drawVertex(matrix4f, pose, ivertexbuilder, 1, 0, -1, 1, 0, 1, 0, 1, 240); matrixStackIn.popPose(); } @@ -69,21 +67,18 @@ public ResourceLocation getTextureLocation(AbyssalBlast entity) { return TEXTURE_0; } - public void drawVertex(Matrix4f p_229039_1_, Matrix3f p_229039_2_, VertexConsumer p_229039_3_, int p_229039_4_, int p_229039_5_, int p_229039_6_, float p_229039_7_, float p_229039_8_, int p_229039_9_, int p_229039_10_, int p_229039_11_, int p_229039_12_) { - p_229039_3_.vertex(p_229039_1_, (float) p_229039_4_, (float) p_229039_5_, (float) p_229039_6_).color(255, 255, 255, 255).uv(p_229039_7_, p_229039_8_).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(p_229039_12_).normal(p_229039_2_, (float) p_229039_9_, (float) p_229039_11_, (float) p_229039_10_).endVertex(); + public void drawVertex(Matrix4f matrixPos, PoseStack.Pose pose, VertexConsumer buffer, int x, int y, int z, float u, float v, int normalX, int normalY, int normalZ, int packedLight) { + buffer.addVertex(matrixPos, (float) x, (float) y, (float) z).setColor(255, 255, 255, 255).setUv(u, v).setOverlay(OverlayTexture.NO_OVERLAY).setLight(packedLight).setNormal(pose, (float) normalX, (float) normalY, (float) normalZ); } public ResourceLocation getEntityTexture(int age) { if (age < 1) { return TEXTURE_0; - } - else if (age < 15) { + } else if (age < 15) { return TEXTURE_1; - } - else if (age < 40) { + } else if (age < 40) { return TEXTURE_2; - } - else { + } else { return TEXTURE_3; } } @@ -91,14 +86,11 @@ else if (age < 40) { public ResourceLocation getEntityTextureFaster(int age) { if (age < 6) { return TEXTURE_0; - } - else if (age < 9) { + } else if (age < 9) { return TEXTURE_1; - } - else if (age < 12) { + } else if (age < 12) { return TEXTURE_2; - } - else { + } else { return TEXTURE_3; } } diff --git a/src/main/java/codyhuh/unusualfishmod/client/misc/render/RootballRenderer.java b/src/main/java/codyhuh/unusualfishmod/client/misc/render/RootballRenderer.java index 54ec9bb..4c1c8c4 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/misc/render/RootballRenderer.java +++ b/src/main/java/codyhuh/unusualfishmod/client/misc/render/RootballRenderer.java @@ -1,6 +1,5 @@ package codyhuh.unusualfishmod.client.misc.render; -import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.client.UFModelLayers; import codyhuh.unusualfishmod.client.misc.render.model.RootballModel; import codyhuh.unusualfishmod.common.entity.Rootball; @@ -10,32 +9,34 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import static codyhuh.unusualfishmod.UnusualFishMod.loc; + public class RootballRenderer extends MobRenderer> { - protected static final ResourceLocation TEXTURE = new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/rootball.png"); - - public RootballRenderer(EntityRendererProvider.Context renderManagerIn) { - super(renderManagerIn, new RootballModel<>(renderManagerIn.bakeLayer(UFModelLayers.ROOTBALL)), 0.2F); - } - - protected void scale(Rootball p_114046_, PoseStack p_114047_, float p_114048_) { - float f = p_114046_.getSwelling(p_114048_); - float f1 = 1.0F + Mth.sin(f * 100.0F) * f * 0.01F; - f = Mth.clamp(f, 0.0F, 1.0F); - f *= f; - f *= f; - float f2 = (1.0F + f * 0.4F) * f1; - float f3 = (1.0F + f * 0.1F) / f1; - p_114047_.scale(f2, f3, f2); - } - - protected float getWhiteOverlayProgress(Rootball p_114043_, float p_114044_) { - float f = p_114043_.getSwelling(p_114044_); - return (int)(f * 10.0F) % 2 == 0 ? 0.0F : Mth.clamp(f, 0.5F, 1.0F); - } - - @Override - public ResourceLocation getTextureLocation(Rootball entity) { - return TEXTURE; - } + protected static final ResourceLocation TEXTURE = loc("textures/entity/rootball.png"); + + public RootballRenderer(EntityRendererProvider.Context renderManagerIn) { + super(renderManagerIn, new RootballModel<>(renderManagerIn.bakeLayer(UFModelLayers.ROOTBALL)), 0.2F); + } + + protected void scale(Rootball p_114046_, PoseStack p_114047_, float p_114048_) { + float f = p_114046_.getSwelling(p_114048_); + float f1 = 1.0F + Mth.sin(f * 100.0F) * f * 0.01F; + f = Mth.clamp(f, 0.0F, 1.0F); + f *= f; + f *= f; + float f2 = (1.0F + f * 0.4F) * f1; + float f3 = (1.0F + f * 0.1F) / f1; + p_114047_.scale(f2, f3, f2); + } + + protected float getWhiteOverlayProgress(Rootball p_114043_, float p_114044_) { + float f = p_114043_.getSwelling(p_114044_); + return (int) (f * 10.0F) % 2 == 0 ? 0.0F : Mth.clamp(f, 0.5F, 1.0F); + } + + @Override + public ResourceLocation getTextureLocation(Rootball entity) { + return TEXTURE; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/client/misc/render/SeaSpikeRenderer.java b/src/main/java/codyhuh/unusualfishmod/client/misc/render/SeaSpikeRenderer.java index f29965a..63a72a5 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/misc/render/SeaSpikeRenderer.java +++ b/src/main/java/codyhuh/unusualfishmod/client/misc/render/SeaSpikeRenderer.java @@ -1,19 +1,20 @@ package codyhuh.unusualfishmod.client.misc.render; -import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.common.entity.item.SeaSpike; import net.minecraft.client.renderer.entity.ArrowRenderer; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.resources.ResourceLocation; +import static codyhuh.unusualfishmod.UnusualFishMod.loc; + public class SeaSpikeRenderer extends ArrowRenderer { - public static final ResourceLocation LOCATION = new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/item/sea_spike.png"); + public static final ResourceLocation LOCATION = loc("textures/entity/item/sea_spike.png"); - public SeaSpikeRenderer(EntityRendererProvider.Context p_174399_) { - super(p_174399_); - } + public SeaSpikeRenderer(EntityRendererProvider.Context p_174399_) { + super(p_174399_); + } - public ResourceLocation getTextureLocation(SeaSpike p_116001_) { - return LOCATION; - } + public ResourceLocation getTextureLocation(SeaSpike p_116001_) { + return LOCATION; + } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/client/misc/render/ThrownPrismarineSpearRenderer.java b/src/main/java/codyhuh/unusualfishmod/client/misc/render/ThrownPrismarineSpearRenderer.java index 2e00849..4510084 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/misc/render/ThrownPrismarineSpearRenderer.java +++ b/src/main/java/codyhuh/unusualfishmod/client/misc/render/ThrownPrismarineSpearRenderer.java @@ -1,6 +1,5 @@ package codyhuh.unusualfishmod.client.misc.render; -import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.client.UFModelLayers; import codyhuh.unusualfishmod.client.misc.render.model.PrismarineSpearModel; import codyhuh.unusualfishmod.common.entity.item.ThrownPrismarineSpear; @@ -13,8 +12,11 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import static codyhuh.unusualfishmod.UnusualFishMod.loc; +import static net.minecraft.util.FastColor.ARGB32.color; + public class ThrownPrismarineSpearRenderer extends EntityRenderer { - public static final ResourceLocation LOC = new ResourceLocation(UnusualFishMod.MOD_ID, "textures/entity/item/prismarine_spear.png"); + public static final ResourceLocation LOC = loc("textures/entity/item/prismarine_spear.png"); private final PrismarineSpearModel model; public ThrownPrismarineSpearRenderer(EntityRendererProvider.Context p_174420_) { @@ -28,7 +30,7 @@ public void render(ThrownPrismarineSpear spear, float p_116112_, float p_116113_ stack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(p_116113_, spear.yRotO, spear.getYRot()) - 90.0F)); stack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(p_116113_, spear.xRotO, spear.getXRot()) + 90.0F)); - this.model.renderToBuffer(stack, buffer.getBuffer(this.model.renderType(this.getTextureLocation(spear))), p_116116_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + this.model.renderToBuffer(stack, buffer.getBuffer(this.model.renderType(this.getTextureLocation(spear))), p_116116_, OverlayTexture.NO_OVERLAY, color(255, 255, 255, 255)); stack.popPose(); super.render(spear, p_116112_, p_116113_, stack, buffer, p_116116_); diff --git a/src/main/java/codyhuh/unusualfishmod/client/misc/render/model/PrismarineSpearModel.java b/src/main/java/codyhuh/unusualfishmod/client/misc/render/model/PrismarineSpearModel.java index c14dbe1..a19e257 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/misc/render/model/PrismarineSpearModel.java +++ b/src/main/java/codyhuh/unusualfishmod/client/misc/render/model/PrismarineSpearModel.java @@ -9,29 +9,29 @@ import net.minecraft.client.model.geom.builders.*; public class PrismarineSpearModel extends EntityModel { - private final ModelPart spear; + private final ModelPart spear; - public PrismarineSpearModel(ModelPart root) { - this.spear = root.getChild("spear"); - } + public PrismarineSpearModel(ModelPart root) { + this.spear = root.getChild("spear"); + } - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition spear = partdefinition.addOrReplaceChild("spear", CubeListBuilder.create().texOffs(10, 0).addBox(-3.0F, -29.0F, 0.0F, 5.0F, 29.0F, 0.0F, new CubeDeformation(0.0F)) - .texOffs(0, 0).addBox(-0.5F, -29.0F, -2.5F, 0.0F, 29.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + PartDefinition spear = partdefinition.addOrReplaceChild("spear", CubeListBuilder.create().texOffs(10, 0).addBox(-3.0F, -29.0F, 0.0F, 5.0F, 29.0F, 0.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(-0.5F, -29.0F, -2.5F, 0.0F, 29.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - return LayerDefinition.create(meshdefinition, 64, 64); - } + return LayerDefinition.create(meshdefinition, 64, 64); + } - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + @Override + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - } + } - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - spear.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); - } + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, int color) { + spear.render(poseStack, vertexConsumer, packedLight, packedOverlay, color); + } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/client/misc/render/model/RootballModel.java b/src/main/java/codyhuh/unusualfishmod/client/misc/render/model/RootballModel.java index 16fe1f2..4619745 100644 --- a/src/main/java/codyhuh/unusualfishmod/client/misc/render/model/RootballModel.java +++ b/src/main/java/codyhuh/unusualfishmod/client/misc/render/model/RootballModel.java @@ -10,45 +10,45 @@ import net.minecraft.util.Mth; public class RootballModel extends EntityModel { - private final ModelPart Body; - private final ModelPart Leg1; - private final ModelPart Leg2; + private final ModelPart Body; + private final ModelPart Leg1; + private final ModelPart Leg2; - public RootballModel(ModelPart root) { - this.Body = root.getChild("Body"); - this.Leg1 = root.getChild("Leg1"); - this.Leg2 = root.getChild("Leg2"); - } + public RootballModel(ModelPart root) { + this.Body = root.getChild("Body"); + this.Leg1 = root.getChild("Leg1"); + this.Leg2 = root.getChild("Leg2"); + } - public static LayerDefinition createBodyLayer() { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); + public static LayerDefinition createBodyLayer() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); - PartDefinition Body = partdefinition.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(0, 8).addBox(-4.0F, -5.0F, 0.0F, 8.0F, 5.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 23.0F, -4.0F, -0.1309F, 0.0F, 0.0F)); + PartDefinition Body = partdefinition.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(0, 8).addBox(-4.0F, -5.0F, 0.0F, 8.0F, 5.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 23.0F, -4.0F, -0.1309F, 0.0F, 0.0F)); - PartDefinition Seaweed1 = Body.addOrReplaceChild("Seaweed1", CubeListBuilder.create().texOffs(0, 0).addBox(-10.0F, -8.0F, 0.0F, 20.0F, 8.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -2.0F, 4.0F, -0.1745F, 0.0F, 0.0F)); + PartDefinition Seaweed1 = Body.addOrReplaceChild("Seaweed1", CubeListBuilder.create().texOffs(0, 0).addBox(-10.0F, -8.0F, 0.0F, 20.0F, 8.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -2.0F, 4.0F, -0.1745F, 0.0F, 0.0F)); - PartDefinition Seaweed2 = Body.addOrReplaceChild("Seaweed2", CubeListBuilder.create().texOffs(0, 9).addBox(0.0F, -8.0F, -1.0F, 0.0F, 8.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -2.0F, 0.0F, -0.1309F, 0.0F, 0.0F)); + PartDefinition Seaweed2 = Body.addOrReplaceChild("Seaweed2", CubeListBuilder.create().texOffs(0, 9).addBox(0.0F, -8.0F, -1.0F, 0.0F, 8.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -2.0F, 0.0F, -0.1309F, 0.0F, 0.0F)); - PartDefinition Feetsies = Body.addOrReplaceChild("Feetsies", CubeListBuilder.create().texOffs(18, 8).addBox(-6.0F, 0.0F, 0.0F, 12.0F, 0.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -1.0F, 5.0F, -0.0873F, 0.0F, 0.0F)); + PartDefinition Feetsies = Body.addOrReplaceChild("Feetsies", CubeListBuilder.create().texOffs(18, 8).addBox(-6.0F, 0.0F, 0.0F, 12.0F, 0.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -1.0F, 5.0F, -0.0873F, 0.0F, 0.0F)); - PartDefinition Leg1 = partdefinition.addOrReplaceChild("Leg1", CubeListBuilder.create().texOffs(24, 21).addBox(0.0F, 0.0F, -2.0F, 4.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(3.0F, 22.0F, -4.0F, 0.0F, -0.3491F, 0.0F)); + PartDefinition Leg1 = partdefinition.addOrReplaceChild("Leg1", CubeListBuilder.create().texOffs(24, 21).addBox(0.0F, 0.0F, -2.0F, 4.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(3.0F, 22.0F, -4.0F, 0.0F, -0.3491F, 0.0F)); - PartDefinition Leg2 = partdefinition.addOrReplaceChild("Leg2", CubeListBuilder.create().texOffs(24, 21).mirror().addBox(-4.0F, 0.0F, -2.0F, 4.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-3.0F, 22.0F, -4.0F, 0.0F, 0.3491F, 0.0F)); + PartDefinition Leg2 = partdefinition.addOrReplaceChild("Leg2", CubeListBuilder.create().texOffs(24, 21).mirror().addBox(-4.0F, 0.0F, -2.0F, 4.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-3.0F, 22.0F, -4.0F, 0.0F, 0.3491F, 0.0F)); - return LayerDefinition.create(meshdefinition, 64, 64); - } + return LayerDefinition.create(meshdefinition, 64, 64); + } - @Override - public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { - this.Leg1.xRot = Mth.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; - this.Leg2.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; - } + @Override + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + this.Leg1.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount; + this.Leg2.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + } - @Override - public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { - Body.render(poseStack, buffer, packedLight, packedOverlay); - Leg1.render(poseStack, buffer, packedLight, packedOverlay); - Leg2.render(poseStack, buffer, packedLight, packedOverlay); - } + @Override + public void renderToBuffer(PoseStack poseStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) { + Body.render(poseStack, buffer, packedLight, packedOverlay, color); + Leg1.render(poseStack, buffer, packedLight, packedOverlay, color); + Leg2.render(poseStack, buffer, packedLight, packedOverlay, color); + } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/common/CommonEvents.java b/src/main/java/codyhuh/unusualfishmod/common/CommonEvents.java index 3a04c8d..9c672ea 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/CommonEvents.java +++ b/src/main/java/codyhuh/unusualfishmod/common/CommonEvents.java @@ -2,95 +2,83 @@ import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.common.entity.*; -import codyhuh.unusualfishmod.common.entity.item.ThrownPrismarineSpear; import codyhuh.unusualfishmod.core.registry.UFEntities; import codyhuh.unusualfishmod.core.registry.UFItems; -import net.minecraft.core.Position; -import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior; -import net.minecraft.world.entity.SpawnPlacements; -import net.minecraft.world.entity.projectile.AbstractArrow; -import net.minecraft.world.entity.projectile.Projectile; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; +import net.minecraft.world.entity.SpawnPlacementTypes; import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraftforge.event.entity.EntityAttributeCreationEvent; -import net.minecraftforge.event.entity.SpawnPlacementRegisterEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent; +import net.neoforged.neoforge.event.entity.RegisterSpawnPlacementsEvent; -@Mod.EventBusSubscriber(modid = UnusualFishMod.MOD_ID, bus = Bus.MOD) +@EventBusSubscriber(modid = UnusualFishMod.MOD_ID) public class CommonEvents { @SubscribeEvent public static void commonSetup(FMLCommonSetupEvent e) { - DispenserBlock.registerBehavior(UFItems.PRISMARINE_SPEAR.get(), new AbstractProjectileDispenseBehavior() { - protected Projectile getProjectile(Level level, Position pos, ItemStack stack) { - ThrownPrismarineSpear arrow = new ThrownPrismarineSpear(UFEntities.PRISMARINE_SPEAR.get(), pos.x(), pos.y(), pos.z(), level); - arrow.pickup = AbstractArrow.Pickup.ALLOWED; - return arrow; - } + e.enqueueWork(() -> { + DispenserBlock.registerProjectileBehavior(UFItems.PRISMARINE_SPEAR.get()); }); } @SubscribeEvent - public static void registerSpawnPlacements(SpawnPlacementRegisterEvent e) { - e.register(UFEntities.AERO_MONO.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, AeroMono::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.PINKFIN.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, PinkfinIdol::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.CLOWNTHORN_SHARK.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, ClownthornShark::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.DUALITY_DAMSELFISH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, DualityDamselfish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.DROOPING_GOURAMI.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, DroopingGourami::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.MOSSTHORN.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, Mossthorn::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.RHINO_TETRA.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, RhinoTetra::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.RIPPER.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, Ripper::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SAILOR_BARB.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, SailorBarb::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SPINDLEFISH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, Spindlefish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.ZEBRA_CORNETFISH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, ZebraCornetfish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.TIGER_PUFFER.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, TigerPuffer::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SNEEPSNORP.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, SneepSnorp::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.WIZARD_JELLY.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, ManaJellyfish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.TRUMPET_SQUID.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, TrumpetSquid::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.BARK_ANGELFISH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, BarkAngelfish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.STOUT_BICHIR.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, StoutBichir::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.KALAPPA.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.WORLD_SURFACE, Kalappa::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.LOBED_SKIPPER.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.WORLD_SURFACE, LobedSkipper::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.BEAKED_HERRING.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, BeakedHerring::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.PICKLEFISH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, Picklefish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.DEMON_HERRING.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, DemonHerring::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.AMBER_GOBY.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, AmberGoby::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.COPPERFLAME.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, CopperflameAnthias::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.ROOTBALL.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.WORLD_SURFACE, Rootball::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.CELESTIAL_FISH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, CelestialFish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.PRAWN.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.WORLD_SURFACE, Prawn::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SEA_MOSQUITO.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, SeaMosquito::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.FORKFISH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, Forkfish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SPOON_SHARK.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, SpoonShark::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.CIRCUS_FISH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, CircusFish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.BLIZZARDFIN_TUNA.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, BlizzardfinTuna::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.TIGER_JUNGLE_SHARK.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, TigerJungleShark::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SNOWFLAKE.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, SnowflakeTailFish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.EYELASH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, EyelashFish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.CRIMSONSHELL_SQUID.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, CrimsonshellSquid::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.VOLT_ANGLER.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.WORLD_SURFACE, VoltAngler::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.TRIBBLE.get(), SpawnPlacements.Type.ON_GROUND, Heightmap.Types.WORLD_SURFACE, Tribble::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.CORAL_SKRIMP.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, Skrimp::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SQUODDLE.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, Squoddle::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.GNASHER.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, Gnasher::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.HATCHET_FISH.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, HatchetFish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.BLIND_SAILFIN.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, BlindSailfin::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SHOCKCAT.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, Shockcat::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.MUDDYTOP_SNAIL.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, MuddytopSnail::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.BRICK_SNAIL.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, BrickSnail::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.BLACKCAP_SNAIL.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, BlackCapSnail::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.DEEP_CRAWLER.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, DeepCrawler::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.FRESHWATER_MANTIS.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, FreshwaterMantis::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.PORCUPINE_LOBSTA.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, PorcupineLobster::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.TRIPLE_TWIRL_PLECO.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, TripleTwirlPleco::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SEA_PANCAKE.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, SeaPancake::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.SEA_SPIDER.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, SeaSpider::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); - e.register(UFEntities.ROUGHBACK.get(), SpawnPlacements.Type.IN_WATER, Heightmap.Types.OCEAN_FLOOR, RoughbackGuitarfish::canSpawn, SpawnPlacementRegisterEvent.Operation.REPLACE); + public static void registerSpawnPlacements(RegisterSpawnPlacementsEvent e) { + e.register(UFEntities.AERO_MONO.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, AeroMono::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.PINKFIN.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, PinkfinIdol::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.CLOWNTHORN_SHARK.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, ClownthornShark::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.DUALITY_DAMSELFISH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, DualityDamselfish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.DROOPING_GOURAMI.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, DroopingGourami::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.MOSSTHORN.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, Mossthorn::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.RHINO_TETRA.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, RhinoTetra::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.RIPPER.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, Ripper::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.SAILOR_BARB.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, SailorBarb::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.SPINDLEFISH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, Spindlefish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.ZEBRA_CORNETFISH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, ZebraCornetfish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.TIGER_PUFFER.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, TigerPuffer::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.SNEEPSNORP.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, SneepSnorp::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.WIZARD_JELLY.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, ManaJellyfish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.TRUMPET_SQUID.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, TrumpetSquid::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.BARK_ANGELFISH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, BarkAngelfish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.STOUT_BICHIR.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, StoutBichir::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.KALAPPA.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.WORLD_SURFACE, Kalappa::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.LOBED_SKIPPER.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.WORLD_SURFACE, LobedSkipper::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.BEAKED_HERRING.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, BeakedHerring::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.PICKLEFISH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, Picklefish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.DEMON_HERRING.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, DemonHerring::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.AMBER_GOBY.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, AmberGoby::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.COPPERFLAME.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, CopperflameAnthias::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.ROOTBALL.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.WORLD_SURFACE, Rootball::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.CELESTIAL_FISH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, CelestialFish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.PRAWN.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.WORLD_SURFACE, Prawn::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.SEA_MOSQUITO.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, SeaMosquito::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.FORKFISH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, Forkfish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.SPOON_SHARK.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, SpoonShark::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.CIRCUS_FISH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, CircusFish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.BLIZZARDFIN_TUNA.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, BlizzardfinTuna::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.TIGER_JUNGLE_SHARK.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, TigerJungleShark::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.FROSTY_FIN.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, FrostyFinFish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.EYELASH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, EyelashFish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.CRIMSONSHELL_SQUID.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, CrimsonshellSquid::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.VOLT_ANGLER.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.WORLD_SURFACE, VoltAngler::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.TRIBBLE.get(), SpawnPlacementTypes.ON_GROUND, Heightmap.Types.WORLD_SURFACE, Tribble::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.CORAL_SKRIMP.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, Skrimp::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.SQUODDLE.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, Squoddle::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.GNASHER.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, Gnasher::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.HATCHET_FISH.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, HatchetFish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.BLIND_SAILFIN.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, BlindSailfin::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.SHOCKCAT.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, Shockcat::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.MUDDYTOP_SNAIL.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, MuddytopSnail::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.BRICK_SNAIL.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, BrickSnail::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.BLACKCAP_SNAIL.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, BlackCapSnail::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.DEEP_CRAWLER.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, DeepCrawler::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.FRESHWATER_MANTIS.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, FreshwaterMantis::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.PORCUPINE_LOBSTA.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, PorcupineLobster::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.TRIPLE_TWIRL_PLECO.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, TripleTwirlPleco::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.SEA_PANCAKE.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, SeaPancake::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.SEA_SPIDER.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, SeaSpider::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); + e.register(UFEntities.ROUGHBACK.get(), SpawnPlacementTypes.IN_WATER, Heightmap.Types.OCEAN_FLOOR, RoughbackGuitarfish::canSpawn, RegisterSpawnPlacementsEvent.Operation.REPLACE); } @SubscribeEvent @@ -144,7 +132,7 @@ public static void registerAttributes(EntityAttributeCreationEvent event) { event.put(UFEntities.CIRCUS_FISH.get(), CircusFish.createAttributes().build()); event.put(UFEntities.BLIZZARDFIN_TUNA.get(), BlizzardfinTuna.createAttributes().build()); event.put(UFEntities.EYELASH.get(), EyelashFish.createAttributes().build()); - event.put(UFEntities.SNOWFLAKE.get(), SnowflakeTailFish.createAttributes().build()); + event.put(UFEntities.FROSTY_FIN.get(), FrostyFinFish.createAttributes().build()); event.put(UFEntities.TIGER_JUNGLE_SHARK.get(), TigerJungleShark.createAttributes().build()); event.put(UFEntities.CRIMSONSHELL_SQUID.get(), CrimsonshellSquid.createAttributes().build()); event.put(UFEntities.VOLT_ANGLER.get(), VoltAngler.createAttributes().build()); diff --git a/src/main/java/codyhuh/unusualfishmod/common/block/SeaBoomBlock.java b/src/main/java/codyhuh/unusualfishmod/common/block/SeaBoomBlock.java index 6dd39d9..7ce5042 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/block/SeaBoomBlock.java +++ b/src/main/java/codyhuh/unusualfishmod/common/block/SeaBoomBlock.java @@ -3,6 +3,7 @@ import codyhuh.unusualfishmod.common.block_entity.SeaBoomBlockEntity; import codyhuh.unusualfishmod.core.registry.UFBlockEntities; import codyhuh.unusualfishmod.core.registry.UFItems; +import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -11,8 +12,9 @@ import net.minecraft.tags.FluidTags; 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.level.Level; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; @@ -47,17 +49,22 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { } @Override - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult p_60508_) { - if (player.getItemInHand(hand).is(UFItems.RAW_DUALITY_DAMSELFISH.get())) { + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hitResult) { + if (stack.is(UFItems.RAW_DUALITY_DAMSELFISH.get())) { level.setBlock(pos, state.setValue(LOADED, state.getValue(LOADED)).setValue(HOSTILE_ONLY, !state.getValue(HOSTILE_ONLY)), 3); if (!player.getAbilities().instabuild) { - player.getItemInHand(hand).shrink(1); + stack.shrink(1); } player.swing(hand); level.playSound(null, pos, SoundEvents.BEACON_DEACTIVATE, SoundSource.BLOCKS, 0.5F, 2.0F); } - return super.use(state, level, pos, player, hand, p_60508_); + return super.useItemOn(stack, state, level, pos, player, hand, hitResult); + } + + @Override + protected MapCodec codec() { + return null; } @Override diff --git a/src/main/java/codyhuh/unusualfishmod/common/block/SquidEggsBlock.java b/src/main/java/codyhuh/unusualfishmod/common/block/SquidEggsBlock.java index 0f56498..32ae6d6 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/block/SquidEggsBlock.java +++ b/src/main/java/codyhuh/unusualfishmod/common/block/SquidEggsBlock.java @@ -10,7 +10,6 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; @@ -31,7 +30,6 @@ import java.util.function.Supplier; public class SquidEggsBlock extends FrogspawnBlock implements SimpleWaterloggedBlock { - private final Supplier> entityType; public static final DirectionProperty FACING = BlockStateProperties.FACING; public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; protected static final VoxelShape UP_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D); @@ -40,6 +38,7 @@ public class SquidEggsBlock extends FrogspawnBlock implements SimpleWaterloggedB protected static final VoxelShape NORTH_AABB = Block.box(0, 0, 10, 16, 16, 16); protected static final VoxelShape EAST_AABB = Block.box(0, 0, 0, 6, 16, 16); protected static final VoxelShape WEST_AABB = Block.box(10, 0, 0, 16, 16, 16); + private final Supplier> entityType; public SquidEggsBlock(Supplier> tadpole, Properties p_221177_) { super(p_221177_); @@ -105,13 +104,13 @@ private void destroyBlock(Level p_221191_, BlockPos p_221192_) { public void spawnTadpoles(ServerLevel p_221221_, BlockPos p_221222_, RandomSource p_221223_) { int i = p_221223_.nextInt(2, 6); - for(int j = 1; j <= i; ++j) { + for (int j = 1; j <= i; ++j) { BreedableWaterAnimal squid = entityType.get().create(p_221221_); - double d0 = (double)p_221222_.getX() + this.getRandomTadpolePositionOffset(p_221223_); - double d1 = (double)p_221222_.getZ() + this.getRandomTadpolePositionOffset(p_221223_); + double d0 = (double) p_221222_.getX() + this.getRandomTadpolePositionOffset(p_221223_); + double d1 = (double) p_221222_.getZ() + this.getRandomTadpolePositionOffset(p_221223_); int k = p_221223_.nextInt(1, 361); double facing = p_221221_.getBlockState(p_221222_).getValue(FACING).get3DDataValue() * 0.5D; - squid.moveTo(d0 + facing, (double)p_221222_.getY() + facing, d1 + facing, (float)k, 0.0F); + squid.moveTo(d0 + facing, (double) p_221222_.getY() + facing, d1 + facing, (float) k, 0.0F); squid.setPersistenceRequired(); squid.setAge(-24000); p_221221_.addFreshEntity(squid); diff --git a/src/main/java/codyhuh/unusualfishmod/common/block/VoltDetectorBlock.java b/src/main/java/codyhuh/unusualfishmod/common/block/VoltDetectorBlock.java index 9d3be9d..6c8a01c 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/block/VoltDetectorBlock.java +++ b/src/main/java/codyhuh/unusualfishmod/common/block/VoltDetectorBlock.java @@ -2,6 +2,7 @@ import codyhuh.unusualfishmod.common.block_entity.VoltDetectorBlockEntity; import codyhuh.unusualfishmod.core.registry.UFBlockEntities; +import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -27,6 +28,11 @@ public VoltDetectorBlock(Properties p_49795_) { this.registerDefaultState(this.stateDefinition.any().setValue(ANGLERS, 0)); } + @Override + protected MapCodec codec() { + return null; + } + @Override protected void createBlockStateDefinition(StateDefinition.Builder p_49915_) { p_49915_.add(ANGLERS); diff --git a/src/main/java/codyhuh/unusualfishmod/common/block_entity/SeaBoomBlockEntity.java b/src/main/java/codyhuh/unusualfishmod/common/block_entity/SeaBoomBlockEntity.java index fcbfc0d..876b4fb 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/block_entity/SeaBoomBlockEntity.java +++ b/src/main/java/codyhuh/unusualfishmod/common/block_entity/SeaBoomBlockEntity.java @@ -9,7 +9,6 @@ import net.minecraft.core.Direction; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.Monster; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; diff --git a/src/main/java/codyhuh/unusualfishmod/common/block_entity/VoltDetectorBlockEntity.java b/src/main/java/codyhuh/unusualfishmod/common/block_entity/VoltDetectorBlockEntity.java index 9d5750d..8927928 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/block_entity/VoltDetectorBlockEntity.java +++ b/src/main/java/codyhuh/unusualfishmod/common/block_entity/VoltDetectorBlockEntity.java @@ -16,21 +16,13 @@ import java.util.List; public class VoltDetectorBlockEntity extends BlockEntity { - private static List anglersList = new ArrayList<>(5); + private static final List anglersList = new ArrayList<>(5); private static List currentList = new ArrayList<>(5); public VoltDetectorBlockEntity(BlockPos pos, BlockState state) { super(UFBlockEntities.VOLT_DETECTOR.get(), pos, state); } - public final List getAnglerList() { - return currentList; - } - - public void addAnglerToList(LivingEntity obj) { - currentList.add(obj); - } - public static void serverTick(Level level, BlockPos pos, BlockState state, VoltDetectorBlockEntity voltDetector) { if (!anglersList.equals(currentList)) { currentList = anglersList; @@ -50,7 +42,7 @@ public static void serverTick(Level level, BlockPos pos, BlockState state, VoltD if (level.hasChunksAt(pos, pos) && state.is(UFBlocks.VOLT_DETECTOR.get()) && !level.getBlockState(pos).isAir() && level.getBlockState(pos).getValue(VoltDetectorBlock.ANGLERS) != anglers) { level.setBlock(pos, state.setValue(VoltDetectorBlock.ANGLERS, Math.min(anglers, 5)), 3); - ((VoltDetectorBlock)state.getBlock()).updateNeighbours(level, pos); + ((VoltDetectorBlock) state.getBlock()).updateNeighbours(level, pos); } } @@ -66,9 +58,9 @@ private static void nearDetector(Level level, BlockPos pos, double radius) { if (level.getBlockEntity(pos) instanceof VoltDetectorBlockEntity voltDetector && level.hasChunksAt(blockpos, blockpos1)) { BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(); - for(int i = blockpos.getX(); i <= blockpos1.getX(); ++i) { - for(int j = blockpos.getY(); j <= blockpos1.getY(); ++j) { - for(int k = blockpos.getZ(); k <= blockpos1.getZ(); ++k) { + for (int i = blockpos.getX(); i <= blockpos1.getX(); ++i) { + for (int j = blockpos.getY(); j <= blockpos1.getY(); ++j) { + for (int k = blockpos.getZ(); k <= blockpos1.getZ(); ++k) { mutablePos.set(i, j, k); int anglers = currentList.size(); @@ -86,4 +78,12 @@ private static void nearDetector(Level level, BlockPos pos, double radius) { } } } + + public final List getAnglerList() { + return currentList; + } + + public void addAnglerToList(LivingEntity obj) { + currentList.add(obj); + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/enchantment/UnusualCatchEnchantment.java b/src/main/java/codyhuh/unusualfishmod/common/enchantment/UnusualCatchEnchantment.java deleted file mode 100644 index 3cf0fdc..0000000 --- a/src/main/java/codyhuh/unusualfishmod/common/enchantment/UnusualCatchEnchantment.java +++ /dev/null @@ -1,39 +0,0 @@ -package codyhuh.unusualfishmod.common.enchantment; - -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.FishingRodItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentCategory; - -public class UnusualCatchEnchantment extends Enchantment { - - public UnusualCatchEnchantment(Rarity rarityIn, EquipmentSlot... slots) { - super(rarityIn, EnchantmentCategory.FISHING_ROD, slots); - } - - @Override - public boolean canApplyAtEnchantingTable(ItemStack stack) { - return stack.getItem() instanceof FishingRodItem; - } - - @Override - public int getMaxLevel() { - return 1; - } - - @Override - public boolean isTradeable() { - return true; - } - - @Override - public boolean isDiscoverable() { - return true; - } - - @Override - public boolean isAllowedOnBooks() { - return true; - } -} diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/AeroMono.java b/src/main/java/codyhuh/unusualfishmod/common/entity/AeroMono.java index 5b8083f..4e7dcc6 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/AeroMono.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/AeroMono.java @@ -1,7 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; @@ -25,114 +25,113 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class AeroMono extends BucketableSchoolingWaterAnimal implements GeoEntity { - public AeroMono(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.AERO_MONO_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - super.aiStep(); - } - - public int getMaxSpawnClusterSize() { - return 8; - } - - public int getMaxSchoolSize() { - return 10; - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public AeroMono(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.AERO_MONO_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + super.aiStep(); + } + + public int getMaxSpawnClusterSize() { + return 8; + } + + public int getMaxSchoolSize() { + return 10; + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/AmberGoby.java b/src/main/java/codyhuh/unusualfishmod/common/entity/AmberGoby.java index 9da811d..ee96ac9 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/AmberGoby.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/AmberGoby.java @@ -1,7 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; @@ -25,120 +25,118 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class AmberGoby extends BucketableSchoolingWaterAnimal implements GeoEntity { - private boolean isSchool = true; - - public AmberGoby(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.AMBER_GOBY_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 2; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 3; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public AmberGoby(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.AMBER_GOBY_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 2; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 3; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/BarkAngelfish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/BarkAngelfish.java index 1884df2..5eeded1 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/BarkAngelfish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/BarkAngelfish.java @@ -1,7 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; @@ -25,116 +25,113 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class BarkAngelfish extends BucketableSchoolingWaterAnimal implements GeoEntity { - private boolean isSchool = true; - - public BarkAngelfish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.BARK_ANGELFISH_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 3; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 3; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public BarkAngelfish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.BARK_ANGELFISH_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 3; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 3; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/BeakedHerring.java b/src/main/java/codyhuh/unusualfishmod/common/entity/BeakedHerring.java index 876443f..f4cd94e 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/BeakedHerring.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/BeakedHerring.java @@ -1,7 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; @@ -25,121 +25,118 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class BeakedHerring extends BucketableSchoolingWaterAnimal implements GeoEntity { - private boolean isSchool = true; - - public BeakedHerring(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.BEAKED_HERRING_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 10; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 20; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public BeakedHerring(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.BEAKED_HERRING_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 10; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 20; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/BlackCapSnail.java b/src/main/java/codyhuh/unusualfishmod/common/entity/BlackCapSnail.java index ac72329..76b41f0 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/BlackCapSnail.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/BlackCapSnail.java @@ -4,6 +4,7 @@ import codyhuh.unusualfishmod.common.entity.util.movement.SnailMoveControl; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; @@ -29,29 +30,35 @@ import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class BlackCapSnail extends WaterAnimal implements Bucketable, GeoEntity { private static final EntityDataAccessor FROM_BUCKET = SynchedEntityData.defineId(BlackCapSnail.class, EntityDataSerializers.BOOLEAN); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); public BlackCapSnail(EntityType type, Level world) { super(type, world); this.moveControl = new SnailMoveControl(this); - this.setMaxUpStep(1.0F); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.0F); } public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.3D).add(Attributes.ARMOR, 4.0D); } + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + protected void registerGoals() { this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.6F)); this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.3F)); @@ -73,9 +80,9 @@ public void handleAirSupply(int p_209207_1_) { } @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(FROM_BUCKET, false); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(FROM_BUCKET, false); } public void addAdditionalSaveData(CompoundTag compound) { @@ -97,9 +104,9 @@ public boolean fromBucket() { @Override public void saveToBucketTag(ItemStack bucket) { - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putFloat("Health", this.getHealth()); - + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putFloat("Health", this.getHealth()); + }); } public boolean requiresCustomPersistence() { @@ -117,6 +124,7 @@ private boolean isFromBucket() { public void setFromBucket(boolean p_203706_1_) { this.entityData.set(FROM_BUCKET, p_203706_1_); } + @Override public void loadFromBucketTag(CompoundTag p_148832_) { @@ -148,10 +156,6 @@ protected SoundEvent getHurtSound(DamageSource p_28281_) { return SoundEvents.COD_HURT; } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -166,8 +170,6 @@ private PlayState predicate(AnimationState event) { return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/BlindSailfin.java b/src/main/java/codyhuh/unusualfishmod/common/entity/BlindSailfin.java index d90aa1c..c4b50df 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/BlindSailfin.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/BlindSailfin.java @@ -2,20 +2,12 @@ import codyhuh.unusualfishmod.common.entity.util.base.BucketableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.goal.BottomStrollGoal; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -27,124 +19,121 @@ import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class BlindSailfin extends BucketableWaterAnimal implements GeoEntity { - public BlindSailfin(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - @Override - public void onInsideBubbleColumn(boolean downwards) { - } - - @Override - public void onAboveBubbleCol(boolean downwards) { - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.BLIND_SAILFIN_BUCKET.get()); - } - - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getLightEmission(pos) < 8 && iServerWorld.getBlockState(pos.above()).is(Blocks.WATER) && iServerWorld.getBlockState(pos).is(Blocks.WATER) && pos.getY() <= 30; - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public BlindSailfin(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getLightEmission(pos) < 8 && iServerWorld.getBlockState(pos.above()).is(Blocks.WATER) && iServerWorld.getBlockState(pos).is(Blocks.WATER) && pos.getY() <= 30; + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + @Override + public void onInsideBubbleColumn(boolean downwards) { + } + + @Override + public void onAboveBubbleCol(boolean downwards) { + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.BLIND_SAILFIN_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/BlizzardfinTuna.java b/src/main/java/codyhuh/unusualfishmod/common/entity/BlizzardfinTuna.java index ad8a51d..325c2f8 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/BlizzardfinTuna.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/BlizzardfinTuna.java @@ -24,107 +24,105 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class BlizzardfinTuna extends BucketableSchoolingWaterAnimal implements GeoEntity { - private boolean isSchool = true; - - public BlizzardfinTuna(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.5F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.BLIZZARDFIN_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 20.0D).add(Attributes.ATTACK_DAMAGE, 3.0D); - } - - @Override - public void registerGoals() { - super.registerGoals(); - this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 3.0D, true)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 1.5D, 1)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - public int getMaxSpawnClusterSize() { - return 4; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 10; - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - public SoundEvent getHurtSound(DamageSource damageSourceIn) { - return SoundEvents.COD_HURT; - } - - public SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public BlizzardfinTuna(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.5F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 20.0D).add(Attributes.ATTACK_DAMAGE, 3.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.BLIZZARDFIN_BUCKET.get()); + } + + @Override + public void registerGoals() { + super.registerGoals(); + this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 3.0D, true)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 1.5D, 1)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + public int getMaxSpawnClusterSize() { + return 4; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 10; + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + public SoundEvent getHurtSound(DamageSource damageSourceIn) { + return SoundEvents.COD_HURT; + } + + public SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/BrickSnail.java b/src/main/java/codyhuh/unusualfishmod/common/entity/BrickSnail.java index ace0633..a567ae3 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/BrickSnail.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/BrickSnail.java @@ -6,15 +6,9 @@ import codyhuh.unusualfishmod.common.entity.util.movement.SnailMoveControl; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -27,32 +21,37 @@ import net.minecraft.world.entity.ai.goal.TryFindWaterGoal; import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; import net.minecraft.world.entity.ai.navigation.PathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class BrickSnail extends BucketableWaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + public BrickSnail(EntityType type, Level world) { super(type, world); this.moveControl = new SnailMoveControl(this); - this.setMaxUpStep(1.0F); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.0F); } public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.3D).add(Attributes.ARMOR, 4.0D); } + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + protected void registerGoals() { this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.6F)); @@ -90,10 +89,6 @@ protected SoundEvent getHurtSound(DamageSource p_28281_) { return SoundEvents.COD_HURT; } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -108,8 +103,6 @@ private PlayState predicate(AnimationState event) { return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/CelestialFish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/CelestialFish.java index 9d3b40c..f1a4b46 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/CelestialFish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/CelestialFish.java @@ -26,14 +26,15 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.material.Fluids; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class CelestialFish extends WaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); protected int attackCooldown = 0; public CelestialFish(EntityType entityType, Level level) { @@ -46,6 +47,16 @@ public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 40.0D).add(Attributes.ATTACK_DAMAGE, 2.0D).add(Attributes.MOVEMENT_SPEED, 0.5D); } + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); + } + + private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { + float time = iServerWorld.getTimeOfDay(1.0F); + int light = iServerWorld.getMaxLocalRawBrightness(pos); + return light <= 4 && time > 0.27F && time <= 0.8F; + } + @Override public void registerGoals() { super.registerGoals(); @@ -105,16 +116,6 @@ public void playerTouch(Player entity) { } } - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); - } - - private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { - float time = iServerWorld.getTimeOfDay(1.0F); - int light = iServerWorld.getMaxLocalRawBrightness(pos); - return light <= 4 && time > 0.27F && time <= 0.8F; - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -127,15 +128,12 @@ private PlayState predicate(AnimationState event) { } else { event.setAnimation(UFAnimations.IDLE); } - } - else { + } else { event.setAnimation(UFAnimations.FLOP); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/CircusFish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/CircusFish.java index d731a88..4f47dc1 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/CircusFish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/CircusFish.java @@ -26,94 +26,93 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class CircusFish extends BucketableWaterAnimal implements GeoEntity { - public CircusFish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 8.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.CIRCUS_FISH_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public CircusFish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 8.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.CIRCUS_FISH_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/ClownthornShark.java b/src/main/java/codyhuh/unusualfishmod/common/entity/ClownthornShark.java index 1b54a24..5f656a5 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/ClownthornShark.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/ClownthornShark.java @@ -2,20 +2,12 @@ import codyhuh.unusualfishmod.common.entity.util.base.BucketableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.goal.BottomStrollGoal; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -27,112 +19,109 @@ import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class ClownthornShark extends BucketableWaterAnimal implements GeoEntity { - public ClownthornShark(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.CLOWNTHORN_SHARK_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public ClownthornShark(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.CLOWNTHORN_SHARK_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/CopperflameAnthias.java b/src/main/java/codyhuh/unusualfishmod/common/entity/CopperflameAnthias.java index 6e4efb0..02c1833 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/CopperflameAnthias.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/CopperflameAnthias.java @@ -1,10 +1,11 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; @@ -25,177 +26,189 @@ import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; +import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.ServerLevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; public class CopperflameAnthias extends BucketableSchoolingWaterAnimal implements GeoEntity { - private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(CopperflameAnthias.class, EntityDataSerializers.INT); - private boolean isSchool = true; - - public CopperflameAnthias(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.COPPERFLAME_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 5; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 7; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(VARIANT, 0); - } - - @Override - public void addAdditionalSaveData(CompoundTag compound) { - super.addAdditionalSaveData(compound); - compound.putInt("Variant", getVariant()); - } - - @Override - public void readAdditionalSaveData(CompoundTag compound) { - super.readAdditionalSaveData(compound); - this.setVariant(compound.getInt("Variant")); - } - - @Override - public void saveToBucketTag(ItemStack bucket) { - super.saveToBucketTag(bucket); - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putInt("Variant", this.getVariant()); - } - - public int getVariant() { - return this.entityData.get(VARIANT); - } - - private void setVariant(int variant) { - this.entityData.set(VARIANT, variant); - } - - @Nullable - @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { - spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); - if (dataTag == null) { - setVariant(random.nextInt(2)); - } else { - if (dataTag.contains("Variant", 3)){ - this.setVariant(dataTag.getInt("Variant")); - } - } - return spawnDataIn; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(CopperflameAnthias.class, EntityDataSerializers.INT); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public CopperflameAnthias(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.COPPERFLAME_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 5; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 7; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(VARIANT, 0); + } + + @Override + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + compound.putInt("Variant", getVariant()); + } + + @Override + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + this.setVariant(compound.getInt("Variant")); + } + + @Override + public void saveToBucketTag(ItemStack bucket) { + Bucketable.saveDefaultDataToBucketTag(this, bucket); + if (this.hasCustomName()) { + bucket.set(DataComponents.CUSTOM_NAME, this.getCustomName()); + } + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putInt("Variant", this.getVariant()); + }); + } + + @Override + public void loadFromBucketTag(CompoundTag tag) { + super.loadFromBucketTag(tag); + if (tag.contains("Variant", 3)) { + this.setVariant(tag.getInt("Variant")); + } + } + + public int getVariant() { + return this.entityData.get(VARIANT); + } + + private void setVariant(int variant) { + this.entityData.set(VARIANT, variant); + } + + @Nullable + @Override + public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { + spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); + if (dataTag == null) { + setVariant(random.nextInt(2)); + } else { + if (dataTag.contains("Variant", 3)) { + this.setVariant(dataTag.getInt("Variant")); + } + } + return spawnDataIn; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/CrimsonshellSquid.java b/src/main/java/codyhuh/unusualfishmod/common/entity/CrimsonshellSquid.java index 102133b..21b6fcd 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/CrimsonshellSquid.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/CrimsonshellSquid.java @@ -1,8 +1,8 @@ package codyhuh.unusualfishmod.common.entity; +import codyhuh.unusualfishmod.common.entity.util.base.BreedableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.goal.BottomStrollGoal; import codyhuh.unusualfishmod.common.entity.util.goal.BreedableWaterAnimalBreedGoal; -import codyhuh.unusualfishmod.common.entity.util.base.BreedableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.goal.SquidLayEggsGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.common.entity.util.movement.SquidMoveControl; @@ -10,6 +10,7 @@ import codyhuh.unusualfishmod.core.registry.UFItems; import codyhuh.unusualfishmod.core.registry.UFTags; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; @@ -18,8 +19,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.tags.FluidTags; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.TimeUtil; import net.minecraft.util.valueproviders.UniformInt; @@ -32,7 +31,6 @@ import net.minecraft.world.entity.NeutralMob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; import net.minecraft.world.entity.ai.goal.*; @@ -44,15 +42,16 @@ import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; @@ -61,6 +60,7 @@ public class CrimsonshellSquid extends BreedableWaterAnimal implements Bucketable, NeutralMob, GeoEntity { private static final EntityDataAccessor FROM_BUCKET = SynchedEntityData.defineId(CrimsonshellSquid.class, EntityDataSerializers.BOOLEAN); private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private int remainingPersistentAngerTime; private UUID persistentAngerTarget; @@ -75,6 +75,10 @@ public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.ATTACK_DAMAGE, 3.0D).add(Attributes.ARMOR, 2.0D); } + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + protected void registerGoals() { this.goalSelector.addGoal(0, new SquidLayEggsGoal(this, UFBlocks.CRIMSON_EGGS.get())); this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); @@ -122,18 +126,18 @@ public boolean hurt(DamageSource p_29963_, float p_29964_) { } private Vec3 rotateVector(Vec3 p_29986_) { - Vec3 vec3 = p_29986_.xRot(getXRot() * ((float)Math.PI / 180F)); - return vec3.yRot(-this.yBodyRotO * ((float)Math.PI / 180F)); + Vec3 vec3 = p_29986_.xRot(getXRot() * ((float) Math.PI / 180F)); + return vec3.yRot(-this.yBodyRotO * ((float) Math.PI / 180F)); } private void spawnInk() { this.playSound(SoundEvents.SQUID_SQUIRT, this.getSoundVolume(), this.getVoicePitch()); Vec3 vec3 = this.rotateVector(new Vec3(0.0D, -0.25D, -0.5D)).add(this.getX(), this.getY(), this.getZ()); - for(int i = 0; i < 30; ++i) { - Vec3 vec31 = this.rotateVector(new Vec3((double)this.random.nextFloat() * 0.6D - 0.3D, -1.0D, (double)this.random.nextFloat() * 0.6D - 0.3D)); - Vec3 vec32 = vec31.scale(0.3D + (double)(this.random.nextFloat() * 2.0F)); - ((ServerLevel)this.level()).sendParticles(ParticleTypes.SQUID_INK, vec3.x, vec3.y + 0.5D, vec3.z, 0, vec32.x, vec32.y, vec32.z, 0.1F); + for (int i = 0; i < 30; ++i) { + Vec3 vec31 = this.rotateVector(new Vec3((double) this.random.nextFloat() * 0.6D - 0.3D, -1.0D, (double) this.random.nextFloat() * 0.6D - 0.3D)); + Vec3 vec32 = vec31.scale(0.3D + (double) (this.random.nextFloat() * 2.0F)); + ((ServerLevel) this.level()).sendParticles(ParticleTypes.SQUID_INK, vec3.x, vec3.y + 0.5D, vec3.z, 0, vec32.x, vec32.y, vec32.z, 0.1F); } } @@ -169,9 +173,9 @@ protected SoundEvent getFlopSound() { } @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(FROM_BUCKET, false); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(FROM_BUCKET, false); } public void addAdditionalSaveData(CompoundTag tag) { @@ -191,8 +195,9 @@ public boolean fromBucket() { @Override public void saveToBucketTag(ItemStack bucket) { - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putFloat("Health", this.getHealth()); + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putFloat("Health", this.getHealth()); + }); } public boolean requiresCustomPersistence() { @@ -230,18 +235,14 @@ public ItemStack getBucketItemStack() { return new ItemStack(UFItems.CRIMSONSHELL_SQUID_BUCKET.get()); } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + public int getRemainingPersistentAngerTime() { + return this.remainingPersistentAngerTime; } public void setRemainingPersistentAngerTime(int p_34448_) { this.remainingPersistentAngerTime = p_34448_; } - public int getRemainingPersistentAngerTime() { - return this.remainingPersistentAngerTime; - } - @Override public void startPersistentAngerTimer() { this.setRemainingPersistentAngerTime(PERSISTENT_ANGER_TIME.sample(this.random)); @@ -262,7 +263,7 @@ public void registerControllers(AnimatableManager.ControllerRegistrar controller } private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { + if (this.isRemoved()) { return PlayState.STOP; } @@ -272,15 +273,12 @@ private PlayState predicate(AnimationState event) { } else { event.setAnimation(UFAnimations.IDLE); } - } - else { + } else { event.setAnimation(UFAnimations.FLOP); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/DeepCrawler.java b/src/main/java/codyhuh/unusualfishmod/common/entity/DeepCrawler.java index 13e018a..b9ce343 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/DeepCrawler.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/DeepCrawler.java @@ -27,118 +27,119 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class DeepCrawler extends BucketableWaterAnimal implements GeoEntity { - public DeepCrawler(EntityType type, Level world) { - super(type, world); - this.moveControl = new DeepCrawler.MoveHelperController(this); - this.setMaxUpStep(1.0F); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.MOVEMENT_SPEED, (double) 0.5F).add(Attributes.ARMOR, 10.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.8F)); - this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.8F)); - this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(4, new AvoidEntityGoal(this, Player.class, 8, 1.3D, 1.0D)); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new GroundPathNavigation(this, level()); - } - - @Override - public void handleAirSupply(int p_209207_1_) { - } - - protected SoundEvent getAmbientSound() { - return UFSounds.CRAB_CHATTER.get(); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { - this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.DEEP_CRAWLER_BUCKET.get()); - } - - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).is(Blocks.WATER) && iServerWorld.getBlockState(pos.above()).is(Blocks.WATER) && pos.getY() <= 20 && iServerWorld.getLightEmission(pos) < 8; - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.WALK); - } else { - event.setAnimation(UFAnimations.IDLE); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } - - static class MoveHelperController extends MoveControl { - - private final Mob spider; - - MoveHelperController(Mob spider) { - super(spider); - this.spider = spider; - } - public void tick() { - if (this.spider.isEyeInFluid(FluidTags.WATER)) { - this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); - } - - if (this.operation == Operation.MOVE_TO && !this.spider.getNavigation().isDone()) { - double d0 = this.wantedX - this.spider.getX(); - double d1 = this.wantedY - this.spider.getY(); - double d2 = this.wantedZ - this.spider.getZ(); - double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); - d1 = d1 / d3; - float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; - this.spider.yRot = this.rotlerp(this.spider.yRot, f, 90.0F); - this.spider.yBodyRot = this.spider.yRot; - float f1 = (float) (this.speedModifier * this.spider.getAttributeValue(Attributes.MOVEMENT_SPEED)); - this.spider.setSpeed(Mth.lerp(0.125F, this.spider.getSpeed(), f1)); - this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, (double) this.spider.getSpeed() * d1 * 0.1D, 0.0D)); - } else { - this.spider.setSpeed(0.0F); - } - } - - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public DeepCrawler(EntityType type, Level world) { + super(type, world); + this.moveControl = new DeepCrawler.MoveHelperController(this); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.0F); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.MOVEMENT_SPEED, 0.5F).add(Attributes.ARMOR, 10.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).is(Blocks.WATER) && iServerWorld.getBlockState(pos.above()).is(Blocks.WATER) && pos.getY() <= 20 && iServerWorld.getLightEmission(pos) < 8; + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.8F)); + this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.8F)); + this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(4, new AvoidEntityGoal(this, Player.class, 8, 1.3D, 1.0D)); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new GroundPathNavigation(this, level()); + } + + @Override + public void handleAirSupply(int p_209207_1_) { + } + + protected SoundEvent getAmbientSound() { + return UFSounds.CRAB_CHATTER.get(); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { + this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.DEEP_CRAWLER_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.WALK); + } else { + event.setAnimation(UFAnimations.IDLE); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } + + static class MoveHelperController extends MoveControl { + + private final Mob spider; + + MoveHelperController(Mob spider) { + super(spider); + this.spider = spider; + } + + public void tick() { + if (this.spider.isEyeInFluid(FluidTags.WATER)) { + this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); + } + + if (this.operation == Operation.MOVE_TO && !this.spider.getNavigation().isDone()) { + double d0 = this.wantedX - this.spider.getX(); + double d1 = this.wantedY - this.spider.getY(); + double d2 = this.wantedZ - this.spider.getZ(); + double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); + d1 = d1 / d3; + float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; + this.spider.setYRot(this.rotlerp(this.spider.getYRot(), f, 90.0F)); + this.spider.yBodyRot = this.spider.getYRot(); + float f1 = (float) (this.speedModifier * this.spider.getAttributeValue(Attributes.MOVEMENT_SPEED)); + this.spider.setSpeed(Mth.lerp(0.125F, this.spider.getSpeed(), f1)); + this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, (double) this.spider.getSpeed() * d1 * 0.1D, 0.0D)); + } else { + this.spider.setSpeed(0.0F); + } + } + + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/DemonHerring.java b/src/main/java/codyhuh/unusualfishmod/common/entity/DemonHerring.java index cd86958..3b4ea56 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/DemonHerring.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/DemonHerring.java @@ -1,10 +1,11 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; @@ -25,174 +26,184 @@ import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; +import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.ServerLevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; public class DemonHerring extends BucketableSchoolingWaterAnimal implements GeoEntity { - private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(DemonHerring.class, EntityDataSerializers.INT); - private boolean isSchool = true; - - public DemonHerring(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.DEMON_HERRING_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 1.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 10; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 20; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(VARIANT, 0); - } - - public int getVariant() { - return this.entityData.get(VARIANT); - } - - private void setVariant(int variant) { - this.entityData.set(VARIANT, variant); - } - - public void addAdditionalSaveData(CompoundTag compound) { - super.addAdditionalSaveData(compound); - compound.putInt("Variant", getVariant()); - } - - public void readAdditionalSaveData(CompoundTag compound) { - super.readAdditionalSaveData(compound); - this.setVariant(compound.getInt("Variant")); - } - - @Override - public void saveToBucketTag(ItemStack bucket) { - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putFloat("Health", this.getHealth()); - compoundnbt.putInt("Variant", this.getVariant()); - if (this.hasCustomName()) { - bucket.setHoverName(this.getCustomName()); - } - } - - @Nullable - @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { - spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); - if (dataTag == null) { - setVariant(random.nextInt(3)); - } else { - if (dataTag.contains("Variant", 3)){ - this.setVariant(dataTag.getInt("Variant")); - } - } - return spawnDataIn; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(DemonHerring.class, EntityDataSerializers.INT); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public DemonHerring(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 1.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.DEMON_HERRING_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 10; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 20; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(VARIANT, 0); + } + + public int getVariant() { + return this.entityData.get(VARIANT); + } + + private void setVariant(int variant) { + this.entityData.set(VARIANT, variant); + } + + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + compound.putInt("Variant", getVariant()); + } + + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + this.setVariant(compound.getInt("Variant")); + } + + @Override + public void saveToBucketTag(ItemStack bucket) { + Bucketable.saveDefaultDataToBucketTag(this, bucket); + if (this.hasCustomName()) { + bucket.set(DataComponents.CUSTOM_NAME, this.getCustomName()); + } + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putInt("Variant", this.getVariant()); + tag.putFloat("Health", this.getHealth()); + }); + } + + @Override + public void loadFromBucketTag(CompoundTag tag) { + super.loadFromBucketTag(tag); + if (tag.contains("Variant", 3)) { + this.setVariant(tag.getInt("Variant")); + } + } + + @Nullable + @Override + public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { + spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); + if (dataTag == null) { + setVariant(random.nextInt(3)); + } else { + if (dataTag.contains("Variant", 3)) { + this.setVariant(dataTag.getInt("Variant")); + } + } + return spawnDataIn; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/DroopingGourami.java b/src/main/java/codyhuh/unusualfishmod/common/entity/DroopingGourami.java index dd76038..4253c21 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/DroopingGourami.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/DroopingGourami.java @@ -24,106 +24,105 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class DroopingGourami extends BucketableSchoolingWaterAnimal implements GeoEntity { - public DroopingGourami(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.DROOPING_GOURAMI_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public DroopingGourami(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.DROOPING_GOURAMI_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/DualityDamselfish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/DualityDamselfish.java index df5077c..4bbf740 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/DualityDamselfish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/DualityDamselfish.java @@ -6,6 +6,7 @@ import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; @@ -26,180 +27,189 @@ import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; +import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.ServerLevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; public class DualityDamselfish extends BucketableSchoolingWaterAnimal implements GeoEntity, IVariant { - private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(DualityDamselfish.class, EntityDataSerializers.INT); - private boolean isSchool = true; - - public DualityDamselfish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.DUALITY_DAMSELFISH_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 1; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 2; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void saveToBucketTag(ItemStack bucket) { - CompoundTag tag = bucket.getOrCreateTag(); - tag.putInt("Variant", this.getVariant()); - super.saveToBucketTag(bucket); - } - - @Override - public void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(VARIANT, 0); - } - - @Override - public boolean hasVariant() { - return true; - } - - @Override - public int getVariantN() { - return getVariant(); - } - - public int getVariant() { - return this.entityData.get(VARIANT); - } - - private void setVariant(int variant) { - this.entityData.set(VARIANT, variant); - } - - @Override - public void addAdditionalSaveData(CompoundTag compound) { - super.addAdditionalSaveData(compound); - compound.putInt("Variant", getVariant()); - } - - @Override - public void readAdditionalSaveData(CompoundTag compound) { - super.readAdditionalSaveData(compound); - setVariant(compound.getInt("Variant")); - } - - @Nullable - @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { - spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); - if (dataTag == null) { - setVariant(random.nextInt(2)); - } else { - if (dataTag.contains("Variant", 3)){ - this.setVariant(dataTag.getInt("Variant")); - } - } - return spawnDataIn; - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } - else { - event.setAnimation(UFAnimations.IDLE); - } - - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(DualityDamselfish.class, EntityDataSerializers.INT); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public DualityDamselfish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.DUALITY_DAMSELFISH_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 1; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 2; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void saveToBucketTag(ItemStack bucket) { + Bucketable.saveDefaultDataToBucketTag(this, bucket); + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putInt("Variant", this.getVariant()); + }); + } + + @Override + public void loadFromBucketTag(CompoundTag tag) { + super.loadFromBucketTag(tag); + if (tag.contains("Variant", 3)) { + this.setVariant(tag.getInt("Variant")); + } + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(VARIANT, 0); + } + + @Override + public boolean hasVariant() { + return true; + } + + @Override + public int getVariantN() { + return getVariant(); + } + + public int getVariant() { + return this.entityData.get(VARIANT); + } + + private void setVariant(int variant) { + this.entityData.set(VARIANT, variant); + } + + @Override + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + compound.putInt("Variant", getVariant()); + } + + @Override + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + setVariant(compound.getInt("Variant")); + } + + @Nullable + @Override + public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { + spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); + if (dataTag == null) { + setVariant(random.nextInt(2)); + } else { + if (dataTag.contains("Variant", 3)) { + this.setVariant(dataTag.getInt("Variant")); + } + } + return spawnDataIn; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/EyelashFish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/EyelashFish.java index 5463f8f..71896cc 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/EyelashFish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/EyelashFish.java @@ -1,10 +1,11 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; @@ -27,202 +28,211 @@ import net.minecraft.world.entity.ai.goal.RandomSwimmingGoal; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; +import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.pathfinder.Path; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; public class EyelashFish extends BucketableSchoolingWaterAnimal implements GeoEntity { - private static final EntityDataAccessor ESCAPING = SynchedEntityData.defineId(EyelashFish.class, EntityDataSerializers.BOOLEAN); - private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(EyelashFish.class, EntityDataSerializers.INT); - private boolean isSchool = true; - private static Path path; - - public EyelashFish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.05F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.EYELASH_FISH_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 1.0D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - } - - @Override - public boolean hurt(DamageSource p_21016_, float p_21017_) { - if (!isEscaping() && isInWater()) { - setEscaping(true); - path = getNavigation().createPath(blockPosition().relative(getDirection(), 10), 1); - } - return super.hurt(p_21016_, p_21017_); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - if (isEscaping()) { - if (getNavigation().moveTo(path, 1.0D)) { - setSpeed(5.0F); - - if (path.isDone()) { - setEscaping(false); - setSpeed(1.0F); - } - } - } - - super.aiStep(); - } - - public int getMaxSpawnClusterSize() { - return 8; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 10; - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public void saveToBucketTag(ItemStack bucket) { - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putInt("Variant", this.getVariant()); - if (this.hasCustomName()) { - bucket.setHoverName(this.getCustomName()); - } - compoundnbt.putFloat("Health", this.getHealth()); - } - - @Override - public void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(VARIANT, 0); - this.entityData.define(ESCAPING, false); - } - - public int getVariant() { - return this.entityData.get(VARIANT); - } - - private void setVariant(int variant) { - this.entityData.set(VARIANT, variant); - } - - @Override - public void addAdditionalSaveData(CompoundTag compound) { - super.addAdditionalSaveData(compound); - compound.putInt("Variant", getVariant()); - } - - @Override - public void readAdditionalSaveData(CompoundTag compound) { - super.readAdditionalSaveData(compound); - setVariant(compound.getInt("Variant")); - } - - @Nullable - @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { - spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); - if (dataTag == null) { - setVariant(random.nextInt(15)); - } - else { - if (dataTag.contains("Variant", 3)){ - this.setVariant(dataTag.getInt("Variant")); - } - } - return spawnDataIn; - } - - private boolean isEscaping() { - return this.entityData.get(ESCAPING); - } - - public void setEscaping(boolean escaping) { - this.entityData.set(ESCAPING, escaping); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private static final EntityDataAccessor ESCAPING = SynchedEntityData.defineId(EyelashFish.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(EyelashFish.class, EntityDataSerializers.INT); + private static Path path; + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public EyelashFish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.05F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.EYELASH_FISH_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 1.0D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + } + + @Override + public boolean hurt(DamageSource p_21016_, float p_21017_) { + if (!isEscaping() && isInWater()) { + setEscaping(true); + path = getNavigation().createPath(blockPosition().relative(getDirection(), 10), 1); + } + return super.hurt(p_21016_, p_21017_); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + if (isEscaping()) { + if (getNavigation().moveTo(path, 1.0D)) { + setSpeed(5.0F); + + if (path.isDone()) { + setEscaping(false); + setSpeed(1.0F); + } + } + } + + super.aiStep(); + } + + public int getMaxSpawnClusterSize() { + return 8; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 10; + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void saveToBucketTag(ItemStack bucket) { + Bucketable.saveDefaultDataToBucketTag(this, bucket); + if (this.hasCustomName()) { + bucket.set(DataComponents.CUSTOM_NAME, this.getCustomName()); + } + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putInt("Variant", this.getVariant()); + tag.putFloat("Health", this.getHealth()); + }); + } + + @Override + public void loadFromBucketTag(CompoundTag tag) { + super.loadFromBucketTag(tag); + if (tag.contains("Variant", 3)) { + this.setVariant(tag.getInt("Variant")); + } + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(VARIANT, 0); + builder.define(ESCAPING, false); + } + + public int getVariant() { + return this.entityData.get(VARIANT); + } + + private void setVariant(int variant) { + this.entityData.set(VARIANT, variant); + } + + @Override + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + compound.putInt("Variant", getVariant()); + } + + @Override + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + setVariant(compound.getInt("Variant")); + } + + @Nullable + @Override + public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { + spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); + if (dataTag == null) { + setVariant(random.nextInt(15)); + } else { + if (dataTag.contains("Variant", 3)) { + this.setVariant(dataTag.getInt("Variant")); + } + } + return spawnDataIn; + } + + private boolean isEscaping() { + return this.entityData.get(ESCAPING); + } + + public void setEscaping(boolean escaping) { + this.entityData.set(ESCAPING, escaping); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Forkfish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Forkfish.java index e2da484..0acc011 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Forkfish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Forkfish.java @@ -4,18 +4,10 @@ import codyhuh.unusualfishmod.common.entity.util.base.BucketableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; -import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -27,114 +19,111 @@ import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Forkfish extends BucketableWaterAnimal implements GeoEntity { - public Forkfish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.FORKFISH_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public Forkfish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.FORKFISH_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/FreshwaterMantis.java b/src/main/java/codyhuh/unusualfishmod/common/entity/FreshwaterMantis.java index 328babd..438d5f6 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/FreshwaterMantis.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/FreshwaterMantis.java @@ -12,7 +12,10 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.*; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.MoveControl; @@ -28,149 +31,150 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class FreshwaterMantis extends BucketableWaterAnimal implements GeoEntity { - public FreshwaterMantis(EntityType type, Level world) { - super(type, world); - this.moveControl = new FreshwaterMantis.MoveHelperController(this); - this.setMaxUpStep(1.1F); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.25D).add(Attributes.ATTACK_DAMAGE, 1.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1.5D, false)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.8D)); - this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 1.0F)); - this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, LivingEntity.class, true, e -> e.getType().is(UFTags.SNAILS))); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, AeroMono.class, true)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, SneepSnorp.class, true)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, RhinoTetra.class, true)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, SailorBarb.class, true)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Silverfish.class, true)); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new GroundPathNavigation(this, level()); - } - - protected SoundEvent getAmbientSound() { - return UFSounds.CRAB_CHATTER.get(); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { - this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); - } - - @Override - public float getWaterSlowDown() { - return 0.9f; - } - - public void baseTick() { - int i = this.getAirSupply(); - super.baseTick(); - if (!this.isNoAi()) { - this.handleAirSupply(i); - } - } - - protected void handleAirSupply(int p_149194_) { - if (this.isAlive() && !this.isInWaterRainOrBubble()) { - this.setAirSupply(p_149194_ - 1); - if (this.getAirSupply() == -20) { - this.setAirSupply(0); - this.hurt(damageSources().dryOut(), 1.0F); - } - } else { - this.setAirSupply(this.getMaxAirSupply()); - } - } - - public int getMaxAirSupply() { - return 6000; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.FRESHWATER_MANTIS_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.WALK); - } else { - event.setAnimation(UFAnimations.IDLE); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } - - static class MoveHelperController extends MoveControl { - - private final Mob mantis; - - MoveHelperController(Mob mantis) { - super(mantis); - this.mantis = mantis; - } - public void tick() { - if (this.mantis.isEyeInFluid(FluidTags.WATER)) { - this.mantis.setDeltaMovement(this.mantis.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); - } - - if (this.operation == Operation.MOVE_TO && !this.mantis.getNavigation().isDone()) { - double d0 = this.wantedX - this.mantis.getX(); - double d1 = this.wantedY - this.mantis.getY(); - double d2 = this.wantedZ - this.mantis.getZ(); - double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); - d1 = d1 / d3; - float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; - this.mantis.yRot = this.rotlerp(this.mantis.yRot, f, 90.0F); - this.mantis.yBodyRot = this.mantis.yRot; - float f1 = (float) (this.speedModifier * this.mantis.getAttributeValue(Attributes.MOVEMENT_SPEED)); - this.mantis.setSpeed(Mth.lerp(0.125F, this.mantis.getSpeed(), f1)); - this.mantis.setDeltaMovement(this.mantis.getDeltaMovement().add(0.0D, (double) this.mantis.getSpeed() * d1 * 0.1D, 0.0D)); - } else { - this.mantis.setSpeed(0.0F); - } - } - - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public FreshwaterMantis(EntityType type, Level world) { + super(type, world); + this.moveControl = new FreshwaterMantis.MoveHelperController(this); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.1F); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.25D).add(Attributes.ATTACK_DAMAGE, 1.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1.5D, false)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.8D)); + this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 1.0F)); + this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, LivingEntity.class, true, e -> e.getType().is(UFTags.SNAILS))); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, AeroMono.class, true)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, SneepSnorp.class, true)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, RhinoTetra.class, true)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, SailorBarb.class, true)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Silverfish.class, true)); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new GroundPathNavigation(this, level()); + } + + protected SoundEvent getAmbientSound() { + return UFSounds.CRAB_CHATTER.get(); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { + this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); + } + + @Override + public float getWaterSlowDown() { + return 0.9f; + } + + public void baseTick() { + int i = this.getAirSupply(); + super.baseTick(); + if (!this.isNoAi()) { + this.handleAirSupply(i); + } + } + + protected void handleAirSupply(int p_149194_) { + if (this.isAlive() && !this.isInWaterRainOrBubble()) { + this.setAirSupply(p_149194_ - 1); + if (this.getAirSupply() == -20) { + this.setAirSupply(0); + this.hurt(damageSources().dryOut(), 1.0F); + } + } else { + this.setAirSupply(this.getMaxAirSupply()); + } + } + + public int getMaxAirSupply() { + return 6000; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.FRESHWATER_MANTIS_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.WALK); + } else { + event.setAnimation(UFAnimations.IDLE); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } + + static class MoveHelperController extends MoveControl { + + private final Mob mantis; + + MoveHelperController(Mob mantis) { + super(mantis); + this.mantis = mantis; + } + + public void tick() { + if (this.mantis.isEyeInFluid(FluidTags.WATER)) { + this.mantis.setDeltaMovement(this.mantis.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); + } + + if (this.operation == Operation.MOVE_TO && !this.mantis.getNavigation().isDone()) { + double d0 = this.wantedX - this.mantis.getX(); + double d1 = this.wantedY - this.mantis.getY(); + double d2 = this.wantedZ - this.mantis.getZ(); + double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); + d1 = d1 / d3; + float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; + this.mantis.setYRot(this.rotlerp(this.mantis.getYRot(), f, 90.0F)); + this.mantis.yBodyRot = this.mantis.getYRot(); + float f1 = (float) (this.speedModifier * this.mantis.getAttributeValue(Attributes.MOVEMENT_SPEED)); + this.mantis.setSpeed(Mth.lerp(0.125F, this.mantis.getSpeed(), f1)); + this.mantis.setDeltaMovement(this.mantis.getDeltaMovement().add(0.0D, (double) this.mantis.getSpeed() * d1 * 0.1D, 0.0D)); + } else { + this.mantis.setSpeed(0.0F); + } + } + + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/FrostyFinFish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/FrostyFinFish.java new file mode 100644 index 0000000..846c71d --- /dev/null +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/FrostyFinFish.java @@ -0,0 +1,137 @@ +package codyhuh.unusualfishmod.common.entity; + +import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; +import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; +import codyhuh.unusualfishmod.core.registry.UFItems; +import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.RandomSource; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; +import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; +import net.minecraft.world.entity.ai.goal.*; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; +import net.minecraft.world.entity.animal.WaterAnimal; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import software.bernie.geckolib.animatable.GeoEntity; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; + +public class FrostyFinFish extends BucketableSchoolingWaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public FrostyFinFish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.FROSTY_FIN_FISH_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + super.aiStep(); + } + + public int getMaxSpawnClusterSize() { + return 8; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 10; + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } +} diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Gnasher.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Gnasher.java index a7de480..0a73062 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Gnasher.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Gnasher.java @@ -4,6 +4,7 @@ import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Mth; @@ -24,173 +25,170 @@ import net.minecraft.world.entity.monster.RangedAttackMob; import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.material.Fluids; -import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Gnasher extends WaterAnimal implements RangedAttackMob, GeoEntity { - protected int attackCooldown = 0; - private int attackAnimationTick; - - public Gnasher(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 45, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 60.0D).add(Attributes.MOVEMENT_SPEED, (double) 1.0D) - .add(Attributes.ATTACK_DAMAGE, 8.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(1, new RangedAttackGoal(this, 0.5D, 20, 10.0F)); - this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.6F)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 1.0D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 1.0D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Player.class, true)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Animal.class, true)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Villager.class, true)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Squid.class, true)); - } - - @Override - public void performRangedAttack(LivingEntity target, float distanceFactor) { - this.lookAt(target, 100, 100); - this.yBodyRot = yBodyRotO; - AbyssalBlast glass = new AbyssalBlast(this.level(), this); - double xDistance = target.getX() - this.getX(); - double yDistance = target.getY(0.3333333333333333D) - glass.getY(); - double zDistance = target.getZ() - this.getZ(); - double yMath = Mth.sqrt((float) ((xDistance * xDistance) + (zDistance * zDistance))); - glass.shoot(xDistance, yDistance + yMath * 0.10000000298023224D, zDistance, 1.6F, 11.0F); - this.level().addFreshEntity(glass); - } - - @Override - public boolean doHurtTarget(Entity entityIn) { - this.attackAnimationTick = 10; - this.level().broadcastEntityEvent(this, (byte)4); - float f = this.getAttackDamage(); - float f1 = (int)f > 0 ? f / 2.0F + (float)this.random.nextInt((int)f) : f; - boolean flag = entityIn.hurt(damageSources().mobAttack(this), f1); - if (flag) { - entityIn.setDeltaMovement(entityIn.getDeltaMovement().add(0.0D, (double)0.4F, 0.0D)); - this.doEnchantDamageEffects(this, entityIn); - } - return flag; - } - - public void tick() { - super.tick(); - - if (this.attackCooldown > 0) { - this.attackCooldown--; - } - } - - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - if (this.attackAnimationTick > 0) { - --this.attackAnimationTick; - } - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - private float getAttackDamage() { - return (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); - } - - public void handleEntityEvent(byte p_28844_) { - if (p_28844_ == 4) { - this.attackAnimationTick = 10; - } - super.handleEntityEvent(p_28844_); - } - - public int getAttackAnimationTick() { - return this.attackAnimationTick; - } - - protected SoundEvent getAmbientSound() { - return UFSounds.GNASHER_IDLE.get(); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); - } - - private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { - float time = iServerWorld.getTimeOfDay(1.0F); - int light = iServerWorld.getMaxLocalRawBrightness(pos); - return light <= 4 && time > 0.27F && time <= 0.8F; - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + protected int attackCooldown = 0; + private int attackAnimationTick; + + public Gnasher(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 45, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 60.0D).add(Attributes.MOVEMENT_SPEED, 1.0D) + .add(Attributes.ATTACK_DAMAGE, 8.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); + } + + private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { + float time = iServerWorld.getTimeOfDay(1.0F); + int light = iServerWorld.getMaxLocalRawBrightness(pos); + return light <= 4 && time > 0.27F && time <= 0.8F; + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(1, new RangedAttackGoal(this, 0.5D, 20, 10.0F)); + this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.6F)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 1.0D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 1.0D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Player.class, true)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Animal.class, true)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Villager.class, true)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Squid.class, true)); + } + + @Override + public void performRangedAttack(LivingEntity target, float distanceFactor) { + this.lookAt(target, 100, 100); + this.yBodyRot = yBodyRotO; + AbyssalBlast glass = new AbyssalBlast(this.level(), this); + double xDistance = target.getX() - this.getX(); + double yDistance = target.getY(0.3333333333333333D) - glass.getY(); + double zDistance = target.getZ() - this.getZ(); + double yMath = Mth.sqrt((float) ((xDistance * xDistance) + (zDistance * zDistance))); + glass.shoot(xDistance, yDistance + yMath * 0.10000000298023224D, zDistance, 1.6F, 11.0F); + this.level().addFreshEntity(glass); + } + + @Override + public boolean doHurtTarget(Entity entityIn) { + this.attackAnimationTick = 10; + this.level().broadcastEntityEvent(this, (byte) 4); + float f = this.getAttackDamage(); + float f1 = (int) f > 0 ? f / 2.0F + (float) this.random.nextInt((int) f) : f; + boolean flag = this.level() instanceof ServerLevel && entityIn.hurt(damageSources().mobAttack(this), f1); + if (flag) { + entityIn.setDeltaMovement(entityIn.getDeltaMovement().add(0.0D, 0.4F, 0.0D)); + EnchantmentHelper.doPostAttackEffects((ServerLevel) this.level(), entityIn, this.damageSources().mobAttack(this)); + } + return flag; + } + + public void tick() { + super.tick(); + + if (this.attackCooldown > 0) { + this.attackCooldown--; + } + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + if (this.attackAnimationTick > 0) { + --this.attackAnimationTick; + } + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + private float getAttackDamage() { + return (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE); + } + + public void handleEntityEvent(byte p_28844_) { + if (p_28844_ == 4) { + this.attackAnimationTick = 10; + } + super.handleEntityEvent(p_28844_); + } + + public int getAttackAnimationTick() { + return this.attackAnimationTick; + } + + protected SoundEvent getAmbientSound() { + return UFSounds.GNASHER_IDLE.get(); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/HatchetFish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/HatchetFish.java index 3c144fc..0a2bee3 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/HatchetFish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/HatchetFish.java @@ -1,7 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; @@ -25,125 +25,122 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.Blocks; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class HatchetFish extends BucketableSchoolingWaterAnimal implements GeoEntity { - private boolean isSchool = true; - - public HatchetFish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.HATCHET_FISH_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 5; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 10; - } - - protected SoundEvent getAmbientSound() { - return SoundEvents.COD_AMBIENT; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getLightEmission(pos) < 8 && iServerWorld.getBlockState(pos.above()).is(Blocks.WATER) && iServerWorld.getBlockState(pos).is(Blocks.WATER) && pos.getY() <= 0; - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public HatchetFish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getLightEmission(pos) < 8 && iServerWorld.getBlockState(pos.above()).is(Blocks.WATER) && iServerWorld.getBlockState(pos).is(Blocks.WATER) && pos.getY() <= 0; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.HATCHET_FISH_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 5; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 10; + } + + protected SoundEvent getAmbientSound() { + return SoundEvents.COD_AMBIENT; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Kalappa.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Kalappa.java index 3537bfa..0d7616d 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Kalappa.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Kalappa.java @@ -20,15 +20,17 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Kalappa extends PathfinderMob implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + public Kalappa(EntityType entityType, Level level) { super(entityType, level); } @@ -37,6 +39,10 @@ public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 40.0D).add(Attributes.MOVEMENT_SPEED, 0.25D).add(Attributes.ATTACK_DAMAGE, 8.0D).add(Attributes.ARMOR, 15.0D); } + public static boolean canSpawn(EntityType type, LevelAccessor worldIn, MobSpawnType reason, BlockPos pos, RandomSource randomIn) { + return worldIn.getBlockState(pos.below()).canOcclude(); + } + protected void registerGoals() { this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.65D)); @@ -44,10 +50,13 @@ protected void registerGoals() { this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 0.65D, true) { @Override - protected double getAttackReachSqr(LivingEntity p_25556_) { - return (this.mob.getBbWidth() * 1.0D * this.mob.getBbWidth() * 1.0D + p_25556_.getBbWidth()); + protected void checkAndPerformAttack(LivingEntity target) { + if (this.mob.isWithinMeleeAttackRange(target) && this.isTimeToAttack()) { + this.mob.doHurtTarget(target); + } } }); + this.goalSelector.addGoal(6, new WaterAvoidingRandomStrollGoal(this, 0.65D)); this.targetSelector.addGoal(1, (new HurtByTargetGoal(this))); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Mob.class, 5, false, false, (p_28879_) -> { @@ -70,10 +79,6 @@ protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); } - public static boolean canSpawn(EntityType type, LevelAccessor worldIn, MobSpawnType reason, BlockPos pos, RandomSource randomIn) { - return worldIn.getBlockState(pos.below()).canOcclude(); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -88,8 +93,6 @@ private PlayState predicate(AnimationState event) { return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/LobedSkipper.java b/src/main/java/codyhuh/unusualfishmod/common/entity/LobedSkipper.java index cb69603..9c70187 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/LobedSkipper.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/LobedSkipper.java @@ -2,12 +2,9 @@ import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; -import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; -import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; @@ -18,7 +15,10 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.*; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.PathfinderMob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.JumpControl; @@ -27,36 +27,45 @@ import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.pathfinder.Path; 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.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nonnull; public class LobedSkipper extends PathfinderMob implements Bucketable, GeoEntity { private static final EntityDataAccessor FROM_BUCKET = SynchedEntityData.defineId(LobedSkipper.class, EntityDataSerializers.BOOLEAN); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private int jumpTicks; + private int jumpDuration; + private boolean wasOnGround; + private int currentMoveTypeDuration; public LobedSkipper(EntityType entityType, Level level) { super(entityType, level); this.jumpControl = new SkipperJumpController(); this.moveControl = new SkipperMoveController(); this.setMovementSpeed(0.0D); - this.setMaxUpStep(1.1F); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.1F); } public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D).add(Attributes.MOVEMENT_SPEED, (double) 0.5D); + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D).add(Attributes.MOVEMENT_SPEED, 0.5D); + } + + public static boolean canSpawn(EntityType type, LevelAccessor worldIn, MobSpawnType reason, BlockPos pos, RandomSource randomIn) { + return worldIn.getBlockState(pos.below()).canOcclude(); } protected void registerGoals() { @@ -84,11 +93,6 @@ public boolean causeFallDamage(float distance, float damageMultiplier, DamageSou return false; } - @Override - protected float getStandingEyeHeight(@Nonnull Pose pose, EntityDimensions size) { - return 0.2f * size.height; - } - @Override public void tick() { @@ -109,14 +113,9 @@ else if (this.jumpDuration != 0) { @Override protected float getJumpPower() { float motion = super.getJumpPower(); - return motion; + return motion; } - private int jumpTicks; - private int jumpDuration; - private boolean wasOnGround; - private int currentMoveTypeDuration; - @Override public void customServerAiStep() { if (this.currentMoveTypeDuration > 0) --this.currentMoveTypeDuration; @@ -177,7 +176,7 @@ private void checkLandingDelay() { } @Override - protected void jumpFromGround() { + public void jumpFromGround() { super.jumpFromGround(); double d0 = this.moveControl.getSpeedModifier(); @@ -221,44 +220,10 @@ public void handleEntityEvent(byte id) { } } - @Nonnull @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); - } - - public class SkipperJumpController extends JumpControl { - private boolean canJump; - - public SkipperJumpController() { - super(LobedSkipper.this); - } - - public boolean getIsJumping() { - return this.jump; - } - - public boolean canJump() { - return this.canJump; - } - - public void setCanJump(boolean canJumpIn) { - this.canJump = canJumpIn; - } - - @Override - public void tick() { - if (this.jump) { - startJumping(); - this.jump = false; - } - } - } - - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(FROM_BUCKET, false); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(FROM_BUCKET, false); } public void addAdditionalSaveData(CompoundTag compound) { @@ -282,8 +247,10 @@ public void setFromBucket(boolean p_203706_1_) { @Override public void saveToBucketTag(ItemStack bucket) { - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putFloat("Health", this.getHealth()); + Bucketable.saveDefaultDataToBucketTag(this, bucket); + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putFloat("Health", this.getHealth()); + }); } public boolean requiresCustomPersistence() { @@ -312,10 +279,6 @@ public ItemStack getBucketItemStack() { return new ItemStack(UFItems.SKIPPER_BUCKET.get()); } - public static boolean canSpawn(EntityType type, LevelAccessor worldIn, MobSpawnType reason, BlockPos pos, RandomSource randomIn) { - return worldIn.getBlockState(pos.below()).canOcclude(); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -324,20 +287,45 @@ public void registerControllers(AnimatableManager.ControllerRegistrar controller private PlayState predicate(AnimationState event) { if (event.isMoving()) { event.setAnimation(UFAnimations.SWIM); - } - else { + } else { event.setAnimation(UFAnimations.IDLE); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; } + public class SkipperJumpController extends JumpControl { + private boolean canJump; + + public SkipperJumpController() { + super(LobedSkipper.this); + } + + public boolean getIsJumping() { + return this.jump; + } + + public boolean canJump() { + return this.canJump; + } + + public void setCanJump(boolean canJumpIn) { + this.canJump = canJumpIn; + } + + @Override + public void tick() { + if (this.jump) { + startJumping(); + this.jump = false; + } + } + } + public class SkipperMoveController extends MoveControl { private double nextJumpSpeed; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/ManaJellyfish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/ManaJellyfish.java index a8b5616..a256c0e 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/ManaJellyfish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/ManaJellyfish.java @@ -1,7 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; @@ -18,26 +18,29 @@ import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; -import net.minecraft.world.entity.ai.goal.*; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.RandomSwimmingGoal; +import net.minecraft.world.entity.ai.goal.TryFindWaterGoal; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.material.Fluids; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class ManaJellyfish extends BucketableSchoolingWaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); protected int attackCooldown = 0; - private boolean isSchool = true; + private final boolean isSchool = true; public ManaJellyfish(EntityType entityType, Level level) { super(entityType, level); @@ -45,15 +48,25 @@ public ManaJellyfish(EntityType entity this.lookControl = new SmoothSwimmingLookControl(this, 10); } + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.3F).add(Attributes.ATTACK_DAMAGE, 2.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); + } + + private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { + float time = iServerWorld.getTimeOfDay(1.0F); + int light = iServerWorld.getMaxLocalRawBrightness(pos); + return light <= 4 && time > 0.27F && time <= 0.8F; + } + @Override public ItemStack getBucketStack() { return new ItemStack(UFItems.WIZARD_JELLY_BUCKET.get()); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.3F).add(Attributes.ATTACK_DAMAGE, 2.0D); - } - protected void registerGoals() { this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); @@ -97,16 +110,6 @@ public void playerTouch(Player entity) { } } - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); - } - - private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { - float time = iServerWorld.getTimeOfDay(1.0F); - int light = iServerWorld.getMaxLocalRawBrightness(pos); - return light <= 4 && time > 0.27F && time <= 0.8F; - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 20, this::predicate)); @@ -119,15 +122,12 @@ private PlayState predicate(AnimationState event) { } else { event.setAnimation(UFAnimations.IDLE); } - } - else { + } else { event.setAnimation(UFAnimations.FLOP); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Mossthorn.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Mossthorn.java index e52b507..4a23a57 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Mossthorn.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Mossthorn.java @@ -1,7 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; @@ -25,116 +25,114 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.Blocks; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Mossthorn extends BucketableSchoolingWaterAnimal implements GeoEntity { - private boolean isSchool = true; - - public Mossthorn(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.MOSSTHORN_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 5; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 7; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).is(Blocks.WATER) && pos.getY() <= 40; - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public Mossthorn(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).is(Blocks.WATER) && pos.getY() <= 40; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.MOSSTHORN_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 5; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 7; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/MuddytopSnail.java b/src/main/java/codyhuh/unusualfishmod/common/entity/MuddytopSnail.java index f107d79..fe99ee6 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/MuddytopSnail.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/MuddytopSnail.java @@ -29,20 +29,29 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class MuddytopSnail extends BucketableWaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); protected int attackCooldown = 0; public MuddytopSnail(EntityType type, Level world) { super(type, world); this.moveControl = new SnailMoveControl(this); - this.setMaxUpStep(1.0F); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.0F); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.3D).add(Attributes.ARMOR, 8.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); } @Override @@ -50,10 +59,6 @@ public ItemStack getBucketStack() { return new ItemStack(UFItems.MUDDYTOP_SNAIL_BUCKET.get()); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.3D).add(Attributes.ARMOR, 8.0D); - } - protected void registerGoals() { this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.6F)); this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.3F)); @@ -96,10 +101,6 @@ protected SoundEvent getHurtSound(DamageSource p_28281_) { return SoundEvents.COD_HURT; } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -114,8 +115,6 @@ private PlayState predicate(AnimationState event) { return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Picklefish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Picklefish.java index 5de52f7..1660ac9 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Picklefish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Picklefish.java @@ -2,19 +2,12 @@ import codyhuh.unusualfishmod.common.entity.util.base.BucketableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.goal.BottomStrollGoal; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -26,113 +19,111 @@ import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Picklefish extends BucketableWaterAnimal implements GeoEntity { - public Picklefish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.PICKLEFISH_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public Picklefish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.PICKLEFISH_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/PinkfinIdol.java b/src/main/java/codyhuh/unusualfishmod/common/entity/PinkfinIdol.java index 2fd0a48..5753497 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/PinkfinIdol.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/PinkfinIdol.java @@ -3,7 +3,6 @@ import codyhuh.unusualfishmod.common.entity.util.base.BucketableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; -import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -29,118 +28,116 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class PinkfinIdol extends BucketableWaterAnimal implements GeoEntity { - public PinkfinIdol(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.PINKFIN_IDOL_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10).add(Attributes.ATTACK_DAMAGE, 2); - } - - @Override - public void registerGoals() { - super.registerGoals(); - this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 3.0D, true)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, TropicalFish.class, false)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void tick() { - super.tick(); - - if (this.level().isClientSide && this.isInWater() && this.getDeltaMovement().lengthSqr() > 0.03D) { - Vec3 vec3 = this.getViewVector(0.0F); - float f = Mth.cos(this.getYRot() * ((float)Math.PI / 180F)) * 0.3F; - float f1 = Mth.sin(this.getYRot() * ((float)Math.PI / 180F)) * 0.3F; - } - - } - - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - public SoundEvent getHurtSound(DamageSource damageSourceIn) { - return SoundEvents.COD_HURT; - } - - public SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public PinkfinIdol(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10).add(Attributes.ATTACK_DAMAGE, 2); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.PINKFIN_IDOL_BUCKET.get()); + } + + @Override + public void registerGoals() { + super.registerGoals(); + this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 3.0D, true)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, TropicalFish.class, false)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void tick() { + super.tick(); + + if (this.level().isClientSide && this.isInWater() && this.getDeltaMovement().lengthSqr() > 0.03D) { + Vec3 vec3 = this.getViewVector(0.0F); + float f = Mth.cos(this.getYRot() * ((float) Math.PI / 180F)) * 0.3F; + float f1 = Mth.sin(this.getYRot() * ((float) Math.PI / 180F)) * 0.3F; + } + + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + public SoundEvent getHurtSound(DamageSource damageSourceIn) { + return SoundEvents.COD_HURT; + } + + public SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/PorcupineLobster.java b/src/main/java/codyhuh/unusualfishmod/common/entity/PorcupineLobster.java index 487034c..d6acf9f 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/PorcupineLobster.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/PorcupineLobster.java @@ -6,18 +6,12 @@ import codyhuh.unusualfishmod.core.registry.UFItems; import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -32,7 +26,6 @@ import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; import net.minecraft.world.entity.ai.navigation.PathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -40,24 +33,29 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class PorcupineLobster extends BucketableWaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); protected int attackCooldown = 0; public PorcupineLobster(EntityType type, Level world) { super(type, world); this.moveControl = new PorcupineLobster.MoveHelperController(this); - this.setMaxUpStep(1.5F); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.5F); } public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, (double) 0.5F).add(Attributes.ARMOR, (double) 7.0F).add(Attributes.ATTACK_DAMAGE, (double) 3.0F); + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.5F).add(Attributes.ARMOR, 7.0F).add(Attributes.ATTACK_DAMAGE, 3.0F); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); } protected void registerGoals() { @@ -119,10 +117,6 @@ public ItemStack getBucketStack() { return new ItemStack(UFItems.PORCUPINE_LOBSTA_BUCKET.get()); } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -137,8 +131,6 @@ private PlayState predicate(AnimationState event) { return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; @@ -164,8 +156,8 @@ public void tick() { double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); d1 = d1 / d3; float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; - this.lobsta.yRot = this.rotlerp(this.lobsta.yRot, f, 90.0F); - this.lobsta.yBodyRot = this.lobsta.yRot; + this.lobsta.setYRot(this.rotlerp(this.lobsta.getYRot(), f, 90.0F)); + this.lobsta.yBodyRot = this.lobsta.getYRot(); float f1 = (float) (this.speedModifier * this.lobsta.getAttributeValue(Attributes.MOVEMENT_SPEED)); this.lobsta.setSpeed(Mth.lerp(0.125F, this.lobsta.getSpeed(), f1)); this.lobsta.setDeltaMovement(this.lobsta.getDeltaMovement().add(0.0D, (double) this.lobsta.getSpeed() * d1 * 0.1D, 0.0D)); @@ -173,5 +165,5 @@ public void tick() { this.lobsta.setSpeed(0.0F); } } -} + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Prawn.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Prawn.java index d0f46fc..c7ae6b6 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Prawn.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Prawn.java @@ -3,6 +3,7 @@ import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; @@ -18,19 +19,22 @@ import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.state.BlockState; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Prawn extends Monster implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + public Prawn(EntityType entityType, Level level) { super(entityType, level); } @@ -39,6 +43,10 @@ public static AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 16.0D).add(Attributes.MOVEMENT_SPEED, 0.6F).add(Attributes.ATTACK_DAMAGE, 5.0D); } + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || !iServerWorld.canSeeSky(pos) && pos.getY() <= 20 && checkMonsterSpawnRules(entityType, iServerWorld, reason, pos, random); + } + protected void registerGoals() { this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.6F)); @@ -46,8 +54,10 @@ protected void registerGoals() { this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0D, true) { @Override - protected double getAttackReachSqr(LivingEntity p_25556_) { - return this.mob.getBbWidth() * 2.0F * this.mob.getBbWidth() * 1.0F + p_25556_.getBbWidth(); + protected void checkAndPerformAttack(LivingEntity target) { + if (this.mob.isWithinMeleeAttackRange(target) && this.isTimeToAttack()) { + this.mob.doHurtTarget(target); + } } }); this.goalSelector.addGoal(6, new WaterAvoidingRandomStrollGoal(this, 0.6D)); @@ -57,9 +67,9 @@ protected double getAttackReachSqr(LivingEntity p_25556_) { @Override public boolean doHurtTarget(Entity entityIn) { - boolean flag = entityIn.hurt(damageSources().mobAttack(this), (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE)); + boolean flag = this.level() instanceof ServerLevel && entityIn.hurt(damageSources().mobAttack(this), (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE)); if (flag) { - this.doEnchantDamageEffects(this, entityIn); + EnchantmentHelper.doPostAttackEffects((ServerLevel) this.level(), entityIn, this.damageSources().mobAttack(this)); } return flag; @@ -81,17 +91,13 @@ protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); } - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || !iServerWorld.canSeeSky(pos) && pos.getY() <= 20 && checkMonsterSpawnRules(entityType, iServerWorld, reason, pos, random); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); } private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { + if (this.isRemoved()) { return PlayState.STOP; } @@ -103,8 +109,6 @@ private PlayState predicate(AnimationState event) { return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/RhinoTetra.java b/src/main/java/codyhuh/unusualfishmod/common/entity/RhinoTetra.java index 7728969..fba964b 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/RhinoTetra.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/RhinoTetra.java @@ -1,10 +1,11 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; @@ -16,7 +17,6 @@ import net.minecraft.util.RandomSource; import net.minecraft.util.TimeUtil; import net.minecraft.util.valueproviders.UniformInt; -import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; @@ -34,260 +34,256 @@ import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; import java.util.UUID; public class RhinoTetra extends BucketableSchoolingWaterAnimal implements GeoEntity, NeutralMob { - private static final EntityDataAccessor REMAINING_ANGER_TIME = SynchedEntityData.defineId(RhinoTetra.class, EntityDataSerializers.INT); - private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(15, 29); - @Nullable - private UUID persistentAngerTarget; - public int stunnedTick; - private boolean isSchool = true; - - public RhinoTetra(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.2F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return ItemStack.EMPTY; - } - - protected InteractionResult mobInteract(Player p_27477_, InteractionHand p_27478_) { - return InteractionResult.PASS; - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.ATTACK_DAMAGE, 2.0D).add(Attributes.ATTACK_KNOCKBACK, 3.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1.0D, true)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 5.0D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.targetSelector.addGoal(1, new ResetUniversalAngerTargetGoal<>(this, false)); - this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, LivingEntity.class, 10, true, false, this::isAngryAt)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - - if (isAlive()) { - if (this.stunnedTick > 0) { - --this.stunnedTick; - this.stunEffect(); - if (this.stunnedTick == 0) { - this.playSound(SoundEvents.BUBBLE_COLUMN_BUBBLE_POP, 1.0F, 0.7F); - } - } - } - } - - @Override - public boolean hurt(DamageSource source, float amount) { - if (super.hurt(source, amount) && source.getEntity() instanceof LivingEntity living) { - setAggressive(true); - setTarget(living); - } - - return super.hurt(source, amount); - } - - protected void blockedByShield(LivingEntity p_33361_) { - if (this.random.nextFloat() > 0.25F) { - this.stunnedTick = 80; - this.playSound(SoundEvents.COD_HURT, 1.0F, 0.5F); - this.level().broadcastEntityEvent(this, (byte)39); - p_33361_.push(this); - setAggressive(false); - setTarget(null); - } - - p_33361_.hurtMarked = true; - } - - private void stunEffect() { - Vec3 pos = getYawVec(yBodyRot, 0.0D, 0.0D, 0.85D).add(0.0D, 0.85D, 0.0D); - - this.level().addParticle(ParticleTypes.CRIT, pos.x + getRandomX(0.5D), pos.y + position().y, pos.z + getRandomZ(0.5D), 0.0D, 0.0D, 0.0D); - } - - @Override - public void tick() { - super.tick(); - - if (isInWater() && getTarget() != null && isAggressive() && level() instanceof ServerLevel serverLevel && stunnedTick <= 0) { - Vec3 pos = getYawVec(yHeadRot, 0.0D, 0.0D, 0.0D).add(position()); - - setDeltaMovement(calculateViewVector(this.getXRot(), this.getYRot()).scale(0.5D)); - - for (int i = 0; i < 5; i++) { - serverLevel.sendParticles(ParticleTypes.BUBBLE, pos.x(), pos.y() + (i * 0.1F) + 0.25F, pos.z(), 0, 0.0D, 0.0D, 0.0D, 0.0D); - } - } - } - - private static Vec3 getYawVec(float yaw, double xOffset, double yOffset, double zOffset) { - return new Vec3(xOffset, yOffset, zOffset).yRot(-yaw * ((float) Math.PI / 180f)); - } - - public void handleEntityEvent(byte p_33335_) { - if (p_33335_ == 39) { - this.stunnedTick = 80; - } - - super.handleEntityEvent(p_33335_); - } - - @Override - protected boolean isImmobile() { - return super.isImmobile() || this.stunnedTick > 0; - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 5; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 7; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(REMAINING_ANGER_TIME, 0); - } - - public void readAdditionalSaveData(CompoundTag compound) { - super.readAdditionalSaveData(compound); - this.stunnedTick = compound.getInt("StunTick"); - readPersistentAngerSaveData(level(), compound); - } - - public void addAdditionalSaveData(CompoundTag compound) { - super.addAdditionalSaveData(compound); - compound.putInt("StunTick", this.stunnedTick); - addPersistentAngerSaveData(compound); - } - - @Override - public void saveToBucketTag(ItemStack bucket) { - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putFloat("Health", this.getHealth()); - if (this.hasCustomName()) { - bucket.setHoverName(this.getCustomName()); - } - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public int getRemainingPersistentAngerTime() { - return this.entityData.get(REMAINING_ANGER_TIME); - } - - @Override - public void setRemainingPersistentAngerTime(int p_21673_) { - this.entityData.set(REMAINING_ANGER_TIME, p_21673_); - } - - @Nullable - @Override - public UUID getPersistentAngerTarget() { - return this.persistentAngerTarget; - } - - @Override - public void setPersistentAngerTarget(@Nullable UUID p_27791_) { - this.persistentAngerTarget = p_27791_; - } - - @Override - public void startPersistentAngerTimer() { - this.setRemainingPersistentAngerTime(PERSISTENT_ANGER_TIME.sample(this.random)); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private static final EntityDataAccessor REMAINING_ANGER_TIME = SynchedEntityData.defineId(RhinoTetra.class, EntityDataSerializers.INT); + private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(15, 29); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + public int stunnedTick; + @Nullable + private UUID persistentAngerTarget; + private final boolean isSchool = true; + + public RhinoTetra(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.2F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.ATTACK_DAMAGE, 2.0D).add(Attributes.ATTACK_KNOCKBACK, 3.0D); + } + + private static Vec3 getYawVec(float yaw, double xOffset, double yOffset, double zOffset) { + return new Vec3(xOffset, yOffset, zOffset).yRot(-yaw * ((float) Math.PI / 180f)); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.RHINO_TETRA_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1.0D, true)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 5.0D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.targetSelector.addGoal(1, new ResetUniversalAngerTargetGoal<>(this, false)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, LivingEntity.class, 10, true, false, this::isAngryAt)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + + if (isAlive()) { + if (this.stunnedTick > 0) { + --this.stunnedTick; + this.stunEffect(); + if (this.stunnedTick == 0) { + this.playSound(SoundEvents.BUBBLE_COLUMN_BUBBLE_POP, 1.0F, 0.7F); + } + } + } + } + + @Override + public boolean hurt(DamageSource source, float amount) { + if (super.hurt(source, amount) && source.getEntity() instanceof LivingEntity living) { + setAggressive(true); + setTarget(living); + } + + return super.hurt(source, amount); + } + + protected void blockedByShield(LivingEntity p_33361_) { + if (this.random.nextFloat() > 0.25F) { + this.stunnedTick = 80; + this.playSound(SoundEvents.COD_HURT, 1.0F, 0.5F); + this.level().broadcastEntityEvent(this, (byte) 39); + p_33361_.push(this); + setAggressive(false); + setTarget(null); + } + + p_33361_.hurtMarked = true; + } + + private void stunEffect() { + Vec3 pos = getYawVec(yBodyRot, 0.0D, 0.0D, 0.85D).add(0.0D, 0.85D, 0.0D); + + this.level().addParticle(ParticleTypes.CRIT, pos.x + getRandomX(0.5D), pos.y + position().y, pos.z + getRandomZ(0.5D), 0.0D, 0.0D, 0.0D); + } + + @Override + public void tick() { + super.tick(); + + if (isInWater() && getTarget() != null && isAggressive() && level() instanceof ServerLevel serverLevel && stunnedTick <= 0) { + Vec3 pos = getYawVec(yHeadRot, 0.0D, 0.0D, 0.0D).add(position()); + + setDeltaMovement(calculateViewVector(this.getXRot(), this.getYRot()).scale(0.5D)); + + for (int i = 0; i < 5; i++) { + serverLevel.sendParticles(ParticleTypes.BUBBLE, pos.x(), pos.y() + (i * 0.1F) + 0.25F, pos.z(), 0, 0.0D, 0.0D, 0.0D, 0.0D); + } + } + } + + public void handleEntityEvent(byte p_33335_) { + if (p_33335_ == 39) { + this.stunnedTick = 80; + } + + super.handleEntityEvent(p_33335_); + } + + @Override + protected boolean isImmobile() { + return super.isImmobile() || this.stunnedTick > 0; + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 5; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 7; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(REMAINING_ANGER_TIME, 0); + } + + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + this.stunnedTick = compound.getInt("StunTick"); + readPersistentAngerSaveData(level(), compound); + } + + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + compound.putInt("StunTick", this.stunnedTick); + addPersistentAngerSaveData(compound); + } + + @Override + public void saveToBucketTag(ItemStack bucket) { + Bucketable.saveDefaultDataToBucketTag(this, bucket); + if (this.hasCustomName()) { + bucket.set(DataComponents.CUSTOM_NAME, this.getCustomName()); + } + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putFloat("Health", this.getHealth()); + }); + } + + @Override + public int getRemainingPersistentAngerTime() { + return this.entityData.get(REMAINING_ANGER_TIME); + } + + @Override + public void setRemainingPersistentAngerTime(int p_21673_) { + this.entityData.set(REMAINING_ANGER_TIME, p_21673_); + } + + @Nullable + @Override + public UUID getPersistentAngerTarget() { + return this.persistentAngerTarget; + } + + @Override + public void setPersistentAngerTarget(@Nullable UUID p_27791_) { + this.persistentAngerTarget = p_27791_; + } + + @Override + public void startPersistentAngerTimer() { + this.setRemainingPersistentAngerTime(PERSISTENT_ANGER_TIME.sample(this.random)); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Ripper.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Ripper.java index 8454f54..92727e1 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Ripper.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Ripper.java @@ -1,11 +1,12 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; @@ -25,185 +26,184 @@ 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.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.material.Fluids; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Ripper extends BucketableSchoolingWaterAnimal implements GeoEntity { - protected int attackCooldown = 0; - private int attackAnimationTick; - private boolean isSchool = true; - - public Ripper(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.RIPPER_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, 1.0D).add(Attributes.ATTACK_DAMAGE, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1.5D, false)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 1.0D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 1.0D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Player.class, true)); - this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, LivingEntity.class, true, p -> p.getHealth() <= p.getMaxHealth() / 3)); - } - - @Override - public boolean doHurtTarget(Entity entityIn) { - this.attackAnimationTick = 10; - this.level().broadcastEntityEvent(this, (byte)4); - float f = this.getAttackDamage(); - float f1 = (int)f > 0 ? f / 2.0F + (float)this.random.nextInt((int)f) : f; - boolean flag = entityIn.hurt(damageSources().mobAttack(this), f1); - if (flag) { - entityIn.setDeltaMovement(entityIn.getDeltaMovement().add(0.0D, 0.4F, 0.0D)); - this.doEnchantDamageEffects(this, entityIn); - - if (random.nextFloat() > 0.9F) { - ItemEntity item = EntityType.ITEM.create(level()); - - item.moveTo(position()); - item.setItem(new ItemStack(UFItems.RIPPER_TOOTH.get())); - - level().addFreshEntity(item); - } - } - return flag; - } - - public void tick() { - super.tick(); - - if (this.attackCooldown > 0) { - this.attackCooldown--; - } - } - - public void aiStep() { - - if (this.attackAnimationTick > 0) { - --this.attackAnimationTick; - } - - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - public int getMaxSpawnClusterSize() { - return 5; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 7; - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - private float getAttackDamage() { - return (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); - } - - public void handleEntityEvent(byte p_28844_) { - if (p_28844_ == 4) { - this.attackAnimationTick = 10; - } - } - - public int getAttackAnimationTick() { - return this.attackAnimationTick; - } - - - protected SoundEvent getAmbientSound() { - return UFSounds.SMALL_ENEMY.get(); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); - } - - private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { - float time = iServerWorld.getTimeOfDay(1.0F); - int light = iServerWorld.getBrightness(LightLayer.BLOCK, pos); - return light <= 4/* && time > 0.27F && time <= 0.8F*/; - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + protected int attackCooldown = 0; + private int attackAnimationTick; + private final boolean isSchool = true; + + public Ripper(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, 1.0D).add(Attributes.ATTACK_DAMAGE, 2.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); + } + + private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { + float time = iServerWorld.getTimeOfDay(1.0F); + int light = iServerWorld.getBrightness(LightLayer.BLOCK, pos); + return light <= 4/* && time > 0.27F && time <= 0.8F*/; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.RIPPER_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1.5D, false)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 1.0D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 1.0D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, Player.class, true)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, LivingEntity.class, true, p -> p.getHealth() <= p.getMaxHealth() / 3)); + } + + @Override + public boolean doHurtTarget(Entity entityIn) { + this.attackAnimationTick = 10; + this.level().broadcastEntityEvent(this, (byte) 4); + float f = this.getAttackDamage(); + float f1 = (int) f > 0 ? f / 2.0F + (float) this.random.nextInt((int) f) : f; + boolean flag = entityIn.hurt(damageSources().mobAttack(this), f1); + if (flag) { + entityIn.setDeltaMovement(entityIn.getDeltaMovement().add(0.0D, 0.4F, 0.0D)); + if (this.level() instanceof ServerLevel serverLevel) { + EnchantmentHelper.doPostAttackEffects(serverLevel, entityIn, this.damageSources().generic()); + } + if (random.nextFloat() > 0.9F) { + ItemEntity item = EntityType.ITEM.create(level()); + + item.moveTo(position()); + item.setItem(new ItemStack(UFItems.RIPPER_TOOTH.get())); + + level().addFreshEntity(item); + } + } + return flag; + } + + public void tick() { + super.tick(); + + if (this.attackCooldown > 0) { + this.attackCooldown--; + } + } + + public void aiStep() { + + if (this.attackAnimationTick > 0) { + --this.attackAnimationTick; + } + + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + public int getMaxSpawnClusterSize() { + return 5; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 7; + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + private float getAttackDamage() { + return (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE); + } + + public void handleEntityEvent(byte p_28844_) { + if (p_28844_ == 4) { + this.attackAnimationTick = 10; + } + } + + public int getAttackAnimationTick() { + return this.attackAnimationTick; + } + + protected SoundEvent getAmbientSound() { + return UFSounds.SMALL_ENEMY.get(); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Rootball.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Rootball.java index 8b51e8a..21a932e 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Rootball.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Rootball.java @@ -1,7 +1,6 @@ package codyhuh.unusualfishmod.common.entity; import codyhuh.unusualfishmod.common.entity.util.goal.CustomSwellGoal; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; @@ -30,11 +29,11 @@ import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.gameevent.GameEvent; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; @@ -43,6 +42,7 @@ public class Rootball extends Monster implements GeoEntity { private static final EntityDataAccessor DATA_SWELL_DIR = SynchedEntityData.defineId(Rootball.class, EntityDataSerializers.INT); private static final EntityDataAccessor DATA_IS_IGNITED = SynchedEntityData.defineId(Rootball.class, EntityDataSerializers.BOOLEAN); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private int oldSwell; private int swell; private int maxSwell = 30; @@ -52,6 +52,24 @@ public Rootball(EntityType entityType, Level level) { super(entityType, level); } + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 3.0D).add(Attributes.MOVEMENT_SPEED, 0.4D) + .add(Attributes.ATTACK_DAMAGE, 2.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.canSeeSky(pos.above()) && canMonsterSpawnInLight(entityType, iServerWorld, reason, pos, random); + } + + public static boolean canMonsterSpawnInLight(EntityType p_223325_0_, ServerLevelAccessor p_223325_1_, MobSpawnType p_223325_2_, BlockPos p_223325_3_, RandomSource p_223325_4_) { + return isValidLightLevel(p_223325_1_, p_223325_3_, p_223325_4_) && checkMobSpawnRules(p_223325_0_, p_223325_1_, p_223325_2_, p_223325_3_, p_223325_4_); + } + + public static boolean isValidLightLevel(ServerLevelAccessor p_223323_0_, BlockPos p_223323_1_, RandomSource p_223323_2_) { + int light = p_223323_0_.getMaxLocalRawBrightness(p_223323_1_); + return light <= 4; + } + protected void registerGoals() { this.goalSelector.addGoal(1, new FloatGoal(this)); this.goalSelector.addGoal(2, new CustomSwellGoal(this)); @@ -65,19 +83,13 @@ protected void registerGoals() { this.targetSelector.addGoal(2, new HurtByTargetGoal(this)); } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 3.0D).add(Attributes.MOVEMENT_SPEED, 0.4D) - .add(Attributes.ATTACK_DAMAGE, 2.0D); - } - public int getMaxFallDistance() { - return this.getTarget() == null ? 3 : 3 + (int)(this.getHealth() - 1.0F); + return this.getTarget() == null ? 3 : 3 + (int) (this.getHealth() - 1.0F); } public boolean causeFallDamage(float p_149687_, float p_149688_, DamageSource p_149689_) { boolean flag = super.causeFallDamage(p_149687_, p_149688_, p_149689_); - this.swell = (int)((float)this.swell + p_149687_ * 1.5F); + this.swell = (int) ((float) this.swell + p_149687_ * 1.5F); if (this.swell > this.maxSwell - 5) { this.swell = this.maxSwell - 5; } @@ -85,17 +97,18 @@ public boolean causeFallDamage(float p_149687_, float p_149688_, DamageSource p_ return flag; } - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(DATA_SWELL_DIR, -1); - this.entityData.define(DATA_IS_IGNITED, false); + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(DATA_SWELL_DIR, -1); + builder.define(DATA_IS_IGNITED, false); } public void addAdditionalSaveData(CompoundTag compound) { super.addAdditionalSaveData(compound); - compound.putShort("Fuse", (short)this.maxSwell); - compound.putByte("ExplosionRadius", (byte)this.explosionRadius); + compound.putShort("Fuse", (short) this.maxSwell); + compound.putByte("ExplosionRadius", (byte) this.explosionRadius); compound.putBoolean("ignited", this.isIgnited()); } @@ -174,7 +187,7 @@ public void setSwellDir(int p_32284_) { } public float getSwelling(float p_32321_) { - return Mth.lerp(p_32321_, (float)this.oldSwell, (float)this.swell) / (float)(this.maxSwell - 2); + return Mth.lerp(p_32321_, (float) this.oldSwell, (float) this.swell) / (float) (this.maxSwell - 2); } private void explodeCreeper() { @@ -195,9 +208,9 @@ private void spawnLingeringCloud() { areaeffectcloud.setRadiusOnUse(-0.5F); areaeffectcloud.setWaitTime(10); areaeffectcloud.setDuration(areaeffectcloud.getDuration() / 2); - areaeffectcloud.setRadiusPerTick(-areaeffectcloud.getRadius() / (float)areaeffectcloud.getDuration()); + areaeffectcloud.setRadiusPerTick(-areaeffectcloud.getRadius() / (float) areaeffectcloud.getDuration()); - for(MobEffectInstance mobeffectinstance : collection) { + for (MobEffectInstance mobeffectinstance : collection) { areaeffectcloud.addEffect(new MobEffectInstance(mobeffectinstance)); } @@ -214,19 +227,6 @@ public void ignite() { this.entityData.set(DATA_IS_IGNITED, true); } - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.canSeeSky(pos.above()) && canMonsterSpawnInLight(entityType, iServerWorld, reason, pos, random); - } - - public static boolean canMonsterSpawnInLight(EntityType p_223325_0_, ServerLevelAccessor p_223325_1_, MobSpawnType p_223325_2_, BlockPos p_223325_3_, RandomSource p_223325_4_) { - return isValidLightLevel(p_223325_1_, p_223325_3_, p_223325_4_) && checkMobSpawnRules(p_223325_0_, p_223325_1_, p_223325_2_, p_223325_3_, p_223325_4_); - } - - public static boolean isValidLightLevel(ServerLevelAccessor p_223323_0_, BlockPos p_223323_1_, RandomSource p_223323_2_) { - int light = p_223323_0_.getMaxLocalRawBrightness(p_223323_1_); - return light <= 4; - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -239,15 +239,12 @@ private PlayState predicate(AnimationState event) { } else { event.setAnimation(UFAnimations.IDLE); } - } - else { + } else { event.setAnimation(UFAnimations.FLOP); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/RoughbackGuitarfish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/RoughbackGuitarfish.java index dca5c58..807e285 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/RoughbackGuitarfish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/RoughbackGuitarfish.java @@ -23,122 +23,120 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class RoughbackGuitarfish extends WaterAnimal implements GeoEntity { - protected int attackCooldown = 0; - - public RoughbackGuitarfish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 16.0D).add(Attributes.ATTACK_DAMAGE, 1.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(4, new HurtByTargetGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void tick() { - super.tick(); - - if (this.attackCooldown > 0) { - this.attackCooldown--; - } - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public void playerTouch(Player entity) { - super.playerTouch(entity); - if (!entity.isCreative() && this.attackCooldown == 0 && entity.level().getDifficulty() != Difficulty.PEACEFUL) { - entity.hurt(damageSources().mobAttack(this), 2.0F); - this.attackCooldown = 80; - } - } - - @Override - public int getMaxSpawnClusterSize() { - return 1; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return random.nextBoolean() && WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + protected int attackCooldown = 0; + + public RoughbackGuitarfish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 16.0D).add(Attributes.ATTACK_DAMAGE, 1.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return random.nextBoolean() && WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(4, new HurtByTargetGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void tick() { + super.tick(); + + if (this.attackCooldown > 0) { + this.attackCooldown--; + } + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void playerTouch(Player entity) { + super.playerTouch(entity); + if (!entity.isCreative() && this.attackCooldown == 0 && entity.level().getDifficulty() != Difficulty.PEACEFUL) { + entity.hurt(damageSources().mobAttack(this), 2.0F); + this.attackCooldown = 80; + } + } + + @Override + public int getMaxSpawnClusterSize() { + return 1; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/SailorBarb.java b/src/main/java/codyhuh/unusualfishmod/common/entity/SailorBarb.java index c601ae0..9ba99f5 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/SailorBarb.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/SailorBarb.java @@ -1,7 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; @@ -25,117 +25,115 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class SailorBarb extends BucketableSchoolingWaterAnimal implements GeoEntity { - private boolean isSchool = true; - - public SailorBarb(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.SAILOR_BARB_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 5; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 7; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public SailorBarb(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.SAILOR_BARB_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 5; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 7; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/SeaMosquito.java b/src/main/java/codyhuh/unusualfishmod/common/entity/SeaMosquito.java index 997b690..8e74e91 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/SeaMosquito.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/SeaMosquito.java @@ -2,21 +2,16 @@ import codyhuh.unusualfishmod.common.entity.util.base.BucketableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.goal.BottomStrollGoal; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -28,116 +23,111 @@ import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class SeaMosquito extends BucketableWaterAnimal implements GeoEntity { - private static final EntityDataAccessor FROM_BUCKET = SynchedEntityData.defineId(SeaMosquito.class, EntityDataSerializers.BOOLEAN); - - public SeaMosquito(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 6.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getAmbientSound() { - return UFSounds.CRAB_CHATTER.get(); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.SEA_MOSQUITO_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public SeaMosquito(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 6.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getAmbientSound() { + return UFSounds.CRAB_CHATTER.get(); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.SEA_MOSQUITO_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/SeaPancake.java b/src/main/java/codyhuh/unusualfishmod/common/entity/SeaPancake.java index 21f2c82..cd25208 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/SeaPancake.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/SeaPancake.java @@ -1,12 +1,13 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.common.entity.util.goal.BottomStrollGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ItemParticleOption; import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; @@ -38,141 +39,142 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import java.util.List; +import static codyhuh.unusualfishmod.UnusualFishMod.loc; + public class SeaPancake extends WaterAnimal implements GeoEntity { - public static final ResourceLocation FEED_REWARD = new ResourceLocation(UnusualFishMod.MOD_ID, "gameplay/sea_pancake_search"); - protected int attackCooldown = 0; - - public SeaPancake(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 45, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 30.0D).add(Attributes.ATTACK_DAMAGE, 5.0D); - } - - @Override - public void registerGoals() { - super.registerGoals(); - this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 3.0D, true)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, TropicalFish.class, false)); - } - - @Override - protected InteractionResult mobInteract(Player player, InteractionHand hand) { - ItemStack stack = player.getItemInHand(hand); - - if (stack.is(UFItems.RAW_LOBSTER.get()) && level() instanceof ServerLevel serverlevel) { - LootTable loottable = serverlevel.getServer().getLootData().getLootTable(FEED_REWARD); - List list = loottable.getRandomItems(new LootParams.Builder(serverlevel).withParameter(LootContextParams.ORIGIN, position()).withParameter(LootContextParams.THIS_ENTITY, this).withLuck(random.nextFloat()).create(LootContextParamSets.PIGLIN_BARTER)); - - if (!list.isEmpty() && random.nextBoolean()) { - ItemEntity item = EntityType.ITEM.create(level()); - - item.setItem(list.get(0)); - item.moveTo(position()); - - level().addFreshEntity(item); - - playSound(SoundEvents.ITEM_PICKUP, 1.0F, 1.0F); - } - - if (!player.getAbilities().instabuild) { - stack.shrink(1); - } - - serverlevel.sendParticles(new ItemParticleOption(ParticleTypes.ITEM, stack), getRandomX(1.0D), position().y - 0.25D, getRandomZ(1.0D), 1, 0.0D, 0.0D, 0.0D, 0.0D); - playSound(SoundEvents.DOLPHIN_EAT, 1.0F, 1.0F); - } - - return super.mobInteract(player, hand); - } - - public void tick() { - super.tick(); - - if (this.attackCooldown > 0) { - this.attackCooldown--; - } - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - public SoundEvent getHurtSound(DamageSource damageSourceIn) { - return SoundEvents.COD_HURT; - } - - public SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + public static final ResourceLocation FEED_REWARD = loc("gameplay/sea_pancake_search"); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + protected int attackCooldown = 0; + + public SeaPancake(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 45, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 30.0D).add(Attributes.ATTACK_DAMAGE, 5.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public void registerGoals() { + super.registerGoals(); + this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 3.0D, true)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, TropicalFish.class, false)); + } + + @Override + protected InteractionResult mobInteract(Player player, InteractionHand hand) { + ItemStack stack = player.getItemInHand(hand); + + if (stack.is(UFItems.RAW_LOBSTER.get()) && level() instanceof ServerLevel serverlevel) { + LootTable loottable = serverlevel.registryAccess().lookupOrThrow(Registries.LOOT_TABLE).getOrThrow(ResourceKey.create(Registries.LOOT_TABLE, FEED_REWARD)).value(); + List list = loottable.getRandomItems(new LootParams.Builder(serverlevel).withParameter(LootContextParams.ORIGIN, position()).withParameter(LootContextParams.THIS_ENTITY, this).withLuck(random.nextFloat()).create(LootContextParamSets.PIGLIN_BARTER)); + + if (!list.isEmpty() && random.nextBoolean()) { + ItemEntity item = EntityType.ITEM.create(level()); + + item.setItem(list.get(0)); + item.moveTo(position()); + + level().addFreshEntity(item); + + playSound(SoundEvents.ITEM_PICKUP, 1.0F, 1.0F); + } + + if (!player.getAbilities().instabuild) { + stack.shrink(1); + } + + serverlevel.sendParticles(new ItemParticleOption(ParticleTypes.ITEM, stack), getRandomX(1.0D), position().y - 0.25D, getRandomZ(1.0D), 1, 0.0D, 0.0D, 0.0D, 0.0D); + playSound(SoundEvents.DOLPHIN_EAT, 1.0F, 1.0F); + } + + return super.mobInteract(player, hand); + } + + public void tick() { + super.tick(); + + if (this.attackCooldown > 0) { + this.attackCooldown--; + } + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + public SoundEvent getHurtSound(DamageSource damageSourceIn) { + return SoundEvents.COD_HURT; + } + + public SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/SeaSpider.java b/src/main/java/codyhuh/unusualfishmod/common/entity/SeaSpider.java index 43e1da3..6be486e 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/SeaSpider.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/SeaSpider.java @@ -5,17 +5,11 @@ import codyhuh.unusualfishmod.core.registry.UFItems; import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -29,7 +23,6 @@ import net.minecraft.world.entity.ai.goal.TryFindWaterGoal; import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; import net.minecraft.world.entity.ai.navigation.PathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -37,121 +30,123 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class SeaSpider extends BucketableWaterAnimal implements GeoEntity { - public SeaSpider(EntityType type, Level world) { - super(type, world); - this.moveControl = new SeaSpider.MoveHelperController(this); - this.setMaxUpStep(1.5F); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.5D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.5F)); - this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.5F)); - this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new GroundPathNavigation(this, level()); - } - - @Override - public float getWaterSlowDown() { - return 0.9f; - } - - @Override - public void handleAirSupply(int p_209207_1_) { - } - - protected SoundEvent getAmbientSound() { - return UFSounds.CRAB_CHATTER.get(); - } - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { - this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.SEA_SPIDER_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.WALK); - } else { - event.setAnimation(UFAnimations.IDLE); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } - - static class MoveHelperController extends MoveControl { - - private final Mob spider; - - MoveHelperController(Mob spider) { - super(spider); - this.spider = spider; - } - public void tick() { - if (this.spider.isEyeInFluid(FluidTags.WATER)) { - this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); - } - - if (this.operation == MoveControl.Operation.MOVE_TO && !this.spider.getNavigation().isDone()) { - double d0 = this.wantedX - this.spider.getX(); - double d1 = this.wantedY - this.spider.getY(); - double d2 = this.wantedZ - this.spider.getZ(); - double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); - d1 = d1 / d3; - float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; - this.spider.yRot = this.rotlerp(this.spider.yRot, f, 90.0F); - this.spider.yBodyRot = this.spider.yRot; - float f1 = (float) (this.speedModifier * this.spider.getAttributeValue(Attributes.MOVEMENT_SPEED)); - this.spider.setSpeed(Mth.lerp(0.125F, this.spider.getSpeed(), f1)); - this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, (double) this.spider.getSpeed() * d1 * 0.1D, 0.0D)); - } else { - this.spider.setSpeed(0.0F); - } - } - - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public SeaSpider(EntityType type, Level world) { + super(type, world); + this.moveControl = new SeaSpider.MoveHelperController(this); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.5F); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.5D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(1, new RandomStrollGoal(this, 0.5F)); + this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.5F)); + this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new GroundPathNavigation(this, level()); + } + + @Override + public float getWaterSlowDown() { + return 0.9f; + } + + @Override + public void handleAirSupply(int p_209207_1_) { + } + + protected SoundEvent getAmbientSound() { + return UFSounds.CRAB_CHATTER.get(); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { + this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.SEA_SPIDER_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.WALK); + } else { + event.setAnimation(UFAnimations.IDLE); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } + + static class MoveHelperController extends MoveControl { + + private final Mob spider; + + MoveHelperController(Mob spider) { + super(spider); + this.spider = spider; + } + + public void tick() { + if (this.spider.isEyeInFluid(FluidTags.WATER)) { + this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); + } + + if (this.operation == MoveControl.Operation.MOVE_TO && !this.spider.getNavigation().isDone()) { + double d0 = this.wantedX - this.spider.getX(); + double d1 = this.wantedY - this.spider.getY(); + double d2 = this.wantedZ - this.spider.getZ(); + double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); + d1 = d1 / d3; + float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; + this.spider.setYRot(this.rotlerp(this.spider.getYRot(), f, 90.0F)); + this.spider.yBodyRot = this.spider.getYRot(); + float f1 = (float) (this.speedModifier * this.spider.getAttributeValue(Attributes.MOVEMENT_SPEED)); + this.spider.setSpeed(Mth.lerp(0.125F, this.spider.getSpeed(), f1)); + this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, (double) this.spider.getSpeed() * d1 * 0.1D, 0.0D)); + } else { + this.spider.setSpeed(0.0F); + } + } + + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Shockcat.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Shockcat.java index ba0d913..eacbca4 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Shockcat.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Shockcat.java @@ -32,133 +32,131 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Shockcat extends BucketableWaterAnimal implements GeoEntity { - protected int attackCooldown = 0; - - public Shockcat(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.SHOCKCAT_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.ATTACK_DAMAGE, 4.0D); - } - - @Override - public void registerGoals() { - super.registerGoals(); - this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 3.0D, true)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, AbstractFish.class, false)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void tick() { - super.tick(); - - if (this.level().isClientSide && this.isInWater() && this.getDeltaMovement().lengthSqr() > 0.03D) { - Vec3 vec3 = this.getViewVector(0.0F); - float f = Mth.cos(this.getYRot() * ((float)Math.PI / 180F)) * 0.3F; - float f1 = Mth.sin(this.getYRot() * ((float)Math.PI / 180F)) * 0.3F; - - } - - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - public SoundEvent getHurtSound(DamageSource damageSourceIn) { - return SoundEvents.COD_HURT; - } - - public SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public void playerTouch(Player entity) { - super.playerTouch(entity); - if (!entity.isCreative() && this.attackCooldown == 0 && entity.level().getDifficulty() != Difficulty.PEACEFUL) { - entity.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 300, 3, false, false)); - entity.addEffect(new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 200, 2, false, false)); - this.attackCooldown = 80; - } - } - - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).is(Blocks.WATER) && pos.getY() <= 10 && iServerWorld.getBlockState(pos.above()).is(Blocks.WATER) && iServerWorld.getLightEmission(pos) < 8; - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + protected int attackCooldown = 0; + + public Shockcat(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.ATTACK_DAMAGE, 4.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).is(Blocks.WATER) && pos.getY() <= 10 && iServerWorld.getBlockState(pos.above()).is(Blocks.WATER) && iServerWorld.getLightEmission(pos) < 8; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.SHOCKCAT_BUCKET.get()); + } + + @Override + public void registerGoals() { + super.registerGoals(); + this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 3.0D, true)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, AbstractFish.class, false)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void tick() { + super.tick(); + + if (this.level().isClientSide && this.isInWater() && this.getDeltaMovement().lengthSqr() > 0.03D) { + Vec3 vec3 = this.getViewVector(0.0F); + float f = Mth.cos(this.getYRot() * ((float) Math.PI / 180F)) * 0.3F; + float f1 = Mth.sin(this.getYRot() * ((float) Math.PI / 180F)) * 0.3F; + + } + + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + public SoundEvent getHurtSound(DamageSource damageSourceIn) { + return SoundEvents.COD_HURT; + } + + public SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void playerTouch(Player entity) { + super.playerTouch(entity); + if (!entity.isCreative() && this.attackCooldown == 0 && entity.level().getDifficulty() != Difficulty.PEACEFUL) { + entity.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 300, 3, false, false)); + entity.addEffect(new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 200, 2, false, false)); + this.attackCooldown = 80; + } + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Skrimp.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Skrimp.java index 42bd1ae..f7507c2 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Skrimp.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Skrimp.java @@ -6,6 +6,7 @@ import codyhuh.unusualfishmod.core.registry.UFItems; import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; @@ -16,8 +17,6 @@ import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.DifficultyInstance; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -36,176 +35,183 @@ import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.block.state.BlockState; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; public class Skrimp extends BucketableWaterAnimal implements GeoEntity { - private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(Skrimp.class, EntityDataSerializers.INT); - - public Skrimp(EntityType type, Level world) { - super(type, world); - this.moveControl = new Skrimp.MoveHelperController(this); - this.setMaxUpStep(1.5F); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.5D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(1, new RandomStrollGoal(this, 1.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.5F)); - this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new GroundPathNavigation(this, level()); - } - - @Override - public float getWaterSlowDown() { - return 0.9f; - } - - @Override - public void handleAirSupply(int p_209207_1_) { - } - - protected SoundEvent getAmbientSound() { - return UFSounds.CRAB_CHATTER.get(); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { - this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); - } - - @Override - public void saveToBucketTag(ItemStack bucket) { - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putInt("Variant", this.getVariant()); - } - - @Override - public void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(VARIANT, 0); - } - - public int getVariant() { - return this.entityData.get(VARIANT); - } - - private void setVariant(int variant) { - this.entityData.set(VARIANT, variant); - } - - @Override - public void addAdditionalSaveData(CompoundTag compound) { - super.addAdditionalSaveData(compound); - compound.putInt("Variant", getVariant()); - } - - @Override - public void readAdditionalSaveData(CompoundTag compound) { - super.readAdditionalSaveData(compound); - setVariant(compound.getInt("Variant")); - } - - @Nullable - @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { - spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag); - if (dataTag == null) { - setVariant(random.nextInt(3)); - } else { - if (dataTag.contains("Variant", 3)){ - this.setVariant(dataTag.getInt("Variant")); - } - } - return spawnDataIn; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.CORAL_SKRIMP_BUCKET.get()); - } - - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.WALK); - } else { - event.setAnimation(UFAnimations.IDLE); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - static class MoveHelperController extends MoveControl { - - private final Mob spider; - - MoveHelperController(Mob spider) { - super(spider); - this.spider = spider; - } - public void tick() { - if (this.spider.isEyeInFluid(FluidTags.WATER)) { - this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); - } - - if (this.operation == Operation.MOVE_TO && !this.spider.getNavigation().isDone()) { - double d0 = this.wantedX - this.spider.getX(); - double d1 = this.wantedY - this.spider.getY(); - double d2 = this.wantedZ - this.spider.getZ(); - double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); - d1 = d1 / d3; - float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; - this.spider.yRot = this.rotlerp(this.spider.yRot, f, 90.0F); - this.spider.yBodyRot = this.spider.yRot; - float f1 = (float) (this.speedModifier * this.spider.getAttributeValue(Attributes.MOVEMENT_SPEED)); - this.spider.setSpeed(Mth.lerp(0.125F, this.spider.getSpeed(), f1)); - this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, (double) this.spider.getSpeed() * d1 * 0.1D, 0.0D)); - } else { - this.spider.setSpeed(0.0F); - } - } - } + private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(Skrimp.class, EntityDataSerializers.INT); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public Skrimp(EntityType type, Level world) { + super(type, world); + this.moveControl = new Skrimp.MoveHelperController(this); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.5F); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.5D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(1, new RandomStrollGoal(this, 1.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.5F)); + this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new GroundPathNavigation(this, level()); + } + + @Override + public float getWaterSlowDown() { + return 0.9f; + } + + @Override + public void handleAirSupply(int p_209207_1_) { + } + + protected SoundEvent getAmbientSound() { + return UFSounds.CRAB_CHATTER.get(); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { + this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); + } + + @Override + public void saveToBucketTag(ItemStack bucket) { + Bucketable.saveDefaultDataToBucketTag(this, bucket); + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putInt("Variant", this.getVariant()); + }); + } + + @Override + public void loadFromBucketTag(CompoundTag tag) { + super.loadFromBucketTag(tag); + if (tag.contains("Variant", 3)) { + this.setVariant(tag.getInt("Variant")); + } + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(VARIANT, 0); + } + + public int getVariant() { + return this.entityData.get(VARIANT); + } + + private void setVariant(int variant) { + this.entityData.set(VARIANT, variant); + } + + @Override + public void addAdditionalSaveData(CompoundTag compound) { + super.addAdditionalSaveData(compound); + compound.putInt("Variant", getVariant()); + } + + @Override + public void readAdditionalSaveData(CompoundTag compound) { + super.readAdditionalSaveData(compound); + setVariant(compound.getInt("Variant")); + } + + @Nullable + @Override + public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType reason, @Nullable SpawnGroupData spawnDataIn) { + spawnDataIn = super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn); + if (reason == MobSpawnType.NATURAL || reason == MobSpawnType.SPAWN_EGG || reason == MobSpawnType.STRUCTURE) { + this.setVariant(this.random.nextInt(3)); + } + + return spawnDataIn; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.CORAL_SKRIMP_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.WALK); + } else { + event.setAnimation(UFAnimations.IDLE); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } + + static class MoveHelperController extends MoveControl { + + private final Mob spider; + + MoveHelperController(Mob spider) { + super(spider); + this.spider = spider; + } + + public void tick() { + if (this.spider.isEyeInFluid(FluidTags.WATER)) { + this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); + } + + if (this.operation == Operation.MOVE_TO && !this.spider.getNavigation().isDone()) { + double d0 = this.wantedX - this.spider.getX(); + double d1 = this.wantedY - this.spider.getY(); + double d2 = this.wantedZ - this.spider.getZ(); + double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); + d1 = d1 / d3; + float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; + this.spider.setYRot(this.rotlerp(this.spider.getYRot(), f, 90.0F)); + this.spider.yBodyRot = this.spider.getYRot(); + float f1 = (float) (this.speedModifier * this.spider.getAttributeValue(Attributes.MOVEMENT_SPEED)); + this.spider.setSpeed(Mth.lerp(0.125F, this.spider.getSpeed(), f1)); + this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, (double) this.spider.getSpeed() * d1 * 0.1D, 0.0D)); + } else { + this.spider.setSpeed(0.0F); + } + } + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/SneepSnorp.java b/src/main/java/codyhuh/unusualfishmod/common/entity/SneepSnorp.java index 0df4f6f..f595a4d 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/SneepSnorp.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/SneepSnorp.java @@ -1,7 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; @@ -25,116 +25,114 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class SneepSnorp extends BucketableSchoolingWaterAnimal implements GeoEntity { - private boolean isSchool = true; - - public SneepSnorp(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.SNEEPSNORP_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - public int getMaxSpawnClusterSize() { - return 5; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 8; - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + private final boolean isSchool = true; + + public SneepSnorp(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.SNEEPSNORP_BUCKET.get()); + } + + protected void registerGoals() { + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + public int getMaxSpawnClusterSize() { + return 5; + } + + public boolean isMaxGroupSizeReached(int p_30035_) { + return !this.isSchool; + } + + public int getMaxSchoolSize() { + return 8; + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/SnowflakeTailFish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/SnowflakeTailFish.java deleted file mode 100644 index 49e4fa9..0000000 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/SnowflakeTailFish.java +++ /dev/null @@ -1,139 +0,0 @@ -package codyhuh.unusualfishmod.common.entity; - -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; -import codyhuh.unusualfishmod.common.entity.util.base.BucketableSchoolingWaterAnimal; -import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; -import codyhuh.unusualfishmod.core.registry.UFItems; -import net.minecraft.core.BlockPos; -import net.minecraft.sounds.SoundEvent; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.RandomSource; -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobSpawnType; -import net.minecraft.world.entity.ai.attributes.AttributeSupplier; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; -import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; -import net.minecraft.world.entity.ai.goal.*; -import net.minecraft.world.entity.ai.navigation.PathNavigation; -import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.WaterAnimal; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; -import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; -import software.bernie.geckolib.util.GeckoLibUtil; - -public class SnowflakeTailFish extends BucketableSchoolingWaterAnimal implements GeoEntity { - private boolean isSchool = true; - - public SnowflakeTailFish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.SNOWFLAKE_TAIL_FISH_BUCKET.get()); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(4, new FollowSchoolLeaderGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4D, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - super.aiStep(); - } - - public int getMaxSpawnClusterSize() { - return 8; - } - - public boolean isMaxGroupSizeReached(int p_30035_) { - return !this.isSchool; - } - - public int getMaxSchoolSize() { - return 10; - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } -} diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Spindlefish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Spindlefish.java index a3a7831..7904d6b 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Spindlefish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Spindlefish.java @@ -3,19 +3,11 @@ import codyhuh.unusualfishmod.common.entity.util.base.BucketableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; -import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; @@ -30,135 +22,130 @@ import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Spindlefish extends BucketableWaterAnimal implements GeoEntity { - protected int attackCooldown = 0; - - public Spindlefish(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(4, new HurtByTargetGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - } - - - public void tick() { - super.tick(); - - if (this.attackCooldown > 0) { - this.attackCooldown--; - } - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.SPINDLEFISH_BUCKET.get()); - } - - @Override - public void playerTouch(Player entity) { - super.playerTouch(entity); - if (!entity.isCreative() && this.attackCooldown == 0 && entity.level().getDifficulty() != Difficulty.PEACEFUL) { - entity.hurt(damageSources().mobAttack(this), 2.0F); - entity.addEffect(new MobEffectInstance(MobEffects.POISON, 200, 0, false, false)); - this.attackCooldown = 80; - } - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (!isAddedToWorld()) { - return PlayState.STOP; - } - - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + protected int attackCooldown = 0; + + public Spindlefish(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(4, new HurtByTargetGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + } + + public void tick() { + super.tick(); + + if (this.attackCooldown > 0) { + this.attackCooldown--; + } + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.SPINDLEFISH_BUCKET.get()); + } + + @Override + public void playerTouch(Player entity) { + super.playerTouch(entity); + if (!entity.isCreative() && this.attackCooldown == 0 && entity.level().getDifficulty() != Difficulty.PEACEFUL) { + entity.hurt(damageSources().mobAttack(this), 2.0F); + entity.addEffect(new MobEffectInstance(MobEffects.POISON, 200, 0, false, false)); + this.attackCooldown = 80; + } + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (this.isRemoved()) { + return PlayState.STOP; + } + + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/SpoonShark.java b/src/main/java/codyhuh/unusualfishmod/common/entity/SpoonShark.java index 900b421..d73d307 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/SpoonShark.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/SpoonShark.java @@ -3,17 +3,10 @@ import codyhuh.unusualfishmod.common.entity.util.base.BucketableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; -import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -27,110 +20,108 @@ import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class SpoonShark extends BucketableWaterAnimal implements GeoEntity { - public SpoonShark(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.ATTACK_DAMAGE, 1.0D).add(Attributes.ATTACK_SPEED, 1.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1.0D, false)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, LivingEntity.class, true, p -> p.getHealth() <= p.getMaxHealth() / 3)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.SPOON_SHARK_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public SpoonShark(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.ATTACK_DAMAGE, 1.0D).add(Attributes.ATTACK_SPEED, 1.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 1.0D, false)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, LivingEntity.class, true, p -> p.getHealth() <= p.getMaxHealth() / 3)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.SPOON_SHARK_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Squoddle.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Squoddle.java index c219320..5d658ce 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Squoddle.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Squoddle.java @@ -5,21 +5,13 @@ import codyhuh.unusualfishmod.core.registry.UFItems; import codyhuh.unusualfishmod.core.registry.UFSounds; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.Difficulty; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.effect.MobEffectInstance; -import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobSpawnType; @@ -33,7 +25,6 @@ import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; import net.minecraft.world.entity.ai.navigation.PathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -41,137 +32,137 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Squoddle extends BucketableWaterAnimal implements GeoEntity { - protected int attackCooldown = 0; - - public Squoddle(EntityType type, Level world) { - super(type, world); - this.moveControl = new Squoddle.MoveHelperController(this); - this.setMaxUpStep(1.5F); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.4D).add(Attributes.ATTACK_DAMAGE, 2.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(1, new RandomStrollGoal(this, 1.0F)); - this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.4F)); - this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); - this.targetSelector.addGoal(1, (new HurtByTargetGoal(this))); - } - - @Override - public void tick() { - super.tick(); - if (this.attackCooldown > 0) { - this.attackCooldown--; - } - } - - @Override - public void playerTouch(Player entity) { - super.playerTouch(entity); - if (!entity.isCreative() && this.attackCooldown == 0 && entity.level().getDifficulty() != Difficulty.PEACEFUL) { - entity.hurt(damageSources().mobAttack(this), 2.0F); - this.playSound(SoundEvents.PUFFER_FISH_STING, 1.0F, 1.0F); - this.attackCooldown = 80; - } - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new GroundPathNavigation(this, level()); - } - - @Override - public float getWaterSlowDown() { - return 0.9f; - } - - @Override - public void handleAirSupply(int p_209207_1_) { - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { - this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.SQUODDLE_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.WALK); - } else { - event.setAnimation(UFAnimations.IDLE); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } - - static class MoveHelperController extends MoveControl { - - private final Mob squoddle; - - MoveHelperController(Mob squoddle) { - super(squoddle); - this.squoddle = squoddle; - } - public void tick() { - if (this.squoddle.isEyeInFluid(FluidTags.WATER)) { - this.squoddle.setDeltaMovement(this.squoddle.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); - } - - if (this.operation == Operation.MOVE_TO && !this.squoddle.getNavigation().isDone()) { - double d0 = this.wantedX - this.squoddle.getX(); - double d1 = this.wantedY - this.squoddle.getY(); - double d2 = this.wantedZ - this.squoddle.getZ(); - double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); - d1 = d1 / d3; - float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; - this.squoddle.yRot = this.rotlerp(this.squoddle.yRot, f, 90.0F); - this.squoddle.yBodyRot = this.squoddle.yRot; - float f1 = (float) (this.speedModifier * this.squoddle.getAttributeValue(Attributes.MOVEMENT_SPEED)); - this.squoddle.setSpeed(Mth.lerp(0.125F, this.squoddle.getSpeed(), f1)); - this.squoddle.setDeltaMovement(this.squoddle.getDeltaMovement().add(0.0D, (double) this.squoddle.getSpeed() * d1 * 0.1D, 0.0D)); - } else { - this.squoddle.setSpeed(0.0F); - } - } - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + protected int attackCooldown = 0; + + public Squoddle(EntityType type, Level world) { + super(type, world); + this.moveControl = new Squoddle.MoveHelperController(this); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.5F); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 4.0D).add(Attributes.MOVEMENT_SPEED, 0.4D).add(Attributes.ATTACK_DAMAGE, 2.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(1, new RandomStrollGoal(this, 1.0F)); + this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.4F)); + this.goalSelector.addGoal(3, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, (new HurtByTargetGoal(this))); + } + + @Override + public void tick() { + super.tick(); + if (this.attackCooldown > 0) { + this.attackCooldown--; + } + } + + @Override + public void playerTouch(Player entity) { + super.playerTouch(entity); + if (!entity.isCreative() && this.attackCooldown == 0 && entity.level().getDifficulty() != Difficulty.PEACEFUL) { + entity.hurt(damageSources().mobAttack(this), 2.0F); + this.playSound(SoundEvents.PUFFER_FISH_STING, 1.0F, 1.0F); + this.attackCooldown = 80; + } + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new GroundPathNavigation(this, level()); + } + + @Override + public float getWaterSlowDown() { + return 0.9f; + } + + @Override + public void handleAirSupply(int p_209207_1_) { + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected void playStepSound(BlockPos p_33804_, BlockState p_33805_) { + this.playSound(UFSounds.CRAB_SCUTTLING.get(), 0.15F, 1.0F); + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.SQUODDLE_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.WALK); + } else { + event.setAnimation(UFAnimations.IDLE); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } + + static class MoveHelperController extends MoveControl { + + private final Mob squoddle; + + MoveHelperController(Mob squoddle) { + super(squoddle); + this.squoddle = squoddle; + } + + public void tick() { + if (this.squoddle.isEyeInFluid(FluidTags.WATER)) { + this.squoddle.setDeltaMovement(this.squoddle.getDeltaMovement().add(0.0D, 0.0D, 0.0D)); + } + + if (this.operation == Operation.MOVE_TO && !this.squoddle.getNavigation().isDone()) { + double d0 = this.wantedX - this.squoddle.getX(); + double d1 = this.wantedY - this.squoddle.getY(); + double d2 = this.wantedZ - this.squoddle.getZ(); + double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); + d1 = d1 / d3; + float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; + this.squoddle.setYRot(this.rotlerp(this.squoddle.getYRot(), f, 90.0F)); + this.squoddle.yBodyRot = this.squoddle.getYRot(); + float f1 = (float) (this.speedModifier * this.squoddle.getAttributeValue(Attributes.MOVEMENT_SPEED)); + this.squoddle.setSpeed(Mth.lerp(0.125F, this.squoddle.getSpeed(), f1)); + this.squoddle.setDeltaMovement(this.squoddle.getDeltaMovement().add(0.0D, (double) this.squoddle.getSpeed() * d1 * 0.1D, 0.0D)); + } else { + this.squoddle.setSpeed(0.0F); + } + } + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/StoutBichir.java b/src/main/java/codyhuh/unusualfishmod/common/entity/StoutBichir.java index 43bc9d2..f28020d 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/StoutBichir.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/StoutBichir.java @@ -25,14 +25,15 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class StoutBichir extends BucketableWaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); protected int attackCooldown = 0; public StoutBichir(EntityType entityType, Level level) { @@ -45,6 +46,10 @@ public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 30.0D).add(Attributes.ATTACK_DAMAGE, 4.0D); } + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + @Override public ItemStack getBucketStack() { return new ItemStack(UFItems.STOUT_BICHIR_BUCKET.get()); @@ -74,7 +79,7 @@ public boolean canUse() { public void aiStep() { if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); this.setOnGround(false); this.hasImpulse = true; this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); @@ -99,10 +104,6 @@ public SoundEvent getFlopSound() { return SoundEvents.COD_FLOP; } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -115,15 +116,12 @@ private PlayState predicate(AnimationState event) { } else { event.setAnimation(UFAnimations.IDLE); } - } - else { + } else { event.setAnimation(UFAnimations.FLOP); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/TigerJungleShark.java b/src/main/java/codyhuh/unusualfishmod/common/entity/TigerJungleShark.java index b2940ec..72806da 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/TigerJungleShark.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/TigerJungleShark.java @@ -2,6 +2,7 @@ import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; @@ -20,17 +21,19 @@ import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class TigerJungleShark extends WaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); protected int attackCooldown = 0; private int attackAnimationTick; @@ -44,6 +47,10 @@ public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 20.0D).add(Attributes.ATTACK_DAMAGE, 3.0D); } + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + @Override public void registerGoals() { super.registerGoals(); @@ -75,19 +82,19 @@ public boolean canUse() { @Override public boolean doHurtTarget(Entity entityIn) { this.attackAnimationTick = 10; - this.level().broadcastEntityEvent(this, (byte)4); + this.level().broadcastEntityEvent(this, (byte) 4); float f = this.getAttackDamage(); - float f1 = (int)f > 0 ? f / 2.0F + (float)this.random.nextInt((int)f) : f; - boolean flag = entityIn.hurt(damageSources().mobAttack(this), f1); + float f1 = (int) f > 0 ? f / 2.0F + (float) this.random.nextInt((int) f) : f; + boolean flag = this.level() instanceof ServerLevel && entityIn.hurt(damageSources().mobAttack(this), f1); if (flag) { entityIn.setDeltaMovement(entityIn.getDeltaMovement().add(0.0D, 0.4D, 0.0D)); - this.doEnchantDamageEffects(this, entityIn); + EnchantmentHelper.doPostAttackEffects((ServerLevel) this.level(), entityIn, this.damageSources().mobAttack(this)); } return flag; } private float getAttackDamage() { - return (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); + return (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE); } public void tick() { @@ -144,10 +151,6 @@ public SoundEvent getFlopSound() { return SoundEvents.COD_FLOP; } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -160,15 +163,12 @@ private PlayState predicate(AnimationState event) { } else { event.setAnimation(UFAnimations.IDLE); } - } - else { + } else { event.setAnimation(UFAnimations.FLOP); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/TigerPuffer.java b/src/main/java/codyhuh/unusualfishmod/common/entity/TigerPuffer.java index a68d4e4..0d18324 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/TigerPuffer.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/TigerPuffer.java @@ -28,43 +28,46 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class TigerPuffer extends BucketableWaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + public TigerPuffer(EntityType entityType, Level level) { super(entityType, level); this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); this.lookControl = new SmoothSwimmingLookControl(this, 10); } + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 20.0D).add(Attributes.ATTACK_DAMAGE, 4.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + @Override public ItemStack getBucketStack() { return new ItemStack(UFItems.TIGER_PUFFER_BUCKET.get()); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 20.0D).add(Attributes.ATTACK_DAMAGE, 4.0D); - } - @Override public void registerGoals() { super.registerGoals(); this.goalSelector.addGoal(0, new MeleeAttackGoal(this, 3.0D, true) { @Override - protected void checkAndPerformAttack(LivingEntity p_25557_, double p_25558_) { - double d0 = this.getAttackReachSqr(p_25557_); - - if (p_25558_ <= d0 && this.getTicksUntilNextAttack() <= 0) { - this.resetAttackCooldown(); + protected void checkAndPerformAttack(LivingEntity target) { + if (this.mob.isWithinMeleeAttackRange(target) && this.isTimeToAttack()) { this.mob.swing(InteractionHand.MAIN_HAND); - this.mob.doHurtTarget(p_25557_); - this.mob.playSound(SoundEvents.TURTLE_EGG_CRACK); + this.mob.doHurtTarget(target); + this.mob.playSound(SoundEvents.TURTLE_EGG_CRACK, 1.0F, 1.0F); } } }); @@ -118,10 +121,6 @@ public SoundEvent getFlopSound() { return SoundEvents.COD_FLOP; } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -134,15 +133,12 @@ private PlayState predicate(AnimationState event) { } else { event.setAnimation(UFAnimations.IDLE); } - } - else { + } else { event.setAnimation(UFAnimations.FLOP); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/Tribble.java b/src/main/java/codyhuh/unusualfishmod/common/entity/Tribble.java index 1130a5d..15873b9 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/Tribble.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/Tribble.java @@ -30,19 +30,35 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluids; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class Tribble extends BucketableWaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + public Tribble(EntityType entityType, Level level) { super(entityType, level); this.moveControl = new Tribble.MoveHelperController(this); - this.setMaxUpStep(1.0F); + this.getAttribute(Attributes.STEP_HEIGHT).setBaseValue(1.0F); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D).add(Attributes.MOVEMENT_SPEED, 0.4D).add(Attributes.ARMOR, 10.0D); + } + + public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { + return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); + } + + private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { + float time = iServerWorld.getTimeOfDay(1.0F); + int light = iServerWorld.getMaxLocalRawBrightness(pos); + return light <= 4 && time > 0.27F && time <= 0.8F; } @Override @@ -50,10 +66,6 @@ public ItemStack getBucketStack() { return new ItemStack(UFItems.TRIBBLE_BUCKET.get()); } - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 5.0D).add(Attributes.MOVEMENT_SPEED, 0.4D).add(Attributes.ARMOR, 10.0D); - } - protected void registerGoals() { this.goalSelector.addGoal(1, new RandomStrollGoal(this, 1.0F)); this.goalSelector.addGoal(2, new LookAtPlayerGoal(this, Player.class, 0.6F)); @@ -85,14 +97,23 @@ protected float getSoundVolume() { return 0.5F; } - public static boolean canSpawn(EntityType entityType, ServerLevelAccessor iServerWorld, MobSpawnType reason, BlockPos pos, RandomSource random) { - return reason == MobSpawnType.SPAWNER || iServerWorld.getBlockState(pos).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && iServerWorld.getBlockState(pos.above()).getFluidState().getFluidType() == Fluids.WATER.getFluidType() && isLightLevelOk(pos, iServerWorld); + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); } - private static boolean isLightLevelOk(BlockPos pos, ServerLevelAccessor iServerWorld) { - float time = iServerWorld.getTimeOfDay(1.0F); - int light = iServerWorld.getMaxLocalRawBrightness(pos); - return light <= 4 && time > 0.27F && time <= 0.8F; + private PlayState predicate(AnimationState event) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.WALK); + } else { + event.setAnimation(UFAnimations.IDLE); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; } static class MoveHelperController extends MoveControl { @@ -115,8 +136,8 @@ public void tick() { double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); d1 = d1 / d3; float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; - this.spider.yRot = this.rotlerp(this.spider.yRot, f, 90.0F); - this.spider.yBodyRot = this.spider.yRot; + this.spider.setYRot(this.rotlerp(this.spider.getYRot(), f, 90.0F)); + this.spider.yBodyRot = this.spider.getYRot(); float f1 = (float) (this.speedModifier * this.spider.getAttributeValue(Attributes.MOVEMENT_SPEED)); this.spider.setSpeed(Mth.lerp(0.125F, this.spider.getSpeed(), f1)); this.spider.setDeltaMovement(this.spider.getDeltaMovement().add(0.0D, (double) this.spider.getSpeed() * d1 * 0.1D, 0.0D)); @@ -125,25 +146,4 @@ public void tick() { } } } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.WALK); - } else { - event.setAnimation(UFAnimations.IDLE); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/TripleTwirlPleco.java b/src/main/java/codyhuh/unusualfishmod/common/entity/TripleTwirlPleco.java index e2e614e..fdb5df5 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/TripleTwirlPleco.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/TripleTwirlPleco.java @@ -5,16 +5,9 @@ import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -26,111 +19,108 @@ import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.phys.Vec3; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class TripleTwirlPleco extends BucketableWaterAnimal implements GeoEntity { - public TripleTwirlPleco(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.ARMOR, 5.0D); - } - - protected void registerGoals() { - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - } - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - protected SoundEvent getDeathSound() { - return SoundEvents.COD_DEATH; - } - - protected SoundEvent getHurtSound(DamageSource p_28281_) { - return SoundEvents.COD_HURT; - } - - protected SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - @Override - public ItemStack getBucketStack() { - return new ItemStack(UFItems.TRIPLE_TWIRL_PLECO_BUCKET.get()); - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + + public TripleTwirlPleco(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.ARMOR, 5.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + protected void registerGoals() { + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(3, new BottomStrollGoal(this, 0.8F, 7)); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + protected SoundEvent getDeathSound() { + return SoundEvents.COD_DEATH; + } + + protected SoundEvent getHurtSound(DamageSource p_28281_) { + return SoundEvents.COD_HURT; + } + + protected SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + @Override + public ItemStack getBucketStack() { + return new ItemStack(UFItems.TRIPLE_TWIRL_PLECO_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/TrumpetSquid.java b/src/main/java/codyhuh/unusualfishmod/common/entity/TrumpetSquid.java index 1294810..82a698c 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/TrumpetSquid.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/TrumpetSquid.java @@ -1,8 +1,7 @@ package codyhuh.unusualfishmod.common.entity; -import codyhuh.unusualfishmod.common.entity.util.goal.BreedableWaterAnimalBreedGoal; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.base.BreedableWaterAnimal; +import codyhuh.unusualfishmod.common.entity.util.goal.BreedableWaterAnimalBreedGoal; import codyhuh.unusualfishmod.common.entity.util.goal.SquidLayEggsGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.common.entity.util.movement.SquidMoveControl; @@ -10,6 +9,7 @@ import codyhuh.unusualfishmod.core.registry.UFItems; import codyhuh.unusualfishmod.core.registry.UFTags; import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; @@ -18,8 +18,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.tags.FluidTags; -import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; @@ -30,7 +28,6 @@ import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.ai.control.MoveControl; import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl; import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl; import net.minecraft.world.entity.ai.goal.*; @@ -42,242 +39,243 @@ import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class TrumpetSquid extends BreedableWaterAnimal implements Bucketable, GeoEntity { - private static final EntityDataAccessor FROM_BUCKET = SynchedEntityData.defineId(TrumpetSquid.class, EntityDataSerializers.BOOLEAN); - public float squidRotation; - - public TrumpetSquid(EntityType entityType, Level level) { - super(entityType, level); - this.moveControl = new SquidMoveControl(this); - this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); - this.lookControl = new SmoothSwimmingLookControl(this, 10); - } - - public static AttributeSupplier.Builder createAttributes() { - return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 15.0D).add(Attributes.ATTACK_DAMAGE, 4.0D).add(Attributes.ARMOR, 10.0D); - } - - @Override - public void registerGoals() { - this.goalSelector.addGoal(0, new SquidLayEggsGoal(this, UFBlocks.RELUCENT_EGGS.get())); - this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); - this.goalSelector.addGoal(0, new BreedableWaterAnimalBreedGoal(this, 1.0D)); - this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 3.0D, true)); - this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { - @Override - public boolean canUse() { - return super.canUse() && isInWater(); - } - }); - this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { - @Override - public boolean canUse() { - return !this.mob.isInWater() && super.canUse(); - } - }); - this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); - this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); - this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, AbstractFish.class, false));} - - public void aiStep() { - if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); - this.setOnGround(false); - this.hasImpulse = true; - this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); - } - - super.aiStep(); - } - - @Override - public boolean isFood(ItemStack stack) { - return stack.is(UFTags.RAW_UNUSUAL_FISH); - } - - protected PathNavigation createNavigation(Level p_27480_) { - return new WaterBoundPathNavigation(this, p_27480_); - } - - @Nullable - @Override - public BreedableWaterAnimal getBreedOffspring(ServerLevel p_146743_, BreedableWaterAnimal p_146744_) { - return null; - } - - public boolean hurt(DamageSource p_29963_, float p_29964_) { - if (super.hurt(p_29963_, p_29964_) && this.getLastHurtByMob() != null) { - if (!this.level().isClientSide) { - this.spawnInk(); - } - - return true; - } else { - return false; - } - } - - private Vec3 rotateVector(Vec3 p_29986_) { - Vec3 vec3 = p_29986_.xRot(getXRot() * ((float)Math.PI / 180F)); - return vec3.yRot(-this.yBodyRotO * ((float)Math.PI / 180F)); - } - - private void spawnInk() { - this.playSound(SoundEvents.SQUID_SQUIRT, this.getSoundVolume(), this.getVoicePitch()); - Vec3 vec3 = this.rotateVector(new Vec3(0.0D, -0.5D, -1.0D)).add(this.getX(), this.getY(), this.getZ()); - - for(int i = 0; i < 30; ++i) { - Vec3 vec31 = this.rotateVector(new Vec3((double)this.random.nextFloat() * 0.6D - 0.3D, -1.0D, (double)this.random.nextFloat() * 0.6D - 0.3D)); - Vec3 vec32 = vec31.scale(0.3D + (double)(this.random.nextFloat() * 2.0F)); - ((ServerLevel)this.level()).sendParticles(ParticleTypes.SQUID_INK, vec3.x, vec3.y + 0.5D, vec3.z, 0, vec32.x, vec32.y, vec32.z, (double)0.1F); - } - } - - public SoundEvent getAmbientSound() { - return SoundEvents.SQUID_AMBIENT; - } - - public SoundEvent getHurtSound(DamageSource damageSourceIn) { - return SoundEvents.SQUID_HURT; - } - - public SoundEvent getDeathSound() { - return SoundEvents.SQUID_DEATH; - } - - public SoundEvent getFlopSound() { - return SoundEvents.COD_FLOP; - } - - public void travel(Vec3 travelVector) { - if (this.isEffectiveAi() && this.isInWater()) { - this.moveRelative(0.01F, travelVector); - this.move(MoverType.SELF, this.getDeltaMovement()); - this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); - if (this.getTarget() == null) { - this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.005D, 0.0D)); - } - } else { - super.travel(travelVector); - } - - } - - @OnlyIn(Dist.CLIENT) - public void handleEntityEvent(byte id) { - if (id == 19) { - this.squidRotation = 0.0F; - } else { - super.handleEntityEvent(id); - } - } - - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - - - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(FROM_BUCKET, false); - } - - @Override - public void addAdditionalSaveData(CompoundTag tag) { - super.addAdditionalSaveData(tag); - tag.putBoolean("FromBucket", this.isFromBucket()); - } - - @Override - public void readAdditionalSaveData(CompoundTag tag) { - super.readAdditionalSaveData(tag); - this.setFromBucket(tag.getBoolean("FromBucket")); - } - - @Override - public boolean fromBucket() { - return this.entityData.get(FROM_BUCKET); - } - - @Override - public void saveToBucketTag(ItemStack bucket) { - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putFloat("Health", this.getHealth()); - } - - public boolean requiresCustomPersistence() { - return super.requiresCustomPersistence() || this.fromBucket(); - } - - public boolean removeWhenFarAway(double p_213397_1_) { - return !this.fromBucket() && !this.hasCustomName(); - } - - private boolean isFromBucket() { - return this.entityData.get(FROM_BUCKET); - } - - public void setFromBucket(boolean p_203706_1_) { - this.entityData.set(FROM_BUCKET, p_203706_1_); - } - - @Override - public void loadFromBucketTag(CompoundTag p_148832_) { - } - - @Override - public SoundEvent getPickupSound() { - return SoundEvents.BUCKET_FILL_FISH; - } - - @Override - public InteractionResult mobInteract(Player p_27584_, InteractionHand p_27585_) { - return Bucketable.bucketMobPickup(p_27584_, p_27585_, this).orElse(super.mobInteract(p_27584_, p_27585_)); - } - - @Override - public ItemStack getBucketItemStack() { - return new ItemStack(UFItems.TRUMPET_SQUID_BUCKET.get()); - } - - @Override - public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { - controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); - } - - private PlayState predicate(AnimationState event) { - if (isInWater()) { - if (event.isMoving()) { - event.setAnimation(UFAnimations.SWIM); - } else { - event.setAnimation(UFAnimations.IDLE); - } - } - else { - event.setAnimation(UFAnimations.FLOP); - } - return PlayState.CONTINUE; - } - - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - - @Override - public AnimatableInstanceCache getAnimatableInstanceCache() { - return cache; - } + private static final EntityDataAccessor FROM_BUCKET = SynchedEntityData.defineId(TrumpetSquid.class, EntityDataSerializers.BOOLEAN); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + public float squidRotation; + + public TrumpetSquid(EntityType entityType, Level level) { + super(entityType, level); + this.moveControl = new SquidMoveControl(this); + this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); + this.lookControl = new SmoothSwimmingLookControl(this, 10); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 15.0D).add(Attributes.ATTACK_DAMAGE, 4.0D).add(Attributes.ARMOR, 10.0D); + } + + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + + @Override + public void registerGoals() { + this.goalSelector.addGoal(0, new SquidLayEggsGoal(this, UFBlocks.RELUCENT_EGGS.get())); + this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); + this.goalSelector.addGoal(0, new BreedableWaterAnimalBreedGoal(this, 1.0D)); + this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 3.0D, true)); + this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { + @Override + public boolean canUse() { + return super.canUse() && isInWater(); + } + }); + this.goalSelector.addGoal(2, new RandomStrollGoal(this, 0.8D, 15) { + @Override + public boolean canUse() { + return !this.mob.isInWater() && super.canUse(); + } + }); + this.goalSelector.addGoal(4, new RandomLookAroundGoal(this)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0F)); + this.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, AbstractFish.class, false)); + } + + public void aiStep() { + if (!this.isInWater() && this.onGround() && this.verticalCollision) { + this.setDeltaMovement(this.getDeltaMovement().add(((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), 0.4F, ((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setOnGround(false); + this.hasImpulse = true; + this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); + } + + super.aiStep(); + } + + @Override + public boolean isFood(ItemStack stack) { + return stack.is(UFTags.RAW_UNUSUAL_FISH); + } + + protected PathNavigation createNavigation(Level p_27480_) { + return new WaterBoundPathNavigation(this, p_27480_); + } + + @Nullable + @Override + public BreedableWaterAnimal getBreedOffspring(ServerLevel p_146743_, BreedableWaterAnimal p_146744_) { + return null; + } + + public boolean hurt(DamageSource p_29963_, float p_29964_) { + if (super.hurt(p_29963_, p_29964_) && this.getLastHurtByMob() != null) { + if (!this.level().isClientSide) { + this.spawnInk(); + } + + return true; + } else { + return false; + } + } + + private Vec3 rotateVector(Vec3 p_29986_) { + Vec3 vec3 = p_29986_.xRot(getXRot() * ((float) Math.PI / 180F)); + return vec3.yRot(-this.yBodyRotO * ((float) Math.PI / 180F)); + } + + private void spawnInk() { + this.playSound(SoundEvents.SQUID_SQUIRT, this.getSoundVolume(), this.getVoicePitch()); + Vec3 vec3 = this.rotateVector(new Vec3(0.0D, -0.5D, -1.0D)).add(this.getX(), this.getY(), this.getZ()); + + for (int i = 0; i < 30; ++i) { + Vec3 vec31 = this.rotateVector(new Vec3((double) this.random.nextFloat() * 0.6D - 0.3D, -1.0D, (double) this.random.nextFloat() * 0.6D - 0.3D)); + Vec3 vec32 = vec31.scale(0.3D + (double) (this.random.nextFloat() * 2.0F)); + ((ServerLevel) this.level()).sendParticles(ParticleTypes.SQUID_INK, vec3.x, vec3.y + 0.5D, vec3.z, 0, vec32.x, vec32.y, vec32.z, 0.1F); + } + } + + public SoundEvent getAmbientSound() { + return SoundEvents.SQUID_AMBIENT; + } + + public SoundEvent getHurtSound(DamageSource damageSourceIn) { + return SoundEvents.SQUID_HURT; + } + + public SoundEvent getDeathSound() { + return SoundEvents.SQUID_DEATH; + } + + public SoundEvent getFlopSound() { + return SoundEvents.COD_FLOP; + } + + public void travel(Vec3 travelVector) { + if (this.isEffectiveAi() && this.isInWater()) { + this.moveRelative(0.01F, travelVector); + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); + if (this.getTarget() == null) { + this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.005D, 0.0D)); + } + } else { + super.travel(travelVector); + } + + } + + @OnlyIn(Dist.CLIENT) + public void handleEntityEvent(byte id) { + if (id == 19) { + this.squidRotation = 0.0F; + } else { + super.handleEntityEvent(id); + } + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(FROM_BUCKET, false); + } + + @Override + public void addAdditionalSaveData(CompoundTag tag) { + super.addAdditionalSaveData(tag); + tag.putBoolean("FromBucket", this.isFromBucket()); + } + + @Override + public void readAdditionalSaveData(CompoundTag tag) { + super.readAdditionalSaveData(tag); + this.setFromBucket(tag.getBoolean("FromBucket")); + } + + @Override + public boolean fromBucket() { + return this.entityData.get(FROM_BUCKET); + } + + @Override + public void saveToBucketTag(ItemStack bucket) { + Bucketable.saveDefaultDataToBucketTag(this, bucket); + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putFloat("Health", this.getHealth()); + }); + } + + public boolean requiresCustomPersistence() { + return super.requiresCustomPersistence() || this.fromBucket(); + } + + public boolean removeWhenFarAway(double p_213397_1_) { + return !this.fromBucket() && !this.hasCustomName(); + } + + private boolean isFromBucket() { + return this.entityData.get(FROM_BUCKET); + } + + public void setFromBucket(boolean p_203706_1_) { + this.entityData.set(FROM_BUCKET, p_203706_1_); + } + + @Override + public void loadFromBucketTag(CompoundTag p_148832_) { + } + + @Override + public SoundEvent getPickupSound() { + return SoundEvents.BUCKET_FILL_FISH; + } + + @Override + public InteractionResult mobInteract(Player p_27584_, InteractionHand p_27585_) { + return Bucketable.bucketMobPickup(p_27584_, p_27585_, this).orElse(super.mobInteract(p_27584_, p_27585_)); + } + + @Override + public ItemStack getBucketItemStack() { + return new ItemStack(UFItems.TRUMPET_SQUID_BUCKET.get()); + } + + @Override + public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { + controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); + } + + private PlayState predicate(AnimationState event) { + if (isInWater()) { + if (event.isMoving()) { + event.setAnimation(UFAnimations.SWIM); + } else { + event.setAnimation(UFAnimations.IDLE); + } + } else { + event.setAnimation(UFAnimations.FLOP); + } + return PlayState.CONTINUE; + } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/VoltAngler.java b/src/main/java/codyhuh/unusualfishmod/common/entity/VoltAngler.java index 650d613..c85499b 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/VoltAngler.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/VoltAngler.java @@ -2,21 +2,14 @@ import codyhuh.unusualfishmod.common.entity.util.base.BucketableWaterAnimal; import codyhuh.unusualfishmod.common.entity.util.goal.BottomStrollGoal; -import codyhuh.unusualfishmod.common.entity.util.goal.FollowSchoolLeaderGoal; import codyhuh.unusualfishmod.common.entity.util.misc.UFAnimations; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.core.BlockPos; -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.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; import net.minecraft.util.TimeUtil; import net.minecraft.util.valueproviders.UniformInt; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; @@ -31,18 +24,17 @@ import net.minecraft.world.entity.ai.goal.target.ResetUniversalAngerTargetGoal; import net.minecraft.world.entity.ai.navigation.PathNavigation; import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation; -import net.minecraft.world.entity.animal.Bucketable; import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; import javax.annotation.Nullable; @@ -50,6 +42,7 @@ public class VoltAngler extends BucketableWaterAnimal implements GeoEntity, NeutralMob { private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private int remainingPersistentAngerTime; private UUID persistentAngerTarget; @@ -63,6 +56,10 @@ public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 16.0D).add(Attributes.ATTACK_DAMAGE, 4.0D); } + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + protected void registerGoals() { this.goalSelector.addGoal(0, new TryFindWaterGoal(this)); this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 0.8D, 1) { @@ -121,18 +118,14 @@ public ItemStack getBucketStack() { return new ItemStack(UFItems.VOLT_ANGLER_BUCKET.get()); } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + public int getRemainingPersistentAngerTime() { + return this.remainingPersistentAngerTime; } public void setRemainingPersistentAngerTime(int p_34448_) { this.remainingPersistentAngerTime = p_34448_; } - public int getRemainingPersistentAngerTime() { - return this.remainingPersistentAngerTime; - } - @Override public void startPersistentAngerTimer() { this.setRemainingPersistentAngerTime(PERSISTENT_ANGER_TIME.sample(this.random)); @@ -159,15 +152,12 @@ private PlayState predicate(AnimationState event) { } else { event.setAnimation(UFAnimations.IDLE); } - } - else { + } else { event.setAnimation(UFAnimations.FLOP); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/ZebraCornetfish.java b/src/main/java/codyhuh/unusualfishmod/common/entity/ZebraCornetfish.java index 564183b..25ba5c6 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/ZebraCornetfish.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/ZebraCornetfish.java @@ -24,15 +24,17 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import software.bernie.geckolib.animatable.GeoEntity; -import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; -import software.bernie.geckolib.core.animation.AnimatableManager; -import software.bernie.geckolib.core.animation.AnimationController; -import software.bernie.geckolib.core.animation.AnimationState; -import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.animation.AnimatableManager; +import software.bernie.geckolib.animation.AnimationController; +import software.bernie.geckolib.animation.AnimationState; +import software.bernie.geckolib.animation.PlayState; import software.bernie.geckolib.util.GeckoLibUtil; public class ZebraCornetfish extends WaterAnimal implements GeoEntity { + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); + public ZebraCornetfish(EntityType entityType, Level level) { super(entityType, level); this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true); @@ -43,6 +45,10 @@ public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 20.0D).add(Attributes.ATTACK_DAMAGE, 2.0D); } + public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { + return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); + } + @Override public void registerGoals() { super.registerGoals(); @@ -67,7 +73,7 @@ public boolean canUse() { public void aiStep() { if (!this.isInWater() && this.onGround() && this.verticalCollision) { - this.setDeltaMovement(this.getDeltaMovement().add((double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F), (double)0.4F, (double)((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F))); + this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.05F, 0.4F, (this.random.nextFloat() * 2.0F - 1.0F) * 0.05F)); this.setOnGround(false); this.hasImpulse = true; this.playSound(this.getFlopSound(), this.getSoundVolume(), this.getVoicePitch()); @@ -92,10 +98,6 @@ public SoundEvent getFlopSound() { return SoundEvents.COD_FLOP; } - public static boolean canSpawn(EntityType p_223364_0_, LevelAccessor p_223364_1_, MobSpawnType reason, BlockPos p_223364_3_, RandomSource random) { - return WaterAnimal.checkSurfaceWaterAnimalSpawnRules(p_223364_0_, p_223364_1_, reason, p_223364_3_, random); - } - @Override public void registerControllers(AnimatableManager.ControllerRegistrar controllerRegistrar) { controllerRegistrar.add(new AnimationController(this, "controller", 2, this::predicate)); @@ -108,15 +110,12 @@ private PlayState predicate(AnimationState event) { } else { event.setAnimation(UFAnimations.IDLE); } - } - else { + } else { event.setAnimation(UFAnimations.FLOP); } return PlayState.CONTINUE; } - private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - @Override public AnimatableInstanceCache getAnimatableInstanceCache() { return cache; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/item/AbstractMovingBlockEntity.java b/src/main/java/codyhuh/unusualfishmod/common/entity/item/AbstractMovingBlockEntity.java index ebabc31..ae4cb47 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/item/AbstractMovingBlockEntity.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/item/AbstractMovingBlockEntity.java @@ -2,16 +2,16 @@ import codyhuh.unusualfishmod.common.entity.util.misc.MovingBlockData; import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; -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.server.level.ServerLevel; import net.minecraft.world.entity.*; import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; @@ -24,7 +24,6 @@ import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; -import net.minecraftforge.network.NetworkHooks; import java.util.ArrayList; import java.util.List; @@ -40,6 +39,16 @@ public AbstractMovingBlockEntity(EntityType entityType, Level level) { super(entityType, level); } + public static CompoundTag createTagFromData(List blocks) { + CompoundTag tag = new CompoundTag(); + ListTag listTag = new ListTag(); + for (MovingBlockData data : blocks) { + listTag.add(data.toTag()); + } + tag.put("BlockData", listTag); + return tag; + } + public void onSyncedDataUpdated(EntityDataAccessor entityDataAccessor) { super.onSyncedDataUpdated(entityDataAccessor); if (BLOCK_DATA_TAG.equals(entityDataAccessor)) { @@ -50,8 +59,8 @@ public void onSyncedDataUpdated(EntityDataAccessor entityDataAccessor) { } @Override - protected void defineSynchedData() { - this.entityData.define(BLOCK_DATA_TAG, new CompoundTag()); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + builder.define(BLOCK_DATA_TAG, new CompoundTag()); } public void tick() { @@ -84,12 +93,13 @@ public void tick() { if (dataBlock.blockData != null && dataBlock.getState().hasBlockEntity()) { BlockEntity blockentity = this.level().getBlockEntity(set); if (blockentity != null) { - CompoundTag compoundtag = blockentity.saveWithoutMetadata(); + HolderLookup.Provider registryProvider = this.level().registryAccess(); + CompoundTag compoundtag = blockentity.saveWithoutMetadata(registryProvider); for (String s : dataBlock.blockData.getAllKeys()) { compoundtag.put(s, dataBlock.blockData.get(s).copy()); } try { - blockentity.load(compoundtag); + blockentity.loadWithComponents(compoundtag, registryProvider); } catch (Exception exception) { } blockentity.setChanged(); @@ -119,12 +129,12 @@ public void moveEntitiesOnTop() { if (!entity.noPhysics) { double gravity = entity.isNoGravity() ? 0 : 0.08D; if (entity instanceof LivingEntity living) { - AttributeInstance attribute = living.getAttribute(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get()); + AttributeInstance attribute = living.getAttribute(Attributes.GRAVITY); gravity = attribute.getValue(); } float f2 = 1.0F; entity.move(MoverType.SHULKER, new Vec3((f2 * (float) this.getDeltaMovement().x), (f2 * (float) this.getDeltaMovement().y), (f2 * (float) this.getDeltaMovement().z))); - if(this.getDeltaMovement().y >= 0){ + if (this.getDeltaMovement().y >= 0) { entity.setDeltaMovement(entity.getDeltaMovement().add(0, gravity, 0)); } } @@ -132,11 +142,11 @@ public void moveEntitiesOnTop() { } protected void createBlockDropAt(BlockPos crushPos, BlockState state, CompoundTag blockData) { - if(this.level() instanceof ServerLevel serverLevel){ + if (this.level() instanceof ServerLevel serverLevel) { LootParams.Builder lootparams$builder = (new LootParams.Builder(serverLevel)).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(crushPos)).withParameter(LootContextParams.TOOL, ItemStack.EMPTY); try { List drops = state.getDrops(lootparams$builder); - for(ItemStack drop : drops){ + for (ItemStack drop : drops) { Block.popResource(serverLevel, crushPos, drop); } state.spawnAfterBreak(serverLevel, crushPos, ItemStack.EMPTY, true); @@ -145,7 +155,6 @@ protected void createBlockDropAt(BlockPos crushPos, BlockState state, CompoundTa } } - protected Entity.MovementEmission getMovementEmission() { return Entity.MovementEmission.NONE; } @@ -172,11 +181,6 @@ protected void addAdditionalSaveData(CompoundTag compound) { } } - @Override - public Packet getAddEntityPacket() { - return (Packet) NetworkHooks.getEntitySpawningPacket(this); - } - private List buildDataFromTrackerTag() { List list = new ArrayList<>(); CompoundTag data = getAllBlockData(); @@ -190,7 +194,6 @@ private List buildDataFromTrackerTag() { return list; } - public void setPlacementCooldown(int cooldown) { placementCooldown = cooldown; } @@ -238,16 +241,6 @@ public Vec3 getLightProbePosition(float f) { return this.getPosition(f); } - public static CompoundTag createTagFromData(List blocks) { - CompoundTag tag = new CompoundTag(); - ListTag listTag = new ListTag(); - for (MovingBlockData data : blocks) { - listTag.add(data.toTag()); - } - tag.put("BlockData", listTag); - return tag; - } - @Override public boolean canBeCollidedWith() { return false; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/item/AbyssalBlast.java b/src/main/java/codyhuh/unusualfishmod/common/entity/item/AbyssalBlast.java index 24b23ff..09ae6ba 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/item/AbyssalBlast.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/item/AbyssalBlast.java @@ -3,15 +3,11 @@ import codyhuh.unusualfishmod.common.entity.Gnasher; import codyhuh.unusualfishmod.core.registry.UFEntities; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.protocol.Packet; -import net.minecraft.network.protocol.game.ClientGamePacketListener; -import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -21,13 +17,11 @@ import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.network.NetworkHooks; -import net.minecraftforge.network.PlayMessages; import javax.annotation.Nullable; import java.util.UUID; -public class AbyssalBlast extends Entity { +public class AbyssalBlast extends Entity { private static final EntityDataAccessor FASTER_ANIM = SynchedEntityData.defineId(AbyssalBlast.class, EntityDataSerializers.BOOLEAN); private UUID ownerUUID; private int ownerNetworkId; @@ -40,29 +34,17 @@ public AbyssalBlast(EntityType p_i50162_1_, Level p_i50162_2_) { public AbyssalBlast(Level worldIn, Gnasher p_i47273_2_) { this(UFEntities.ABYSSAL_BLAST.get(), worldIn); this.setShooter(p_i47273_2_); - this.setPos(p_i47273_2_.getX() - (double)(p_i47273_2_.getBbWidth() + 1.0F) * 0.35D * (double) Mth.sin(p_i47273_2_.yBodyRot * ((float)Math.PI / 180F)), p_i47273_2_.getEyeY() + (double)0.2F, p_i47273_2_.getZ() + (double)(p_i47273_2_.getBbWidth() + 1.0F) * 0.35D * (double)Mth.cos(p_i47273_2_.yBodyRot * ((float)Math.PI / 180F))); + this.setPos(p_i47273_2_.getX() - (double) (p_i47273_2_.getBbWidth() + 1.0F) * 0.35D * (double) Mth.sin(p_i47273_2_.yBodyRot * ((float) Math.PI / 180F)), p_i47273_2_.getEyeY() + (double) 0.2F, p_i47273_2_.getZ() + (double) (p_i47273_2_.getBbWidth() + 1.0F) * 0.35D * (double) Mth.cos(p_i47273_2_.yBodyRot * ((float) Math.PI / 180F))); } public AbyssalBlast(Level worldIn, LivingEntity p_i47273_2_, boolean right) { this(UFEntities.ABYSSAL_BLAST.get(), worldIn); this.setShooter(p_i47273_2_); - float rot = p_i47273_2_.yBodyRot + (right ? 90 : -80); + float rot = p_i47273_2_.yBodyRot + (right ? 90 : -80); this.setFasterAnimation(true); this.setPos(p_i47273_2_.getX() - (double) (p_i47273_2_.getBbWidth()) * 0.5D * (double) Mth.sin(rot * ((float) Math.PI / 290F)), p_i47273_2_.getEyeY() - (double) 0.2F, p_i47273_2_.getZ() + (double) (p_i47273_2_.getBbWidth()) * 0.5D * (double) Mth.cos(rot * ((float) Math.PI / 290F))); } - public AbyssalBlast(PlayMessages.SpawnEntity spawnEntity, Level world) { - this(UFEntities.ABYSSAL_BLAST.get(), world); - } - - public boolean isFasterAnimation() { - return this.entityData.get(FASTER_ANIM); - } - - public void setFasterAnimation(boolean anim) { - this.entityData.set(FASTER_ANIM, anim); - } - protected static float lerpRotation(float p_234614_0_, float p_234614_1_) { while (p_234614_1_ - p_234614_0_ < -180.0F) { p_234614_0_ -= 360.0F; @@ -75,13 +57,16 @@ protected static float lerpRotation(float p_234614_0_, float p_234614_1_) { return Mth.lerp(0.2F, p_234614_0_, p_234614_1_); } - @Override - public Packet getAddEntityPacket() { - return NetworkHooks.getEntitySpawningPacket(this); + public boolean isFasterAnimation() { + return this.entityData.get(FASTER_ANIM); + } + + public void setFasterAnimation(boolean anim) { + this.entityData.set(FASTER_ANIM, anim); } public void tick() { - double yMot = Mth.sqrt((float)(this.getDeltaMovement().x * this.getDeltaMovement().x + this.getDeltaMovement().z * this.getDeltaMovement().z)); + double yMot = Mth.sqrt((float) (this.getDeltaMovement().x * this.getDeltaMovement().x + this.getDeltaMovement().z * this.getDeltaMovement().z)); this.setXRot((float) (Mth.atan2(this.getDeltaMovement().y, yMot) * (double) (180F / (float) Math.PI))); if (!this.leftOwner) { this.leftOwner = this.checkLeftOwner(); @@ -110,7 +95,7 @@ public void tick() { protected void onEntityHit(EntityHitResult p_213868_1_) { Entity entity = p_213868_1_.getEntity(); Entity entity1 = this.getOwner(); - LivingEntity livingentity = entity1 instanceof LivingEntity ? (LivingEntity)entity1 : null; + LivingEntity livingentity = entity1 instanceof LivingEntity ? (LivingEntity) entity1 : null; entity.hurt(damageSources().mobProjectile(this, livingentity), 5.0F); } @@ -121,8 +106,9 @@ protected void onHitBlock(BlockHitResult p_230299_1_) { } } - protected void defineSynchedData() { - this.entityData.define(FASTER_ANIM, false); + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + builder.define(FASTER_ANIM, false); } public void setShooter(@Nullable Entity entityIn) { @@ -201,7 +187,7 @@ protected void onImpact(HitResult result) { public void lerpMotion(double x, double y, double z) { this.setDeltaMovement(x, y, z); if (this.xRotO == 0.0F && this.yRotO == 0.0F) { - float f = Mth.sqrt((float)(x * x + z * z)); + float f = Mth.sqrt((float) (x * x + z * z)); this.setXRot((float) (Mth.atan2(y, f) * (double) (180F / (float) Math.PI))); this.setYRot((float) (Mth.atan2(x, z) * (double) (180F / (float) Math.PI))); this.xRotO = this.getXRot(); @@ -222,7 +208,7 @@ protected boolean canHitEntity(Entity p_230298_1_) { protected void updateRotation() { Vec3 vector3d = this.getDeltaMovement(); - float f = Mth.sqrt((float)horizontalMag(vector3d)); + float f = Mth.sqrt((float) horizontalMag(vector3d)); this.setXRot(lerpRotation(this.xRotO, (float) (Mth.atan2(vector3d.y, f) * (double) (180F / (float) Math.PI)))); this.setYRot(lerpRotation(this.yRotO, (float) (Mth.atan2(vector3d.x, vector3d.z) * (double) (180F / (float) Math.PI)))); } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/item/FallingTreeBlockEntity.java b/src/main/java/codyhuh/unusualfishmod/common/entity/item/FallingTreeBlockEntity.java index a5d8c27..d199095 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/item/FallingTreeBlockEntity.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/item/FallingTreeBlockEntity.java @@ -1,7 +1,6 @@ package codyhuh.unusualfishmod.common.entity.item; import codyhuh.unusualfishmod.common.entity.util.misc.MovingBlockData; -import codyhuh.unusualfishmod.core.registry.UFEntities; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -11,7 +10,6 @@ import net.minecraft.world.entity.EntityType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Rotation; -import net.minecraftforge.network.PlayMessages; // Adapted from Alex's Caves (licensed under GNU GPLv3) public class FallingTreeBlockEntity extends AbstractMovingBlockEntity { @@ -26,16 +24,11 @@ public FallingTreeBlockEntity(EntityType entityType, Level level) { super(entityType, level); } - public FallingTreeBlockEntity(PlayMessages.SpawnEntity spawnEntity, Level level) { - this(UFEntities.FALLING_TREE.get(), level); - this.setBoundingBox(this.makeBoundingBox()); - } - @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(FALL_DIRECTION, Direction.NORTH); - this.entityData.define(FALL_PROGRESS, 0F); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(FALL_DIRECTION, Direction.NORTH); + builder.define(FALL_PROGRESS, 0F); } public void readAdditionalSaveData(CompoundTag compound) { @@ -100,14 +93,14 @@ protected float getFallProgress() { return this.entityData.get(FALL_PROGRESS); } - public float getFallProgress(float partialTick) { - return prevFallProgress + (getFallProgress() - prevFallProgress) * partialTick; - } - public void setFallProgress(float f) { this.entityData.set(FALL_PROGRESS, f); } + public float getFallProgress(float partialTick) { + return prevFallProgress + (getFallProgress() - prevFallProgress) * partialTick; + } + public boolean canBePlaced() { return false; } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/item/SeaSpike.java b/src/main/java/codyhuh/unusualfishmod/common/entity/item/SeaSpike.java index 5a09248..6aea6ef 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/item/SeaSpike.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/item/SeaSpike.java @@ -6,6 +6,7 @@ import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; @@ -16,6 +17,7 @@ public class SeaSpike extends AbstractArrow { public SeaSpike(EntityType type, Level level) { super(type, level); hostileOnly = false; + this.pickup = AbstractArrow.Pickup.DISALLOWED; } public SeaSpike(EntityType p_36711_, double p_36712_, double p_36713_, double p_36714_, Level p_36715_) { @@ -45,7 +47,12 @@ protected float getWaterInertia() { @Override protected ItemStack getPickupItem() { - return ItemStack.EMPTY; + return new ItemStack(Items.ARROW); + } + + @Override + protected ItemStack getDefaultPickupItem() { + return new ItemStack(Items.ARROW); } @Override diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/item/ThrownPrismarineSpear.java b/src/main/java/codyhuh/unusualfishmod/common/entity/item/ThrownPrismarineSpear.java index 4b0639b..cb9138d 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/item/ThrownPrismarineSpear.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/item/ThrownPrismarineSpear.java @@ -3,6 +3,7 @@ import codyhuh.unusualfishmod.core.registry.UFEntities; import codyhuh.unusualfishmod.core.registry.UFItems; import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.damagesource.DamageSource; @@ -23,18 +24,27 @@ public class ThrownPrismarineSpear extends AbstractArrow { private ItemStack spearItem = new ItemStack(UFItems.PRISMARINE_SPEAR.get()); private boolean dealtDamage; - public ThrownPrismarineSpear(EntityType p_36711_, double p_36712_, double p_36713_, double p_36714_, Level p_36715_) { - this(p_36711_, p_36715_); - this.setPos(p_36712_, p_36713_, p_36714_); + public ThrownPrismarineSpear(EntityType entityType, Level level) { + super(entityType, level); } - public ThrownPrismarineSpear(EntityType p_37561_, Level p_37562_) { - super(p_37561_, p_37562_); + public ThrownPrismarineSpear(Level level, double x, double y, double z, ItemStack pickupItemStack) { + super(UFEntities.PRISMARINE_SPEAR.get(), level); + this.setPos(x, y, z); + this.spearItem = pickupItemStack.copy(); } - public ThrownPrismarineSpear(Level p_37569_, LivingEntity p_37570_, ItemStack p_37571_) { - super(UFEntities.PRISMARINE_SPEAR.get(), p_37570_, p_37569_); - this.spearItem = p_37571_.copy(); + public ThrownPrismarineSpear(EntityType entityType, double x, double y, double z, Level level) { + this(entityType, level); + this.setPos(x, y, z); + + } + + public ThrownPrismarineSpear(Level level, LivingEntity livingEntity, ItemStack itemStack) { + super(UFEntities.PRISMARINE_SPEAR.get(), level); + this.spearItem = itemStack.copy(); + this.setOwner(livingEntity); + this.setPos(livingEntity.getX(), livingEntity.getEyeY(), livingEntity.getZ()); } public void tick() { @@ -46,6 +56,17 @@ public void tick() { } protected ItemStack getPickupItem() { + if (this.spearItem == null) { + return new ItemStack(UFItems.PRISMARINE_SPEAR.get()); + } + return this.spearItem.copy(); + } + + @Override + protected ItemStack getDefaultPickupItem() { + if (this.spearItem == null) { + return new ItemStack(UFItems.PRISMARINE_SPEAR.get()); + } return this.spearItem.copy(); } @@ -57,8 +78,9 @@ protected EntityHitResult findHitEntity(Vec3 p_37575_, Vec3 p_37576_) { protected void onHitEntity(EntityHitResult result) { Entity entity = result.getEntity(); float f = 5.0F; - if (entity instanceof LivingEntity livingentity) { - f += EnchantmentHelper.getDamageBonus(this.spearItem, livingentity.getMobType()); + if (entity instanceof LivingEntity livingentity && this.level() instanceof net.minecraft.server.level.ServerLevel serverLevel) { + DamageSource damageSource = this.damageSources().mobAttack((LivingEntity) this.getOwner()); + f = EnchantmentHelper.modifyDamage(serverLevel, this.spearItem, livingentity, damageSource, (float) this.getBaseDamage()); } Entity entity1 = this.getOwner(); @@ -70,12 +92,10 @@ protected void onHitEntity(EntityHitResult result) { return; } - if (entity instanceof LivingEntity livingentity1) { - if (entity1 instanceof LivingEntity) { - EnchantmentHelper.doPostHurtEffects(livingentity1, entity1); - EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity1); + if (entity instanceof LivingEntity livingentity1 && entity1 instanceof LivingEntity livingentityAttacker) { + if (this.level() instanceof ServerLevel serverLevel) { + EnchantmentHelper.doPostAttackEffects(serverLevel, livingentity1, this.damageSources().mobAttack(livingentityAttacker)); } - this.doPostHurtEffects(livingentity1); } } @@ -100,19 +120,18 @@ public void playerTouch(Player p_37580_) { } } - public void readAdditionalSaveData(CompoundTag p_37578_) { - super.readAdditionalSaveData(p_37578_); - if (p_37578_.contains("Trident", 10)) { - this.spearItem = ItemStack.of(p_37578_.getCompound("Trident")); + public void readAdditionalSaveData(CompoundTag tag) { + super.readAdditionalSaveData(tag); + if (tag.contains("Trident", 10)) { + this.spearItem = ItemStack.parseOptional(this.level().registryAccess(), tag.getCompound("Trident")); } - - this.dealtDamage = p_37578_.getBoolean("DealtDamage"); + this.dealtDamage = tag.getBoolean("DealtDamage"); } - public void addAdditionalSaveData(CompoundTag p_37582_) { - super.addAdditionalSaveData(p_37582_); - p_37582_.put("Trident", this.spearItem.save(new CompoundTag())); - p_37582_.putBoolean("DealtDamage", this.dealtDamage); + public void addAdditionalSaveData(CompoundTag tag) { + super.addAdditionalSaveData(tag); + tag.put("Trident", this.spearItem.save(this.level().registryAccess())); + tag.putBoolean("DealtDamage", this.dealtDamage); } protected float getWaterInertia() { diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BreedableWaterAnimal.java b/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BreedableWaterAnimal.java index e382282..c3b2550 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BreedableWaterAnimal.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BreedableWaterAnimal.java @@ -40,6 +40,10 @@ protected BreedableWaterAnimal(EntityType p_146738_, Leve super(p_146738_, p_146739_); } + public static int getSpeedUpSecondsWhenFeeding(int p_216968_) { + return (int) ((float) (p_216968_ / 20) * 0.1F); + } + public boolean isGravid() { return this.entityData.get(DATA_GRAVID); } @@ -51,10 +55,11 @@ public void setGravid(boolean gravid) { @Nullable public abstract BreedableWaterAnimal getBreedOffspring(ServerLevel p_146743_, BreedableWaterAnimal p_146744_); - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(DATA_BABY_ID, false); - this.entityData.define(DATA_GRAVID, false); + @Override + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(DATA_BABY_ID, false); + builder.define(DATA_GRAVID, false); } public int getAge() { @@ -65,6 +70,16 @@ public int getAge() { } } + public void setAge(int p_146763_) { + int i = this.getAge(); + this.age = p_146763_; + if (i < 0 && p_146763_ >= 0 || i >= 0 && p_146763_ < 0) { + this.entityData.set(DATA_BABY_ID, p_146763_ < 0); + this.ageBoundaryReached(); + } + + } + public void ageUp(int p_146741_, boolean p_146742_) { int i = this.getAge(); i += p_146741_ * 20; @@ -72,7 +87,7 @@ public void ageUp(int p_146741_, boolean p_146742_) { i = 0; } - int j = i - i; + int j = 0; this.setAge(i); if (p_146742_) { this.forcedAge += j; @@ -91,16 +106,6 @@ public void ageUp(int p_146759_) { this.ageUp(p_146759_, false); } - public void setAge(int p_146763_) { - int i = this.getAge(); - this.age = p_146763_; - if (i < 0 && p_146763_ >= 0 || i >= 0 && p_146763_ < 0) { - this.entityData.set(DATA_BABY_ID, p_146763_ < 0); - this.ageBoundaryReached(); - } - - } - protected void customServerAiStep() { if (this.getAge() != 0) { this.inLove = 0; @@ -194,13 +199,9 @@ public void setBaby(boolean p_146756_) { this.setAge(p_146756_ ? -24000 : 0); } - public static int getSpeedUpSecondsWhenFeeding(int p_216968_) { - return (int)((float)(p_216968_ / 20) * 0.1F); - } - public void handleEntityEvent(byte p_27562_) { if (p_27562_ == 18) { - for(int i = 0; i < 7; ++i) { + for (int i = 0; i < 7; ++i) { double d0 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D; double d2 = this.random.nextGaussian() * 0.02D; @@ -223,22 +224,13 @@ public boolean canFallInLove() { return this.inLove <= 0; } - public void setInLove(@Nullable Player p_27596_) { - this.inLove = 600; - if (p_27596_ != null) { - this.loveCause = p_27596_.getUUID(); - } - - this.level().broadcastEntityEvent(this, (byte)18); - } - @Nullable public ServerPlayer getLoveCause() { if (this.loveCause == null) { return null; } else { Player player = this.level().getPlayerByUUID(this.loveCause); - return player instanceof ServerPlayer ? (ServerPlayer)player : null; + return player instanceof ServerPlayer ? (ServerPlayer) player : null; } } @@ -286,6 +278,15 @@ public boolean isInLove() { return this.inLove > 0; } + public void setInLove(@Nullable Player p_27596_) { + this.inLove = 600; + if (p_27596_ != null) { + this.loveCause = p_27596_.getUUID(); + } + + this.level().broadcastEntityEvent(this, (byte) 18); + } + public void resetLove() { this.inLove = 0; } @@ -331,7 +332,7 @@ public void spawnChildFromBreeding(ServerLevel p_27564_, BreedableWaterAnimal an ageable.setBaby(true); ageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F); p_27564_.addFreshEntityWithPassengers(ageable); - p_27564_.broadcastEntityEvent(this, (byte)18); + p_27564_.broadcastEntityEvent(this, (byte) 18); if (p_27564_.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { p_27564_.addFreshEntity(new ExperienceOrb(p_27564_, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1)); } @@ -340,9 +341,9 @@ public void spawnChildFromBreeding(ServerLevel p_27564_, BreedableWaterAnimal an } public static class AgeableWaterAnimalGroupData implements SpawnGroupData { - private int groupSize; private final boolean shouldSpawnBaby; private final float babySpawnChance; + private int groupSize; private AgeableWaterAnimalGroupData(boolean p_146775_, float p_146776_) { this.shouldSpawnBaby = p_146775_; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BucketableSchoolingWaterAnimal.java b/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BucketableSchoolingWaterAnimal.java index 56fb374..6ff9c0c 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BucketableSchoolingWaterAnimal.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BucketableSchoolingWaterAnimal.java @@ -111,8 +111,7 @@ public void addFollowers(Stream p_2753 if (this.getVariantN() == p_27536_.getVariantN()) { p_27536_.startFollowing(this); } - } - else { + } else { p_27536_.startFollowing(this); } }); @@ -120,11 +119,11 @@ public void addFollowers(Stream p_2753 @Nullable public SpawnGroupData finalizeSpawn(ServerLevelAccessor p_27528_, DifficultyInstance p_27529_, MobSpawnType p_27530_, @Nullable SpawnGroupData p_27531_, @Nullable CompoundTag p_27532_) { - super.finalizeSpawn(p_27528_, p_27529_, p_27530_, p_27531_, p_27532_); + super.finalizeSpawn(p_27528_, p_27529_, p_27530_, p_27531_); if (p_27531_ == null) { p_27531_ = new BucketableSchoolingWaterAnimal.SchoolSpawnGroupData(this); } else { - this.startFollowing(((BucketableSchoolingWaterAnimal.SchoolSpawnGroupData)p_27531_).leader); + this.startFollowing(((BucketableSchoolingWaterAnimal.SchoolSpawnGroupData) p_27531_).leader); } return p_27531_; diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BucketableWaterAnimal.java b/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BucketableWaterAnimal.java index db2bdc6..632869b 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BucketableWaterAnimal.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/util/base/BucketableWaterAnimal.java @@ -1,5 +1,6 @@ package codyhuh.unusualfishmod.common.entity.util.base; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; @@ -13,6 +14,7 @@ import net.minecraft.world.entity.animal.WaterAnimal; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; import net.minecraft.world.level.Level; public abstract class BucketableWaterAnimal extends WaterAnimal implements Bucketable { @@ -23,9 +25,9 @@ protected BucketableWaterAnimal(EntityType p_30341_, Leve } @Override - protected void defineSynchedData() { - super.defineSynchedData(); - this.entityData.define(FROM_BUCKET, false); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(FROM_BUCKET, false); } public void addAdditionalSaveData(CompoundTag compound) { @@ -45,11 +47,13 @@ public boolean fromBucket() { @Override public void saveToBucketTag(ItemStack bucket) { - CompoundTag compoundnbt = bucket.getOrCreateTag(); - compoundnbt.putFloat("Health", this.getHealth()); + Bucketable.saveDefaultDataToBucketTag(this, bucket); if (this.hasCustomName()) { - bucket.setHoverName(this.getCustomName()); + bucket.set(DataComponents.CUSTOM_NAME, this.getCustomName()); } + CustomData.update(DataComponents.BUCKET_ENTITY_DATA, bucket, (tag) -> { + tag.putFloat("Health", this.getHealth()); + }); } public boolean requiresCustomPersistence() { diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/util/goal/BottomStrollGoal.java b/src/main/java/codyhuh/unusualfishmod/common/entity/util/goal/BottomStrollGoal.java index 7ad982e..52c3ef1 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/util/goal/BottomStrollGoal.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/util/goal/BottomStrollGoal.java @@ -21,17 +21,18 @@ public BottomStrollGoal(PathfinderMob p_i48937_1_, double p_i48937_2_, int p_i48 protected Vec3 getPosition() { Vec3 vec = DefaultRandomPos.getPos(this.mob, 10, 7); - for(int var2 = 0; vec != null && !this.mob.level().getBlockState(new BlockPos(new Vec3i((int)vec.x, (int)vec.y, (int)vec.z))).isPathfindable(this.mob.level(), new BlockPos(new Vec3i((int)vec.x, (int)vec.y, (int)vec.z)), PathComputationType.WATER) && var2++ < 10; vec = DefaultRandomPos.getPos(this.mob, 10, 7)) { + for (int var2 = 0; vec != null && !this.mob.level().getBlockState(BlockPos.containing(vec)).isPathfindable(PathComputationType.WATER) && var2++ < 10; vec = DefaultRandomPos.getPos(this.mob, 10, 7)) { } + int yDrop = 1 + this.mob.getRandom().nextInt(3); - if(vec != null){ - BlockPos pos = new BlockPos(new Vec3i((int)vec.x, (int)vec.y, (int)vec.z)); - while(this.mob.level().getFluidState(pos).is(FluidTags.WATER) && this.mob.level().getBlockState(pos).isPathfindable(this.mob.level(), pos, PathComputationType.WATER) && pos.getY() > 1){ + if (vec != null) { + BlockPos pos = new BlockPos(new Vec3i((int) vec.x, (int) vec.y, (int) vec.z)); + while (this.mob.level().getFluidState(pos).is(FluidTags.WATER) && this.mob.level().getBlockState(pos).isPathfindable(PathComputationType.WATER) && pos.getY() > this.mob.level().getMinBuildHeight()) { pos = pos.below(); } pos = pos.above(); int yUp = 0; - while(this.mob.level().getFluidState(pos).is(FluidTags.WATER) && this.mob.level().getBlockState(pos).isPathfindable(this.mob.level(), pos, PathComputationType.WATER) && yUp < yDrop){ + while (this.mob.level().getFluidState(pos).is(FluidTags.WATER) && this.mob.level().getBlockState(pos).isPathfindable(PathComputationType.WATER) && yUp < yDrop) { pos = pos.above(); yUp++; } diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/util/goal/BreedableWaterAnimalBreedGoal.java b/src/main/java/codyhuh/unusualfishmod/common/entity/util/goal/BreedableWaterAnimalBreedGoal.java index 2269676..9fcf547 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/util/goal/BreedableWaterAnimalBreedGoal.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/util/goal/BreedableWaterAnimalBreedGoal.java @@ -13,12 +13,12 @@ public class BreedableWaterAnimalBreedGoal extends Goal { private static final TargetingConditions PARTNER_TARGETING = TargetingConditions.forNonCombat().range(8.0D).ignoreLineOfSight(); protected final BreedableWaterAnimal animal; - private final Class partnerClass; protected final Level level; + private final Class partnerClass; + private final double speedModifier; @Nullable protected BreedableWaterAnimal partner; private int loveTime; - private final double speedModifier; public BreedableWaterAnimalBreedGoal(BreedableWaterAnimal p_25122_, double p_25123_) { this(p_25122_, p_25123_, p_25122_.getClass()); @@ -51,7 +51,7 @@ public void stop() { } public void tick() { - this.animal.getLookControl().setLookAt(this.partner, 10.0F, (float)this.animal.getMaxHeadXRot()); + this.animal.getLookControl().setLookAt(this.partner, 10.0F, (float) this.animal.getMaxHeadXRot()); this.animal.getNavigation().moveTo(this.partner, this.speedModifier); ++this.loveTime; if (this.loveTime >= this.adjustedTickDelay(60) && this.animal.distanceToSqr(this.partner) < 9.0D) { @@ -66,7 +66,7 @@ private BreedableWaterAnimal getFreePartner() { double d0 = Double.MAX_VALUE; BreedableWaterAnimal animal = null; - for(BreedableWaterAnimal animal1 : list) { + for (BreedableWaterAnimal animal1 : list) { if (this.animal.canMate(animal1) && this.animal.distanceToSqr(animal1) < d0) { animal = animal1; d0 = this.animal.distanceToSqr(animal1); @@ -77,6 +77,6 @@ private BreedableWaterAnimal getFreePartner() { } protected void breed() { - this.animal.spawnChildFromBreeding((ServerLevel)this.level, this.partner); + this.animal.spawnChildFromBreeding((ServerLevel) this.level, this.partner); } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/util/misc/MovingBlockData.java b/src/main/java/codyhuh/unusualfishmod/common/entity/util/misc/MovingBlockData.java index 396a1d3..094e382 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/util/misc/MovingBlockData.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/util/misc/MovingBlockData.java @@ -17,11 +17,11 @@ // Adapted from Alex's Caves (licensed under GNU GPLv3) public class MovingBlockData { + @Nullable + public CompoundTag blockData; private BlockState state; private VoxelShape shape; private BlockPos offset; - @Nullable - public CompoundTag blockData; public MovingBlockData(BlockState state, VoxelShape shape, BlockPos offset, @Nullable CompoundTag blockData) { this.state = state; @@ -31,7 +31,20 @@ public MovingBlockData(BlockState state, VoxelShape shape, BlockPos offset, @Nul } public MovingBlockData(Level level, CompoundTag tag) { - this(NbtUtils.readBlockState(level.holderLookup(Registries.BLOCK), tag.getCompound("BlockState")), getShapeFromTag(tag.getCompound("VoxelShape")), new BlockPos(tag.getInt("OffsetX"), tag.getInt("OffsetY"), tag.getInt("OffsetZ")), tag.contains("BlockData") ? tag.getCompound("BlockData") : null); + this(NbtUtils.readBlockState(level.registryAccess().lookupOrThrow(Registries.BLOCK), tag.getCompound("BlockState")), getShapeFromTag(tag.getCompound("VoxelShape")), new BlockPos(tag.getInt("OffsetX"), tag.getInt("OffsetY"), tag.getInt("OffsetZ")), tag.contains("BlockData") ? tag.getCompound("BlockData") : null); + } + + private static VoxelShape getShapeFromTag(CompoundTag data) { + VoxelShape shape = Shapes.empty(); + if (data.contains("AABBs")) { + ListTag listtag = data.getList("AABBs", 10); + for (int i = 0; i < listtag.size(); ++i) { + CompoundTag innerTag = listtag.getCompound(i); + AABB aabb = new AABB(innerTag.getDouble("BoxMinX"), innerTag.getDouble("BoxMinY"), innerTag.getDouble("BoxMinZ"), innerTag.getDouble("BoxMaxX"), innerTag.getDouble("BoxMaxY"), innerTag.getDouble("BoxMaxZ")); + shape = Shapes.join(shape, Shapes.create(aabb), BooleanOp.OR); + } + } + return shape; } public BlockState getState() { @@ -97,17 +110,4 @@ private CompoundTag getShapeTag() { return data; } - private static VoxelShape getShapeFromTag(CompoundTag data) { - VoxelShape shape = Shapes.empty(); - if (data.contains("AABBs")) { - ListTag listtag = data.getList("AABBs", 10); - for (int i = 0; i < listtag.size(); ++i) { - CompoundTag innerTag = listtag.getCompound(i); - AABB aabb = new AABB(innerTag.getDouble("BoxMinX"), innerTag.getDouble("BoxMinY"), innerTag.getDouble("BoxMinZ"), innerTag.getDouble("BoxMaxX"), innerTag.getDouble("BoxMaxY"), innerTag.getDouble("BoxMaxZ")); - shape = Shapes.join(shape, Shapes.create(aabb), BooleanOp.OR); - } - } - return shape; - } - } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/util/misc/UFAnimations.java b/src/main/java/codyhuh/unusualfishmod/common/entity/util/misc/UFAnimations.java index c8d0f55..9a93592 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/util/misc/UFAnimations.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/util/misc/UFAnimations.java @@ -1,6 +1,6 @@ package codyhuh.unusualfishmod.common.entity.util.misc; -import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.animation.RawAnimation; public class UFAnimations { public static final RawAnimation WALK = RawAnimation.begin().thenLoop("walk"); diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/util/movement/SnailMoveControl.java b/src/main/java/codyhuh/unusualfishmod/common/entity/util/movement/SnailMoveControl.java index 7404a60..b3de2b5 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/util/movement/SnailMoveControl.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/util/movement/SnailMoveControl.java @@ -26,8 +26,8 @@ public void tick() { double d3 = Mth.sqrt((float) (d0 * d0 + d1 * d1 + d2 * d2)); d1 = d1 / d3; float f = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; - this.snail.yRot = this.rotlerp(this.snail.yRot, f, 90.0F); - this.snail.yBodyRot = this.snail.yRot; + this.snail.setYRot(this.rotlerp(this.snail.getYRot(), f, 90.0F)); + this.snail.yBodyRot = this.snail.getYRot(); float f1 = (float) (this.speedModifier * this.snail.getAttributeValue(Attributes.MOVEMENT_SPEED)); this.snail.setSpeed(Mth.lerp(0.125F, this.snail.getSpeed(), f1)); this.snail.setDeltaMovement(this.snail.getDeltaMovement().add(0.0D, (double) this.snail.getSpeed() * d1 * 0.1D, 0.0D)); diff --git a/src/main/java/codyhuh/unusualfishmod/common/entity/util/movement/SquidMoveControl.java b/src/main/java/codyhuh/unusualfishmod/common/entity/util/movement/SquidMoveControl.java index 81df43d..9db11a3 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/entity/util/movement/SquidMoveControl.java +++ b/src/main/java/codyhuh/unusualfishmod/common/entity/util/movement/SquidMoveControl.java @@ -32,8 +32,8 @@ public void tick() { if (d0 != 0.0D || d2 != 0.0D) { float f1 = (float) (Mth.atan2(d2, d0) * (double) (180F / (float) Math.PI)) - 90.0F; - this.fish.yRot = this.rotlerp(this.fish.yRot, f1, 90.0F); - this.fish.yBodyRot = this.fish.yRot; + this.fish.setYRot(this.rotlerp(this.fish.getYRot(), f1, 90.0F)); + this.fish.yBodyRot = this.fish.getYRot(); } } else { diff --git a/src/main/java/codyhuh/unusualfishmod/common/item/DepthScytheItem.java b/src/main/java/codyhuh/unusualfishmod/common/item/DepthScytheItem.java index 8d5f6b0..3b43810 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/item/DepthScytheItem.java +++ b/src/main/java/codyhuh/unusualfishmod/common/item/DepthScytheItem.java @@ -1,10 +1,13 @@ package codyhuh.unusualfishmod.common.item; import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.Registries; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.*; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.SwordItem; +import net.minecraft.world.item.Tier; import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; @@ -12,31 +15,26 @@ public class DepthScytheItem extends SwordItem { - public DepthScytheItem(Tier tier, int attackDamageIn, float attackSpeedIn, Properties builderIn) { - super(tier, attackDamageIn, attackSpeedIn, builderIn); + public DepthScytheItem(Tier tier, Properties properties) { + super(tier, properties); } public float getDestroySpeed(ItemStack stack, BlockState state) { if (state.is(Blocks.COBWEB)) { return 15.0F; - } - else { + } else { return super.getDestroySpeed(stack, state); } } public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { - stack.hurtAndBreak(1, attacker, (entity) -> { - entity.broadcastBreakEvent(EquipmentSlot.MAINHAND); - }); + stack.hurtAndBreak(1, attacker, EquipmentSlot.MAINHAND); return true; } public boolean mineBlock(ItemStack stack, Level worldIn, BlockState state, BlockPos pos, LivingEntity entityLiving) { if (state.getDestroySpeed(worldIn, pos) != 0.0F) { - stack.hurtAndBreak(2, entityLiving, (entity) -> { - entity.broadcastBreakEvent(EquipmentSlot.MAINHAND); - }); + stack.hurtAndBreak(2, entityLiving, EquipmentSlot.MAINHAND); } return true; @@ -53,8 +51,8 @@ public void fillItemCategory(CreativeModeTab tab, NonNullList list) { @Override public void onCraftedBy(ItemStack stack, Level level, Player player) { - stack.serializeNBT(); - stack.enchant(Enchantments.SWEEPING_EDGE, 5); + level.holderLookup(Registries.ENCHANTMENT).get(Enchantments.SWEEPING_EDGE).ifPresent(enchant -> stack.enchant(enchant, 5)); + super.onCraftedBy(stack, level, player); } @Override diff --git a/src/main/java/codyhuh/unusualfishmod/common/item/PrismarineSpearItem.java b/src/main/java/codyhuh/unusualfishmod/common/item/PrismarineSpearItem.java index be219de..67359b0 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/item/PrismarineSpearItem.java +++ b/src/main/java/codyhuh/unusualfishmod/common/item/PrismarineSpearItem.java @@ -1,116 +1,156 @@ package codyhuh.unusualfishmod.common.item; import codyhuh.unusualfishmod.common.entity.item.ThrownPrismarineSpear; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.core.Position; +import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; +import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; 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.MoverType; 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.entity.projectile.AbstractArrow; +import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ProjectileItem; import net.minecraft.world.item.UseAnim; -import net.minecraft.world.item.Vanishable; +import net.minecraft.world.item.component.ItemAttributeModifiers; +import net.minecraft.world.item.component.Tool; +import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; +import net.neoforged.neoforge.common.ItemAbilities; +import net.neoforged.neoforge.common.ItemAbility; -public class PrismarineSpearItem extends Item implements Vanishable { - private final Multimap defaultModifiers; +import java.util.List; - public PrismarineSpearItem(Item.Properties p_43381_) { - super(p_43381_); - ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); - builder.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Tool modifier", 5.0D, AttributeModifier.Operation.ADDITION)); - builder.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Tool modifier", -2.9F, AttributeModifier.Operation.ADDITION)); - this.defaultModifiers = builder.build(); +public class PrismarineSpearItem extends Item implements ProjectileItem { + public static final int THROW_THRESHOLD_TIME = 10; + public static final float BASE_DAMAGE = 8.0F; + public static final float SHOOT_POWER = 2.5F; + + public PrismarineSpearItem(Item.Properties properties) { + super(properties); } - public boolean canAttackBlock(BlockState p_43409_, Level p_43410_, BlockPos p_43411_, Player p_43412_) { - return !p_43412_.isCreative(); + public static ItemAttributeModifiers createAttributes() { + return ItemAttributeModifiers.builder().add(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_ID, 8.0F, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND).add(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_ID, -2.9F, AttributeModifier.Operation.ADD_VALUE), EquipmentSlotGroup.MAINHAND).build(); } - public UseAnim getUseAnimation(ItemStack p_43417_) { - return UseAnim.SPEAR; + public static Tool createToolProperties() { + return new Tool(List.of(), 1.0F, 2); } - public int getUseDuration(ItemStack p_43419_) { - return 72000; + private static boolean isTooDamagedToUse(ItemStack stack) { + return stack.getDamageValue() >= stack.getMaxDamage() - 1; } - public void releaseUsing(ItemStack stack, Level level, LivingEntity living, int time) { - if (living instanceof Player player) { - int i = this.getUseDuration(stack) - time; - if (i >= 10) { - if (!level.isClientSide) { + public boolean canAttackBlock(BlockState state, Level level, BlockPos pos, Player player) { + return !player.isCreative(); + } - stack.hurtAndBreak(1, player, (p_43388_) -> { - p_43388_.broadcastBreakEvent(player.getUsedItemHand()); - }); + public UseAnim getUseAnimation(ItemStack stack) { + return UseAnim.SPEAR; + } - ThrownPrismarineSpear spear = new ThrownPrismarineSpear(level, player, stack); - spear.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 2.5F, 1.0F); + public int getUseDuration(ItemStack stack, LivingEntity entity) { + return 72000; + } - if (player.getAbilities().instabuild) { - spear.pickup = AbstractArrow.Pickup.CREATIVE_ONLY; + public void releaseUsing(ItemStack stack, Level level, LivingEntity entityLiving, int timeLeft) { + if (entityLiving instanceof Player player) { + int i = this.getUseDuration(stack, entityLiving) - timeLeft; + if (i >= 10) { + float f = EnchantmentHelper.getTridentSpinAttackStrength(stack, player); + if ((!(f > 0.0F) || player.isInWaterOrRain()) && !isTooDamagedToUse(stack)) { + Holder holder = EnchantmentHelper.pickHighestLevel(stack, EnchantmentEffectComponents.TRIDENT_SOUND).orElse(SoundEvents.TRIDENT_THROW); + if (!level.isClientSide) { + stack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(entityLiving.getUsedItemHand())); + if (f == 0.0F) { + ThrownPrismarineSpear thrownSpear = new ThrownPrismarineSpear(level, player, stack); + thrownSpear.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 2.5F, 1.0F); + if (player.hasInfiniteMaterials()) { + thrownSpear.pickup = AbstractArrow.Pickup.CREATIVE_ONLY; + } + + level.addFreshEntity(thrownSpear); + level.playSound(null, thrownSpear, holder.value(), SoundSource.PLAYERS, 1.0F, 1.0F); + if (!player.hasInfiniteMaterials()) { + player.getInventory().removeItem(stack); + } + } } - level.addFreshEntity(spear); - level.playSound(null, spear, SoundEvents.TRIDENT_THROW, SoundSource.PLAYERS, 1.0F, 1.0F); - - if (!player.getAbilities().instabuild) { - player.getInventory().removeItem(stack); + player.awardStat(Stats.ITEM_USED.get(this)); + if (f > 0.0F) { + float f7 = player.getYRot(); + float f1 = player.getXRot(); + float f2 = -Mth.sin(f7 * ((float) Math.PI / 180F)) * Mth.cos(f1 * ((float) Math.PI / 180F)); + float f3 = -Mth.sin(f1 * ((float) Math.PI / 180F)); + float f4 = Mth.cos(f7 * ((float) Math.PI / 180F)) * Mth.cos(f1 * ((float) Math.PI / 180F)); + float f5 = Mth.sqrt(f2 * f2 + f3 * f3 + f4 * f4); + f2 *= f / f5; + f3 *= f / f5; + f4 *= f / f5; + player.push(f2, f3, f4); + player.startAutoSpinAttack(20, 8.0F, stack); + if (player.onGround()) { + float f6 = 1.1999999F; + player.move(MoverType.SELF, new Vec3(0.0F, 1.1999999F, 0.0F)); + } + + level.playSound(null, player, holder.value(), SoundSource.PLAYERS, 1.0F, 1.0F); } } - - player.awardStat(Stats.ITEM_USED.get(this)); } } + } - public InteractionResultHolder use(Level p_43405_, Player p_43406_, InteractionHand p_43407_) { - ItemStack itemstack = p_43406_.getItemInHand(p_43407_); - if (itemstack.getDamageValue() >= itemstack.getMaxDamage() - 1) { + public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { + ItemStack itemstack = player.getItemInHand(hand); + if (isTooDamagedToUse(itemstack)) { return InteractionResultHolder.fail(itemstack); - } else if (EnchantmentHelper.getRiptide(itemstack) > 0 && !p_43406_.isInWaterOrRain()) { + } else if (EnchantmentHelper.getTridentSpinAttackStrength(itemstack, player) > 0.0F && !player.isInWaterOrRain()) { return InteractionResultHolder.fail(itemstack); } else { - p_43406_.startUsingItem(p_43407_); + player.startUsingItem(hand); return InteractionResultHolder.consume(itemstack); } } - public boolean hurtEnemy(ItemStack p_43390_, LivingEntity p_43391_, LivingEntity p_43392_) { - p_43390_.hurtAndBreak(1, p_43392_, (p_43414_) -> { - p_43414_.broadcastBreakEvent(EquipmentSlot.MAINHAND); - }); + public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { return true; } - public boolean mineBlock(ItemStack p_43399_, Level p_43400_, BlockState p_43401_, BlockPos p_43402_, LivingEntity p_43403_) { - if ((double)p_43401_.getDestroySpeed(p_43400_, p_43402_) != 0.0D) { - p_43399_.hurtAndBreak(2, p_43403_, (p_43385_) -> { - p_43385_.broadcastBreakEvent(EquipmentSlot.MAINHAND); - }); - } + public void postHurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { + stack.hurtAndBreak(1, attacker, EquipmentSlot.MAINHAND); + } - return true; + public int getEnchantmentValue() { + return 1; } - public Multimap getDefaultAttributeModifiers(EquipmentSlot p_43383_) { - return p_43383_ == EquipmentSlot.MAINHAND ? this.defaultModifiers : super.getDefaultAttributeModifiers(p_43383_); + public Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) { + ThrownPrismarineSpear thrownSpear = new ThrownPrismarineSpear(level, pos.x(), pos.y(), pos.z(), stack.copyWithCount(1)); + thrownSpear.pickup = AbstractArrow.Pickup.ALLOWED; + return thrownSpear; } - public int getEnchantmentValue() { - return 1; + public boolean canPerformAction(ItemStack stack, ItemAbility itemAbility) { + return ItemAbilities.DEFAULT_TRIDENT_ACTIONS.contains(itemAbility); } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/common/item/RipsawItem.java b/src/main/java/codyhuh/unusualfishmod/common/item/RipsawItem.java index 71ea9a1..b1ced4b 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/item/RipsawItem.java +++ b/src/main/java/codyhuh/unusualfishmod/common/item/RipsawItem.java @@ -7,7 +7,6 @@ import codyhuh.unusualfishmod.core.registry.UFTags; import codyhuh.unusualfishmod.core.registry.UFTiers; import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.BlockParticleOption; @@ -20,6 +19,7 @@ import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.ProjectileUtil; import net.minecraft.world.item.*; @@ -32,17 +32,23 @@ import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.common.ToolAction; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; // Tree chopping code adapted from Alex's Caves (licensed under GNU GPLv3) -public class RipsawItem extends AxeItem implements Vanishable { +public class RipsawItem extends AxeItem { - public RipsawItem(Properties p_41383_) { - super(UFTiers.RIPPER_SAW, 7.0F, -1.0F, p_41383_); + public RipsawItem(Properties properties) { + super(UFTiers.RIPPER_SAW, properties); + } + + public static EntityHitResult getLookAtEntity(Player player, Level level, double range) { + Vec3 eyePos = player.getEyePosition(1.0F); + Vec3 viewVec = player.getViewVector(1.0F); + Vec3 endVec = eyePos.add(viewVec.x * range, viewVec.y * range, viewVec.z * range); + + return ProjectileUtil.getEntityHitResult(level, player, eyePos, endVec, player.getBoundingBox().inflate(range), e -> e instanceof LivingEntity); } @Override @@ -89,7 +95,7 @@ public boolean isTreePart(LivingEntity player, BlockPos pos) { } @Override - public void appendHoverText(ItemStack p_41421_, @Nullable Level p_41422_, List componentList, TooltipFlag p_41424_) { + public void appendHoverText(ItemStack stack, Item.TooltipContext context, List componentList, TooltipFlag flag) { componentList.add(Component.translatable("tooltip.ripsaw").withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC)); } @@ -102,7 +108,7 @@ public void onUseTick(Level level, LivingEntity user, ItemStack stack, int remai BlockState state = level.getBlockState(blockHitResult.getBlockPos()); BlockPos blockPos = blockHitResult.getBlockPos(); Direction face = blockHitResult.getDirection(); - int i = this.getUseDuration(stack) - remainingUseDuration + 1; + int i = this.getUseDuration(stack, user) - remainingUseDuration + 1; if (state.is(BlockTags.LOGS) && !level.getBlockState(blockPos.below()).is(BlockTags.LOGS)) { List gathered = new ArrayList<>(); @@ -129,7 +135,7 @@ public void onUseTick(Level level, LivingEntity user, ItemStack stack, int remai BlockState moveState = player.level().getBlockState(pos); BlockEntity te = player.level().getBlockEntity(pos); BlockPos offset = pos.subtract(blockPos); - MovingBlockData data = new MovingBlockData(moveState, moveState.getShape(player.level(), pos), offset, te == null ? null : te.saveWithoutMetadata()); + MovingBlockData data = new MovingBlockData(moveState, moveState.getShape(player.level(), pos), offset, te == null ? null : te.saveWithoutMetadata(player.level().registryAccess())); player.level().removeBlockEntity(pos); allData.add(data); } @@ -146,9 +152,7 @@ public void onUseTick(Level level, LivingEntity user, ItemStack stack, int remai fallingTree.setFallDirection(Direction.fromYRot(f)); player.level().addFreshEntity(fallingTree); - stack.hurtAndBreak(allData.stream().filter(e -> e.getState().is(BlockTags.LOGS)).toList().size(), player, (p_40992_) -> { - p_40992_.broadcastBreakEvent(EquipmentSlot.MAINHAND); - }); + stack.hurtAndBreak(1, player, EquipmentSlot.MAINHAND); } } @@ -157,26 +161,18 @@ public void onUseTick(Level level, LivingEntity user, ItemStack stack, int remai if (remainingUseDuration % 15 == 0) { player.playSound(UFSounds.SAWING.get()); } - - EntityHitResult entityResult = getLookAtEntity(player, player.level(), player.getEntityReach() + 1.0D); + EntityHitResult entityResult = getLookAtEntity(player, player.level(), player.getAttributeValue(Attributes.ENTITY_INTERACTION_RANGE) + 1.0D); if (entityResult != null && entityResult.getEntity() instanceof LivingEntity living) { - if (living.hurt(player.damageSources().playerAttack(player), getAttackDamage())) { - stack.hurtAndBreak(1, player, (p_40665_) -> { - p_40665_.broadcastBreakEvent(living.getUsedItemHand()); - }); + if (living.hurt(player.damageSources().playerAttack(player), this.getTier().getAttackDamageBonus())) { + stack.hurtAndBreak(1, player, EquipmentSlot.MAINHAND); } } } } - @Override - public boolean canPerformAction(ItemStack stack, ToolAction toolAction) { - return false; - } - private HitResult calculateHitResult(Player pPlayer) { - return ProjectileUtil.getHitResultOnViewVector(pPlayer, p_281111_ -> !p_281111_.isSpectator() && p_281111_.isPickable(), pPlayer.getBlockReach()); + return ProjectileUtil.getHitResultOnViewVector(pPlayer, p_281111_ -> !p_281111_.isSpectator() && p_281111_.isPickable(), pPlayer.getAttributeValue(Attributes.ENTITY_INTERACTION_RANGE)); } @Override @@ -194,16 +190,8 @@ public InteractionResultHolder use(Level level, Player player, Intera } @Override - public int getUseDuration(ItemStack p_41454_) { + public int getUseDuration(ItemStack stack, LivingEntity entity) { return 72000; } - public static EntityHitResult getLookAtEntity(Player player, Level level, double range) { - Vec3 eyePos = player.getEyePosition(1.0F); - Vec3 viewVec = player.getViewVector(1.0F); - Vec3 endVec = eyePos.add(viewVec.x * range, viewVec.y * range, viewVec.z * range); - - return ProjectileUtil.getEntityHitResult(level, player, eyePos, endVec, player.getBoundingBox().inflate(range), e -> e instanceof LivingEntity); - } - } diff --git a/src/main/java/codyhuh/unusualfishmod/common/item/StargazerItem.java b/src/main/java/codyhuh/unusualfishmod/common/item/StargazerItem.java index ccb6e90..01b479b 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/item/StargazerItem.java +++ b/src/main/java/codyhuh/unusualfishmod/common/item/StargazerItem.java @@ -26,9 +26,9 @@ public InteractionResultHolder use(Level level, Player player, Intera */ var time = level.getDayTime() % 24000; // Correct - var i = Mth.frac((double)time / 24000.0D - 0.25D); // + var i = Mth.frac((double) time / 24000.0D - 0.25D); // var i1 = 0.5D - Math.cos(i * Math.PI) / 2.0D; - var i2 = (float)(i * 2.0D + i1) / 3.0F; + var i2 = (float) (i * 2.0D + i1) / 3.0F; System.out.println("time of day: " + level.getTimeOfDay(1.0F)); diff --git a/src/main/java/codyhuh/unusualfishmod/common/item/UFFishBucketItem.java b/src/main/java/codyhuh/unusualfishmod/common/item/UFFishBucketItem.java index 4aaad0e..4c4012b 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/item/UFFishBucketItem.java +++ b/src/main/java/codyhuh/unusualfishmod/common/item/UFFishBucketItem.java @@ -10,7 +10,7 @@ public class UFFishBucketItem extends MobBucketItem { - public UFFishBucketItem(Supplier> entityType, Supplier fluid, Item item, boolean hasTooltip, Properties builder) { - super(entityType, fluid, () -> SoundEvents.BUCKET_EMPTY_FISH, builder); - } + public UFFishBucketItem(Supplier> entityType, Supplier fluid, Item item, boolean hasTooltip, Properties builder) { + super(entityType.get(), fluid.get(), SoundEvents.BUCKET_EMPTY_FISH, builder); + } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/common/item/WeatherShellItem.java b/src/main/java/codyhuh/unusualfishmod/common/item/WeatherShellItem.java index 76c6d1c..45bd93f 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/item/WeatherShellItem.java +++ b/src/main/java/codyhuh/unusualfishmod/common/item/WeatherShellItem.java @@ -4,6 +4,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; @@ -28,15 +29,13 @@ public void releaseUsing(ItemStack stack, Level level, LivingEntity holder, int if (level instanceof ServerLevel sl) { if (weather.equals("thunder") && !level.getLevelData().isThundering()) { sl.setWeatherParameters(0, 1200, true, true); - stack.hurtAndBreak(1, player, (e) -> e.broadcastBreakEvent(hand)); - } - else if (weather.equals("rain") && !level.getLevelData().isRaining()) { + stack.hurtAndBreak(1, player, EquipmentSlot.MAINHAND); + } else if (weather.equals("rain") && !level.getLevelData().isRaining()) { sl.setWeatherParameters(0, 1200, true, false); - stack.hurtAndBreak(1, player, (e) -> e.broadcastBreakEvent(hand)); - } - else if (weather.equals("clear") && (level.getLevelData().isRaining() || level.getLevelData().isThundering())) { + stack.hurtAndBreak(1, player, EquipmentSlot.MAINHAND); + } else if (weather.equals("clear") && (level.getLevelData().isRaining() || level.getLevelData().isThundering())) { sl.setWeatherParameters(36000, 0, false, false); - stack.hurtAndBreak(1, player, (e) -> e.broadcastBreakEvent(hand)); + stack.hurtAndBreak(1, player, EquipmentSlot.MAINHAND); } } } @@ -48,8 +47,8 @@ public InteractionResultHolder use(Level level, Player player, Intera if (!player.isUsingItem() && !player.getCooldowns().isOnCooldown(stack.getItem())) { player.startUsingItem(hand); - player.playSound(SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(1).get(), 1.0F, 1.0F); - player.getCooldowns().addCooldown(this, getUseDuration(stack)); + player.playSound(SoundEvents.GOAT_HORN_SOUND_VARIANTS.get(1).value(), 1.0F, 1.0F); + player.getCooldowns().addCooldown(this, getUseDuration(stack, player)); } return InteractionResultHolder.success(stack); @@ -61,7 +60,7 @@ public UseAnim getUseAnimation(ItemStack p_41452_) { } @Override - public int getUseDuration(ItemStack p_41454_) { + public int getUseDuration(ItemStack stack, LivingEntity entity) { return 40; } diff --git a/src/main/java/codyhuh/unusualfishmod/common/loot/BuriedTreasureLootModifier.java b/src/main/java/codyhuh/unusualfishmod/common/loot/BuriedTreasureLootModifier.java index 3c25112..7affe4d 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/loot/BuriedTreasureLootModifier.java +++ b/src/main/java/codyhuh/unusualfishmod/common/loot/BuriedTreasureLootModifier.java @@ -1,21 +1,21 @@ package codyhuh.unusualfishmod.common.loot; import codyhuh.unusualfishmod.core.registry.UFItems; -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.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import net.minecraftforge.common.loot.IGlobalLootModifier; -import net.minecraftforge.common.loot.LootModifier; +import net.neoforged.neoforge.common.loot.IGlobalLootModifier; +import net.neoforged.neoforge.common.loot.LootModifier; import org.jetbrains.annotations.NotNull; -import java.util.function.Supplier; - // some code that could be consolidated between these two loot mods...oh well, im lazy! public class BuriedTreasureLootModifier extends LootModifier { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(inst -> codecStart(inst).apply(inst, BuriedTreasureLootModifier::new)); + public BuriedTreasureLootModifier(LootItemCondition[] condition) { super(condition); } @@ -28,11 +28,9 @@ public BuriedTreasureLootModifier(LootItemCondition[] condition) { return generatedLoot; } - public static final Supplier> CODEC = () -> RecordCodecBuilder.create(inst -> codecStart(inst).apply(inst, BuriedTreasureLootModifier::new)); - @Override - public Codec codec() { - return CODEC.get(); + public MapCodec codec() { + return CODEC; } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/common/loot/UnderwaterRuinsLootModifier.java b/src/main/java/codyhuh/unusualfishmod/common/loot/UnderwaterRuinsLootModifier.java index 6b676a0..fd434e0 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/loot/UnderwaterRuinsLootModifier.java +++ b/src/main/java/codyhuh/unusualfishmod/common/loot/UnderwaterRuinsLootModifier.java @@ -1,20 +1,20 @@ package codyhuh.unusualfishmod.common.loot; import codyhuh.unusualfishmod.core.registry.UFItems; -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.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import net.minecraftforge.common.loot.IGlobalLootModifier; -import net.minecraftforge.common.loot.LootModifier; +import net.neoforged.neoforge.common.loot.IGlobalLootModifier; +import net.neoforged.neoforge.common.loot.LootModifier; import org.jetbrains.annotations.NotNull; -import java.util.function.Supplier; - public class UnderwaterRuinsLootModifier extends LootModifier { + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(inst -> codecStart(inst).apply(inst, UnderwaterRuinsLootModifier::new)); + public UnderwaterRuinsLootModifier(LootItemCondition[] condition) { super(condition); } @@ -27,11 +27,9 @@ public UnderwaterRuinsLootModifier(LootItemCondition[] condition) { return generatedLoot; } - public static final Supplier> CODEC = () -> RecordCodecBuilder.create(inst -> codecStart(inst).apply(inst, UnderwaterRuinsLootModifier::new)); - @Override - public Codec codec() { - return CODEC.get(); + public MapCodec codec() { + return CODEC; } } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/common/loot/UnusualCatchLootModifier.java b/src/main/java/codyhuh/unusualfishmod/common/loot/UnusualCatchLootModifier.java index 90e2014..a14c164 100644 --- a/src/main/java/codyhuh/unusualfishmod/common/loot/UnusualCatchLootModifier.java +++ b/src/main/java/codyhuh/unusualfishmod/common/loot/UnusualCatchLootModifier.java @@ -2,54 +2,59 @@ import codyhuh.unusualfishmod.core.registry.UFEnchantments; import codyhuh.unusualfishmod.core.registry.UFTags; -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.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; 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.LootContextParams; import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; -import net.minecraftforge.common.Tags; -import net.minecraftforge.common.loot.IGlobalLootModifier; -import net.minecraftforge.common.loot.LootModifier; -import net.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.common.Tags; +import net.neoforged.neoforge.common.loot.IGlobalLootModifier; +import net.neoforged.neoforge.common.loot.LootModifier; import org.jetbrains.annotations.NotNull; -import java.util.function.Supplier; +import java.util.List; public class UnusualCatchLootModifier extends LootModifier { - public UnusualCatchLootModifier(LootItemCondition[] condition) { - super(condition); + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(inst -> codecStart(inst).apply(inst, UnusualCatchLootModifier::new)); + + public UnusualCatchLootModifier(LootItemCondition[] conditions) { + super(conditions); } @Override protected @NotNull ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { - var items = ForgeRegistries.ITEMS.tags().getTag(UFTags.UNUSUAL_CATCH_ITEMS).stream().toList(); - int size = items.size(); + List items = BuiltInRegistries.ITEM.getTag(UFTags.UNUSUAL_CATCH_ITEMS).map(holderSet -> holderSet.stream().map(ItemStack::new).toList()).orElse(List.of()); - ObjectArrayList ret = new ObjectArrayList<>(); + if (items.isEmpty()) { + return generatedLoot; + } ItemStack stack = context.getParamOrNull(LootContextParams.TOOL); - if (stack != null) { - int i = EnchantmentHelper.getTagEnchantmentLevel(UFEnchantments.UNUSUAL_CATCH.get(), stack); - - if (stack.is(Tags.Items.TOOLS_FISHING_RODS) && i > 0) { - ret.add(new ItemStack(items.get(context.getRandom().nextInt(size)))); - } - else { - ret = generatedLoot; + Holder.Reference unusualCatch = context.getLevel().holderLookup(Registries.ENCHANTMENT).get(UFEnchantments.UNUSUAL_CATCH).orElse(null); + if (unusualCatch != null) { + int enchantmentLevel = EnchantmentHelper.getTagEnchantmentLevel(unusualCatch, stack); + if (stack.is(Tags.Items.TOOLS_FISHING_ROD) && enchantmentLevel > 0) { + ObjectArrayList ret = new ObjectArrayList<>(); + ret.add(items.get(context.getRandom().nextInt(items.size()))); + return ret; + } } } - return ret; - } - public static final Supplier> CODEC = () -> RecordCodecBuilder.create(inst -> codecStart(inst).apply(inst, UnusualCatchLootModifier::new)); + return generatedLoot; + } @Override - public Codec codec() { - return CODEC.get(); + public MapCodec codec() { + return CODEC; } +} -} \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFBlockEntities.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFBlockEntities.java index 7db0d3d..47cf561 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFBlockEntities.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFBlockEntities.java @@ -3,14 +3,14 @@ import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.common.block_entity.SeaBoomBlockEntity; import codyhuh.unusualfishmod.common.block_entity.VoltDetectorBlockEntity; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; public class UFBlockEntities { - public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, UnusualFishMod.MOD_ID); + public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(BuiltInRegistries.BLOCK_ENTITY_TYPE, UnusualFishMod.MOD_ID); - public static final RegistryObject> VOLT_DETECTOR = BLOCK_ENTITIES.register("volt_detector", () -> BlockEntityType.Builder.of(VoltDetectorBlockEntity::new, UFBlocks.VOLT_DETECTOR.get()).build(null)); - public static final RegistryObject> SEA_BOOM = BLOCK_ENTITIES.register("sea_boom", () -> BlockEntityType.Builder.of(SeaBoomBlockEntity::new, UFBlocks.SEA_BOOM.get()).build(null)); + public static final DeferredHolder, BlockEntityType> VOLT_DETECTOR = BLOCK_ENTITIES.register("volt_detector", () -> BlockEntityType.Builder.of(VoltDetectorBlockEntity::new, UFBlocks.VOLT_DETECTOR.get()).build(null)); + public static final DeferredHolder, BlockEntityType> SEA_BOOM = BLOCK_ENTITIES.register("sea_boom", () -> BlockEntityType.Builder.of(SeaBoomBlockEntity::new, UFBlocks.SEA_BOOM.get()).build(null)); } \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFBlocks.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFBlocks.java index 649d210..9593b41 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFBlocks.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFBlocks.java @@ -3,54 +3,54 @@ import codyhuh.unusualfishmod.UnusualFishMod; import codyhuh.unusualfishmod.common.block.*; import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.registries.DeferredBlock; +import net.neoforged.neoforge.registries.DeferredItem; +import net.neoforged.neoforge.registries.DeferredRegister; import java.util.function.Supplier; public final class UFBlocks { - public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, UnusualFishMod.MOD_ID); - - public static final RegistryObject VOLT_DETECTOR = registerBlock("volt_detector", () -> new VoltDetectorBlock(BlockBehaviour.Properties.copy(Blocks.COPPER_BLOCK).sound(SoundType.METAL).randomTicks().lightLevel(state -> 10))); - public static final RegistryObject NAUTICAL_LAMP = registerBlock("nautical_lamp", () -> new NauticalLampBlock(BlockBehaviour.Properties.copy(Blocks.LANTERN))); - public static final RegistryObject SEA_BOOM = registerBlock("sea_boom", () -> new SeaBoomBlock(BlockBehaviour.Properties.copy(Blocks.PRISMARINE).sound(SoundType.METAL).randomTicks())); - public static final RegistryObject CRIMSON_EGGS = registerBlock("crimson_eggs", () -> new SquidEggsBlock(UFEntities.CRIMSONSHELL_SQUID::get, BlockBehaviour.Properties.copy(Blocks.FROGSPAWN))); - public static final RegistryObject RELUCENT_EGGS = registerBlock("relucent_eggs", () -> new SquidEggsBlock(UFEntities.TRUMPET_SQUID::get, BlockBehaviour.Properties.copy(Blocks.FROGSPAWN))); - public static final RegistryObject COPPER_ANTENNA = registerBlock("copper_antenna", () -> new CopperAntennaBlock(BlockBehaviour.Properties.copy(Blocks.LIGHTNING_ROD))); - - public static final RegistryObject CHISELED_CRIMSON_BRICKS = registerBlock("chiseled_crimson_bricks", () -> new Block(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject CRIMSON_BRICKS = registerBlock("crimson_bricks", () -> new Block(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject CRIMSON_BRICK_STAIRS = registerBlock("crimson_brick_stairs", () -> new StairBlock(() -> CRIMSON_BRICKS.get().defaultBlockState(), BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject CRIMSON_BRICK_SLAB = registerBlock("crimson_brick_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject CRIMSON_BRICK_WALL = registerBlock("crimson_brick_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject CRIMSON_TILES = registerBlock("crimson_tiles", () -> new Block(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject CRIMSON_TILE_STAIRS = registerBlock("crimson_tile_stairs", () -> new StairBlock(() -> CRIMSON_TILES.get().defaultBlockState(), BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject CRIMSON_TILE_SLAB = registerBlock("crimson_tile_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject CRIMSON_TILE_WALL = registerBlock("crimson_tile_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - - public static final RegistryObject CHISELED_RELUCENT_BRICKS = registerBlock("chiseled_relucent_bricks", () -> new Block(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject RELUCENT_BRICKS = registerBlock("relucent_bricks", () -> new Block(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject RELUCENT_BRICK_STAIRS = registerBlock("relucent_brick_stairs", () -> new StairBlock(() -> RELUCENT_BRICKS.get().defaultBlockState(), BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject RELUCENT_BRICK_SLAB = registerBlock("relucent_brick_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject RELUCENT_BRICK_WALL = registerBlock("relucent_brick_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject RELUCENT_TILES = registerBlock("relucent_tiles", () -> new Block(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject RELUCENT_TILE_STAIRS = registerBlock("relucent_tile_stairs", () -> new StairBlock(() -> RELUCENT_TILES.get().defaultBlockState(), BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject RELUCENT_TILE_SLAB = registerBlock("relucent_tile_slab", () -> new SlabBlock(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - public static final RegistryObject RELUCENT_TILE_WALL = registerBlock("relucent_tile_wall", () -> new WallBlock(BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS))); - - private static RegistryObject registerBlock(String name, Supplier block) { - RegistryObject toReturn = BLOCKS.register(name, block); + public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(UnusualFishMod.MOD_ID); + + public static final DeferredBlock VOLT_DETECTOR = registerBlock("volt_detector", () -> new VoltDetectorBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.COPPER_BLOCK).sound(SoundType.METAL).randomTicks().lightLevel(state -> 10))); + + public static final DeferredBlock NAUTICAL_LAMP = registerBlock("nautical_lamp", () -> new NauticalLampBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.LANTERN))); + public static final DeferredBlock SEA_BOOM = registerBlock("sea_boom", () -> new SeaBoomBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.PRISMARINE).sound(SoundType.METAL).randomTicks())); + public static final DeferredBlock CRIMSON_EGGS = registerBlock("crimson_eggs", () -> new SquidEggsBlock(UFEntities.CRIMSONSHELL_SQUID::get, BlockBehaviour.Properties.ofFullCopy(Blocks.FROGSPAWN))); + public static final DeferredBlock RELUCENT_EGGS = registerBlock("relucent_eggs", () -> new SquidEggsBlock(UFEntities.TRUMPET_SQUID::get, BlockBehaviour.Properties.ofFullCopy(Blocks.FROGSPAWN))); + public static final DeferredBlock COPPER_ANTENNA = registerBlock("copper_antenna", () -> new CopperAntennaBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.LIGHTNING_ROD))); + + public static final DeferredBlock CHISELED_CRIMSON_BRICKS = registerBlock("chiseled_crimson_bricks", () -> new Block(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock CRIMSON_BRICKS = registerBlock("crimson_bricks", () -> new Block(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock CRIMSON_BRICK_STAIRS = registerBlock("crimson_brick_stairs", () -> new StairBlock(UFBlocks.CRIMSON_BRICKS.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock CRIMSON_BRICK_SLAB = registerBlock("crimson_brick_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock CRIMSON_BRICK_WALL = registerBlock("crimson_brick_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock CRIMSON_TILES = registerBlock("crimson_tiles", () -> new Block(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock CRIMSON_TILE_STAIRS = registerBlock("crimson_tile_stairs", () -> new StairBlock(UFBlocks.CRIMSON_TILES.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock CRIMSON_TILE_SLAB = registerBlock("crimson_tile_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock CRIMSON_TILE_WALL = registerBlock("crimson_tile_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + + public static final DeferredBlock CHISELED_RELUCENT_BRICKS = registerBlock("chiseled_relucent_bricks", () -> new Block(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock RELUCENT_BRICKS = registerBlock("relucent_bricks", () -> new Block(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock RELUCENT_BRICK_STAIRS = registerBlock("relucent_brick_stairs", () -> new StairBlock(UFBlocks.RELUCENT_BRICKS.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock RELUCENT_BRICK_SLAB = registerBlock("relucent_brick_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock RELUCENT_BRICK_WALL = registerBlock("relucent_brick_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock RELUCENT_TILES = registerBlock("relucent_tiles", () -> new Block(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock RELUCENT_TILE_STAIRS = registerBlock("relucent_tile_stairs", () -> new StairBlock(UFBlocks.RELUCENT_TILES.get().defaultBlockState(), BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock RELUCENT_TILE_SLAB = registerBlock("relucent_tile_slab", () -> new SlabBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + public static final DeferredBlock RELUCENT_TILE_WALL = registerBlock("relucent_tile_wall", () -> new WallBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS))); + + private static DeferredBlock registerBlock(String name, Supplier block) { + DeferredBlock toReturn = BLOCKS.register(name, block); registerBlockItem(name, toReturn); return toReturn; } - private static RegistryObject registerBlockItem(String name, RegistryObject block) { + private static DeferredItem registerBlockItem(String name, DeferredBlock block) { return UFItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties())); } diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFEnchantments.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFEnchantments.java index 9e8d93c..3a91558 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFEnchantments.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFEnchantments.java @@ -1,15 +1,11 @@ package codyhuh.unusualfishmod.core.registry; import codyhuh.unusualfishmod.UnusualFishMod; -import codyhuh.unusualfishmod.common.enchantment.UnusualCatchEnchantment; -import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; public class UFEnchantments { - public static final DeferredRegister ENCHANTMENTS = DeferredRegister.create(ForgeRegistries.ENCHANTMENTS, UnusualFishMod.MOD_ID); - - public static final RegistryObject UNUSUAL_CATCH = ENCHANTMENTS.register("unusual_catch", () -> new UnusualCatchEnchantment(Enchantment.Rarity.UNCOMMON, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND)); + public static final ResourceKey UNUSUAL_CATCH = ResourceKey.create(Registries.ENCHANTMENT, ResourceLocation.fromNamespaceAndPath(UnusualFishMod.MOD_ID, "unusual_catch")); } diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFEntities.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFEntities.java index 893f0b1..8fb2bc2 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFEntities.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFEntities.java @@ -6,77 +6,76 @@ import codyhuh.unusualfishmod.common.entity.item.FallingTreeBlockEntity; import codyhuh.unusualfishmod.common.entity.item.SeaSpike; import codyhuh.unusualfishmod.common.entity.item.ThrownPrismarineSpear; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; public class UFEntities { - public static final DeferredRegister> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, UnusualFishMod.MOD_ID); + public static final DeferredRegister> ENTITIES = DeferredRegister.create(BuiltInRegistries.ENTITY_TYPE, UnusualFishMod.MOD_ID); - // Living - public static final RegistryObject> DUALITY_DAMSELFISH = ENTITIES.register("duality_damselfish", () -> EntityType.Builder.of(DualityDamselfish::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.5f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "duality_damselfish").toString())); - public static final RegistryObject> MOSSTHORN = ENTITIES.register("mossthorn", () -> EntityType.Builder.of(Mossthorn::new, MobCategory.UNDERGROUND_WATER_CREATURE).sized(0.8f, 1.0f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "mossthorn").toString())); - public static final RegistryObject> RIPPER = ENTITIES.register("ripper", () -> EntityType.Builder.of(Ripper::new, MobCategory.WATER_CREATURE).sized(0.9f, 0.6f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "ripper").toString())); - public static final RegistryObject> SPINDLEFISH = ENTITIES.register("spindlefish", () -> EntityType.Builder.of(Spindlefish::new, MobCategory.WATER_AMBIENT).sized(0.6f, 0.7f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "spindlefish").toString())); - public static final RegistryObject> RHINO_TETRA = ENTITIES.register("rhino_tetra", () -> EntityType.Builder.of(RhinoTetra::new, MobCategory.WATER_AMBIENT).sized(1.0f, 0.8f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "rhino_tetra").toString())); - public static final RegistryObject> DROOPING_GOURAMI = ENTITIES.register("drooping_gourami", () -> EntityType.Builder.of(DroopingGourami::new, MobCategory.WATER_AMBIENT).sized(0.3f, 0.3f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "drooping_gourami").toString())); - public static final RegistryObject> SAILOR_BARB = ENTITIES.register("sailor_barb", () -> EntityType.Builder.of(SailorBarb::new, MobCategory.WATER_AMBIENT).sized(0.3f, 0.3f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "sailor_barb").toString())); - public static final RegistryObject> SEA_SPIDER = ENTITIES.register("sea_spider", () -> EntityType.Builder.of(SeaSpider::new, MobCategory.WATER_AMBIENT).sized(0.9f, 0.9f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "sea_spider").toString())); - public static final RegistryObject> TRIPLE_TWIRL_PLECO = ENTITIES.register("triple_twirl_pleco", () -> EntityType.Builder.of(TripleTwirlPleco::new, MobCategory.WATER_AMBIENT).sized(0.75f, 0.45f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "triple_twirl_pleco").toString())); - public static final RegistryObject> AERO_MONO = ENTITIES.register("aero_mono", () -> EntityType.Builder.of(AeroMono::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.5f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "aero_mono").toString())); - public static final RegistryObject> CLOWNTHORN_SHARK = ENTITIES.register("clownthorn_shark", () -> EntityType.Builder.of(ClownthornShark::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.6f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "clownthorn_shark").toString())); - public static final RegistryObject> ROUGHBACK = ENTITIES.register("roughback_guitarfish", () -> EntityType.Builder.of(RoughbackGuitarfish::new, MobCategory.WATER_CREATURE).sized(1.0f, 0.3f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "roughback_guitarfish").toString())); - public static final RegistryObject> SEA_PANCAKE = ENTITIES.register("sea_pancake", () -> EntityType.Builder.of(SeaPancake::new, MobCategory.WATER_CREATURE).sized(3.0f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "sea_pancake").toString())); - public static final RegistryObject> PINKFIN = ENTITIES.register("pinkfin", () -> EntityType.Builder.of(PinkfinIdol::new, MobCategory.WATER_CREATURE).sized(1.0f, 1.8f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "pinkfin").toString())); - public static final RegistryObject> BRICK_SNAIL = ENTITIES.register("brick_snail", () -> EntityType.Builder.of(BrickSnail::new, MobCategory.WATER_AMBIENT).sized(0.3f, 0.3f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "brick_snail").toString())); - public static final RegistryObject> ZEBRA_CORNETFISH = ENTITIES.register("zebra_cornetfish", () -> EntityType.Builder.of(ZebraCornetfish::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.3f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "zebra_cornetfish").toString())); - public static final RegistryObject> TIGER_PUFFER = ENTITIES.register("tiger_puffer", () -> EntityType.Builder.of(TigerPuffer::new, MobCategory.WATER_CREATURE).sized(0.8f, 0.8f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "tiger_puffer").toString())); - public static final RegistryObject> BLACKCAP_SNAIL = ENTITIES.register("blackcap_snail", () -> EntityType.Builder.of(BlackCapSnail::new, MobCategory.WATER_AMBIENT).sized(0.3f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "blackcap_snail").toString())); - public static final RegistryObject> SNEEPSNORP = ENTITIES.register("sneep_snorp", () -> EntityType.Builder.of(SneepSnorp::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "sneep_snorp").toString())); - public static final RegistryObject> DEEP_CRAWLER = ENTITIES.register("deep_crawler", () -> EntityType.Builder.of(DeepCrawler::new, MobCategory.WATER_CREATURE).sized(0.9f, 0.5f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "deep_crawler").toString())); - public static final RegistryObject> WIZARD_JELLY = ENTITIES.register("wizard_jelly", () -> EntityType.Builder.of(ManaJellyfish::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.5f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "wizard_jelly").toString())); - public static final RegistryObject> PORCUPINE_LOBSTA = ENTITIES.register("porcupine_lobsta", () -> EntityType.Builder.of(PorcupineLobster::new, MobCategory.WATER_CREATURE).sized(0.5f, 0.6f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "porcupine_lobsta").toString())); - public static final RegistryObject> TRUMPET_SQUID = ENTITIES.register("trumpet_squid", () -> EntityType.Builder.of(TrumpetSquid::new, MobCategory.WATER_CREATURE).sized(1.5f, 0.6f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "trumpet_squid").toString())); - public static final RegistryObject> FRESHWATER_MANTIS = ENTITIES.register("freshwater_mantis", () -> EntityType.Builder.of(FreshwaterMantis::new, MobCategory.WATER_CREATURE).sized(0.5f, 0.6f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "freshwater_mantis").toString())); - public static final RegistryObject> BARK_ANGELFISH = ENTITIES.register("bark_angelfish", () -> EntityType.Builder.of(BarkAngelfish::new, MobCategory.WATER_AMBIENT).sized(0.2f, 0.2f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "bark_angelfish").toString())); - public static final RegistryObject> SHOCKCAT = ENTITIES.register("shockcat", () -> EntityType.Builder.of(Shockcat::new, MobCategory.WATER_CREATURE).sized(0.5f, 0.7f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "shockcat").toString())); - public static final RegistryObject> MUDDYTOP_SNAIL = ENTITIES.register("muddytop", () -> EntityType.Builder.of(MuddytopSnail::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.6f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "muddytop").toString())); - public static final RegistryObject> KALAPPA = ENTITIES.register("kalappa", () -> EntityType.Builder.of(Kalappa::new, MobCategory.CREATURE).sized(1.8f, 1.8f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "kalappa").toString())); - public static final RegistryObject> LOBED_SKIPPER = ENTITIES.register("skipper", () -> EntityType.Builder.of(LobedSkipper::new, MobCategory.CREATURE).sized(0.5f, 0.6f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "skipper").toString())); - public static final RegistryObject> STOUT_BICHIR = ENTITIES.register("stout_bichir", () -> EntityType.Builder.of(StoutBichir::new, MobCategory.WATER_CREATURE).sized(1.0f, 0.7f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "stout_bichir").toString())); - public static final RegistryObject> BEAKED_HERRING = ENTITIES.register("beaked_herring", () -> EntityType.Builder.of(BeakedHerring::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.3f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "beaked_herring").toString())); - public static final RegistryObject> PICKLEFISH = ENTITIES.register("picklefish", () -> EntityType.Builder.of(Picklefish::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "picklefish").toString())); - public static final RegistryObject> BLIND_SAILFIN = ENTITIES.register("blindsailfin", () -> EntityType.Builder.of(BlindSailfin::new, MobCategory.WATER_AMBIENT).sized(0.6f, 0.5f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "blindsailfin").toString())); - public static final RegistryObject> DEMON_HERRING = ENTITIES.register("demon_herring", () -> EntityType.Builder.of(DemonHerring::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "demon_herring").toString())); - public static final RegistryObject> AMBER_GOBY = ENTITIES.register("amber_goby", () -> EntityType.Builder.of(AmberGoby::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "amber_goby").toString())); - public static final RegistryObject> HATCHET_FISH = ENTITIES.register("hatchet_fish", () -> EntityType.Builder.of(HatchetFish::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "hatchet_fish").toString())); - public static final RegistryObject> COPPERFLAME = ENTITIES.register("copperflame", () -> EntityType.Builder.of(CopperflameAnthias::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "copperflame").toString())); - public static final RegistryObject> ROOTBALL = ENTITIES.register("rootball", () -> EntityType.Builder.of(Rootball::new, MobCategory.MONSTER).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "rootball").toString())); - public static final RegistryObject> CELESTIAL_FISH = ENTITIES.register("celestial", () -> EntityType.Builder.of(CelestialFish::new, MobCategory.WATER_CREATURE).sized(1.0f, 1.8f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "celestial").toString())); - public static final RegistryObject> GNASHER = ENTITIES.register("gnasher", () -> EntityType.Builder.of(Gnasher::new, MobCategory.WATER_CREATURE).sized(1.5f, 0.8f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "gnasher").toString())); - public static final RegistryObject> PRAWN = ENTITIES.register("prawn", () -> EntityType.Builder.of(Prawn::new, MobCategory.MONSTER).sized(1.5f, 1.2f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "prawn").toString())); - public static final RegistryObject> SQUODDLE = ENTITIES.register("squoddle", () -> EntityType.Builder.of(Squoddle::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "squoddle").toString())); - public static final RegistryObject> SEA_MOSQUITO = ENTITIES.register("sea_mosquito", () -> EntityType.Builder.of(SeaMosquito::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "sea_mosquito").toString())); - public static final RegistryObject> FORKFISH = ENTITIES.register("forkfish", () -> EntityType.Builder.of(Forkfish::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "forkfish").toString())); - public static final RegistryObject> SPOON_SHARK = ENTITIES.register("spoon_shark", () -> EntityType.Builder.of(SpoonShark::new, MobCategory.WATER_CREATURE).sized(1.1f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "spoon_shark").toString())); - public static final RegistryObject> CORAL_SKRIMP = ENTITIES.register("coral_skrimp", () -> EntityType.Builder.of(Skrimp::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "coral_skrimp").toString())); - public static final RegistryObject> CIRCUS_FISH = ENTITIES.register("circus", () -> EntityType.Builder.of(CircusFish::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.8f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "circus").toString())); - public static final RegistryObject> BLIZZARDFIN_TUNA = ENTITIES.register("blizzardfin", () -> EntityType.Builder.of(BlizzardfinTuna::new, MobCategory.WATER_CREATURE).sized(0.8f, 0.8f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "blizzardfin").toString())); - public static final RegistryObject> SNOWFLAKE = ENTITIES.register("snowflaketail", () -> EntityType.Builder.of(SnowflakeTailFish::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "snowflaketail").toString())); - public static final RegistryObject> EYELASH = ENTITIES.register("eyelash", () -> EntityType.Builder.of(EyelashFish::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "eyelash").toString())); - public static final RegistryObject> TIGER_JUNGLE_SHARK = ENTITIES.register("jungleshark", () -> EntityType.Builder.of(TigerJungleShark::new, MobCategory.WATER_CREATURE).sized(0.8f, 0.4f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "jungleshark").toString())); - public static final RegistryObject> CRIMSONSHELL_SQUID = ENTITIES.register("crimsonshell", () -> EntityType.Builder.of(CrimsonshellSquid::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.6f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "crimsonshell").toString())); - public static final RegistryObject> VOLT_ANGLER = ENTITIES.register("volt_angler", () -> EntityType.Builder.of(VoltAngler::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.6f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "volt_angler").toString())); - public static final RegistryObject> TRIBBLE = ENTITIES.register("tribble", () -> EntityType.Builder.of(Tribble::new, MobCategory.WATER_CREATURE).sized(0.8f, 0.2f).build(new ResourceLocation(UnusualFishMod.MOD_ID, "tribble").toString())); + // Living + public static final DeferredHolder, EntityType> DUALITY_DAMSELFISH = ENTITIES.register("duality_damselfish", () -> EntityType.Builder.of(DualityDamselfish::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.5f).build("duality_damselfish")); + public static final DeferredHolder, EntityType> MOSSTHORN = ENTITIES.register("mossthorn", () -> EntityType.Builder.of(Mossthorn::new, MobCategory.UNDERGROUND_WATER_CREATURE).sized(0.8f, 1.0f).build("mossthorn")); + public static final DeferredHolder, EntityType> RIPPER = ENTITIES.register("ripper", () -> EntityType.Builder.of(Ripper::new, MobCategory.WATER_CREATURE).sized(0.9f, 0.6f).build("ripper")); + public static final DeferredHolder, EntityType> SPINDLEFISH = ENTITIES.register("spindlefish", () -> EntityType.Builder.of(Spindlefish::new, MobCategory.WATER_AMBIENT).sized(0.6f, 0.7f).build("spindlefish")); + public static final DeferredHolder, EntityType> RHINO_TETRA = ENTITIES.register("rhino_tetra", () -> EntityType.Builder.of(RhinoTetra::new, MobCategory.WATER_AMBIENT).sized(1.0f, 0.8f).build("rhino_tetra")); + public static final DeferredHolder, EntityType> DROOPING_GOURAMI = ENTITIES.register("drooping_gourami", () -> EntityType.Builder.of(DroopingGourami::new, MobCategory.WATER_AMBIENT).sized(0.3f, 0.3f).build("drooping_gourami")); + public static final DeferredHolder, EntityType> SAILOR_BARB = ENTITIES.register("sailor_barb", () -> EntityType.Builder.of(SailorBarb::new, MobCategory.WATER_AMBIENT).sized(0.3f, 0.3f).build("sailor_barb")); + public static final DeferredHolder, EntityType> SEA_SPIDER = ENTITIES.register("sea_spider", () -> EntityType.Builder.of(SeaSpider::new, MobCategory.WATER_AMBIENT).sized(0.9f, 0.9f).build("sea_spider")); + public static final DeferredHolder, EntityType> TRIPLE_TWIRL_PLECO = ENTITIES.register("triple_twirl_pleco", () -> EntityType.Builder.of(TripleTwirlPleco::new, MobCategory.WATER_AMBIENT).sized(0.75f, 0.45f).build("triple_twirl_pleco")); + public static final DeferredHolder, EntityType> AERO_MONO = ENTITIES.register("aero_mono", () -> EntityType.Builder.of(AeroMono::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.5f).build("aero_mono")); + public static final DeferredHolder, EntityType> CLOWNTHORN_SHARK = ENTITIES.register("clownthorn_shark", () -> EntityType.Builder.of(ClownthornShark::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.6f).build("clownthorn_shark")); + public static final DeferredHolder, EntityType> ROUGHBACK = ENTITIES.register("roughback_guitarfish", () -> EntityType.Builder.of(RoughbackGuitarfish::new, MobCategory.WATER_CREATURE).sized(1.0f, 0.3f).build("roughback_guitarfish")); + public static final DeferredHolder, EntityType> SEA_PANCAKE = ENTITIES.register("sea_pancake", () -> EntityType.Builder.of(SeaPancake::new, MobCategory.WATER_CREATURE).sized(3.0f, 0.4f).build("sea_pancake")); + public static final DeferredHolder, EntityType> PINKFIN = ENTITIES.register("pinkfin", () -> EntityType.Builder.of(PinkfinIdol::new, MobCategory.WATER_CREATURE).sized(1.0f, 1.8f).build("pinkfin")); + public static final DeferredHolder, EntityType> BRICK_SNAIL = ENTITIES.register("brick_snail", () -> EntityType.Builder.of(BrickSnail::new, MobCategory.WATER_AMBIENT).sized(0.3f, 0.3f).build("brick_snail")); + public static final DeferredHolder, EntityType> ZEBRA_CORNETFISH = ENTITIES.register("zebra_cornetfish", () -> EntityType.Builder.of(ZebraCornetfish::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.3f).build("zebra_cornetfish")); + public static final DeferredHolder, EntityType> TIGER_PUFFER = ENTITIES.register("tiger_puffer", () -> EntityType.Builder.of(TigerPuffer::new, MobCategory.WATER_CREATURE).sized(0.8f, 0.8f).build("tiger_puffer")); + public static final DeferredHolder, EntityType> BLACKCAP_SNAIL = ENTITIES.register("blackcap_snail", () -> EntityType.Builder.of(BlackCapSnail::new, MobCategory.WATER_AMBIENT).sized(0.3f, 0.4f).build("blackcap_snail")); + public static final DeferredHolder, EntityType> SNEEPSNORP = ENTITIES.register("sneep_snorp", () -> EntityType.Builder.of(SneepSnorp::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.4f).build("sneep_snorp")); + public static final DeferredHolder, EntityType> DEEP_CRAWLER = ENTITIES.register("deep_crawler", () -> EntityType.Builder.of(DeepCrawler::new, MobCategory.WATER_CREATURE).sized(0.9f, 0.5f).build("deep_crawler")); + public static final DeferredHolder, EntityType> WIZARD_JELLY = ENTITIES.register("wizard_jelly", () -> EntityType.Builder.of(ManaJellyfish::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.5f).build("wizard_jelly")); + public static final DeferredHolder, EntityType> PORCUPINE_LOBSTA = ENTITIES.register("porcupine_lobsta", () -> EntityType.Builder.of(PorcupineLobster::new, MobCategory.WATER_CREATURE).sized(0.5f, 0.6f).build("porcupine_lobsta")); + public static final DeferredHolder, EntityType> TRUMPET_SQUID = ENTITIES.register("trumpet_squid", () -> EntityType.Builder.of(TrumpetSquid::new, MobCategory.WATER_CREATURE).sized(1.5f, 0.6f).build("trumpet_squid")); + public static final DeferredHolder, EntityType> FRESHWATER_MANTIS = ENTITIES.register("freshwater_mantis", () -> EntityType.Builder.of(FreshwaterMantis::new, MobCategory.WATER_CREATURE).sized(0.5f, 0.6f).build("freshwater_mantis")); + public static final DeferredHolder, EntityType> BARK_ANGELFISH = ENTITIES.register("bark_angelfish", () -> EntityType.Builder.of(BarkAngelfish::new, MobCategory.WATER_AMBIENT).sized(0.2f, 0.2f).build("bark_angelfish")); + public static final DeferredHolder, EntityType> SHOCKCAT = ENTITIES.register("shockcat", () -> EntityType.Builder.of(Shockcat::new, MobCategory.WATER_CREATURE).sized(0.5f, 0.7f).build("shockcat")); + public static final DeferredHolder, EntityType> MUDDYTOP_SNAIL = ENTITIES.register("muddytop", () -> EntityType.Builder.of(MuddytopSnail::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.6f).build("muddytop")); + public static final DeferredHolder, EntityType> KALAPPA = ENTITIES.register("kalappa", () -> EntityType.Builder.of(Kalappa::new, MobCategory.CREATURE).sized(1.8f, 1.8f).build("kalappa")); + public static final DeferredHolder, EntityType> LOBED_SKIPPER = ENTITIES.register("skipper", () -> EntityType.Builder.of(LobedSkipper::new, MobCategory.CREATURE).sized(0.5f, 0.6f).eyeHeight(0.2F * 0.6f).build("skipper")); + public static final DeferredHolder, EntityType> STOUT_BICHIR = ENTITIES.register("stout_bichir", () -> EntityType.Builder.of(StoutBichir::new, MobCategory.WATER_CREATURE).sized(1.0f, 0.7f).build("stout_bichir")); + public static final DeferredHolder, EntityType> BEAKED_HERRING = ENTITIES.register("beaked_herring", () -> EntityType.Builder.of(BeakedHerring::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.3f).build("beaked_herring")); + public static final DeferredHolder, EntityType> PICKLEFISH = ENTITIES.register("picklefish", () -> EntityType.Builder.of(Picklefish::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build("picklefish")); + public static final DeferredHolder, EntityType> BLIND_SAILFIN = ENTITIES.register("blindsailfin", () -> EntityType.Builder.of(BlindSailfin::new, MobCategory.WATER_AMBIENT).sized(0.6f, 0.5f).build("blindsailfin")); + public static final DeferredHolder, EntityType> DEMON_HERRING = ENTITIES.register("demon_herring", () -> EntityType.Builder.of(DemonHerring::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build("demon_herring")); + public static final DeferredHolder, EntityType> AMBER_GOBY = ENTITIES.register("amber_goby", () -> EntityType.Builder.of(AmberGoby::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build("amber_goby")); + public static final DeferredHolder, EntityType> HATCHET_FISH = ENTITIES.register("hatchet_fish", () -> EntityType.Builder.of(HatchetFish::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build("hatchet_fish")); + public static final DeferredHolder, EntityType> COPPERFLAME = ENTITIES.register("copperflame", () -> EntityType.Builder.of(CopperflameAnthias::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build("copperflame")); + public static final DeferredHolder, EntityType> ROOTBALL = ENTITIES.register("rootball", () -> EntityType.Builder.of(Rootball::new, MobCategory.MONSTER).sized(0.5f, 0.4f).build("rootball")); + public static final DeferredHolder, EntityType> CELESTIAL_FISH = ENTITIES.register("celestial", () -> EntityType.Builder.of(CelestialFish::new, MobCategory.WATER_CREATURE).sized(1.0f, 1.8f).build("celestial")); + public static final DeferredHolder, EntityType> GNASHER = ENTITIES.register("gnasher", () -> EntityType.Builder.of(Gnasher::new, MobCategory.WATER_CREATURE).sized(1.5f, 0.8f).build("gnasher")); + public static final DeferredHolder, EntityType> PRAWN = ENTITIES.register("prawn", () -> EntityType.Builder.of(Prawn::new, MobCategory.MONSTER).sized(1.5f, 1.2f).build("prawn")); + public static final DeferredHolder, EntityType> SQUODDLE = ENTITIES.register("squoddle", () -> EntityType.Builder.of(Squoddle::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build("squoddle")); + public static final DeferredHolder, EntityType> SEA_MOSQUITO = ENTITIES.register("sea_mosquito", () -> EntityType.Builder.of(SeaMosquito::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build("sea_mosquito")); + public static final DeferredHolder, EntityType> FORKFISH = ENTITIES.register("forkfish", () -> EntityType.Builder.of(Forkfish::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build("forkfish")); + public static final DeferredHolder, EntityType> SPOON_SHARK = ENTITIES.register("spoon_shark", () -> EntityType.Builder.of(SpoonShark::new, MobCategory.WATER_CREATURE).sized(1.1f, 0.4f).build("spoon_shark")); + public static final DeferredHolder, EntityType> CORAL_SKRIMP = ENTITIES.register("coral_skrimp", () -> EntityType.Builder.of(Skrimp::new, MobCategory.WATER_AMBIENT).sized(0.5f, 0.4f).build("coral_skrimp")); + public static final DeferredHolder, EntityType> CIRCUS_FISH = ENTITIES.register("circus", () -> EntityType.Builder.of(CircusFish::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.8f).build("circus")); + public static final DeferredHolder, EntityType> BLIZZARDFIN_TUNA = ENTITIES.register("blizzardfin", () -> EntityType.Builder.of(BlizzardfinTuna::new, MobCategory.WATER_CREATURE).sized(0.8f, 0.8f).build("blizzardfin")); + public static final DeferredHolder, EntityType> FROSTY_FIN = ENTITIES.register("frostyfin", () -> EntityType.Builder.of(FrostyFinFish::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.4f).build("frostyfin")); + public static final DeferredHolder, EntityType> EYELASH = ENTITIES.register("eyelash", () -> EntityType.Builder.of(EyelashFish::new, MobCategory.WATER_AMBIENT).sized(0.4f, 0.4f).build("eyelash")); + public static final DeferredHolder, EntityType> TIGER_JUNGLE_SHARK = ENTITIES.register("jungleshark", () -> EntityType.Builder.of(TigerJungleShark::new, MobCategory.WATER_CREATURE).sized(0.8f, 0.4f).build("jungleshark")); + public static final DeferredHolder, EntityType> CRIMSONSHELL_SQUID = ENTITIES.register("crimsonshell", () -> EntityType.Builder.of(CrimsonshellSquid::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.6f).build("crimsonshell")); + public static final DeferredHolder, EntityType> VOLT_ANGLER = ENTITIES.register("volt_angler", () -> EntityType.Builder.of(VoltAngler::new, MobCategory.WATER_CREATURE).sized(0.6f, 0.6f).build("volt_angler")); + public static final DeferredHolder, EntityType> TRIBBLE = ENTITIES.register("tribble", () -> EntityType.Builder.of(Tribble::new, MobCategory.WATER_CREATURE).sized(0.8f, 0.2f).build("tribble")); - // Other - public static final RegistryObject> ABYSSAL_BLAST = ENTITIES.register("abyssal_blast", () -> EntityType.Builder.of(AbyssalBlast::new, MobCategory.MISC).sized(2.0F, 0.2F).setCustomClientFactory(AbyssalBlast::new).fireImmune().build("abyssal_blast")); - public static final RegistryObject> PRISMARINE_SPEAR = ENTITIES.register("prismarine_spear", () -> EntityType.Builder.of(ThrownPrismarineSpear::new, MobCategory.MISC).sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20).build("prismarine_spear")); - public static final RegistryObject> SEA_SPIKE = ENTITIES.register("sea_spike", () -> EntityType.Builder.of(SeaSpike::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(20).build("sea_spike")); - public static final RegistryObject> FALLING_TREE = ENTITIES.register("falling_tree", () -> EntityType.Builder.of(FallingTreeBlockEntity::new, MobCategory.MISC).sized(0.99F, 0.99F).setCustomClientFactory(FallingTreeBlockEntity::new).setUpdateInterval(1).setShouldReceiveVelocityUpdates(true).updateInterval(10).clientTrackingRange(20).build("falling_tree")); + // Other + public static final DeferredHolder, EntityType> ABYSSAL_BLAST = ENTITIES.register("abyssal_blast", () -> EntityType.Builder.of(AbyssalBlast::new, MobCategory.MISC).sized(2.0F, 0.2F).fireImmune().build("abyssal_blast")); + public static final DeferredHolder, EntityType> PRISMARINE_SPEAR = ENTITIES.register("prismarine_spear", () -> EntityType.Builder.of(ThrownPrismarineSpear::new, MobCategory.MISC).sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20).build("prismarine_spear")); + public static final DeferredHolder, EntityType> SEA_SPIKE = ENTITIES.register("sea_spike", () -> EntityType.Builder.of(SeaSpike::new, MobCategory.MISC).sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(20).build("sea_spike")); + public static final DeferredHolder, EntityType> FALLING_TREE = ENTITIES.register("falling_tree", () -> EntityType.Builder.of(FallingTreeBlockEntity::new, MobCategory.MISC).sized(0.99F, 0.99F).setUpdateInterval(1).setShouldReceiveVelocityUpdates(true).updateInterval(10).clientTrackingRange(20).build("falling_tree")); } diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFFoodProperties.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFFoodProperties.java index 7d63c8a..8cf0c62 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFFoodProperties.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFFoodProperties.java @@ -3,52 +3,54 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.Items; public class UFFoodProperties { // Raw - public static final FoodProperties RAW_RIPPER = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).effect(() -> new MobEffectInstance(MobEffects.HUNGER, 150, 1), 1.0F).build(); - public static final FoodProperties RAW_AERO_MONO = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).fast().effect(() -> new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 150, 0), 1.0F).build(); - public static final FoodProperties RAW_AERO_MONO_STICK = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).fast().effect(() -> new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 150, 0), 1.0F).build(); - public static final FoodProperties RAW_BUMPFACE = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_RHINO_TETRA = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_SAILOR_BARB = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_BARK_ANGELFISH = new FoodProperties.Builder().nutrition(1).saturationMod(0.1F).build(); - public static final FoodProperties RAW_BLIZZARD_TUNA = new FoodProperties.Builder().nutrition(3).saturationMod(0.1F).build(); - public static final FoodProperties RAW_SPINDLEFISH = new FoodProperties.Builder().nutrition(1).saturationMod(0.1F).effect(() -> new MobEffectInstance(MobEffects.POISON, 200, 1), 1.0F).effect(() -> new MobEffectInstance(MobEffects.WEAKNESS, 150, 1), 1.0F).build(); - public static final FoodProperties RAW_SHOCKCAT = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_MOSSTHORN = new FoodProperties.Builder().nutrition(1).saturationMod(0.1F).effect(() -> new MobEffectInstance(MobEffects.POISON, 200, 1), 1.0F).build(); - public static final FoodProperties RAW_LOBSTER = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_SNOWFLAKE = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).effect(() -> new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 150, 1), 1.0F).build(); - public static final FoodProperties RAW_EYELASH = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties UNUSUAL_FILLET = new FoodProperties.Builder().nutrition(3).saturationMod(0.15F).build(); - public static final FoodProperties RAW_PICKLEFISH = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_AMBER_GOBY = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_BEAKED_HERRING = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_BLIND_SAILFIN = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_CIRCUS_FISH = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_COPPERFLAME_ANTHIAS = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_DEMON_HERRING = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_DROOPING_GOURAMI = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_DUALITY_DAMSELFISH = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_FORKFISH = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_HATCHETFISH = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_SNEEP_SNORP = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); - public static final FoodProperties RAW_TRIPLE_TWIRL_PLECO = new FoodProperties.Builder().nutrition(2).saturationMod(0.1F).build(); + + public static final FoodProperties RAW_RIPPER = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).effect(() -> new MobEffectInstance(MobEffects.HUNGER, 150, 1), 1.0F).build(); + public static final FoodProperties RAW_AERO_MONO = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).fast().effect(() -> new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 150, 0), 1.0F).build(); + public static final FoodProperties RAW_AERO_MONO_STICK = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).fast().effect(() -> new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 150, 0), 1.0F).build(); + public static final FoodProperties RAW_BUMPFACE = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_RHINO_TETRA = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_SAILOR_BARB = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_BARK_ANGELFISH = new FoodProperties.Builder().nutrition(1).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_BLIZZARD_TUNA = new FoodProperties.Builder().nutrition(3).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_SPINDLEFISH = new FoodProperties.Builder().nutrition(1).saturationModifier(0.1F).effect(() -> new MobEffectInstance(MobEffects.POISON, 200, 1), 1.0F).effect(() -> new MobEffectInstance(MobEffects.WEAKNESS, 150, 1), 1.0F).build(); + public static final FoodProperties RAW_SHOCKCAT = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_MOSSTHORN = new FoodProperties.Builder().nutrition(1).saturationModifier(0.1F).effect(() -> new MobEffectInstance(MobEffects.POISON, 200, 1), 1.0F).build(); + public static final FoodProperties RAW_LOBSTER = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_FROSTY_FIN = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).effect(() -> new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 150, 1), 1.0F).build(); + public static final FoodProperties RAW_EYELASH = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties UNUSUAL_FILLET = new FoodProperties.Builder().nutrition(3).saturationModifier(0.15F).build(); + public static final FoodProperties RAW_PICKLEFISH = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_AMBER_GOBY = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_BEAKED_HERRING = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_BLIND_SAILFIN = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_CIRCUS_FISH = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_COPPERFLAME_ANTHIAS = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_DEMON_HERRING = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_DROOPING_GOURAMI = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_DUALITY_DAMSELFISH = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_FORKFISH = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_HATCHETFISH = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_SNEEP_SNORP = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); + public static final FoodProperties RAW_TRIPLE_TWIRL_PLECO = new FoodProperties.Builder().nutrition(2).saturationModifier(0.1F).build(); // Cooked - public static final FoodProperties COOKED_AERO_MONO_STICK = new FoodProperties.Builder().nutrition(4).saturationMod(0.4F).fast().effect(() -> new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 150, 1), 1.0F).build(); - public static final FoodProperties COOKED_BLIZZARD_TUNA = new FoodProperties.Builder().nutrition(8).saturationMod(0.5F).build(); - public static final FoodProperties COOKED_MOSSTHORN = new FoodProperties.Builder().nutrition(7).saturationMod(0.3F).build(); - public static final FoodProperties COOKED_SHOCKCAT = new FoodProperties.Builder().nutrition(7).saturationMod(0.4F).build(); - public static final FoodProperties COOKED_LOBSTER = new FoodProperties.Builder().nutrition(7).saturationMod(0.4F).build(); - public static final FoodProperties COOKED_UNUSUAL_FILLET = new FoodProperties.Builder().nutrition(6).saturationMod(0.4F).build(); + public static final FoodProperties COOKED_AERO_MONO_STICK = new FoodProperties.Builder().nutrition(4).saturationModifier(0.4F).fast().effect(() -> new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 150, 1), 1.0F).build(); + public static final FoodProperties COOKED_BLIZZARD_TUNA = new FoodProperties.Builder().nutrition(8).saturationModifier(0.5F).build(); + public static final FoodProperties COOKED_MOSSTHORN = new FoodProperties.Builder().nutrition(7).saturationModifier(0.3F).build(); + public static final FoodProperties COOKED_SHOCKCAT = new FoodProperties.Builder().nutrition(7).saturationModifier(0.4F).build(); + public static final FoodProperties COOKED_LOBSTER = new FoodProperties.Builder().nutrition(7).saturationModifier(0.4F).build(); + public static final FoodProperties COOKED_UNUSUAL_FILLET = new FoodProperties.Builder().nutrition(6).saturationModifier(0.4F).build(); // Meals - public static final FoodProperties LOBSTER_ROLL = new FoodProperties.Builder().nutrition(10).saturationMod(0.8F).build(); - public static final FoodProperties ODD_FISHSTICKS = new FoodProperties.Builder().nutrition(8).saturationMod(0.5F).build(); - public static final FoodProperties PICKLEDISH = new FoodProperties.Builder().nutrition(8).saturationMod(0.4F).build(); - public static final FoodProperties STRANGE_BROTH = new FoodProperties.Builder().nutrition(12).saturationMod(0.85F).build(); - public static final FoodProperties UNUSUAL_SANDWICH = new FoodProperties.Builder().nutrition(14).saturationMod(0.7F).build(); - public static final FoodProperties WEIRD_GOLDFISH = new FoodProperties.Builder().nutrition(4).saturationMod(0.35F).fast().build(); + public static final FoodProperties LOBSTER_ROLL = new FoodProperties.Builder().nutrition(10).saturationModifier(0.8F).build(); + public static final FoodProperties ODD_FISHSTICKS = new FoodProperties.Builder().nutrition(8).saturationModifier(0.5F).build(); + public static final FoodProperties PICKLEDISH = new FoodProperties.Builder().nutrition(8).saturationModifier(0.4F).usingConvertsTo(Items.BOWL).build(); + public static final FoodProperties STRANGE_BROTH = new FoodProperties.Builder().nutrition(12).saturationModifier(0.85F).usingConvertsTo(Items.BOWL).build(); + public static final FoodProperties UNUSUAL_SANDWICH = new FoodProperties.Builder().nutrition(14).saturationModifier(0.7F).build(); + public static final FoodProperties WEIRD_GOLDFISH = new FoodProperties.Builder().nutrition(4).saturationModifier(0.35F).fast().build(); } diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFItems.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFItems.java index f8b7c60..7c7533f 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFItems.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFItems.java @@ -4,192 +4,186 @@ import codyhuh.unusualfishmod.common.item.*; import net.minecraft.ChatFormatting; import net.minecraft.Util; +import net.minecraft.core.component.DataComponents; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.*; import net.minecraft.world.level.material.Fluids; -import net.minecraftforge.common.ForgeSpawnEggItem; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; +import net.neoforged.neoforge.registries.DeferredItem; +import net.neoforged.neoforge.registries.DeferredRegister; import java.util.List; -public final class UFItems { - public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, UnusualFishMod.MOD_ID); - - private static final ChatFormatting TITLE_FORMAT = ChatFormatting.GRAY; - private static final ChatFormatting DESCRIPTION_FORMAT = ChatFormatting.BLUE; - private static final Component ANCIENT_WEAPON_UPGRADE = Component.translatable(Util.makeDescriptionId("upgrade", new ResourceLocation(UnusualFishMod.MOD_ID, "ancient_weapon_upgrade"))).withStyle(TITLE_FORMAT); - private static final Component ANCIENT_WEAPON_APPLIES_TO = Component.translatable(Util.makeDescriptionId("item", new ResourceLocation(UnusualFishMod.MOD_ID, "smithing_template.ancient_weapon_parts.applies_to"))).withStyle(DESCRIPTION_FORMAT); - private static final Component ANCIENT_WEAPON_INGREDIENTS = Component.translatable(Util.makeDescriptionId("item", new ResourceLocation(UnusualFishMod.MOD_ID, "smithing_template.ancient_weapon_parts.ingredients"))).withStyle(DESCRIPTION_FORMAT); - private static final Component ANCIENT_WEAPON_BASE_SLOT_DESCRIPTION = Component.translatable(Util.makeDescriptionId("item", new ResourceLocation(UnusualFishMod.MOD_ID, "smithing_template.ancient_weapon_parts.base_slot_description"))); - private static final Component ANCIENT_WEAPON_ADDITIONS_SLOT_DESCRIPTION = Component.translatable(Util.makeDescriptionId("item", new ResourceLocation(UnusualFishMod.MOD_ID, "smithing_template.ancient_weapon_parts.additions_slot_description"))); - private static final ResourceLocation EMPTY_SLOT_WEAPON_PARTS = new ResourceLocation(UnusualFishMod.MOD_ID, "item/empty_slot_weapon_parts"); - private static final ResourceLocation EMPTY_SLOT_DEPTH_CLAW = new ResourceLocation(UnusualFishMod.MOD_ID, "item/empty_slot_depth_claw"); - private static final ResourceLocation EMPTY_SLOT_RIPPER_TOOTH = new ResourceLocation(UnusualFishMod.MOD_ID, "item/empty_slot_ripper_tooth"); - - // Foods - public static final RegistryObject RAW_EYELASH = ITEMS.register("raw_eyelash", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_EYELASH))); - public static final RegistryObject RAW_SPINDLEFISH = ITEMS.register("raw_spindlefish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_SPINDLEFISH))); - public static final RegistryObject RAW_SNOWFLAKE = ITEMS.register("raw_snowflake", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_SNOWFLAKE))); - public static final RegistryObject RAW_AERO_MONO = ITEMS.register("raw_aero_mono", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_AERO_MONO))); - public static final RegistryObject RAW_PICKLEFSIH = ITEMS.register("raw_picklefish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_PICKLEFISH))); - public static final RegistryObject RAW_AMBER_GOBY = ITEMS.register("raw_amber_goby", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_AMBER_GOBY))); - public static final RegistryObject RAW_BEAKED_HERRING = ITEMS.register("raw_beaked_herring", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BEAKED_HERRING))); - public static final RegistryObject RAW_BLIND_SAILFIN = ITEMS.register("raw_blind_sailfin", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BLIND_SAILFIN))); - public static final RegistryObject RAW_CIRCUS_FISH = ITEMS.register("raw_circus_fish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_CIRCUS_FISH))); - public static final RegistryObject RAW_COPPERFLAME_ANTHIAS = ITEMS.register("raw_copperflame_anthias", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_COPPERFLAME_ANTHIAS))); - public static final RegistryObject RAW_DEMON_HERRING = ITEMS.register("raw_demon_herring", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_DEMON_HERRING))); - public static final RegistryObject RAW_DROOPING_GOURAMI = ITEMS.register("raw_drooping_gourami", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_DROOPING_GOURAMI))); - public static final RegistryObject RAW_DUALITY_DAMSELFISH = ITEMS.register("raw_duality_damselfish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_DUALITY_DAMSELFISH))); - public static final RegistryObject RAW_FORKFISH = ITEMS.register("raw_forkfish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_FORKFISH))); - public static final RegistryObject RAW_HATCHETFISH = ITEMS.register("raw_hatchetfish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_HATCHETFISH))); - public static final RegistryObject RAW_SNEEP_SNORP = ITEMS.register("raw_sneep_snorp", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_SNEEP_SNORP))); - public static final RegistryObject RAW_TRIPLE_TWIRL_PLECO = ITEMS.register("raw_triple_twirl_pleco", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_TRIPLE_TWIRL_PLECO))); - //public static final RegistryObject UNUSUAL_FILLET = ITEMS.register("unusual_fillet", () -> new Item(new Item.Properties().food(UFFoodProperties.UNUSUAL_FILLET))); - - public static final RegistryObject RAW_AERO_MONO_STICK = ITEMS.register("raw_aero_mono_stick", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_AERO_MONO_STICK))); - public static final RegistryObject COOKED_AERO_MONO_STICK = ITEMS.register("cooked_aero_mono_stick", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_AERO_MONO_STICK))); - //public static final RegistryObject RAW_BUMPFACE = ITEMS.register("raw_bumpface", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BUMPFACE))); - public static final RegistryObject RAW_SAILOR_BARB = ITEMS.register("raw_sailor_barb", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_SAILOR_BARB))); - public static final RegistryObject RAW_BARK_ANGELFISH = ITEMS.register("raw_bark_angelfish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BARK_ANGELFISH))); - public static final RegistryObject RAW_BLIZZARD_TUNA = ITEMS.register("raw_blizzard_tuna", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BLIZZARD_TUNA))); - public static final RegistryObject COOKED_BLIZZARD_TUNA = ITEMS.register("cooked_blizzard_tuna", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_BLIZZARD_TUNA))); - public static final RegistryObject RAW_SHOCKCAT = ITEMS.register("raw_shockcat", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_SHOCKCAT))); - public static final RegistryObject COOKED_SHOCKCAT = ITEMS.register("cooked_shockcat", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_SHOCKCAT))); - public static final RegistryObject RAW_LOBSTER = ITEMS.register("raw_lobster", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_LOBSTER))); - public static final RegistryObject COOKED_LOBSTER = ITEMS.register("cooked_lobster", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_LOBSTER))); - public static final RegistryObject RAW_MOSSTHORN = ITEMS.register("raw_mossthorn", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_MOSSTHORN))); - public static final RegistryObject COOKED_MOSSTHORN = ITEMS.register("cooked_mossthorn", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_MOSSTHORN))); - public static final RegistryObject COOKED_UNUSUAL_FILLET = ITEMS.register("cooked_unusual_fillet", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_UNUSUAL_FILLET))); - public static final RegistryObject LOBSTER_ROLL = ITEMS.register("lobster_roll", () -> new Item(new Item.Properties().food(UFFoodProperties.LOBSTER_ROLL))); - public static final RegistryObject ODD_FISHSTICKS = ITEMS.register("odd_fishsticks", () -> new Item(new Item.Properties().food(UFFoodProperties.ODD_FISHSTICKS))); - public static final RegistryObject PICKLEDISH = ITEMS.register("pickledish", () -> new BowlFoodItem(new Item.Properties().food(UFFoodProperties.PICKLEDISH).stacksTo(1))); - public static final RegistryObject STRANGE_BROTH = ITEMS.register("strange_broth", () -> new BowlFoodItem(new Item.Properties().food(UFFoodProperties.STRANGE_BROTH).stacksTo(1))); - public static final RegistryObject UNUSUAL_SANDWICH = ITEMS.register("unusual_sandwich", () -> new Item(new Item.Properties().food(UFFoodProperties.UNUSUAL_SANDWICH))); - public static final RegistryObject WEIRD_GOLDFISH = ITEMS.register("weird_goldfish", () -> new Item(new Item.Properties().food(UFFoodProperties.WEIRD_GOLDFISH))); +import static codyhuh.unusualfishmod.UnusualFishMod.loc; - // Drops - public static final RegistryObject TENDRIL = ITEMS.register("tendril", () -> new Item(new Item.Properties())); - public static final RegistryObject RIPPER_TOOTH = ITEMS.register("ripper_tooth", () -> new Item(new Item.Properties())); - public static final RegistryObject LOBSTER_SPIKE = ITEMS.register("lobster_spike", () -> new Item(new Item.Properties())); - public static final RegistryObject RELUCENT_SHARD = ITEMS.register("relucent_shard", () -> new Item(new Item.Properties())); - public static final RegistryObject CRIMSON_SHARD = ITEMS.register("crimson_shard", () -> new Item(new Item.Properties())); - public static final RegistryObject DEPTH_CLAW = ITEMS.register("depth_claw", () -> new Item(new Item.Properties())); - - // Gear - public static final RegistryObject DEPTH_SCYTHE = ITEMS.register("depth_scythe", () -> new DepthScytheItem(Tiers.DIAMOND, 3, -2.4F, new Item.Properties().durability(600))); - public static final RegistryObject RIPSAW = ITEMS.register("ripsaw", () -> new RipsawItem(new Item.Properties().stacksTo(1))); - public static final RegistryObject FLUVIAL_SHELL = ITEMS.register("fluvial_shell", () -> new WeatherShellItem("rain", new Item.Properties().stacksTo(1).durability(1))); - public static final RegistryObject CLEMENT_SHELL = ITEMS.register("clement_shell", () -> new WeatherShellItem("clear", new Item.Properties().stacksTo(1).durability(1))); - public static final RegistryObject THUNDEROUS_SHELL = ITEMS.register("thunderous_shell", () -> new WeatherShellItem("thunder", new Item.Properties().stacksTo(1).durability(1))); - public static final RegistryObject PRISMARINE_SPEAR = ITEMS.register("prismarine_spear", () -> new PrismarineSpearItem(new Item.Properties().stacksTo(1).durability(100))); - public static final RegistryObject WEAPON_PARTS = ITEMS.register("weapon_parts", () -> new Item(new Item.Properties())); - public static final RegistryObject ANCIENT_WEAPON_SMITHING_TEMPLATE = ITEMS.register("ancient_weapon_smithing_template", () -> new SmithingTemplateItem(ANCIENT_WEAPON_APPLIES_TO, ANCIENT_WEAPON_INGREDIENTS, ANCIENT_WEAPON_UPGRADE, ANCIENT_WEAPON_ADDITIONS_SLOT_DESCRIPTION, ANCIENT_WEAPON_BASE_SLOT_DESCRIPTION, List.of(EMPTY_SLOT_WEAPON_PARTS), List.of(EMPTY_SLOT_DEPTH_CLAW, EMPTY_SLOT_RIPPER_TOOTH))); - public static final RegistryObject MUSIC_DISC_SEAFOAM = ITEMS.register("music_disc_seafoam", () -> new RecordItem(1, UFSounds.MUSIC_DISC_SEAFOAM, new Item.Properties().stacksTo(1).rarity(Rarity.RARE), 155 * 20)); - //public static final RegistryObject STARGAZER = ITEMS.register("stargazer", () -> new StargazerItem(new Item.Properties().tab(UnusualFishMod.UNUSUAL_TAB).stacksTo(1))); - - // Buckets - public static final RegistryObject AERO_MONO_BUCKET = ITEMS.register("aero_mono_bucket", () -> new UFFishBucketItem(UFEntities.AERO_MONO, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - //public static final RegistryObject RHINO_TETRA_BUCKET = ITEMS.register("rhino_tetra_bucket", () -> new UFFishBucketItem(UFEntities.RHINO_TETRA, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject DUALITY_DAMSELFISH_BUCKET = ITEMS.register("duality_damselfish_bucket", () -> new UFFishBucketItem(UFEntities.DUALITY_DAMSELFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject DROOPING_GOURAMI_BUCKET = ITEMS.register("drooping_gourami_bucket", () -> new UFFishBucketItem(UFEntities.DROOPING_GOURAMI, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject MOSSTHORN_BUCKET = ITEMS.register("mossthorn_bucket", () -> new UFFishBucketItem(UFEntities.MOSSTHORN, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SAILOR_BARB_BUCKET = ITEMS.register("sailor_barb_bucket", () -> new UFFishBucketItem(UFEntities.SAILOR_BARB, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject TRIPLE_TWIRL_PLECO_BUCKET = ITEMS.register("triple_twirl_pleco_bucket", () -> new UFFishBucketItem(UFEntities.TRIPLE_TWIRL_PLECO, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SPINDLEFISH_BUCKET = ITEMS.register("spindlefish_bucket", () -> new UFFishBucketItem(UFEntities.SPINDLEFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject RIPPER_BUCKET = ITEMS.register("ripper_bucket", () -> new UFFishBucketItem(UFEntities.RIPPER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SEA_SPIDER_BUCKET = ITEMS.register("sea_spider_bucket", () -> new UFFishBucketItem(UFEntities.SEA_SPIDER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject CLOWNTHORN_SHARK_BUCKET = ITEMS.register("clownthorn_shark_bucket", () -> new UFFishBucketItem(UFEntities.CLOWNTHORN_SHARK, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SNEEPSNORP_BUCKET = ITEMS.register("sneepsnorp_bucket", () -> new UFFishBucketItem(UFEntities.SNEEPSNORP, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject BLACKCAP_SNAIL_BUCKET = ITEMS.register("blackcap_snail_bucket", () -> new UFFishBucketItem(UFEntities.BLACKCAP_SNAIL, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject BRICK_SNAIL_BUCKET = ITEMS.register("brick_snail_bucket", () -> new UFFishBucketItem(UFEntities.BRICK_SNAIL, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject DEEP_CRAWLER_BUCKET = ITEMS.register("deep_crawler_bucket", () -> new UFFishBucketItem(UFEntities.DEEP_CRAWLER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject WIZARD_JELLY_BUCKET = ITEMS.register("wizard_jelly_bucket", () -> new UFFishBucketItem(UFEntities.WIZARD_JELLY, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject PORCUPINE_LOBSTA_BUCKET = ITEMS.register("porcupine_lobsta_bucket", () -> new UFFishBucketItem(UFEntities.PORCUPINE_LOBSTA, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject FRESHWATER_MANTIS_BUCKET = ITEMS.register("freshwater_mantis_bucket", () -> new UFFishBucketItem(UFEntities.FRESHWATER_MANTIS, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject BARK_ANGELFISH_BUCKET = ITEMS.register("bark_angelfish_bucket", () -> new UFFishBucketItem(UFEntities.BARK_ANGELFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SKIPPER_BUCKET = ITEMS.register("lobed_skipper_bucket", () -> new UFFishBucketItem(UFEntities.LOBED_SKIPPER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject BEAKED_HERRING_BUCKET = ITEMS.register("beaked_herring_bucket", () -> new UFFishBucketItem(UFEntities.BEAKED_HERRING, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject PICKLEFISH_BUCKET = ITEMS.register("picklefish_bucket", () -> new UFFishBucketItem(UFEntities.PICKLEFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject BLIND_SAILFIN_BUCKET = ITEMS.register("blind_sailfin_bucket", () -> new UFFishBucketItem(UFEntities.BLIND_SAILFIN, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject DEMON_HERRING_BUCKET = ITEMS.register("demon_herring_bucket", () -> new UFFishBucketItem(UFEntities.DEMON_HERRING, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject AMBER_GOBY_BUCKET = ITEMS.register("amber_goby_bucket", () -> new UFFishBucketItem(UFEntities.AMBER_GOBY, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject HATCHET_FISH_BUCKET = ITEMS.register("hatchet_fish_bucket", () -> new UFFishBucketItem(UFEntities.HATCHET_FISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject COPPERFLAME_BUCKET = ITEMS.register("copperflame_bucket", () -> new UFFishBucketItem(UFEntities.COPPERFLAME, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SQUODDLE_BUCKET = ITEMS.register("squoddle_bucket", () -> new UFFishBucketItem(UFEntities.SQUODDLE, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SEA_MOSQUITO_BUCKET = ITEMS.register("sea_mosquito_bucket", () -> new UFFishBucketItem(UFEntities.SEA_MOSQUITO, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject FORKFISH_BUCKET = ITEMS.register("forkfish_bucket", () -> new UFFishBucketItem(UFEntities.FORKFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SPOON_SHARK_BUCKET = ITEMS.register("spoon_shark_bucket", () -> new UFFishBucketItem(UFEntities.SPOON_SHARK, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject CORAL_SKRIMP_BUCKET = ITEMS.register("coral_skrimp_bucket", () -> new UFFishBucketItem(UFEntities.CORAL_SKRIMP, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject CIRCUS_FISH_BUCKET = ITEMS.register("circus_fish_bucket", () -> new UFFishBucketItem(UFEntities.CIRCUS_FISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject EYELASH_FISH_BUCKET = ITEMS.register("eyelash_fish_bucket", () -> new UFFishBucketItem(UFEntities.EYELASH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SNOWFLAKE_TAIL_FISH_BUCKET = ITEMS.register("snowflake_tail_fish_bucket", () -> new UFFishBucketItem(UFEntities.SNOWFLAKE, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject CRIMSONSHELL_SQUID_BUCKET = ITEMS.register("crimsonshell_squid_bucket", () -> new UFFishBucketItem(UFEntities.CRIMSONSHELL_SQUID, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject VOLT_ANGLER_BUCKET = ITEMS.register("volt_angler_bucket", () -> new UFFishBucketItem(UFEntities.VOLT_ANGLER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject BLIZZARDFIN_BUCKET = ITEMS.register("blizzardfin_bucket", () -> new UFFishBucketItem(UFEntities.BLIZZARDFIN_TUNA, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject MUDDYTOP_SNAIL_BUCKET = ITEMS.register("muddytop_snail_bucket", () -> new UFFishBucketItem(UFEntities.MUDDYTOP_SNAIL, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject SHOCKCAT_BUCKET = ITEMS.register("shockcat_bucket", () -> new UFFishBucketItem(UFEntities.SHOCKCAT, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject PINKFIN_IDOL_BUCKET = ITEMS.register("pinkfin_idol_bucket", () -> new UFFishBucketItem(UFEntities.PINKFIN, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject TIGER_PUFFER_BUCKET = ITEMS.register("tiger_puffer_bucket", () -> new UFFishBucketItem(UFEntities.TIGER_PUFFER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject STOUT_BICHIR_BUCKET = ITEMS.register("stout_bichir_bucket", () -> new UFFishBucketItem(UFEntities.STOUT_BICHIR, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject TRIBBLE_BUCKET = ITEMS.register("tribble_bucket", () -> new UFFishBucketItem(UFEntities.TRIBBLE, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - public static final RegistryObject TRUMPET_SQUID_BUCKET = ITEMS.register("trumpet_squid_bucket", () -> new UFFishBucketItem(UFEntities.TRUMPET_SQUID, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); - - // Spawn Eggs - public static final RegistryObject AERO_MONO_SPAWN_EGG = ITEMS.register("aero_mono_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.AERO_MONO, 0x8ca8b5, 0x506884, new Item.Properties())); - public static final RegistryObject PINKFIN_SPAWN_EGG = ITEMS.register("pinkfin_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.PINKFIN, 0x0e011e, 0x421054, new Item.Properties())); - public static final RegistryObject BARBED_SPAWN_EGG = ITEMS.register("roughback_guitarfish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.ROUGHBACK, 0x5e5d4f, 0x92998e, new Item.Properties())); - public static final RegistryObject CLOWNTHORN_SPAWN_EGG = ITEMS.register("clownthorn_shark_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.CLOWNTHORN_SHARK, 0xbe5515, 0xa21e00, new Item.Properties())); - public static final RegistryObject DUALITY_SPAWN_EGG = ITEMS.register("duality_damselfish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.DUALITY_DAMSELFISH, 0x8a94a1, 0x2c3338, new Item.Properties())); - public static final RegistryObject DROOPING_GOURAMI_SPAWN_EGG = ITEMS.register("drooping_gourami_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.DROOPING_GOURAMI, 0x54434d, 0x363243, new Item.Properties())); - public static final RegistryObject MOSSTHORN_SPAWN_EGG = ITEMS.register("mossthorn_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.MOSSTHORN, 0x26a529, 0x034223, new Item.Properties())); - public static final RegistryObject RHINO_TETRA_SPAWN_EGG = ITEMS.register("rhino_tetra_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.RHINO_TETRA, 0x919187, 0x7b2726, new Item.Properties())); - public static final RegistryObject RIPPER_SPAWN_EGG = ITEMS.register("ripper_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.RIPPER, 0x565950, 0x8f9386, new Item.Properties())); - public static final RegistryObject SAILOR_BARB_PAWN_EGG = ITEMS.register("sailor_barb_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SAILOR_BARB, 0x5e6a25, 0xa1a68c, new Item.Properties())); - public static final RegistryObject SEA_PANCAKE_SPAWN_EGG = ITEMS.register("sea_pancake_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SEA_PANCAKE, 0xbda877, 0xdfcbb7, new Item.Properties())); - public static final RegistryObject SEA_SPIDER_SPAWN_EGG = ITEMS.register("sea_spider_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SEA_SPIDER, 0x774128, 0xaf7834, new Item.Properties())); - public static final RegistryObject SPINDLEFISH_SPAWN_EGG = ITEMS.register("spindlefish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SPINDLEFISH, 0x8e2573, 0xc14aeb, new Item.Properties())); - public static final RegistryObject TRIPLE_TWIRL_PLECO_SPAWN_EGG = ITEMS.register("triple_twirl_pleco_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.TRIPLE_TWIRL_PLECO, 0xc1923a, 0x903113, new Item.Properties())); - public static final RegistryObject BRICK_SNAIL_SPAWN_EGG = ITEMS.register("brick_snail_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.BRICK_SNAIL, 0xb5553b, 0x674f17, new Item.Properties())); - public static final RegistryObject ZEBRA_CORNETFISH_SPAWN_EGG = ITEMS.register("zebra_cornetfish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.ZEBRA_CORNETFISH , 0x153957, 0xc7ad0d, new Item.Properties())); - public static final RegistryObject TIGER_PUFFER_SPAWN_EGG = ITEMS.register("tiger_puffer_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.TIGER_PUFFER, 0x622814, 0x84736f, new Item.Properties())); - public static final RegistryObject BLACKCAP_SNAIL_SPAWN_EGG = ITEMS.register("blackcap_snail_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.BLACKCAP_SNAIL, 0x262917, 0x4c3d27, new Item.Properties())); - public static final RegistryObject SNEEPSNORP_EGG = ITEMS.register("sneepsnorp_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SNEEPSNORP, 0x3347a7, 0xce8a24, new Item.Properties())); - public static final RegistryObject DEEP_CRAWLER_SPAWN_EGG = ITEMS.register("deep_crawler_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.DEEP_CRAWLER, 0x536761, 0x34363f, new Item.Properties())); - public static final RegistryObject WIZARD_JELLY_SPAWN_EGG = ITEMS.register("wizard_jelly_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.WIZARD_JELLY, 0x5550b4, 0x3aa8d7, new Item.Properties())); - public static final RegistryObject PORCUPINE_LOBSTA_SPAWN_EGG = ITEMS.register("porcupine_lobsta_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.PORCUPINE_LOBSTA, 0x624736, 0x9e521b, new Item.Properties())); - public static final RegistryObject TRUMPET_SQUID_SPAWN_EGG = ITEMS.register("trumpet_squid_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.TRUMPET_SQUID, 0xe8d26a, 0xc6a042, new Item.Properties())); - public static final RegistryObject FRESHWATER_MANTIS_EGG = ITEMS.register("freshwater_mantis_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.FRESHWATER_MANTIS, 0x454629, 0x94ab67, new Item.Properties())); - public static final RegistryObject BARK_ANGELFISH_SPAWN_EGG = ITEMS.register("bark_angelfish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.BARK_ANGELFISH, 0x553f1a, 0x35270a, new Item.Properties())); - public static final RegistryObject SHOCKCAT_SPAWN_EGG = ITEMS.register("shockcat_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SHOCKCAT, 0x34294f, 0x255f9b, new Item.Properties())); - public static final RegistryObject MUDDYTOP_SNAIL_SPAWN_EGG = ITEMS.register("muddytop_snail_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.MUDDYTOP_SNAIL, 0x23100e, 0x5f4d3b, new Item.Properties())); - public static final RegistryObject KALAPPA_SPAWN_EGG = ITEMS.register("kalappa_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.KALAPPA, 0x624051, 0x886d86, new Item.Properties())); - public static final RegistryObject LOBED_SKIPPER_SPAWN_EGG = ITEMS.register("lobed_skipper_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.LOBED_SKIPPER, 0x4b2618, 0x9e632f, new Item.Properties())); - public static final RegistryObject STOUT_BICHIR_SPAWN_EGG = ITEMS.register("stout_bichir_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.STOUT_BICHIR, 0x5a5e3d, 0xb08f33, new Item.Properties())); - public static final RegistryObject BEAKED_HERRING_SPAWN_EGG = ITEMS.register("beaked_herring_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.BEAKED_HERRING, 0x8bacc4, 0xc5d0cf, new Item.Properties())); - public static final RegistryObject PICKLEFISH_SPAWN_EGG = ITEMS.register("picklefish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.PICKLEFISH, 0x235806, 0xd0cd07, new Item.Properties())); - public static final RegistryObject BLIND_SAILFIN_SPAWN_EGG = ITEMS.register("blind_sailfin_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.BLIND_SAILFIN, 0xdcccc3, 0xc19c8e, new Item.Properties())); - public static final RegistryObject DEMON_HERRING_SPAWN_EGG = ITEMS.register("demon_herring_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.DEMON_HERRING, 0x363243, 0xef7930, new Item.Properties())); - public static final RegistryObject AMBER_GOBY_SPAWN_EGG = ITEMS.register("amber_goby_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.AMBER_GOBY, 0xfb912e, 0xae5e2c, new Item.Properties())); - public static final RegistryObject HATCHET_FISH_SPAWN_EGG = ITEMS.register("hatchet_fish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.HATCHET_FISH, 0x0b0b26, 0x7d3283, new Item.Properties())); - public static final RegistryObject COPPERFLAME_SPAWN_EGG = ITEMS.register("copperflame_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.COPPERFLAME, 0x4fab90, 0x7fcf90, new Item.Properties())); - public static final RegistryObject ROOTBALL_SPAWN_EGG = ITEMS.register("root_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.ROOTBALL, 0x647233, 0xad7d65, new Item.Properties())); - public static final RegistryObject CELESTIAL_FISH_SPAWN_EGG = ITEMS.register("celestial_fish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.CELESTIAL_FISH, 0x6876a2, 0xe2e4c5, new Item.Properties())); - public static final RegistryObject GNASHER_SPAWN_EGG = ITEMS.register("gnasher_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.GNASHER, 0x323232, 0x465bb2, new Item.Properties())); - public static final RegistryObject PRAWN_SPAWN_EGG = ITEMS.register("prawn_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.PRAWN, 0x5a579e, 0x4694d1, new Item.Properties())); - public static final RegistryObject SQUODDLE_SPAWN_EGG = ITEMS.register("squoddle_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SQUODDLE, 0xb37817, 0xe58a2e, new Item.Properties())); - public static final RegistryObject SEA_MOSQUITO_SPAWN_EGG = ITEMS.register("sea_mosquito_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SEA_MOSQUITO, 0x326934, 0x6c122f, new Item.Properties())); - public static final RegistryObject FORKFISH_SPAWN_EGG = ITEMS.register("forkfish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.FORKFISH, 0x8e882c, 0x3dbba0, new Item.Properties())); - public static final RegistryObject SPOON_SHARK_SPAWN_EGG = ITEMS.register("spoon_shark_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SPOON_SHARK, 0xddbd78, 0xb3925b, new Item.Properties())); - public static final RegistryObject CORAL_SKRIMP_EGG = ITEMS.register("coral_skrimp_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.CORAL_SKRIMP, 0x5a0e7a, 0xb34aa2, new Item.Properties())); - public static final RegistryObject CIRCUS_FISH_SPAWN_EGG = ITEMS.register("circus_fish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.CIRCUS_FISH, 0xab4b36, 0xc88f62, new Item.Properties())); - public static final RegistryObject BLIZZARDFIN_SPAWN_EGG = ITEMS.register("blizzardfin_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.BLIZZARDFIN_TUNA, 0x9ed7dc, 0x6182a6, new Item.Properties())); - public static final RegistryObject EYELASH_FISH_SPAWN_EGG = ITEMS.register("eyelash_fish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.EYELASH, 0xb7b7ba, 0xfcfcfa, new Item.Properties())); - public static final RegistryObject SNOWFLAKE_TAIL_FISH_SPAWN_EGG = ITEMS.register("snowflake_tail_fish_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.SNOWFLAKE, 0x649ccc, 0xcbe8e6, new Item.Properties())); - public static final RegistryObject TIGER_JUNGLE_SHARK_SPAWN_EGG = ITEMS.register("tiger_jungle_shark_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.TIGER_JUNGLE_SHARK, 0x272530, 0xa5a8c6, new Item.Properties())); - public static final RegistryObject CRIMSONSHELL_SQUID_SPAWN_EGG = ITEMS.register("crimsonshell_squid_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.CRIMSONSHELL_SQUID, 0xab101c, 0x432c39, new Item.Properties())); - public static final RegistryObject VOLT_ANGLER_SPAWN_EGG = ITEMS.register("volt_angler_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.VOLT_ANGLER, 0x2d4035, 0x509033, new Item.Properties())); - public static final RegistryObject TRIBBLE_SPAWN_EGG = ITEMS.register("tribble_spawn_egg", () -> new ForgeSpawnEggItem(UFEntities.TRIBBLE, 0x656f26, 0x46491a, new Item.Properties())); +public final class UFItems { + public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(UnusualFishMod.MOD_ID); + // Foods + public static final DeferredItem RAW_EYELASH = ITEMS.register("raw_eyelash", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_EYELASH))); + public static final DeferredItem RAW_SPINDLEFISH = ITEMS.register("raw_spindlefish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_SPINDLEFISH))); + public static final DeferredItem RAW_FROSTY_FIN = ITEMS.register("raw_frosty_fin", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_FROSTY_FIN))); + public static final DeferredItem RAW_AERO_MONO = ITEMS.register("raw_aero_mono", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_AERO_MONO))); + public static final DeferredItem RAW_PICKLEFSIH = ITEMS.register("raw_picklefish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_PICKLEFISH))); + public static final DeferredItem RAW_AMBER_GOBY = ITEMS.register("raw_amber_goby", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_AMBER_GOBY))); + public static final DeferredItem RAW_BEAKED_HERRING = ITEMS.register("raw_beaked_herring", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BEAKED_HERRING))); + public static final DeferredItem RAW_BLIND_SAILFIN = ITEMS.register("raw_blind_sailfin", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BLIND_SAILFIN))); + public static final DeferredItem RAW_CIRCUS_FISH = ITEMS.register("raw_circus_fish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_CIRCUS_FISH))); + public static final DeferredItem RAW_COPPERFLAME_ANTHIAS = ITEMS.register("raw_copperflame_anthias", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_COPPERFLAME_ANTHIAS))); + public static final DeferredItem RAW_DEMON_HERRING = ITEMS.register("raw_demon_herring", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_DEMON_HERRING))); + public static final DeferredItem RAW_DROOPING_GOURAMI = ITEMS.register("raw_drooping_gourami", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_DROOPING_GOURAMI))); + public static final DeferredItem RAW_DUALITY_DAMSELFISH = ITEMS.register("raw_duality_damselfish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_DUALITY_DAMSELFISH))); + public static final DeferredItem RAW_FORKFISH = ITEMS.register("raw_forkfish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_FORKFISH))); + public static final DeferredItem RAW_HATCHETFISH = ITEMS.register("raw_hatchetfish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_HATCHETFISH))); + public static final DeferredItem RAW_SNEEP_SNORP = ITEMS.register("raw_sneep_snorp", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_SNEEP_SNORP))); + public static final DeferredItem RAW_TRIPLE_TWIRL_PLECO = ITEMS.register("raw_triple_twirl_pleco", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_TRIPLE_TWIRL_PLECO))); + public static final DeferredItem RAW_AERO_MONO_STICK = ITEMS.register("raw_aero_mono_stick", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_AERO_MONO_STICK))); + public static final DeferredItem COOKED_AERO_MONO_STICK = ITEMS.register("cooked_aero_mono_stick", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_AERO_MONO_STICK))); + //public static final DeferredItem RAW_BUMPFACE = ITEMS.register("raw_bumpface", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BUMPFACE))); + public static final DeferredItem RAW_SAILOR_BARB = ITEMS.register("raw_sailor_barb", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_SAILOR_BARB))); + public static final DeferredItem RAW_BARK_ANGELFISH = ITEMS.register("raw_bark_angelfish", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BARK_ANGELFISH))); + public static final DeferredItem RAW_BLIZZARD_TUNA = ITEMS.register("raw_blizzard_tuna", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_BLIZZARD_TUNA))); + public static final DeferredItem COOKED_BLIZZARD_TUNA = ITEMS.register("cooked_blizzard_tuna", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_BLIZZARD_TUNA))); + public static final DeferredItem RAW_SHOCKCAT = ITEMS.register("raw_shockcat", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_SHOCKCAT))); + public static final DeferredItem COOKED_SHOCKCAT = ITEMS.register("cooked_shockcat", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_SHOCKCAT))); + public static final DeferredItem RAW_LOBSTER = ITEMS.register("raw_lobster", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_LOBSTER))); + public static final DeferredItem COOKED_LOBSTER = ITEMS.register("cooked_lobster", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_LOBSTER))); + //public static final DeferredItem UNUSUAL_FILLET = ITEMS.register("unusual_fillet", () -> new Item(new Item.Properties().food(UFFoodProperties.UNUSUAL_FILLET))); + public static final DeferredItem RAW_MOSSTHORN = ITEMS.register("raw_mossthorn", () -> new Item(new Item.Properties().food(UFFoodProperties.RAW_MOSSTHORN))); + public static final DeferredItem COOKED_MOSSTHORN = ITEMS.register("cooked_mossthorn", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_MOSSTHORN))); + public static final DeferredItem COOKED_UNUSUAL_FILLET = ITEMS.register("cooked_unusual_fillet", () -> new Item(new Item.Properties().food(UFFoodProperties.COOKED_UNUSUAL_FILLET))); + public static final DeferredItem LOBSTER_ROLL = ITEMS.register("lobster_roll", () -> new Item(new Item.Properties().food(UFFoodProperties.LOBSTER_ROLL))); + public static final DeferredItem ODD_FISHSTICKS = ITEMS.register("odd_fishsticks", () -> new Item(new Item.Properties().food(UFFoodProperties.ODD_FISHSTICKS))); + public static final DeferredItem PICKLEDISH = ITEMS.register("pickledish", () -> new Item(new Item.Properties().food(UFFoodProperties.PICKLEDISH).stacksTo(1))); + public static final DeferredItem STRANGE_BROTH = ITEMS.register("strange_broth", () -> new Item(new Item.Properties().food(UFFoodProperties.STRANGE_BROTH).stacksTo(1))); + public static final DeferredItem UNUSUAL_SANDWICH = ITEMS.register("unusual_sandwich", () -> new Item(new Item.Properties().food(UFFoodProperties.UNUSUAL_SANDWICH))); + public static final DeferredItem WEIRD_GOLDFISH = ITEMS.register("weird_goldfish", () -> new Item(new Item.Properties().food(UFFoodProperties.WEIRD_GOLDFISH))); + // Drops + public static final DeferredItem TENDRIL = ITEMS.register("tendril", () -> new Item(new Item.Properties())); + public static final DeferredItem RIPPER_TOOTH = ITEMS.register("ripper_tooth", () -> new Item(new Item.Properties())); + public static final DeferredItem LOBSTER_SPIKE = ITEMS.register("lobster_spike", () -> new Item(new Item.Properties())); + public static final DeferredItem RELUCENT_SHARD = ITEMS.register("relucent_shard", () -> new Item(new Item.Properties())); + public static final DeferredItem CRIMSON_SHARD = ITEMS.register("crimson_shard", () -> new Item(new Item.Properties())); + public static final DeferredItem DEPTH_CLAW = ITEMS.register("depth_claw", () -> new Item(new Item.Properties())); + // Gear + public static final DeferredItem DEPTH_SCYTHE = ITEMS.register("depth_scythe", () -> new DepthScytheItem(Tiers.DIAMOND, new Item.Properties().durability(600).attributes(SwordItem.createAttributes(Tiers.DIAMOND, 3, -2.4F)))); + public static final DeferredItem RIPSAW = ITEMS.register("ripsaw", () -> new RipsawItem(new Item.Properties().stacksTo(1).attributes(AxeItem.createAttributes(UFTiers.RIPPER_SAW, 7.0F, -1.0F)))); + public static final DeferredItem FLUVIAL_SHELL = ITEMS.register("fluvial_shell", () -> new WeatherShellItem("rain", new Item.Properties().stacksTo(1).durability(1))); + public static final DeferredItem CLEMENT_SHELL = ITEMS.register("clement_shell", () -> new WeatherShellItem("clear", new Item.Properties().stacksTo(1).durability(1))); + public static final DeferredItem THUNDEROUS_SHELL = ITEMS.register("thunderous_shell", () -> new WeatherShellItem("thunder", new Item.Properties().stacksTo(1).durability(1))); + public static final DeferredItem PRISMARINE_SPEAR = ITEMS.register("prismarine_spear", () -> new PrismarineSpearItem(new Item.Properties().stacksTo(1).durability(100))); + public static final DeferredItem WEAPON_PARTS = ITEMS.register("weapon_parts", () -> new Item(new Item.Properties())); + public static final DeferredItem MUSIC_DISC_SEAFOAM = ITEMS.register("music_disc_seafoam", () -> new Item(new Item.Properties().component(DataComponents.JUKEBOX_PLAYABLE, new JukeboxPlayable(new EitherHolder<>(UFSounds.SEAFOAM_SONG), true)).stacksTo(1).rarity(Rarity.RARE))); + // Buckets + public static final DeferredItem AERO_MONO_BUCKET = ITEMS.register("aero_mono_bucket", () -> new UFFishBucketItem(UFEntities.AERO_MONO, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem RHINO_TETRA_BUCKET = ITEMS.register("rhino_tetra_bucket", () -> new UFFishBucketItem(UFEntities.RHINO_TETRA, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem DUALITY_DAMSELFISH_BUCKET = ITEMS.register("duality_damselfish_bucket", () -> new UFFishBucketItem(UFEntities.DUALITY_DAMSELFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem DROOPING_GOURAMI_BUCKET = ITEMS.register("drooping_gourami_bucket", () -> new UFFishBucketItem(UFEntities.DROOPING_GOURAMI, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem MOSSTHORN_BUCKET = ITEMS.register("mossthorn_bucket", () -> new UFFishBucketItem(UFEntities.MOSSTHORN, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem SAILOR_BARB_BUCKET = ITEMS.register("sailor_barb_bucket", () -> new UFFishBucketItem(UFEntities.SAILOR_BARB, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem TRIPLE_TWIRL_PLECO_BUCKET = ITEMS.register("triple_twirl_pleco_bucket", () -> new UFFishBucketItem(UFEntities.TRIPLE_TWIRL_PLECO, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem SPINDLEFISH_BUCKET = ITEMS.register("spindlefish_bucket", () -> new UFFishBucketItem(UFEntities.SPINDLEFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem RIPPER_BUCKET = ITEMS.register("ripper_bucket", () -> new UFFishBucketItem(UFEntities.RIPPER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem SEA_SPIDER_BUCKET = ITEMS.register("sea_spider_bucket", () -> new UFFishBucketItem(UFEntities.SEA_SPIDER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem CLOWNTHORN_SHARK_BUCKET = ITEMS.register("clownthorn_shark_bucket", () -> new UFFishBucketItem(UFEntities.CLOWNTHORN_SHARK, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + //public static final DeferredItem STARGAZER = ITEMS.register("stargazer", () -> new StargazerItem(new Item.Properties().tab(UnusualFishMod.UNUSUAL_TAB).stacksTo(1))); + public static final DeferredItem SNEEPSNORP_BUCKET = ITEMS.register("sneepsnorp_bucket", () -> new UFFishBucketItem(UFEntities.SNEEPSNORP, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem BLACKCAP_SNAIL_BUCKET = ITEMS.register("blackcap_snail_bucket", () -> new UFFishBucketItem(UFEntities.BLACKCAP_SNAIL, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem BRICK_SNAIL_BUCKET = ITEMS.register("brick_snail_bucket", () -> new UFFishBucketItem(UFEntities.BRICK_SNAIL, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem DEEP_CRAWLER_BUCKET = ITEMS.register("deep_crawler_bucket", () -> new UFFishBucketItem(UFEntities.DEEP_CRAWLER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem WIZARD_JELLY_BUCKET = ITEMS.register("wizard_jelly_bucket", () -> new UFFishBucketItem(UFEntities.WIZARD_JELLY, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem PORCUPINE_LOBSTA_BUCKET = ITEMS.register("porcupine_lobsta_bucket", () -> new UFFishBucketItem(UFEntities.PORCUPINE_LOBSTA, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem FRESHWATER_MANTIS_BUCKET = ITEMS.register("freshwater_mantis_bucket", () -> new UFFishBucketItem(UFEntities.FRESHWATER_MANTIS, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem BARK_ANGELFISH_BUCKET = ITEMS.register("bark_angelfish_bucket", () -> new UFFishBucketItem(UFEntities.BARK_ANGELFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem SKIPPER_BUCKET = ITEMS.register("lobed_skipper_bucket", () -> new UFFishBucketItem(UFEntities.LOBED_SKIPPER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem BEAKED_HERRING_BUCKET = ITEMS.register("beaked_herring_bucket", () -> new UFFishBucketItem(UFEntities.BEAKED_HERRING, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem PICKLEFISH_BUCKET = ITEMS.register("picklefish_bucket", () -> new UFFishBucketItem(UFEntities.PICKLEFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem BLIND_SAILFIN_BUCKET = ITEMS.register("blind_sailfin_bucket", () -> new UFFishBucketItem(UFEntities.BLIND_SAILFIN, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem DEMON_HERRING_BUCKET = ITEMS.register("demon_herring_bucket", () -> new UFFishBucketItem(UFEntities.DEMON_HERRING, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem AMBER_GOBY_BUCKET = ITEMS.register("amber_goby_bucket", () -> new UFFishBucketItem(UFEntities.AMBER_GOBY, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem HATCHET_FISH_BUCKET = ITEMS.register("hatchet_fish_bucket", () -> new UFFishBucketItem(UFEntities.HATCHET_FISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem COPPERFLAME_BUCKET = ITEMS.register("copperflame_bucket", () -> new UFFishBucketItem(UFEntities.COPPERFLAME, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem SQUODDLE_BUCKET = ITEMS.register("squoddle_bucket", () -> new UFFishBucketItem(UFEntities.SQUODDLE, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem SEA_MOSQUITO_BUCKET = ITEMS.register("sea_mosquito_bucket", () -> new UFFishBucketItem(UFEntities.SEA_MOSQUITO, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem FORKFISH_BUCKET = ITEMS.register("forkfish_bucket", () -> new UFFishBucketItem(UFEntities.FORKFISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem SPOON_SHARK_BUCKET = ITEMS.register("spoon_shark_bucket", () -> new UFFishBucketItem(UFEntities.SPOON_SHARK, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem CORAL_SKRIMP_BUCKET = ITEMS.register("coral_skrimp_bucket", () -> new UFFishBucketItem(UFEntities.CORAL_SKRIMP, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem CIRCUS_FISH_BUCKET = ITEMS.register("circus_fish_bucket", () -> new UFFishBucketItem(UFEntities.CIRCUS_FISH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem EYELASH_FISH_BUCKET = ITEMS.register("eyelash_fish_bucket", () -> new UFFishBucketItem(UFEntities.EYELASH, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem FROSTY_FIN_FISH_BUCKET = ITEMS.register("frosty_fin_fish_bucket", () -> new UFFishBucketItem(UFEntities.FROSTY_FIN, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem CRIMSONSHELL_SQUID_BUCKET = ITEMS.register("crimsonshell_squid_bucket", () -> new UFFishBucketItem(UFEntities.CRIMSONSHELL_SQUID, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem VOLT_ANGLER_BUCKET = ITEMS.register("volt_angler_bucket", () -> new UFFishBucketItem(UFEntities.VOLT_ANGLER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem BLIZZARDFIN_BUCKET = ITEMS.register("blizzardfin_bucket", () -> new UFFishBucketItem(UFEntities.BLIZZARDFIN_TUNA, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem MUDDYTOP_SNAIL_BUCKET = ITEMS.register("muddytop_snail_bucket", () -> new UFFishBucketItem(UFEntities.MUDDYTOP_SNAIL, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem SHOCKCAT_BUCKET = ITEMS.register("shockcat_bucket", () -> new UFFishBucketItem(UFEntities.SHOCKCAT, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem PINKFIN_IDOL_BUCKET = ITEMS.register("pinkfin_idol_bucket", () -> new UFFishBucketItem(UFEntities.PINKFIN, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem TIGER_PUFFER_BUCKET = ITEMS.register("tiger_puffer_bucket", () -> new UFFishBucketItem(UFEntities.TIGER_PUFFER, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem STOUT_BICHIR_BUCKET = ITEMS.register("stout_bichir_bucket", () -> new UFFishBucketItem(UFEntities.STOUT_BICHIR, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem TRIBBLE_BUCKET = ITEMS.register("tribble_bucket", () -> new UFFishBucketItem(UFEntities.TRIBBLE, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + public static final DeferredItem TRUMPET_SQUID_BUCKET = ITEMS.register("trumpet_squid_bucket", () -> new UFFishBucketItem(UFEntities.TRUMPET_SQUID, () -> Fluids.WATER, Items.BUCKET, false, new Item.Properties().stacksTo(1))); + // Spawn Eggs + public static final DeferredItem AERO_MONO_SPAWN_EGG = ITEMS.register("aero_mono_spawn_egg", () -> new SpawnEggItem(UFEntities.AERO_MONO.get(), 0x8ca8b5, 0x506884, new Item.Properties())); + public static final DeferredItem PINKFIN_SPAWN_EGG = ITEMS.register("pinkfin_spawn_egg", () -> new SpawnEggItem(UFEntities.PINKFIN.get(), 0x0e011e, 0x421054, new Item.Properties())); + public static final DeferredItem BARBED_SPAWN_EGG = ITEMS.register("roughback_guitarfish_spawn_egg", () -> new SpawnEggItem(UFEntities.ROUGHBACK.get(), 0x5e5d4f, 0x92998e, new Item.Properties())); + public static final DeferredItem CLOWNTHORN_SPAWN_EGG = ITEMS.register("clownthorn_shark_spawn_egg", () -> new SpawnEggItem(UFEntities.CLOWNTHORN_SHARK.get(), 0xbe5515, 0xa21e00, new Item.Properties())); + public static final DeferredItem DUALITY_SPAWN_EGG = ITEMS.register("duality_damselfish_spawn_egg", () -> new SpawnEggItem(UFEntities.DUALITY_DAMSELFISH.get(), 0x8a94a1, 0x2c3338, new Item.Properties())); + public static final DeferredItem DROOPING_GOURAMI_SPAWN_EGG = ITEMS.register("drooping_gourami_spawn_egg", () -> new SpawnEggItem(UFEntities.DROOPING_GOURAMI.get(), 0x54434d, 0x363243, new Item.Properties())); + public static final DeferredItem MOSSTHORN_SPAWN_EGG = ITEMS.register("mossthorn_spawn_egg", () -> new SpawnEggItem(UFEntities.MOSSTHORN.get(), 0x26a529, 0x034223, new Item.Properties())); + public static final DeferredItem RHINO_TETRA_SPAWN_EGG = ITEMS.register("rhino_tetra_spawn_egg", () -> new SpawnEggItem(UFEntities.RHINO_TETRA.get(), 0x919187, 0x7b2726, new Item.Properties())); + public static final DeferredItem RIPPER_SPAWN_EGG = ITEMS.register("ripper_spawn_egg", () -> new SpawnEggItem(UFEntities.RIPPER.get(), 0x565950, 0x8f9386, new Item.Properties())); + public static final DeferredItem SAILOR_BARB_PAWN_EGG = ITEMS.register("sailor_barb_spawn_egg", () -> new SpawnEggItem(UFEntities.SAILOR_BARB.get(), 0x5e6a25, 0xa1a68c, new Item.Properties())); + public static final DeferredItem SEA_PANCAKE_SPAWN_EGG = ITEMS.register("sea_pancake_spawn_egg", () -> new SpawnEggItem(UFEntities.SEA_PANCAKE.get(), 0xbda877, 0xdfcbb7, new Item.Properties())); + public static final DeferredItem SEA_SPIDER_SPAWN_EGG = ITEMS.register("sea_spider_spawn_egg", () -> new SpawnEggItem(UFEntities.SEA_SPIDER.get(), 0x774128, 0xaf7834, new Item.Properties())); + public static final DeferredItem SPINDLEFISH_SPAWN_EGG = ITEMS.register("spindlefish_spawn_egg", () -> new SpawnEggItem(UFEntities.SPINDLEFISH.get(), 0x8e2573, 0xc14aeb, new Item.Properties())); + public static final DeferredItem TRIPLE_TWIRL_PLECO_SPAWN_EGG = ITEMS.register("triple_twirl_pleco_spawn_egg", () -> new SpawnEggItem(UFEntities.TRIPLE_TWIRL_PLECO.get(), 0xc1923a, 0x903113, new Item.Properties())); + public static final DeferredItem BRICK_SNAIL_SPAWN_EGG = ITEMS.register("brick_snail_spawn_egg", () -> new SpawnEggItem(UFEntities.BRICK_SNAIL.get(), 0xb5553b, 0x674f17, new Item.Properties())); + public static final DeferredItem ZEBRA_CORNETFISH_SPAWN_EGG = ITEMS.register("zebra_cornetfish_spawn_egg", () -> new SpawnEggItem(UFEntities.ZEBRA_CORNETFISH.get(), 0x153957, 0xc7ad0d, new Item.Properties())); + public static final DeferredItem TIGER_PUFFER_SPAWN_EGG = ITEMS.register("tiger_puffer_spawn_egg", () -> new SpawnEggItem(UFEntities.TIGER_PUFFER.get(), 0x622814, 0x84736f, new Item.Properties())); + public static final DeferredItem BLACKCAP_SNAIL_SPAWN_EGG = ITEMS.register("blackcap_snail_spawn_egg", () -> new SpawnEggItem(UFEntities.BLACKCAP_SNAIL.get(), 0x262917, 0x4c3d27, new Item.Properties())); + public static final DeferredItem SNEEPSNORP_EGG = ITEMS.register("sneepsnorp_spawn_egg", () -> new SpawnEggItem(UFEntities.SNEEPSNORP.get(), 0x3347a7, 0xce8a24, new Item.Properties())); + public static final DeferredItem DEEP_CRAWLER_SPAWN_EGG = ITEMS.register("deep_crawler_spawn_egg", () -> new SpawnEggItem(UFEntities.DEEP_CRAWLER.get(), 0x536761, 0x34363f, new Item.Properties())); + public static final DeferredItem WIZARD_JELLY_SPAWN_EGG = ITEMS.register("wizard_jelly_spawn_egg", () -> new SpawnEggItem(UFEntities.WIZARD_JELLY.get(), 0x5550b4, 0x3aa8d7, new Item.Properties())); + public static final DeferredItem PORCUPINE_LOBSTA_SPAWN_EGG = ITEMS.register("porcupine_lobsta_spawn_egg", () -> new SpawnEggItem(UFEntities.PORCUPINE_LOBSTA.get(), 0x624736, 0x9e521b, new Item.Properties())); + public static final DeferredItem TRUMPET_SQUID_SPAWN_EGG = ITEMS.register("trumpet_squid_spawn_egg", () -> new SpawnEggItem(UFEntities.TRUMPET_SQUID.get(), 0xe8d26a, 0xc6a042, new Item.Properties())); + public static final DeferredItem FRESHWATER_MANTIS_EGG = ITEMS.register("freshwater_mantis_spawn_egg", () -> new SpawnEggItem(UFEntities.FRESHWATER_MANTIS.get(), 0x454629, 0x94ab67, new Item.Properties())); + public static final DeferredItem BARK_ANGELFISH_SPAWN_EGG = ITEMS.register("bark_angelfish_spawn_egg", () -> new SpawnEggItem(UFEntities.BARK_ANGELFISH.get(), 0x553f1a, 0x35270a, new Item.Properties())); + public static final DeferredItem SHOCKCAT_SPAWN_EGG = ITEMS.register("shockcat_spawn_egg", () -> new SpawnEggItem(UFEntities.SHOCKCAT.get(), 0x34294f, 0x255f9b, new Item.Properties())); + public static final DeferredItem MUDDYTOP_SNAIL_SPAWN_EGG = ITEMS.register("muddytop_snail_spawn_egg", () -> new SpawnEggItem(UFEntities.MUDDYTOP_SNAIL.get(), 0x23100e, 0x5f4d3b, new Item.Properties())); + public static final DeferredItem KALAPPA_SPAWN_EGG = ITEMS.register("kalappa_spawn_egg", () -> new SpawnEggItem(UFEntities.KALAPPA.get(), 0x624051, 0x886d86, new Item.Properties())); + public static final DeferredItem LOBED_SKIPPER_SPAWN_EGG = ITEMS.register("lobed_skipper_spawn_egg", () -> new SpawnEggItem(UFEntities.LOBED_SKIPPER.get(), 0x4b2618, 0x9e632f, new Item.Properties())); + public static final DeferredItem STOUT_BICHIR_SPAWN_EGG = ITEMS.register("stout_bichir_spawn_egg", () -> new SpawnEggItem(UFEntities.STOUT_BICHIR.get(), 0x5a5e3d, 0xb08f33, new Item.Properties())); + public static final DeferredItem BEAKED_HERRING_SPAWN_EGG = ITEMS.register("beaked_herring_spawn_egg", () -> new SpawnEggItem(UFEntities.BEAKED_HERRING.get(), 0x8bacc4, 0xc5d0cf, new Item.Properties())); + public static final DeferredItem PICKLEFISH_SPAWN_EGG = ITEMS.register("picklefish_spawn_egg", () -> new SpawnEggItem(UFEntities.PICKLEFISH.get(), 0x235806, 0xd0cd07, new Item.Properties())); + public static final DeferredItem BLIND_SAILFIN_SPAWN_EGG = ITEMS.register("blind_sailfin_spawn_egg", () -> new SpawnEggItem(UFEntities.BLIND_SAILFIN.get(), 0xdcccc3, 0xc19c8e, new Item.Properties())); + public static final DeferredItem DEMON_HERRING_SPAWN_EGG = ITEMS.register("demon_herring_spawn_egg", () -> new SpawnEggItem(UFEntities.DEMON_HERRING.get(), 0x363243, 0xef7930, new Item.Properties())); + public static final DeferredItem AMBER_GOBY_SPAWN_EGG = ITEMS.register("amber_goby_spawn_egg", () -> new SpawnEggItem(UFEntities.AMBER_GOBY.get(), 0xfb912e, 0xae5e2c, new Item.Properties())); + public static final DeferredItem HATCHET_FISH_SPAWN_EGG = ITEMS.register("hatchet_fish_spawn_egg", () -> new SpawnEggItem(UFEntities.HATCHET_FISH.get(), 0x0b0b26, 0x7d3283, new Item.Properties())); + public static final DeferredItem COPPERFLAME_SPAWN_EGG = ITEMS.register("copperflame_spawn_egg", () -> new SpawnEggItem(UFEntities.COPPERFLAME.get(), 0x4fab90, 0x7fcf90, new Item.Properties())); + public static final DeferredItem ROOTBALL_SPAWN_EGG = ITEMS.register("root_spawn_egg", () -> new SpawnEggItem(UFEntities.ROOTBALL.get(), 0x647233, 0xad7d65, new Item.Properties())); + public static final DeferredItem CELESTIAL_FISH_SPAWN_EGG = ITEMS.register("celestial_fish_spawn_egg", () -> new SpawnEggItem(UFEntities.CELESTIAL_FISH.get(), 0x6876a2, 0xe2e4c5, new Item.Properties())); + public static final DeferredItem GNASHER_SPAWN_EGG = ITEMS.register("gnasher_spawn_egg", () -> new SpawnEggItem(UFEntities.GNASHER.get(), 0x323232, 0x465bb2, new Item.Properties())); + public static final DeferredItem PRAWN_SPAWN_EGG = ITEMS.register("prawn_spawn_egg", () -> new SpawnEggItem(UFEntities.PRAWN.get(), 0x5a579e, 0x4694d1, new Item.Properties())); + public static final DeferredItem SQUODDLE_SPAWN_EGG = ITEMS.register("squoddle_spawn_egg", () -> new SpawnEggItem(UFEntities.SQUODDLE.get(), 0xb37817, 0xe58a2e, new Item.Properties())); + public static final DeferredItem SEA_MOSQUITO_SPAWN_EGG = ITEMS.register("sea_mosquito_spawn_egg", () -> new SpawnEggItem(UFEntities.SEA_MOSQUITO.get(), 0x326934, 0x6c122f, new Item.Properties())); + public static final DeferredItem FORKFISH_SPAWN_EGG = ITEMS.register("forkfish_spawn_egg", () -> new SpawnEggItem(UFEntities.FORKFISH.get(), 0x8e882c, 0x3dbba0, new Item.Properties())); + public static final DeferredItem SPOON_SHARK_SPAWN_EGG = ITEMS.register("spoon_shark_spawn_egg", () -> new SpawnEggItem(UFEntities.SPOON_SHARK.get(), 0xddbd78, 0xb3925b, new Item.Properties())); + public static final DeferredItem CORAL_SKRIMP_EGG = ITEMS.register("coral_skrimp_spawn_egg", () -> new SpawnEggItem(UFEntities.CORAL_SKRIMP.get(), 0x5a0e7a, 0xb34aa2, new Item.Properties())); + public static final DeferredItem CIRCUS_FISH_SPAWN_EGG = ITEMS.register("circus_fish_spawn_egg", () -> new SpawnEggItem(UFEntities.CIRCUS_FISH.get(), 0xab4b36, 0xc88f62, new Item.Properties())); + public static final DeferredItem BLIZZARDFIN_SPAWN_EGG = ITEMS.register("blizzardfin_spawn_egg", () -> new SpawnEggItem(UFEntities.BLIZZARDFIN_TUNA.get(), 0x9ed7dc, 0x6182a6, new Item.Properties())); + public static final DeferredItem EYELASH_FISH_SPAWN_EGG = ITEMS.register("eyelash_fish_spawn_egg", () -> new SpawnEggItem(UFEntities.EYELASH.get(), 0xb7b7ba, 0xfcfcfa, new Item.Properties())); + public static final DeferredItem FROSTY_FIN_FISH_SPAWN_EGG = ITEMS.register("frosty_fin_fish_spawn_egg", () -> new SpawnEggItem(UFEntities.FROSTY_FIN.get(), 0x649ccc, 0xcbe8e6, new Item.Properties())); + public static final DeferredItem TIGER_JUNGLE_SHARK_SPAWN_EGG = ITEMS.register("tiger_jungle_shark_spawn_egg", () -> new SpawnEggItem(UFEntities.TIGER_JUNGLE_SHARK.get(), 0x272530, 0xa5a8c6, new Item.Properties())); + public static final DeferredItem CRIMSONSHELL_SQUID_SPAWN_EGG = ITEMS.register("crimsonshell_squid_spawn_egg", () -> new SpawnEggItem(UFEntities.CRIMSONSHELL_SQUID.get(), 0xab101c, 0x432c39, new Item.Properties())); + public static final DeferredItem VOLT_ANGLER_SPAWN_EGG = ITEMS.register("volt_angler_spawn_egg", () -> new SpawnEggItem(UFEntities.VOLT_ANGLER.get(), 0x2d4035, 0x509033, new Item.Properties())); + public static final DeferredItem TRIBBLE_SPAWN_EGG = ITEMS.register("tribble_spawn_egg", () -> new SpawnEggItem(UFEntities.TRIBBLE.get(), 0x656f26, 0x46491a, new Item.Properties())); + private static final ChatFormatting TITLE_FORMAT = ChatFormatting.GRAY; + private static final ChatFormatting DESCRIPTION_FORMAT = ChatFormatting.BLUE; + private static final Component ANCIENT_WEAPON_UPGRADE = Component.translatable(Util.makeDescriptionId("upgrade", loc("ancient_weapon_upgrade"))).withStyle(TITLE_FORMAT); + private static final Component ANCIENT_WEAPON_APPLIES_TO = Component.translatable(Util.makeDescriptionId("item", loc("smithing_template.ancient_weapon_parts.applies_to"))).withStyle(DESCRIPTION_FORMAT); + private static final Component ANCIENT_WEAPON_INGREDIENTS = Component.translatable(Util.makeDescriptionId("item", loc("smithing_template.ancient_weapon_parts.ingredients"))).withStyle(DESCRIPTION_FORMAT); + private static final Component ANCIENT_WEAPON_BASE_SLOT_DESCRIPTION = Component.translatable(Util.makeDescriptionId("item", loc("smithing_template.ancient_weapon_parts.base_slot_description"))); + private static final Component ANCIENT_WEAPON_ADDITIONS_SLOT_DESCRIPTION = Component.translatable(Util.makeDescriptionId("item", loc("smithing_template.ancient_weapon_parts.additions_slot_description"))); + private static final ResourceLocation EMPTY_SLOT_WEAPON_PARTS = loc("item/empty_slot_weapon_parts"); + private static final ResourceLocation EMPTY_SLOT_DEPTH_CLAW = loc("item/empty_slot_depth_claw"); + private static final ResourceLocation EMPTY_SLOT_RIPPER_TOOTH = loc("item/empty_slot_ripper_tooth"); + public static final DeferredItem ANCIENT_WEAPON_SMITHING_TEMPLATE = ITEMS.register("ancient_weapon_smithing_template", () -> new SmithingTemplateItem(ANCIENT_WEAPON_APPLIES_TO, ANCIENT_WEAPON_INGREDIENTS, ANCIENT_WEAPON_UPGRADE, ANCIENT_WEAPON_ADDITIONS_SLOT_DESCRIPTION, ANCIENT_WEAPON_BASE_SLOT_DESCRIPTION, List.of(EMPTY_SLOT_WEAPON_PARTS), List.of(EMPTY_SLOT_DEPTH_CLAW, EMPTY_SLOT_RIPPER_TOOTH))); } diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFLootModifiers.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFLootModifiers.java index bda1dc0..07bd9ba 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFLootModifiers.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFLootModifiers.java @@ -4,16 +4,16 @@ import codyhuh.unusualfishmod.common.loot.BuriedTreasureLootModifier; import codyhuh.unusualfishmod.common.loot.UnderwaterRuinsLootModifier; import codyhuh.unusualfishmod.common.loot.UnusualCatchLootModifier; -import com.mojang.serialization.Codec; -import net.minecraftforge.common.loot.IGlobalLootModifier; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; +import com.mojang.serialization.MapCodec; +import net.neoforged.neoforge.common.loot.IGlobalLootModifier; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; +import net.neoforged.neoforge.registries.NeoForgeRegistries; public class UFLootModifiers { - public static final DeferredRegister> LOOT_MODIFIERS = DeferredRegister.create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, UnusualFishMod.MOD_ID); + public static final DeferredRegister> LOOT_MODIFIERS = DeferredRegister.create(NeoForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, UnusualFishMod.MOD_ID); - public static final RegistryObject> UNUSUAL_CATCH_LOOT_MODIFIER = LOOT_MODIFIERS.register("unusual_catch_glm", UnusualCatchLootModifier.CODEC); - public static final RegistryObject> UNDERWATER_RUINS_LOOT_MODIFIER = LOOT_MODIFIERS.register("underwater_ruins_glm", UnderwaterRuinsLootModifier.CODEC); - public static final RegistryObject> BURIED_TREASURE_LOOT_MODIFIER = LOOT_MODIFIERS.register("buried_treasure_glm", BuriedTreasureLootModifier.CODEC); -} + public static final DeferredHolder, MapCodec> UNUSUAL_CATCH_LOOT_MODIFIER = LOOT_MODIFIERS.register("unusual_catch_glm", () -> UnusualCatchLootModifier.CODEC); + public static final DeferredHolder, MapCodec> UNDERWATER_RUINS_LOOT_MODIFIER = LOOT_MODIFIERS.register("underwater_ruins_glm", () -> UnderwaterRuinsLootModifier.CODEC); + public static final DeferredHolder, MapCodec> BURIED_TREASURE_LOOT_MODIFIER = LOOT_MODIFIERS.register("buried_treasure_glm", () -> BuriedTreasureLootModifier.CODEC); +} \ No newline at end of file diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFSounds.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFSounds.java index 7218f99..9bbd0f2 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFSounds.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFSounds.java @@ -1,26 +1,32 @@ package codyhuh.unusualfishmod.core.registry; import codyhuh.unusualfishmod.UnusualFishMod; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.sounds.SoundEvent; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; +import net.minecraft.world.item.JukeboxSong; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; + +import static codyhuh.unusualfishmod.UnusualFishMod.loc; public class UFSounds { - public static final DeferredRegister SOUND_EVENTS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, UnusualFishMod.MOD_ID); + public static final DeferredRegister SOUND_EVENTS = DeferredRegister.create(BuiltInRegistries.SOUND_EVENT, UnusualFishMod.MOD_ID); + + public static final DeferredHolder CRAB_CHATTER = createSoundEvent("crab_chatter"); + public static final DeferredHolder CRAB_SCUTTLING = createSoundEvent("crab_scuttling"); + public static final DeferredHolder DEEP_WATER = createSoundEvent("deep_water"); + public static final DeferredHolder GNASHER_IDLE = createSoundEvent("gnasher_idle"); + public static final DeferredHolder EVIL_CHATTERING = createSoundEvent("evil_chattering"); + public static final DeferredHolder SMALL_ENEMY = createSoundEvent("small_enemy"); + public static final DeferredHolder SAWING = createSoundEvent("sawing"); + public static final DeferredHolder MUSIC_DISC_SEAFOAM = createSoundEvent("seafoam"); - public static final RegistryObject CRAB_CHATTER = createSoundEvent("crab_chatter"); - public static final RegistryObject CRAB_SCUTTLING = createSoundEvent("crab_scuttling"); - public static final RegistryObject DEEP_WATER = createSoundEvent("deep_water"); - public static final RegistryObject GNASHER_IDLE = createSoundEvent("gnasher_idle"); - public static final RegistryObject EVIL_CHATTERING = createSoundEvent("evil_chattering"); - public static final RegistryObject SMALL_ENEMY = createSoundEvent("small_enemy"); - public static final RegistryObject SAWING = createSoundEvent("sawing"); - public static final RegistryObject MUSIC_DISC_SEAFOAM = createSoundEvent("seafoam"); + public static final ResourceKey SEAFOAM_SONG = ResourceKey.create(Registries.JUKEBOX_SONG, UnusualFishMod.loc("seafoam")); - private static RegistryObject createSoundEvent(final String name) { - return SOUND_EVENTS.register(name, () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(UnusualFishMod.MOD_ID, name))); + private static DeferredHolder createSoundEvent(final String name) { + return SOUND_EVENTS.register(name, () -> SoundEvent.createVariableRangeEvent(loc(name))); } } diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFTabs.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFTabs.java index 8b014f1..9c38b51 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFTabs.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFTabs.java @@ -4,22 +4,17 @@ import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.world.item.CreativeModeTab; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.ItemLike; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.RegistryObject; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.Supplier; +import net.neoforged.neoforge.registries.DeferredHolder; +import net.neoforged.neoforge.registries.DeferredRegister; public class UFTabs { - public static final DeferredRegister CREATIVE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, UnusualFishMod.MOD_ID); + public static final DeferredRegister CREATIVE_TABS = + DeferredRegister.create(Registries.CREATIVE_MODE_TAB, UnusualFishMod.MOD_ID); - public static final RegistryObject UF_TAB = CREATIVE_TABS.register("unusual_fish_tab", + public static final DeferredHolder UF_TAB = CREATIVE_TABS.register("unusual_fish_tab", () -> CreativeModeTab.builder() .title(Component.translatable("itemGroup.unusual_fish_mod")) - .icon(UFItems.RAW_CIRCUS_FISH.get()::getDefaultInstance) + .icon(() -> UFItems.RAW_SNEEP_SNORP.get().getDefaultInstance()) .displayItems((displayParams, output) -> { for (var item : UFItems.ITEMS.getEntries()) { output.accept(item.get()); diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFTags.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFTags.java index 9906d00..e5a7bde 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFTags.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFTags.java @@ -1,9 +1,6 @@ package codyhuh.unusualfishmod.core.registry; -import codyhuh.unusualfishmod.UnusualFishMod; -import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; @@ -11,6 +8,8 @@ import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; +import static codyhuh.unusualfishmod.UnusualFishMod.loc; + public class UFTags { public static final TagKey> TIGER_PUFFER_PREY = entityTag("tiger_puffer_prey"); public static final TagKey> SNAILS = entityTag("snails"); @@ -21,14 +20,14 @@ public class UFTags { public static final TagKey UNCHOPPABLE = blockTag("unchoppable"); private static TagKey> entityTag(String path) { - return TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(UnusualFishMod.MOD_ID, path)); + return TagKey.create(Registries.ENTITY_TYPE, loc(path)); } private static TagKey itemTag(String path) { - return ItemTags.create(new ResourceLocation(UnusualFishMod.MOD_ID, path)); + return ItemTags.create(loc(path)); } private static TagKey blockTag(String path) { - return BlockTags.create(new ResourceLocation(UnusualFishMod.MOD_ID, path)); + return BlockTags.create(loc(path)); } } diff --git a/src/main/java/codyhuh/unusualfishmod/core/registry/UFTiers.java b/src/main/java/codyhuh/unusualfishmod/core/registry/UFTiers.java index b4906d7..8af8ee3 100644 --- a/src/main/java/codyhuh/unusualfishmod/core/registry/UFTiers.java +++ b/src/main/java/codyhuh/unusualfishmod/core/registry/UFTiers.java @@ -1,8 +1,11 @@ package codyhuh.unusualfishmod.core.registry; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.TagKey; import net.minecraft.util.LazyLoadedValue; import net.minecraft.world.item.Tier; import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.block.Block; import java.util.function.Supplier; @@ -37,6 +40,11 @@ public float getAttackDamageBonus() { return this.damage; } + @Override + public TagKey getIncorrectBlocksForDrops() { + return BlockTags.INCORRECT_FOR_STONE_TOOL; + } + public int getLevel() { return this.level; } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg deleted file mode 100644 index 849aa4f..0000000 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ /dev/null @@ -1,2 +0,0 @@ -public net.minecraft.world.entity.Entity f_19857_ # yRot -public-f net.minecraft.world.item.DiggerItem f_40980_ # speed \ No newline at end of file diff --git a/src/main/resources/assets/unusualfishmod/animations/entity/duality_damselfish.animation.json b/src/main/resources/assets/unusualfishmod/animations/entity/duality_damselfish.animation.json index cfdd7eb..08a8217 100644 --- a/src/main/resources/assets/unusualfishmod/animations/entity/duality_damselfish.animation.json +++ b/src/main/resources/assets/unusualfishmod/animations/entity/duality_damselfish.animation.json @@ -78,7 +78,7 @@ }, "position": { "0.0": ["math.sin(query.anim_time*180)*2.5", "3*query.is_on_ground+math.sin(query.anim_time*360)*5", "math.sin(query.anim_time*180/1)*5"], - "1.0": ["math.sin(query.anim_time*180)*2.5", "5+3*query.is_on_ground+math.sin(query.anim_time*360)*5", "+math.sin(query.anim_time*360-90)*5"], + "1.0": ["math.sin(query.anim_time*180)*2.5", "5+3*query.is_on_ground+math.sin(query.anim_time*360)*5", "math.sin(query.anim_time*360-90)*5"], "2.0": ["math.sin(query.anim_time*180)*2.5", "3*query.is_on_ground+math.sin(query.anim_time*360)*5", 0] } }, diff --git a/src/main/resources/assets/unusualfishmod/animations/entity/freshwater_mantis.animation.json b/src/main/resources/assets/unusualfishmod/animations/entity/freshwater_mantis.animation.json index facce41..7a971db 100644 --- a/src/main/resources/assets/unusualfishmod/animations/entity/freshwater_mantis.animation.json +++ b/src/main/resources/assets/unusualfishmod/animations/entity/freshwater_mantis.animation.json @@ -605,7 +605,7 @@ "rotation": [0, "math.sin(query.anim_time*360-150)*-10", "math.clamp(math.sin(query.anim_time*360-60)*20,-20,0)"] }, "Leg3": { - "rotation": [0, "math.sin(query.anim_time*180-150)*-20", "math.clamp(math.sin(query.anim_time*180-60)*0,0,20)2"] + "rotation": [0, "math.sin(query.anim_time*180-150)*-20", "math.clamp(math.sin(query.anim_time*180-60)*0,0,20)"] }, "Leg4": { "rotation": [0, "math.sin(query.anim_time*360-90)*-10", "math.clamp(math.sin(query.anim_time*360)*20,0,20)"] diff --git a/src/main/resources/assets/unusualfishmod/animations/entity/snowflaketail.animation.json b/src/main/resources/assets/unusualfishmod/animations/entity/frostyfin.animation.json similarity index 100% rename from src/main/resources/assets/unusualfishmod/animations/entity/snowflaketail.animation.json rename to src/main/resources/assets/unusualfishmod/animations/entity/frostyfin.animation.json diff --git a/src/main/resources/assets/unusualfishmod/animations/entity/sea_pancake.animation.json b/src/main/resources/assets/unusualfishmod/animations/entity/sea_pancake.animation.json index 760207c..34ed798 100644 --- a/src/main/resources/assets/unusualfishmod/animations/entity/sea_pancake.animation.json +++ b/src/main/resources/assets/unusualfishmod/animations/entity/sea_pancake.animation.json @@ -72,7 +72,7 @@ "position": [0, 0, -1] }, "BackFin2": { - "rotation": ["0math.sin(query.anim_time*720+60)*-10", "math.sin(query.anim_time*720+60)*10", "math.sin(query.anim_time*720-30)*-20"] + "rotation": ["math.sin(query.anim_time*720+60)*-10", "math.sin(query.anim_time*720+60)*10", "math.sin(query.anim_time*720-30)*-20"] }, "BackFin1": { "rotation": ["math.sin(query.anim_time*720+60)*-10", "math.sin(query.anim_time*720+60)*-10", "math.sin(query.anim_time*720-30)*-20"] diff --git a/src/main/resources/assets/unusualfishmod/geo/entity/snowflaketail.geo.json b/src/main/resources/assets/unusualfishmod/geo/entity/frostyfin.geo.json similarity index 97% rename from src/main/resources/assets/unusualfishmod/geo/entity/snowflaketail.geo.json rename to src/main/resources/assets/unusualfishmod/geo/entity/frostyfin.geo.json index 3718fb7..853ae0a 100644 --- a/src/main/resources/assets/unusualfishmod/geo/entity/snowflaketail.geo.json +++ b/src/main/resources/assets/unusualfishmod/geo/entity/frostyfin.geo.json @@ -3,7 +3,7 @@ "minecraft:geometry": [ { "description": { - "identifier": "geometry.snowflake_tail_fish", + "identifier": "geometry.frosty_fin_fish", "texture_width": 64, "texture_height": 64, "visible_bounds_width": 3, diff --git a/src/main/resources/assets/unusualfishmod/lang/en_us.json b/src/main/resources/assets/unusualfishmod/lang/en_us.json index 9d368be..c8ff584 100644 --- a/src/main/resources/assets/unusualfishmod/lang/en_us.json +++ b/src/main/resources/assets/unusualfishmod/lang/en_us.json @@ -13,7 +13,7 @@ "item.unusualfishmod.raw_shockcat": "Raw Shockcat Fillet", "item.unusualfishmod.raw_lobster": "Raw Porcupine Lobster Tail", "item.unusualfishmod.raw_eyelash": "Eyelash Fish", - "item.unusualfishmod.raw_snowflake": "Frosty Fin", + "item.unusualfishmod.raw_frosty_fin": "Frosty Fin", "item.unusualfishmod.unusual_fillet": "Raw Unusual Fillet", "item.unusualfishmod.raw_picklefish": "Picklefish", "item.unusualfishmod.raw_amber_goby": "Amber Goby", @@ -114,7 +114,7 @@ "item.unusualfishmod.circus_fish_spawn_egg": "Circus Fish Spawn Egg", "item.unusualfishmod.blizzardfin_spawn_egg": "Blizzardfin Tuna Spawn Egg", "item.unusualfishmod.eyelash_fish_spawn_egg": "Eyelash Fish Spawn Egg", - "item.unusualfishmod.snowflake_tail_fish_spawn_egg": "Frosty Fin Spawn Egg", + "item.unusualfishmod.frosty_fin_fish_spawn_egg": "Frosty Fin Spawn Egg", "item.unusualfishmod.tiger_jungle_shark_spawn_egg": "Tiger Jungle Shark Spawn Egg", "item.unusualfishmod.crimsonshell_squid_spawn_egg": "Crimsonshell Squid Spawn Egg", "item.unusualfishmod.volt_angler_spawn_egg": "Volt Angler Spawn Egg", @@ -159,7 +159,7 @@ "item.unusualfishmod.coral_skrimp_bucket": "Bucket of Skrimp", "item.unusualfishmod.circus_fish_bucket": "Bucket of Circus Fish", "item.unusualfishmod.eyelash_fish_bucket": "Bucket of Eyelash Fish", - "item.unusualfishmod.snowflake_tail_fish_bucket": "Bucket of Frosty Fin", + "item.unusualfishmod.frosty_fin_fish_bucket": "Bucket of Frosty Fin", "item.unusualfishmod.crimsonshell_squid_bucket": "Bucket of Crimsonshell Squid", "item.unusualfishmod.volt_angler_bucket": "Bucket of Volt Anglerfish", "item.unusualfishmod.blizzardfin_bucket": "Bucket of Blizzardfin Tuna", @@ -245,7 +245,7 @@ "entity.unusualfishmod.circus":"Circus Fish", "entity.unusualfishmod.blizzardfin":"Blizzardfin Tuna", "entity.unusualfishmod.eyelash":"Eyelash Fish", - "entity.unusualfishmod.snowflaketail":"Frosty Fin", + "entity.unusualfishmod.frostyfin":"Frosty Fin", "entity.unusualfishmod.jungleshark":"Tiger Jungle Shark", "entity.unusualfishmod.crimsonshell":"Crimsonshell Squid", "entity.unusualfishmod.volt_angler":"Volt Anglerfish", diff --git a/src/main/resources/assets/unusualfishmod/lang/ko_kr.json b/src/main/resources/assets/unusualfishmod/lang/ko_kr.json index 61c13ff..39ea9e9 100644 --- a/src/main/resources/assets/unusualfishmod/lang/ko_kr.json +++ b/src/main/resources/assets/unusualfishmod/lang/ko_kr.json @@ -13,7 +13,7 @@ "item.unusualfishmod.raw_shockcat": "익히지 않은 전기메기 살점", "item.unusualfishmod.raw_lobster": "익히지 않은 고슴도치 바닷가재 꼬리", "item.unusualfishmod.raw_eyelash": "익히지 않은 속눈썹고기", - "item.unusualfishmod.raw_snowflake": "익히지 않은 눈송이 지느러미고기", + "item.unusualfishmod.raw_frosty_fin": "익히지 않은 눈송이 지느러미고기", "item.unusualfishmod.unusual_fillet": "익히지 않은 특이한 살점", "item.unusualfishmod.raw_picklefish": "익히지 않은 피클고기", "item.unusualfishmod.raw_amber_goby": "익히지 않은 호박고비", @@ -114,7 +114,7 @@ "item.unusualfishmod.circus_fish_spawn_egg": "서커스고기 스폰 알", "item.unusualfishmod.blizzardfin_spawn_egg": "눈보라 지느러미참치 스폰 알", "item.unusualfishmod.eyelash_fish_spawn_egg": "속눈썹고기 스폰 알", - "item.unusualfishmod.snowflake_tail_fish_spawn_egg": "눈송이 지느러미고기 스폰 알", + "item.unusualfishmod.frosty_fin_fish_spawn_egg": "눈송이 지느러미고기 스폰 알", "item.unusualfishmod.tiger_jungle_shark_spawn_egg": "정글 호랑이 상어 스폰 알", "item.unusualfishmod.crimsonshell_squid_spawn_egg": "진홍조개 오징어 스폰 알", "item.unusualfishmod.volt_angler_spawn_egg": "전압 아귀 스폰 알", @@ -159,7 +159,7 @@ "item.unusualfishmod.coral_skrimp_bucket": "산호 새우 양동이", "item.unusualfishmod.circus_fish_bucket": "서커스고기 양동이", "item.unusualfishmod.eyelash_fish_bucket": "속눈썹고기 양동이", - "item.unusualfishmod.snowflake_tail_fish_bucket": "눈송이 지느러미고기 양동이", + "item.unusualfishmod.frosty_fin_fish_bucket": "눈송이 지느러미고기 양동이", "item.unusualfishmod.crimsonshell_squid_bucket": "진홍껍질 오징어 양동이", "item.unusualfishmod.volt_angler_bucket": "볼트 아귀 양동이", "item.unusualfishmod.blizzardfin_bucket": "눈보라 지느러미참치 양동이", @@ -245,7 +245,7 @@ "entity.unusualfishmod.circus": "서커스고기", "entity.unusualfishmod.blizzardfin": "눈보라 지느러미참치", "entity.unusualfishmod.eyelash": "속눈썹고기", - "entity.unusualfishmod.snowflaketail": "눈송이 지느러미고기", + "entity.unusualfishmod.frostyfin": "눈송이 지느러미고기", "entity.unusualfishmod.jungleshark": "정글 호랑이 상어", "entity.unusualfishmod.crimsonshell": "진홍껍질 오징어", "entity.unusualfishmod.volt_angler": "볼트 아귀", diff --git a/src/main/resources/assets/unusualfishmod/lang/uk_ua.json b/src/main/resources/assets/unusualfishmod/lang/uk_ua.json index bbf65a8..895027c 100644 --- a/src/main/resources/assets/unusualfishmod/lang/uk_ua.json +++ b/src/main/resources/assets/unusualfishmod/lang/uk_ua.json @@ -13,7 +13,7 @@ "item.unusualfishmod.raw_shockcat": "Сирий шококіт", "item.unusualfishmod.raw_lobster": "Сирий хвіст голчастого лобстера", "item.unusualfishmod.raw_eyelash": "Сира війкориба", - "item.unusualfishmod.raw_snowflake": "Сирий сніжинкохвіст", + "item.unusualfishmod.raw_frosty_fin": "Сирий сніжинкохвіст", "item.unusualfishmod.unusual_fillet": "Незвичайне філе", "item.unusualfishmod.raw_picklefish": "Сира маринориба", "item.unusualfishmod.raw_amber_goby": "Сирий бурштиновий бичок", @@ -112,7 +112,7 @@ "item.unusualfishmod.circus_fish_spawn_egg": "Яйце виклику циркової риби", "item.unusualfishmod.blizzardfin_spawn_egg": "Яйце виклику тунця завірюхи", "item.unusualfishmod.eyelash_fish_spawn_egg": "Яйце виклику війкориби", - "item.unusualfishmod.snowflake_tail_fish_spawn_egg": "Яйце виклику сніжинкохвоста", + "item.unusualfishmod.frosty_fin_fish_spawn_egg": "Яйце виклику сніжинкохвоста", "item.unusualfishmod.tiger_jungle_shark_spawn_egg": "Яйце виклику джунглевої тигрової акули", "item.unusualfishmod.crimsonshell_squid_spawn_egg": "Яйце виклику багряного наутилуса", "item.unusualfishmod.volt_angler_spawn_egg": "Яйце виклику вольт-удильника", @@ -157,7 +157,7 @@ "item.unusualfishmod.coral_skrimp_bucket": "Відро з кораловою креветкою", "item.unusualfishmod.circus_fish_bucket": "Відро з цирковою рибою", "item.unusualfishmod.eyelash_fish_bucket": "Відро з війкорибою", - "item.unusualfishmod.snowflake_tail_fish_bucket": "Відро зі сніжинкохвостом", + "item.unusualfishmod.frosty_fin_fish_bucket": "Відро зі сніжинкохвостом", "item.unusualfishmod.crimsonshell_squid_bucket": "Відро з багряним наутилусом", "item.unusualfishmod.volt_angler_bucket": "Відро з вольт-удильником", "item.unusualfishmod.blizzardfin_bucket": "Відро з тунцем завірюхи", @@ -243,7 +243,7 @@ "entity.unusualfishmod.circus": "Циркова риба", "entity.unusualfishmod.blizzardfin": "Тунець завірюхи", "entity.unusualfishmod.eyelash": "Війкориба", - "entity.unusualfishmod.snowflake_tail_fish": "Сніжинкохвіст", + "entity.unusualfishmod.frosty_fin_fish": "Сніжинкохвіст", "entity.unusualfishmod.tiger_jungle_shark": "Джунглева тигрова акула", "entity.unusualfishmod.crimsonshell": "Багряний наутилус", "entity.unusualfishmod.volt_angler": "Вольт-удильник", diff --git a/src/main/resources/assets/unusualfishmod/models/item/depth_scythe.json b/src/main/resources/assets/unusualfishmod/models/item/depth_scythe.json index 64ad365..60fe214 100644 --- a/src/main/resources/assets/unusualfishmod/models/item/depth_scythe.json +++ b/src/main/resources/assets/unusualfishmod/models/item/depth_scythe.json @@ -1,6 +1,6 @@ { - "parent":"forge:item/default", - "loader":"forge:separate_transforms", + "parent":"neoforge:item/default", + "loader":"neoforge:separate_transforms", "base": { "parent": "unusualfishmod:item/scythe_in_hand" }, diff --git a/src/main/resources/assets/unusualfishmod/models/item/frosty_fin_fish_bucket.json b/src/main/resources/assets/unusualfishmod/models/item/frosty_fin_fish_bucket.json new file mode 100644 index 0000000..dbb45ce --- /dev/null +++ b/src/main/resources/assets/unusualfishmod/models/item/frosty_fin_fish_bucket.json @@ -0,0 +1,6 @@ +{ + "parent" : "item/generated", + "textures" : { + "layer0" : "unusualfishmod:item/frosty_fin_bucket" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unusualfishmod/models/item/snowflake_tail_fish_spawn_egg.json b/src/main/resources/assets/unusualfishmod/models/item/frosty_fin_fish_spawn_egg.json similarity index 100% rename from src/main/resources/assets/unusualfishmod/models/item/snowflake_tail_fish_spawn_egg.json rename to src/main/resources/assets/unusualfishmod/models/item/frosty_fin_fish_spawn_egg.json diff --git a/src/main/resources/assets/unusualfishmod/models/item/prismarine_spear.json b/src/main/resources/assets/unusualfishmod/models/item/prismarine_spear.json index 0f0922b..7c1ef9e 100644 --- a/src/main/resources/assets/unusualfishmod/models/item/prismarine_spear.json +++ b/src/main/resources/assets/unusualfishmod/models/item/prismarine_spear.json @@ -1,6 +1,6 @@ { - "parent": "forge:item/default", - "loader": "forge:separate_transforms", + "parent": "neoforge:item/default", + "loader": "neoforge:separate_transforms", "base": { "parent": "unusualfishmod:item/prismarine_spear_handheld", "textures": { diff --git a/src/main/resources/assets/unusualfishmod/models/item/prismarine_spear_handheld_using.json b/src/main/resources/assets/unusualfishmod/models/item/prismarine_spear_handheld_using.json index a7967b9..6ecf3ea 100644 --- a/src/main/resources/assets/unusualfishmod/models/item/prismarine_spear_handheld_using.json +++ b/src/main/resources/assets/unusualfishmod/models/item/prismarine_spear_handheld_using.json @@ -1,6 +1,6 @@ { - "parent": "forge:item/default", - "loader": "forge:separate_transforms", + "parent": "neoforge:item/default", + "loader": "neoforge:separate_transforms", "base": { "parent": "unusualfishmod:item/prismarine_spear_handheld", "textures": { diff --git a/src/main/resources/assets/unusualfishmod/models/item/raw_frosty_fin.json b/src/main/resources/assets/unusualfishmod/models/item/raw_frosty_fin.json new file mode 100644 index 0000000..487f957 --- /dev/null +++ b/src/main/resources/assets/unusualfishmod/models/item/raw_frosty_fin.json @@ -0,0 +1,6 @@ +{ + "parent" : "item/generated", + "textures" : { + "layer0" : "unusualfishmod:item/raw_frosty_fin_fish" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/unusualfishmod/models/item/raw_snowflake.json b/src/main/resources/assets/unusualfishmod/models/item/raw_snowflake.json deleted file mode 100644 index 66583e5..0000000 --- a/src/main/resources/assets/unusualfishmod/models/item/raw_snowflake.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent" : "item/generated", - "textures" : { - "layer0" : "unusualfishmod:item/raw_snowflake_tail_fish" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/unusualfishmod/models/item/snowflake_tail_fish_bucket.json b/src/main/resources/assets/unusualfishmod/models/item/snowflake_tail_fish_bucket.json deleted file mode 100644 index 4002db9..0000000 --- a/src/main/resources/assets/unusualfishmod/models/item/snowflake_tail_fish_bucket.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent" : "item/generated", - "textures" : { - "layer0" : "unusualfishmod:item/snowflake_tail_bucket" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/unusualfishmod/textures/entity/snowflaketail.png b/src/main/resources/assets/unusualfishmod/textures/entity/frostyfin.png similarity index 100% rename from src/main/resources/assets/unusualfishmod/textures/entity/snowflaketail.png rename to src/main/resources/assets/unusualfishmod/textures/entity/frostyfin.png diff --git a/src/main/resources/assets/unusualfishmod/textures/item/snowflake_tail_bucket.png b/src/main/resources/assets/unusualfishmod/textures/item/frosty_fin_bucket.png similarity index 100% rename from src/main/resources/assets/unusualfishmod/textures/item/snowflake_tail_bucket.png rename to src/main/resources/assets/unusualfishmod/textures/item/frosty_fin_bucket.png diff --git a/src/main/resources/assets/unusualfishmod/textures/item/raw_snowflake_tail_fish.png b/src/main/resources/assets/unusualfishmod/textures/item/raw_frosty_fin_fish.png similarity index 100% rename from src/main/resources/assets/unusualfishmod/textures/item/raw_snowflake_tail_fish.png rename to src/main/resources/assets/unusualfishmod/textures/item/raw_frosty_fin_fish.png diff --git a/src/main/resources/data/forge/tags/items/cooked_fishes.json b/src/main/resources/data/c/tags/item/cooked_fishes.json similarity index 100% rename from src/main/resources/data/forge/tags/items/cooked_fishes.json rename to src/main/resources/data/c/tags/item/cooked_fishes.json diff --git a/src/main/resources/data/forge/tags/items/foods/cooked_fishes.json b/src/main/resources/data/c/tags/item/foods/cooked_fishes.json similarity index 100% rename from src/main/resources/data/forge/tags/items/foods/cooked_fishes.json rename to src/main/resources/data/c/tags/item/foods/cooked_fishes.json diff --git a/src/main/resources/data/forge/tags/items/foods/raw_fishes.json b/src/main/resources/data/c/tags/item/foods/raw_fishes.json similarity index 100% rename from src/main/resources/data/forge/tags/items/foods/raw_fishes.json rename to src/main/resources/data/c/tags/item/foods/raw_fishes.json diff --git a/src/main/resources/data/forge/tags/items/raw_fishes.json b/src/main/resources/data/c/tags/item/raw_fishes.json similarity index 100% rename from src/main/resources/data/forge/tags/items/raw_fishes.json rename to src/main/resources/data/c/tags/item/raw_fishes.json diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/main/resources/data/minecraft/tags/block/mineable/pickaxe.json similarity index 88% rename from src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json rename to src/main/resources/data/minecraft/tags/block/mineable/pickaxe.json index 0b0521f..970a5f1 100644 --- a/src/main/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/src/main/resources/data/minecraft/tags/block/mineable/pickaxe.json @@ -19,6 +19,8 @@ "unusualfishmod:relucent_tile_slab", "unusualfishmod:relucent_tile_wall", "unusualfishmod:nautical_lamp", - "unusualfishmod:sea_boom" + "unusualfishmod:sea_boom", + "unusualfishmod:copper_antenna", + "unusualfishmod:volt_detector" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/slabs.json b/src/main/resources/data/minecraft/tags/block/slabs.json similarity index 100% rename from src/main/resources/data/minecraft/tags/blocks/slabs.json rename to src/main/resources/data/minecraft/tags/block/slabs.json diff --git a/src/main/resources/data/minecraft/tags/blocks/stairs.json b/src/main/resources/data/minecraft/tags/block/stairs.json similarity index 100% rename from src/main/resources/data/minecraft/tags/blocks/stairs.json rename to src/main/resources/data/minecraft/tags/block/stairs.json diff --git a/src/main/resources/data/minecraft/tags/blocks/walls.json b/src/main/resources/data/minecraft/tags/block/walls.json similarity index 100% rename from src/main/resources/data/minecraft/tags/blocks/walls.json rename to src/main/resources/data/minecraft/tags/block/walls.json diff --git a/src/main/resources/data/minecraft/tags/entity_type/aquatic.json b/src/main/resources/data/minecraft/tags/entity_type/aquatic.json new file mode 100644 index 0000000..1420c01 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/entity_type/aquatic.json @@ -0,0 +1,58 @@ +{ + "values": [ + "unusualfishmod:duality_damselfish", + "unusualfishmod:mossthorn", + "unusualfishmod:ripper", + "unusualfishmod:spindlefish", + "unusualfishmod:rhino_tetra", + "unusualfishmod:drooping_gourami", + "unusualfishmod:sailor_barb", + "unusualfishmod:sea_spider", + "unusualfishmod:triple_twirl_pleco", + "unusualfishmod:aero_mono", + "unusualfishmod:clownthorn_shark", + "unusualfishmod:roughback_guitarfish", + "unusualfishmod:sea_pancake", + "unusualfishmod:pinkfin", + "unusualfishmod:brick_snail", + "unusualfishmod:zebra_cornetfish", + "unusualfishmod:tiger_puffer", + "unusualfishmod:blackcap_snail", + "unusualfishmod:sneep_snorp", + "unusualfishmod:deep_crawler", + "unusualfishmod:wizard_jelly", + "unusualfishmod:porcupine_lobsta", + "unusualfishmod:trumpet_squid", + "unusualfishmod:freshwater_mantis", + "unusualfishmod:bark_angelfish", + "unusualfishmod:shockcat", + "unusualfishmod:muddytop", + "unusualfishmod:kalappa", + "unusualfishmod:skipper", + "unusualfishmod:stout_bichir", + "unusualfishmod:beaked_herring", + "unusualfishmod:picklefish", + "unusualfishmod:blindsailfin", + "unusualfishmod:demon_herring", + "unusualfishmod:amber_goby", + "unusualfishmod:hatchet_fish", + "unusualfishmod:copperflame", + "unusualfishmod:rootball", + "unusualfishmod:celestial", + "unusualfishmod:gnasher", + "unusualfishmod:prawn", + "unusualfishmod:squoddle", + "unusualfishmod:sea_mosquito", + "unusualfishmod:forkfish", + "unusualfishmod:spoon_shark", + "unusualfishmod:coral_skrimp", + "unusualfishmod:circus", + "unusualfishmod:blizzardfin", + "unusualfishmod:frostyfin", + "unusualfishmod:eyelash", + "unusualfishmod:jungleshark", + "unusualfishmod:crimsonshell", + "unusualfishmod:volt_angler", + "unusualfishmod:tribble" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/entity_type/can_breathe_under_water.json b/src/main/resources/data/minecraft/tags/entity_type/can_breathe_under_water.json new file mode 100644 index 0000000..0ebadfc --- /dev/null +++ b/src/main/resources/data/minecraft/tags/entity_type/can_breathe_under_water.json @@ -0,0 +1,13 @@ +{ + "values": [ + "unusualfishmod:brick_snail", + "unusualfishmod:muddytop", + "unusualfishmod:blackcap_snail", + "unusualfishmod:squoddle", + "unusualfishmod:deep_crawler", + "unusualfishmod:sea_spider", + "unusualfishmod:coral_skrimp", + "unusualfishmod:tribble", + "unusualfishmod:porcupine_lobsta" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/items/fishes.json b/src/main/resources/data/minecraft/tags/item/fishes.json similarity index 100% rename from src/main/resources/data/minecraft/tags/items/fishes.json rename to src/main/resources/data/minecraft/tags/item/fishes.json diff --git a/src/main/resources/data/minecraft/tags/items/slabs.json b/src/main/resources/data/minecraft/tags/item/slabs.json similarity index 100% rename from src/main/resources/data/minecraft/tags/items/slabs.json rename to src/main/resources/data/minecraft/tags/item/slabs.json diff --git a/src/main/resources/data/minecraft/tags/items/stairs.json b/src/main/resources/data/minecraft/tags/item/stairs.json similarity index 100% rename from src/main/resources/data/minecraft/tags/items/stairs.json rename to src/main/resources/data/minecraft/tags/item/stairs.json diff --git a/src/main/resources/data/minecraft/tags/items/walls.json b/src/main/resources/data/minecraft/tags/item/walls.json similarity index 100% rename from src/main/resources/data/minecraft/tags/items/walls.json rename to src/main/resources/data/minecraft/tags/item/walls.json diff --git a/src/main/resources/data/minecraft/tags/items/music_discs.json b/src/main/resources/data/minecraft/tags/items/music_discs.json deleted file mode 100644 index f3e955b..0000000 --- a/src/main/resources/data/minecraft/tags/items/music_discs.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "unusualfishmod:music_disc_seafoam" - ] -} \ No newline at end of file diff --git a/src/main/resources/data/forge/loot_modifiers/global_loot_modifiers.json b/src/main/resources/data/neoforge/loot_modifiers/global_loot_modifiers.json similarity index 100% rename from src/main/resources/data/forge/loot_modifiers/global_loot_modifiers.json rename to src/main/resources/data/neoforge/loot_modifiers/global_loot_modifiers.json diff --git a/src/main/resources/data/unusualfishmod/enchantment/unusual_catch.json b/src/main/resources/data/unusualfishmod/enchantment/unusual_catch.json new file mode 100644 index 0000000..745a788 --- /dev/null +++ b/src/main/resources/data/unusualfishmod/enchantment/unusual_catch.json @@ -0,0 +1,23 @@ +{ + "description": { + "translate": "enchantment.unusualfishmod.unusual_catch" + }, + "weight": 2, + "max_level": 1, + "min_cost": { + "base": 12, + "per_level_above_first": 0 + }, + "max_cost": { + "base": 62, + "per_level_above_first": 0 + }, + "anvil_cost": 4, + "slots": [ + "mainhand", + "offhand" + ], + "effects": {}, + "supported_items": "#minecraft:enchantable/fishing", + "primary_items": "#minecraft:enchantable/fishing" +} \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/jukebox_song/seafoam.json b/src/main/resources/data/unusualfishmod/jukebox_song/seafoam.json new file mode 100644 index 0000000..5b952b5 --- /dev/null +++ b/src/main/resources/data/unusualfishmod/jukebox_song/seafoam.json @@ -0,0 +1,8 @@ +{ + "comparator_output": 15, + "description": { + "translate": "item.unusualfishmod.music_disc_seafoam.desc" + }, + "length_in_seconds": 155.0, + "sound_event": "unusualfishmod:seafoam" +} \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/loot_modifiers/buried_treasure_glm.json b/src/main/resources/data/unusualfishmod/loot_modifiers/buried_treasure_glm.json index 00e2bc3..775a962 100644 --- a/src/main/resources/data/unusualfishmod/loot_modifiers/buried_treasure_glm.json +++ b/src/main/resources/data/unusualfishmod/loot_modifiers/buried_treasure_glm.json @@ -2,7 +2,7 @@ "type": "unusualfishmod:buried_treasure_glm", "conditions": [ { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/buried_treasure" } ] diff --git a/src/main/resources/data/unusualfishmod/loot_modifiers/underwater_ruins_glm.json b/src/main/resources/data/unusualfishmod/loot_modifiers/underwater_ruins_glm.json index 54841ba..60b4a1e 100644 --- a/src/main/resources/data/unusualfishmod/loot_modifiers/underwater_ruins_glm.json +++ b/src/main/resources/data/unusualfishmod/loot_modifiers/underwater_ruins_glm.json @@ -2,7 +2,7 @@ "type": "unusualfishmod:underwater_ruins_glm", "conditions": [ { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/underwater_ruin_big" } ] diff --git a/src/main/resources/data/unusualfishmod/loot_modifiers/unusual_catch_glm.json b/src/main/resources/data/unusualfishmod/loot_modifiers/unusual_catch_glm.json index 069aaad..ea9f610 100644 --- a/src/main/resources/data/unusualfishmod/loot_modifiers/unusual_catch_glm.json +++ b/src/main/resources/data/unusualfishmod/loot_modifiers/unusual_catch_glm.json @@ -2,7 +2,7 @@ "type": "unusualfishmod:unusual_catch_glm", "conditions": [ { - "condition": "forge:loot_table_id", + "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:gameplay/fishing" } ] diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/chiseled_crimson_bricks.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/chiseled_crimson_bricks.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/chiseled_crimson_bricks.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/chiseled_crimson_bricks.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/chiseled_relucent_bricks.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/chiseled_relucent_bricks.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/chiseled_relucent_bricks.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/chiseled_relucent_bricks.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/copper_antenna.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/copper_antenna.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/copper_antenna.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/copper_antenna.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_brick_slab.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_brick_slab.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_brick_slab.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_brick_slab.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_brick_stairs.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_brick_stairs.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_brick_stairs.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_brick_stairs.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_brick_wall.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_brick_wall.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_brick_wall.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_brick_wall.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_bricks.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_bricks.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_bricks.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_bricks.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_tile_slab.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_tile_slab.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_tile_slab.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_tile_slab.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_tile_stairs.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_tile_stairs.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_tile_stairs.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_tile_stairs.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_tile_wall.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_tile_wall.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_tile_wall.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_tile_wall.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_tiles.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_tiles.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/crimson_tiles.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/crimson_tiles.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/nautical_lamp.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/nautical_lamp.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/nautical_lamp.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/nautical_lamp.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_brick_slab.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_brick_slab.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_brick_slab.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_brick_slab.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_brick_stairs.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_brick_stairs.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_brick_stairs.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_brick_stairs.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_brick_wall.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_brick_wall.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_brick_wall.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_brick_wall.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_bricks.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_bricks.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_bricks.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_bricks.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_tile_slab.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_tile_slab.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_tile_slab.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_tile_slab.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_tile_stairs.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_tile_stairs.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_tile_stairs.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_tile_stairs.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_tile_wall.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_tile_wall.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_tile_wall.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_tile_wall.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_tiles.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_tiles.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/relucent_tiles.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/relucent_tiles.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/sea_boom.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/sea_boom.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/sea_boom.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/sea_boom.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/blocks/volt_detector.json b/src/main/resources/data/unusualfishmod/loot_table/blocks/volt_detector.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/blocks/volt_detector.json rename to src/main/resources/data/unusualfishmod/loot_table/blocks/volt_detector.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/aero_mono.json b/src/main/resources/data/unusualfishmod/loot_table/entities/aero_mono.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/aero_mono.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/aero_mono.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/amber_goby.json b/src/main/resources/data/unusualfishmod/loot_table/entities/amber_goby.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/amber_goby.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/amber_goby.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/bark_angelfish.json b/src/main/resources/data/unusualfishmod/loot_table/entities/bark_angelfish.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/bark_angelfish.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/bark_angelfish.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/beaked_herring.json b/src/main/resources/data/unusualfishmod/loot_table/entities/beaked_herring.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/beaked_herring.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/beaked_herring.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/blindsailfin.json b/src/main/resources/data/unusualfishmod/loot_table/entities/blindsailfin.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/blindsailfin.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/blindsailfin.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/blizzardfin.json b/src/main/resources/data/unusualfishmod/loot_table/entities/blizzardfin.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/blizzardfin.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/blizzardfin.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/circus.json b/src/main/resources/data/unusualfishmod/loot_table/entities/circus.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/circus.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/circus.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/copperflame.json b/src/main/resources/data/unusualfishmod/loot_table/entities/copperflame.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/copperflame.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/copperflame.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/crimsonshell.json b/src/main/resources/data/unusualfishmod/loot_table/entities/crimsonshell.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/crimsonshell.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/crimsonshell.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/demon_herring.json b/src/main/resources/data/unusualfishmod/loot_table/entities/demon_herring.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/demon_herring.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/demon_herring.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/drooping_gourami.json b/src/main/resources/data/unusualfishmod/loot_table/entities/drooping_gourami.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/drooping_gourami.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/drooping_gourami.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/duality_damselfish.json b/src/main/resources/data/unusualfishmod/loot_table/entities/duality_damselfish.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/duality_damselfish.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/duality_damselfish.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/eyelash.json b/src/main/resources/data/unusualfishmod/loot_table/entities/eyelash.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/eyelash.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/eyelash.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/forkfish.json b/src/main/resources/data/unusualfishmod/loot_table/entities/forkfish.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/forkfish.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/forkfish.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/gnasher.json b/src/main/resources/data/unusualfishmod/loot_table/entities/gnasher.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/gnasher.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/gnasher.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/hatchet_fish.json b/src/main/resources/data/unusualfishmod/loot_table/entities/hatchet_fish.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/hatchet_fish.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/hatchet_fish.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/mossthorn.json b/src/main/resources/data/unusualfishmod/loot_table/entities/mossthorn.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/mossthorn.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/mossthorn.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/picklefish.json b/src/main/resources/data/unusualfishmod/loot_table/entities/picklefish.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/picklefish.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/picklefish.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/pinkfin.json b/src/main/resources/data/unusualfishmod/loot_table/entities/pinkfin.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/pinkfin.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/pinkfin.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/porcupine_lobsta.json b/src/main/resources/data/unusualfishmod/loot_table/entities/porcupine_lobsta.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/porcupine_lobsta.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/porcupine_lobsta.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/prawn.json b/src/main/resources/data/unusualfishmod/loot_table/entities/prawn.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/prawn.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/prawn.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/ripper.json b/src/main/resources/data/unusualfishmod/loot_table/entities/ripper.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/ripper.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/ripper.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/rootball.json b/src/main/resources/data/unusualfishmod/loot_table/entities/rootball.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/rootball.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/rootball.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/sailor_barb.json b/src/main/resources/data/unusualfishmod/loot_table/entities/sailor_barb.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/sailor_barb.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/sailor_barb.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/shockcat.json b/src/main/resources/data/unusualfishmod/loot_table/entities/shockcat.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/shockcat.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/shockcat.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/sneep_snorp.json b/src/main/resources/data/unusualfishmod/loot_table/entities/sneep_snorp.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/sneep_snorp.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/sneep_snorp.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/sneepsnorp.json b/src/main/resources/data/unusualfishmod/loot_table/entities/sneepsnorp.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/sneepsnorp.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/sneepsnorp.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/snowflaketail.json b/src/main/resources/data/unusualfishmod/loot_table/entities/snowflaketail.json similarity index 89% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/snowflaketail.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/snowflaketail.json index acb00fb..87f5459 100644 --- a/src/main/resources/data/unusualfishmod/loot_tables/entities/snowflaketail.json +++ b/src/main/resources/data/unusualfishmod/loot_table/entities/snowflaketail.json @@ -21,7 +21,7 @@ "entries": [ { "type": "minecraft:item", - "name": "unusualfishmod:raw_snowflake" + "name": "unusualfishmod:raw_frosty_fin" } ] } diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/spindlefish.json b/src/main/resources/data/unusualfishmod/loot_table/entities/spindlefish.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/spindlefish.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/spindlefish.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/triple_twirl_pleco.json b/src/main/resources/data/unusualfishmod/loot_table/entities/triple_twirl_pleco.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/triple_twirl_pleco.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/triple_twirl_pleco.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/trumpet_squid.json b/src/main/resources/data/unusualfishmod/loot_table/entities/trumpet_squid.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/trumpet_squid.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/trumpet_squid.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/entities/voltangler.json b/src/main/resources/data/unusualfishmod/loot_table/entities/voltangler.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/entities/voltangler.json rename to src/main/resources/data/unusualfishmod/loot_table/entities/voltangler.json diff --git a/src/main/resources/data/unusualfishmod/loot_tables/gameplay/sea_pancake_search.json b/src/main/resources/data/unusualfishmod/loot_table/gameplay/sea_pancake_search.json similarity index 100% rename from src/main/resources/data/unusualfishmod/loot_tables/gameplay/sea_pancake_search.json rename to src/main/resources/data/unusualfishmod/loot_table/gameplay/sea_pancake_search.json diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/aero_mono.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/aero_mono.json similarity index 82% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/aero_mono.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/aero_mono.json index 3a322cd..41caf86 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/aero_mono.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/aero_mono.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/amber_goby.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/amber_goby.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/amber_goby.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/amber_goby.json index b0eac03..a2d5f98 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/amber_goby.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/amber_goby.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:warm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/bark_angelfish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/bark_angelfish.json similarity index 82% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/bark_angelfish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/bark_angelfish.json index a1da55c..45af8d6 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/bark_angelfish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/bark_angelfish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "minecraft:swamp", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/beaked_herring.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/beaked_herring.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/beaked_herring.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/beaked_herring.json index e55e911..fb6b982 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/beaked_herring.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/beaked_herring.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/blackcap_snail.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/blackcap_snail.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/blackcap_snail.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/blackcap_snail.json index 0fc64d0..947d488 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/blackcap_snail.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/blackcap_snail.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:river" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/blind_sailfin.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/blind_sailfin.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/blind_sailfin.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/blind_sailfin.json index 45ec00a..bf31327 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/blind_sailfin.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/blind_sailfin.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "#minecraft:is_overworld", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/blizzardfin_tuna.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/blizzardfin_tuna.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/blizzardfin_tuna.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/blizzardfin_tuna.json index a6c50ce..b413c74 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/blizzardfin_tuna.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/blizzardfin_tuna.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:frozen_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/brick_snail.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/brick_snail.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/brick_snail.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/brick_snail.json index 8845856..acaab5f 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/brick_snail.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/brick_snail.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/celestial_fish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/celestial_fish.json similarity index 81% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/celestial_fish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/celestial_fish.json index b1d086d..8c1efe1 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/celestial_fish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/celestial_fish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "minecraft:ocean", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/circus_fish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/circus_fish.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/circus_fish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/circus_fish.json index 41e1a6a..6c5b87f 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/circus_fish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/circus_fish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:lukewarm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/clownthorn_shark.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/clownthorn_shark.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/clownthorn_shark.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/clownthorn_shark.json index f39f114..0173dee 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/clownthorn_shark.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/clownthorn_shark.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:warm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/copperflame_anthias.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/copperflame_anthias.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/copperflame_anthias.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/copperflame_anthias.json index 958fd0e..8ce198c 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/copperflame_anthias.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/copperflame_anthias.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:lukewarm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/coral_skrimp.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/coral_skrimp.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/coral_skrimp.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/coral_skrimp.json index 358534b..2cca90e 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/coral_skrimp.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/coral_skrimp.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:warm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/crimsonshell_squid.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/crimsonshell_squid.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/crimsonshell_squid.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/crimsonshell_squid.json index 120380b..3746a94 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/crimsonshell_squid.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/crimsonshell_squid.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:deep_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/deep_crawler.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/deep_crawler.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/deep_crawler.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/deep_crawler.json index 5aba3c5..17b8108 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/deep_crawler.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/deep_crawler.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "#minecraft:is_overworld", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/demon_herring.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/demon_herring.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/demon_herring.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/demon_herring.json index 72b3cb0..eef8b5b 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/demon_herring.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/demon_herring.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:deep_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/drooping_gourami.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/drooping_gourami.json similarity index 84% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/drooping_gourami.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/drooping_gourami.json index 4078f3f..6267150 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/drooping_gourami.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/drooping_gourami.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:mangrove_swamp" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/duality_damselfish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/duality_damselfish.json similarity index 84% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/duality_damselfish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/duality_damselfish.json index 557f75e..a00425c 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/duality_damselfish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/duality_damselfish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:warm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/eyelash_fish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/eyelash_fish.json similarity index 82% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/eyelash_fish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/eyelash_fish.json index f0ebe72..bc806d7 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/eyelash_fish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/eyelash_fish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "#minecraft:is_jungle", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/forkfish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/forkfish.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/forkfish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/forkfish.json index a8807ed..acb1479 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/forkfish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/forkfish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:lukewarm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/freshwater_mantis.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/freshwater_mantis.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/freshwater_mantis.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/freshwater_mantis.json index 64b5d7d..ea21d58 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/freshwater_mantis.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/freshwater_mantis.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "#minecraft:is_jungle", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/gnasher.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/gnasher.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/gnasher.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/gnasher.json index 033f7d4..0207ca7 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/gnasher.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/gnasher.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:deep_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/hatchet_fish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/hatchet_fish.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/hatchet_fish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/hatchet_fish.json index 1668b2a..e80514e 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/hatchet_fish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/hatchet_fish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "#minecraft:is_overworld", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/kalappa.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/kalappa.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/kalappa.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/kalappa.json index 6f8ac84..88e70a8 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/kalappa.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/kalappa.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:mushroom_fields" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/lobed_skipper.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/lobed_skipper.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/lobed_skipper.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/lobed_skipper.json index 7584f36..1d3d011 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/lobed_skipper.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/lobed_skipper.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:mangrove_swamp" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/mossthorn.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/mossthorn.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/mossthorn.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/mossthorn.json index 49d884f..1c85e6d 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/mossthorn.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/mossthorn.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:lush_caves" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/muddytop_snail.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/muddytop_snail.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/muddytop_snail.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/muddytop_snail.json index 86ad52b..1c97501 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/muddytop_snail.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/muddytop_snail.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:mangrove_swamp" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/picklefish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/picklefish.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/picklefish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/picklefish.json index e79f025..5c00c02 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/picklefish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/picklefish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:lukewarm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/pinkfin.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/pinkfin.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/pinkfin.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/pinkfin.json index 19a1213..a2fe3e8 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/pinkfin.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/pinkfin.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:frozen_river" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/porcupine_lobster.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/porcupine_lobster.json similarity index 84% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/porcupine_lobster.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/porcupine_lobster.json index 5d8f390..99fa123 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/porcupine_lobster.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/porcupine_lobster.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:deep_lukewarm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/prawn.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/prawn.json similarity index 82% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/prawn.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/prawn.json index 643a954..f482d88 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/prawn.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/prawn.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "minecraft:dripstone_caves", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/remove_deep_dark_spawns.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/remove_deep_dark_spawns.json similarity index 86% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/remove_deep_dark_spawns.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/remove_deep_dark_spawns.json index 1df9492..abf513f 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/remove_deep_dark_spawns.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/remove_deep_dark_spawns.json @@ -1,5 +1,5 @@ { - "type": "forge:remove_spawns", + "type": "neoforge:remove_spawns", "biomes": "#unusualfishmod:no_spawns", "entity_types": [ "unusualfishmod:deep_crawler", diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/rhino_tetra.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/rhino_tetra.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/rhino_tetra.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/rhino_tetra.json index 2c55cbf..2ab4f05 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/rhino_tetra.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/rhino_tetra.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:savanna" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/ripper.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/ripper.json similarity index 82% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/ripper.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/ripper.json index 2fbdf82..7e769ea 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/ripper.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/ripper.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:river" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/roughback_guitarfish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/roughback_guitarfish.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/roughback_guitarfish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/roughback_guitarfish.json index 2b228dd..8e5174c 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/roughback_guitarfish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/roughback_guitarfish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:swamp" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sailor_barb.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sailor_barb.json similarity index 85% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/sailor_barb.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sailor_barb.json index 82c4413..5e97413 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sailor_barb.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sailor_barb.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:swamp", "minecraft:mangrove_swamp" diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sea_mosquito.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sea_mosquito.json similarity index 82% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/sea_mosquito.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sea_mosquito.json index 63ba553..be29dd5 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sea_mosquito.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sea_mosquito.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "minecraft:warm_ocean", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sea_pancake.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sea_pancake.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/sea_pancake.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sea_pancake.json index 18d6460..9568b28 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sea_pancake.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sea_pancake.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:lukewarm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sea_spider.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sea_spider.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/sea_spider.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sea_spider.json index 4f4b118..13160de 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sea_spider.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sea_spider.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:deep_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/shockcat.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/shockcat.json similarity index 82% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/shockcat.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/shockcat.json index 2d08c08..6f3b2c6 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/shockcat.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/shockcat.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "#minecraft:is_overworld", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sneep_snorp.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sneep_snorp.json similarity index 82% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/sneep_snorp.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sneep_snorp.json index 7ce6e81..35562fa 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/sneep_snorp.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/sneep_snorp.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "minecraft:warm_ocean", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/snowflake_tail_fish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/snowflake_tail_fish.json similarity index 63% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/snowflake_tail_fish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/snowflake_tail_fish.json index e62ca6c..b1e4dd2 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/snowflake_tail_fish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/snowflake_tail_fish.json @@ -1,11 +1,11 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:frozen_ocean" ], "spawners": { - "type": "unusualfishmod:snowflaketail", + "type": "unusualfishmod:frostyfin", "weight": 20, "minCount": 3, "maxCount": 5 diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/spindlefish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/spindlefish.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/spindlefish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/spindlefish.json index eb5bc1e..e2c1b32 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/spindlefish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/spindlefish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:warm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/spoon_shark.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/spoon_shark.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/spoon_shark.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/spoon_shark.json index 72f9599..914e000 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/spoon_shark.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/spoon_shark.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:lukewarm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/squoddle.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/squoddle.json similarity index 84% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/squoddle.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/squoddle.json index 83f98c5..2607930 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/squoddle.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/squoddle.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:deep_lukewarm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/stout_bichir.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/stout_bichir.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/stout_bichir.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/stout_bichir.json index 7cc4664..fa1651f 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/stout_bichir.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/stout_bichir.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:mangrove_swamp" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/tiger_jungle_shark.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/tiger_jungle_shark.json similarity index 82% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/tiger_jungle_shark.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/tiger_jungle_shark.json index eeabbf7..e12d359 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/tiger_jungle_shark.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/tiger_jungle_shark.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": "#minecraft:is_jungle", "spawners": { diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/tiger_puffer.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/tiger_puffer.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/tiger_puffer.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/tiger_puffer.json index 68f08a0..345fa25 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/tiger_puffer.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/tiger_puffer.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:warm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/tribble.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/tribble.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/tribble.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/tribble.json index 931e4db..9488c05 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/tribble.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/tribble.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:deep_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/triple_twirl_pleco.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/triple_twirl_pleco.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/triple_twirl_pleco.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/triple_twirl_pleco.json index c06fc4a..867cef4 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/triple_twirl_pleco.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/triple_twirl_pleco.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:river" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/trumpet_squid.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/trumpet_squid.json similarity index 84% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/trumpet_squid.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/trumpet_squid.json index 44fd8e3..e0edb56 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/trumpet_squid.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/trumpet_squid.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:deep_lukewarm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/volt_angler.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/volt_angler.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/volt_angler.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/volt_angler.json index 96d7305..bc9666c 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/volt_angler.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/volt_angler.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:deep_cold_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/wizard_jelly.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/wizard_jelly.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/wizard_jelly.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/wizard_jelly.json index 64efab1..7047cd8 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/wizard_jelly.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/wizard_jelly.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:ocean" ], diff --git a/src/main/resources/data/unusualfishmod/forge/biome_modifier/zebra_cornetfish.json b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/zebra_cornetfish.json similarity index 83% rename from src/main/resources/data/unusualfishmod/forge/biome_modifier/zebra_cornetfish.json rename to src/main/resources/data/unusualfishmod/neoforge/biome_modifier/zebra_cornetfish.json index 583da09..c7fb82c 100644 --- a/src/main/resources/data/unusualfishmod/forge/biome_modifier/zebra_cornetfish.json +++ b/src/main/resources/data/unusualfishmod/neoforge/biome_modifier/zebra_cornetfish.json @@ -1,5 +1,5 @@ { - "type": "forge:add_spawns", + "type": "neoforge:add_spawns", "biomes": [ "minecraft:warm_ocean" ], diff --git a/src/main/resources/data/unusualfishmod/recipes/ancient_weapon_smithing_template.json b/src/main/resources/data/unusualfishmod/recipe/ancient_weapon_smithing_template.json similarity index 86% rename from src/main/resources/data/unusualfishmod/recipes/ancient_weapon_smithing_template.json rename to src/main/resources/data/unusualfishmod/recipe/ancient_weapon_smithing_template.json index 698f0e8..ea41437 100644 --- a/src/main/resources/data/unusualfishmod/recipes/ancient_weapon_smithing_template.json +++ b/src/main/resources/data/unusualfishmod/recipe/ancient_weapon_smithing_template.json @@ -19,7 +19,7 @@ ], "result": { "count": 2, - "item": "unusualfishmod:ancient_weapon_smithing_template" + "id": "unusualfishmod:ancient_weapon_smithing_template" }, "show_notification": true } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks.json b/src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks.json similarity index 80% rename from src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks.json rename to src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks.json index 19c7772..b6255b3 100644 --- a/src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks.json +++ b/src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:chiseled_crimson_bricks", + "id": "unusualfishmod:chiseled_crimson_bricks", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks_from_tiles.json b/src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks_from_tiles.json similarity index 80% rename from src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks_from_tiles.json rename to src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks_from_tiles.json index 4c3ac6b..57159ac 100644 --- a/src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks_from_tiles.json +++ b/src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks_from_tiles.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:chiseled_crimson_bricks", + "id": "unusualfishmod:chiseled_crimson_bricks", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks_from_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks_from_tiles_stonecutting.json similarity index 54% rename from src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks_from_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks_from_tiles_stonecutting.json index 863250d..1266fed 100644 --- a/src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks_from_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks_from_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_tiles" }, - "result": "unusualfishmod:chiseled_crimson_bricks", - "count": 1 + "result": { + "id": "unusualfishmod:chiseled_crimson_bricks", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks_stonecutting.json similarity index 54% rename from src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks_stonecutting.json index 7062e27..039bff3 100644 --- a/src/main/resources/data/unusualfishmod/recipes/chiseled_crimson_bricks_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/chiseled_crimson_bricks_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_bricks" }, - "result": "unusualfishmod:chiseled_crimson_bricks", - "count": 1 + "result": { + "id": "unusualfishmod:chiseled_crimson_bricks", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks.json b/src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks.json similarity index 80% rename from src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks.json rename to src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks.json index a8dcc82..1843fc3 100644 --- a/src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks.json +++ b/src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:chiseled_relucent_bricks", + "id": "unusualfishmod:chiseled_relucent_bricks", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks_from_tiles.json b/src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks_from_tiles.json similarity index 79% rename from src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks_from_tiles.json rename to src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks_from_tiles.json index ecbf894..26740f9 100644 --- a/src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks_from_tiles.json +++ b/src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks_from_tiles.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:chiseled_relucent_bricks", + "id": "unusualfishmod:chiseled_relucent_bricks", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks_from_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks_from_tiles_stonecutting.json similarity index 54% rename from src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks_from_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks_from_tiles_stonecutting.json index 322457e..f5d4277 100644 --- a/src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks_from_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks_from_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_tiles" }, - "result": "unusualfishmod:chiseled_relucent_bricks", - "count": 1 + "result": { + "id": "unusualfishmod:chiseled_relucent_bricks", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks_stonecutting.json similarity index 54% rename from src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks_stonecutting.json index a526519..d77d3e4 100644 --- a/src/main/resources/data/unusualfishmod/recipes/chiseled_relucent_bricks_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/chiseled_relucent_bricks_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_bricks" }, - "result": "unusualfishmod:chiseled_relucent_bricks", - "count": 1 + "result": { + "id": "unusualfishmod:chiseled_relucent_bricks", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_aero_mono_stick.json b/src/main/resources/data/unusualfishmod/recipe/cooked_aero_mono_stick.json similarity index 68% rename from src/main/resources/data/unusualfishmod/recipes/cooked_aero_mono_stick.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_aero_mono_stick.json index 0c9ca7e..bdb2354 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_aero_mono_stick.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_aero_mono_stick.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_aero_mono_stick" }, - "result": "unusualfishmod:cooked_aero_mono_stick", + "result": { + "id": "unusualfishmod:cooked_aero_mono_stick" + }, "experience": 0.35, "cookingtime": 200 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_aero_mono_stick_from_campfire_cooking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_aero_mono_stick_from_campfire_cooking.json similarity index 69% rename from src/main/resources/data/unusualfishmod/recipes/cooked_aero_mono_stick_from_campfire_cooking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_aero_mono_stick_from_campfire_cooking.json index 1f20e62..661b724 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_aero_mono_stick_from_campfire_cooking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_aero_mono_stick_from_campfire_cooking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_aero_mono_stick" }, - "result": "unusualfishmod:cooked_aero_mono_stick", + "result": { + "id": "unusualfishmod:cooked_aero_mono_stick" + }, "experience": 0.35, "cookingtime": 600 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_aero_mono_stick_from_smoking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_aero_mono_stick_from_smoking.json similarity index 68% rename from src/main/resources/data/unusualfishmod/recipes/cooked_aero_mono_stick_from_smoking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_aero_mono_stick_from_smoking.json index 03375b5..b422893 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_aero_mono_stick_from_smoking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_aero_mono_stick_from_smoking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_aero_mono_stick" }, - "result": "unusualfishmod:cooked_aero_mono_stick", + "result": { + "id": "unusualfishmod:cooked_aero_mono_stick" + }, "experience": 0.35, "cookingtime": 100 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_blizzard_tuna.json b/src/main/resources/data/unusualfishmod/recipe/cooked_blizzard_tuna.json similarity index 68% rename from src/main/resources/data/unusualfishmod/recipes/cooked_blizzard_tuna.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_blizzard_tuna.json index 2bd8ed3..b8818bc 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_blizzard_tuna.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_blizzard_tuna.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_blizzard_tuna" }, - "result": "unusualfishmod:cooked_blizzard_tuna", + "result": { + "id": "unusualfishmod:cooked_blizzard_tuna" + }, "experience": 0.35, "cookingtime": 200 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_blizzard_tuna_from_campfire_cooking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_blizzard_tuna_from_campfire_cooking.json similarity index 69% rename from src/main/resources/data/unusualfishmod/recipes/cooked_blizzard_tuna_from_campfire_cooking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_blizzard_tuna_from_campfire_cooking.json index 3a9a6ce..eb206dd 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_blizzard_tuna_from_campfire_cooking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_blizzard_tuna_from_campfire_cooking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_blizzard_tuna" }, - "result": "unusualfishmod:cooked_blizzard_tuna", + "result": { + "id": "unusualfishmod:cooked_blizzard_tuna" + }, "experience": 0.35, "cookingtime": 600 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_blizzard_tuna_from_smoking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_blizzard_tuna_from_smoking.json similarity index 68% rename from src/main/resources/data/unusualfishmod/recipes/cooked_blizzard_tuna_from_smoking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_blizzard_tuna_from_smoking.json index 1be2457..87646a7 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_blizzard_tuna_from_smoking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_blizzard_tuna_from_smoking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_blizzard_tuna" }, - "result": "unusualfishmod:cooked_blizzard_tuna", + "result": { + "id": "unusualfishmod:cooked_blizzard_tuna" + }, "experience": 0.35, "cookingtime": 100 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_fillet.json b/src/main/resources/data/unusualfishmod/recipe/cooked_fillet.json similarity index 68% rename from src/main/resources/data/unusualfishmod/recipes/cooked_fillet.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_fillet.json index d616a16..95fcb9a 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_fillet.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_fillet.json @@ -3,7 +3,9 @@ "ingredient": { "tag": "unusualfishmod:raw_unusual_fish" }, - "result": "unusualfishmod:cooked_unusual_fillet", + "result": { + "id": "unusualfishmod:cooked_unusual_fillet" + }, "experience": 0.35, "cookingtime": 200 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_fillet_from_campfire_cooking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_fillet_from_campfire_cooking.json similarity index 69% rename from src/main/resources/data/unusualfishmod/recipes/cooked_fillet_from_campfire_cooking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_fillet_from_campfire_cooking.json index 19b7a28..e35a511 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_fillet_from_campfire_cooking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_fillet_from_campfire_cooking.json @@ -3,7 +3,9 @@ "ingredient": { "tag": "unusualfishmod:raw_unusual_fish" }, - "result": "unusualfishmod:cooked_unusual_fillet", + "result": { + "id": "unusualfishmod:cooked_unusual_fillet" + }, "experience": 0.35, "cookingtime": 600 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_fillet_from_smoking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_fillet_from_smoking.json similarity index 68% rename from src/main/resources/data/unusualfishmod/recipes/cooked_fillet_from_smoking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_fillet_from_smoking.json index ac2c907..432c3c5 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_fillet_from_smoking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_fillet_from_smoking.json @@ -3,7 +3,9 @@ "ingredient": { "tag": "unusualfishmod:raw_unusual_fish" }, - "result": "unusualfishmod:cooked_unusual_fillet", + "result": { + "id": "unusualfishmod:cooked_unusual_fillet" + }, "experience": 0.35, "cookingtime": 100 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_lobster.json b/src/main/resources/data/unusualfishmod/recipe/cooked_lobster.json similarity index 69% rename from src/main/resources/data/unusualfishmod/recipes/cooked_lobster.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_lobster.json index 9368225..920531f 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_lobster.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_lobster.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_lobster" }, - "result": "unusualfishmod:cooked_lobster", + "result": { + "id": "unusualfishmod:cooked_lobster" + }, "experience": 0.35, "cookingtime": 200 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_lobster_from_campfire_cooking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_lobster_from_campfire_cooking.json similarity index 71% rename from src/main/resources/data/unusualfishmod/recipes/cooked_lobster_from_campfire_cooking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_lobster_from_campfire_cooking.json index 2db3bb6..60bc156 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_lobster_from_campfire_cooking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_lobster_from_campfire_cooking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_lobster" }, - "result": "unusualfishmod:cooked_lobster", + "result": { + "id": "unusualfishmod:cooked_lobster" + }, "experience": 0.35, "cookingtime": 600 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_lobster_from_smoking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_lobster_from_smoking.json similarity index 69% rename from src/main/resources/data/unusualfishmod/recipes/cooked_lobster_from_smoking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_lobster_from_smoking.json index 6bf5bca..b2143e1 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_lobster_from_smoking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_lobster_from_smoking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_lobster" }, - "result": "unusualfishmod:cooked_lobster", + "result": { + "id": "unusualfishmod:cooked_lobster" + }, "experience": 0.35, "cookingtime": 100 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_mossthorn.json b/src/main/resources/data/unusualfishmod/recipe/cooked_mossthorn.json similarity index 69% rename from src/main/resources/data/unusualfishmod/recipes/cooked_mossthorn.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_mossthorn.json index 9b44954..c212d6c 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_mossthorn.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_mossthorn.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_mossthorn" }, - "result": "unusualfishmod:cooked_mossthorn", + "result": { + "id": "unusualfishmod:cooked_mossthorn" + }, "experience": 0.35, "cookingtime": 200 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_mossthorn_from_campfire_cooking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_mossthorn_from_campfire_cooking.json similarity index 70% rename from src/main/resources/data/unusualfishmod/recipes/cooked_mossthorn_from_campfire_cooking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_mossthorn_from_campfire_cooking.json index dcdd5f2..2dbce91 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_mossthorn_from_campfire_cooking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_mossthorn_from_campfire_cooking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_mossthorn" }, - "result": "unusualfishmod:cooked_mossthorn", + "result": { + "id": "unusualfishmod:cooked_mossthorn" + }, "experience": 0.35, "cookingtime": 300 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_mossthorn_from_smoking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_mossthorn_from_smoking.json similarity index 69% rename from src/main/resources/data/unusualfishmod/recipes/cooked_mossthorn_from_smoking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_mossthorn_from_smoking.json index a0b9198..f213c67 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_mossthorn_from_smoking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_mossthorn_from_smoking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_mossthorn" }, - "result": "unusualfishmod:cooked_mossthorn", + "result": { + "id": "unusualfishmod:cooked_mossthorn" + }, "experience": 0.35, "cookingtime": 75 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_shockcat.json b/src/main/resources/data/unusualfishmod/recipe/cooked_shockcat.json similarity index 69% rename from src/main/resources/data/unusualfishmod/recipes/cooked_shockcat.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_shockcat.json index 5dcd618..4071ad5 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_shockcat.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_shockcat.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_shockcat" }, - "result": "unusualfishmod:cooked_shockcat", + "result": { + "id": "unusualfishmod:cooked_shockcat" + }, "experience": 0.35, "cookingtime": 200 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_shockcat_from_campfire_cooking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_shockcat_from_campfire_cooking.json similarity index 70% rename from src/main/resources/data/unusualfishmod/recipes/cooked_shockcat_from_campfire_cooking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_shockcat_from_campfire_cooking.json index 332fded..605eb3f 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_shockcat_from_campfire_cooking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_shockcat_from_campfire_cooking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_shockcat" }, - "result": "unusualfishmod:cooked_shockcat", + "result": { + "id": "unusualfishmod:cooked_shockcat" + }, "experience": 0.35, "cookingtime": 600 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/cooked_shockcat_from_smoking.json b/src/main/resources/data/unusualfishmod/recipe/cooked_shockcat_from_smoking.json similarity index 69% rename from src/main/resources/data/unusualfishmod/recipes/cooked_shockcat_from_smoking.json rename to src/main/resources/data/unusualfishmod/recipe/cooked_shockcat_from_smoking.json index 1490755..e080477 100644 --- a/src/main/resources/data/unusualfishmod/recipes/cooked_shockcat_from_smoking.json +++ b/src/main/resources/data/unusualfishmod/recipe/cooked_shockcat_from_smoking.json @@ -3,7 +3,9 @@ "ingredient": { "item": "unusualfishmod:raw_shockcat" }, - "result": "unusualfishmod:cooked_shockcat", + "result": { + "id": "unusualfishmod:cooked_shockcat" + }, "experience": 0.35, "cookingtime": 100 } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/copper_antenna.json b/src/main/resources/data/unusualfishmod/recipe/copper_antenna.json similarity index 84% rename from src/main/resources/data/unusualfishmod/recipes/copper_antenna.json rename to src/main/resources/data/unusualfishmod/recipe/copper_antenna.json index c6aecd8..6604fd4 100644 --- a/src/main/resources/data/unusualfishmod/recipes/copper_antenna.json +++ b/src/main/resources/data/unusualfishmod/recipe/copper_antenna.json @@ -13,7 +13,7 @@ } }, "result": { - "item": "unusualfishmod:copper_antenna", + "id": "unusualfishmod:copper_antenna", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_slab.json b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_slab.json similarity index 80% rename from src/main/resources/data/unusualfishmod/recipes/crimson_brick_slab.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_brick_slab.json index 846417e..5db79ff 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_slab.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_slab.json @@ -9,7 +9,7 @@ } }, "result": { - "item": "unusualfishmod:crimson_brick_slab", + "id": "unusualfishmod:crimson_brick_slab", "count": 6 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_slab_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_slab_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/crimson_brick_slab_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_brick_slab_stonecutting.json index d0fd1de..96ce95b 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_slab_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_slab_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_bricks" }, - "result": "unusualfishmod:crimson_brick_slab", - "count": 2 + "result": { + "id": "unusualfishmod:crimson_brick_slab", + "count": 2 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_stairs.json b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_stairs.json similarity index 81% rename from src/main/resources/data/unusualfishmod/recipes/crimson_brick_stairs.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_brick_stairs.json index 1a8379b..4b0baf0 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_stairs.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_stairs.json @@ -11,7 +11,7 @@ } }, "result": { - "item": "unusualfishmod:crimson_brick_stairs", + "id": "unusualfishmod:crimson_brick_stairs", "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_stairs_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_stairs_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/crimson_brick_stairs_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_brick_stairs_stonecutting.json index e75cfa2..74f7c28 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_stairs_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_stairs_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_bricks" }, - "result": "unusualfishmod:crimson_brick_stairs", - "count": 1 + "result": { + "id": "unusualfishmod:crimson_brick_stairs", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_wall.json b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_wall.json similarity index 81% rename from src/main/resources/data/unusualfishmod/recipes/crimson_brick_wall.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_brick_wall.json index 5c0bb2a..ef56829 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_wall.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_wall.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:crimson_brick_wall", + "id": "unusualfishmod:crimson_brick_wall", "count": 6 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_wall_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_wall_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/crimson_brick_wall_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_brick_wall_stonecutting.json index 6089287..1c31a43 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_brick_wall_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_brick_wall_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_bricks" }, - "result": "unusualfishmod:crimson_brick_wall", - "count": 1 + "result": { + "id": "unusualfishmod:crimson_brick_wall", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_bricks.json b/src/main/resources/data/unusualfishmod/recipe/crimson_bricks.json similarity index 82% rename from src/main/resources/data/unusualfishmod/recipes/crimson_bricks.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_bricks.json index 2169441..f8469bf 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_bricks.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_bricks.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:crimson_bricks", + "id": "unusualfishmod:crimson_bricks", "count": 2 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_slab.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_slab.json similarity index 80% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tile_slab.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tile_slab.json index 66a13bb..ebce485 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_slab.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_slab.json @@ -9,7 +9,7 @@ } }, "result": { - "item": "unusualfishmod:crimson_tile_slab", + "id": "unusualfishmod:crimson_tile_slab", "count": 6 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_slab_from_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_slab_from_tiles_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tile_slab_from_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tile_slab_from_tiles_stonecutting.json index bae1317..83efddd 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_slab_from_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_slab_from_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_tiles" }, - "result": "unusualfishmod:crimson_tile_slab", - "count": 2 + "result": { + "id": "unusualfishmod:crimson_tile_slab", + "count": 2 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_slab_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_slab_stonecutting.json similarity index 56% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tile_slab_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tile_slab_stonecutting.json index 826c5b9..2d379a6 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_slab_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_slab_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_bricks" }, - "result": "unusualfishmod:crimson_tile_slab", - "count": 2 + "result": { + "id": "unusualfishmod:crimson_tile_slab", + "count": 2 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_stairs.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_stairs.json similarity index 82% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tile_stairs.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tile_stairs.json index 93b9f07..ca64575 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_stairs.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_stairs.json @@ -11,7 +11,7 @@ } }, "result": { - "item": "unusualfishmod:crimson_tile_stairs", + "id": "unusualfishmod:crimson_tile_stairs", "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_stairs_from_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_stairs_from_tiles_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tile_stairs_from_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tile_stairs_from_tiles_stonecutting.json index a7b9acb..d179468 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_stairs_from_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_stairs_from_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_tiles" }, - "result": "unusualfishmod:crimson_tile_stairs", - "count": 1 + "result": { + "id": "unusualfishmod:crimson_tile_stairs", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_stairs_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_stairs_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tile_stairs_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tile_stairs_stonecutting.json index 6d02b7d..23d17f2 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_stairs_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_stairs_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_bricks" }, - "result": "unusualfishmod:crimson_tile_stairs", - "count": 1 + "result": { + "id": "unusualfishmod:crimson_tile_stairs", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_wall.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_wall.json similarity index 81% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tile_wall.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tile_wall.json index 2cd89af..76b9264 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_wall.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_wall.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:crimson_tile_wall", + "id": "unusualfishmod:crimson_tile_wall", "count": 6 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_wall_from_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_wall_from_tiles_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tile_wall_from_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tile_wall_from_tiles_stonecutting.json index 28277e8..881ee82 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_wall_from_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_wall_from_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_tiles" }, - "result": "unusualfishmod:crimson_tile_wall", - "count": 1 + "result": { + "id": "unusualfishmod:crimson_tile_wall", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_wall_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_wall_stonecutting.json similarity index 56% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tile_wall_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tile_wall_stonecutting.json index 2aec17e..4a723f6 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tile_wall_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tile_wall_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_bricks" }, - "result": "unusualfishmod:crimson_tile_wall", - "count": 1 + "result": { + "id": "unusualfishmod:crimson_tile_wall", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tiles.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tiles.json similarity index 82% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tiles.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tiles.json index dd0ab7d..281a642 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tiles.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tiles.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:crimson_tiles", + "id": "unusualfishmod:crimson_tiles", "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/crimson_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/crimson_tiles_stonecutting.json similarity index 57% rename from src/main/resources/data/unusualfishmod/recipes/crimson_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/crimson_tiles_stonecutting.json index c3dabdb..f5625de 100644 --- a/src/main/resources/data/unusualfishmod/recipes/crimson_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/crimson_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:crimson_bricks" }, - "result": "unusualfishmod:crimson_tiles", - "count": 1 + "result": { + "id": "unusualfishmod:crimson_tiles", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/depth_scythe_smithing.json b/src/main/resources/data/unusualfishmod/recipe/depth_scythe_smithing.json similarity index 85% rename from src/main/resources/data/unusualfishmod/recipes/depth_scythe_smithing.json rename to src/main/resources/data/unusualfishmod/recipe/depth_scythe_smithing.json index 61a685c..8031d0f 100644 --- a/src/main/resources/data/unusualfishmod/recipes/depth_scythe_smithing.json +++ b/src/main/resources/data/unusualfishmod/recipe/depth_scythe_smithing.json @@ -10,6 +10,6 @@ "item": "unusualfishmod:weapon_parts" }, "result": { - "item": "unusualfishmod:depth_scythe" + "id": "unusualfishmod:depth_scythe" } -}s \ No newline at end of file +} \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/lobster_roll.json b/src/main/resources/data/unusualfishmod/recipe/lobster_roll.json similarity index 82% rename from src/main/resources/data/unusualfishmod/recipes/lobster_roll.json rename to src/main/resources/data/unusualfishmod/recipe/lobster_roll.json index aa77188..a3feefa 100644 --- a/src/main/resources/data/unusualfishmod/recipes/lobster_roll.json +++ b/src/main/resources/data/unusualfishmod/recipe/lobster_roll.json @@ -9,7 +9,7 @@ } ], "result": { - "item": "unusualfishmod:lobster_roll", + "id": "unusualfishmod:lobster_roll", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/nautical_lamp.json b/src/main/resources/data/unusualfishmod/recipe/nautical_lamp.json similarity index 81% rename from src/main/resources/data/unusualfishmod/recipes/nautical_lamp.json rename to src/main/resources/data/unusualfishmod/recipe/nautical_lamp.json index c38d3e2..44ec4ab 100644 --- a/src/main/resources/data/unusualfishmod/recipes/nautical_lamp.json +++ b/src/main/resources/data/unusualfishmod/recipe/nautical_lamp.json @@ -13,14 +13,14 @@ "item": "minecraft:prismarine_crystals" }, "G": { - "tag": "forge:glass_panes" + "tag": "c:glass_panes" }, "S": { "item": "unusualfishmod:tendril" } }, "result": { - "item": "unusualfishmod:nautical_lamp", + "id": "unusualfishmod:nautical_lamp", "count": 3 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/odd_fishsticks.json b/src/main/resources/data/unusualfishmod/recipe/odd_fishsticks.json similarity index 80% rename from src/main/resources/data/unusualfishmod/recipes/odd_fishsticks.json rename to src/main/resources/data/unusualfishmod/recipe/odd_fishsticks.json index 2b0652b..35d7a6d 100644 --- a/src/main/resources/data/unusualfishmod/recipes/odd_fishsticks.json +++ b/src/main/resources/data/unusualfishmod/recipe/odd_fishsticks.json @@ -9,7 +9,7 @@ } }, "result": { - "item": "unusualfishmod:odd_fishsticks", + "id": "unusualfishmod:odd_fishsticks", "count": 2 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/pickledish.json b/src/main/resources/data/unusualfishmod/recipe/pickledish.json similarity index 89% rename from src/main/resources/data/unusualfishmod/recipes/pickledish.json rename to src/main/resources/data/unusualfishmod/recipe/pickledish.json index bfb3cf3..8b98850 100644 --- a/src/main/resources/data/unusualfishmod/recipes/pickledish.json +++ b/src/main/resources/data/unusualfishmod/recipe/pickledish.json @@ -19,7 +19,7 @@ } }, "result": { - "item": "unusualfishmod:pickledish", + "id": "unusualfishmod:pickledish", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/prismarine_spear.json b/src/main/resources/data/unusualfishmod/recipe/prismarine_spear.json similarity index 84% rename from src/main/resources/data/unusualfishmod/recipes/prismarine_spear.json rename to src/main/resources/data/unusualfishmod/recipe/prismarine_spear.json index 1101ef0..8a46500 100644 --- a/src/main/resources/data/unusualfishmod/recipes/prismarine_spear.json +++ b/src/main/resources/data/unusualfishmod/recipe/prismarine_spear.json @@ -14,7 +14,7 @@ } }, "result": { - "item": "unusualfishmod:prismarine_spear", + "id": "unusualfishmod:prismarine_spear", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/raw_aero_mono_stick.json b/src/main/resources/data/unusualfishmod/recipe/raw_aero_mono_stick.json similarity index 80% rename from src/main/resources/data/unusualfishmod/recipes/raw_aero_mono_stick.json rename to src/main/resources/data/unusualfishmod/recipe/raw_aero_mono_stick.json index cd959e1..b80e0b1 100644 --- a/src/main/resources/data/unusualfishmod/recipes/raw_aero_mono_stick.json +++ b/src/main/resources/data/unusualfishmod/recipe/raw_aero_mono_stick.json @@ -9,7 +9,7 @@ } ], "result": { - "item": "unusualfishmod:raw_aero_mono_stick", + "id": "unusualfishmod:raw_aero_mono_stick", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_slab.json b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_slab.json similarity index 80% rename from src/main/resources/data/unusualfishmod/recipes/relucent_brick_slab.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_brick_slab.json index 20677b7..f840c83 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_slab.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_slab.json @@ -9,7 +9,7 @@ } }, "result": { - "item": "unusualfishmod:relucent_brick_slab", + "id": "unusualfishmod:relucent_brick_slab", "count": 6 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_slab_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_slab_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/relucent_brick_slab_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_brick_slab_stonecutting.json index e5e2bba..80bca3a 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_slab_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_slab_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_bricks" }, - "result": "unusualfishmod:relucent_brick_slab", - "count": 2 + "result": { + "id": "unusualfishmod:relucent_brick_slab", + "count": 2 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_stairs.json b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_stairs.json similarity index 81% rename from src/main/resources/data/unusualfishmod/recipes/relucent_brick_stairs.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_brick_stairs.json index 3ce884e..abf0be4 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_stairs.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_stairs.json @@ -11,7 +11,7 @@ } }, "result": { - "item": "unusualfishmod:relucent_brick_stairs", + "id": "unusualfishmod:relucent_brick_stairs", "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_stairs_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_stairs_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/relucent_brick_stairs_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_brick_stairs_stonecutting.json index d1ed074..940bde9 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_stairs_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_stairs_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_bricks" }, - "result": "unusualfishmod:relucent_brick_stairs", - "count": 1 + "result": { + "id": "unusualfishmod:relucent_brick_stairs", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_wall.json b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_wall.json similarity index 81% rename from src/main/resources/data/unusualfishmod/recipes/relucent_brick_wall.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_brick_wall.json index f67be3b..768022e 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_wall.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_wall.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:relucent_brick_wall", + "id": "unusualfishmod:relucent_brick_wall", "count": 6 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_wall_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_wall_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/relucent_brick_wall_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_brick_wall_stonecutting.json index df525d6..3d21075 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_brick_wall_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_brick_wall_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_bricks" }, - "result": "unusualfishmod:relucent_brick_wall", - "count": 1 + "result": { + "id": "unusualfishmod:relucent_brick_wall", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_bricks.json b/src/main/resources/data/unusualfishmod/recipe/relucent_bricks.json similarity index 82% rename from src/main/resources/data/unusualfishmod/recipes/relucent_bricks.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_bricks.json index 083ee5a..bf83b62 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_bricks.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_bricks.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:relucent_bricks", + "id": "unusualfishmod:relucent_bricks", "count": 2 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_slab.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_slab.json similarity index 80% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tile_slab.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tile_slab.json index 2a16641..6a6287f 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_slab.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_slab.json @@ -9,7 +9,7 @@ } }, "result": { - "item": "unusualfishmod:relucent_tile_slab", + "id": "unusualfishmod:relucent_tile_slab", "count": 6 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_slab_from_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_slab_from_tiles_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tile_slab_from_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tile_slab_from_tiles_stonecutting.json index 2841f2d..750a82e 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_slab_from_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_slab_from_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_tiles" }, - "result": "unusualfishmod:relucent_tile_slab", - "count": 2 + "result": { + "id": "unusualfishmod:relucent_tile_slab", + "count": 2 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_slab_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_slab_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tile_slab_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tile_slab_stonecutting.json index 3657b02..061adef 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_slab_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_slab_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_bricks" }, - "result": "unusualfishmod:relucent_tile_slab", - "count": 2 + "result": { + "id": "unusualfishmod:relucent_tile_slab", + "count": 2 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_stairs.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_stairs.json similarity index 81% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tile_stairs.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tile_stairs.json index 668e392..d55e648 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_stairs.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_stairs.json @@ -11,7 +11,7 @@ } }, "result": { - "item": "unusualfishmod:relucent_tile_stairs", + "id": "unusualfishmod:relucent_tile_stairs", "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_stairs_from_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_stairs_from_tiles_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tile_stairs_from_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tile_stairs_from_tiles_stonecutting.json index 25f43f5..d8412e0 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_stairs_from_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_stairs_from_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_tiles" }, - "result": "unusualfishmod:relucent_tile_stairs", - "count": 1 + "result": { + "id": "unusualfishmod:relucent_tile_stairs", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_stairs_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_stairs_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tile_stairs_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tile_stairs_stonecutting.json index 07dc919..9006b60 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_stairs_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_stairs_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_bricks" }, - "result": "unusualfishmod:relucent_tile_stairs", - "count": 1 + "result": { + "id": "unusualfishmod:relucent_tile_stairs", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_wall.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_wall.json similarity index 81% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tile_wall.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tile_wall.json index af406bc..85cc0a6 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_wall.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_wall.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:relucent_tile_wall", + "id": "unusualfishmod:relucent_tile_wall", "count": 6 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_wall_from_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_wall_from_tiles_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tile_wall_from_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tile_wall_from_tiles_stonecutting.json index f81ed4b..1f69600 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_wall_from_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_wall_from_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_tiles" }, - "result": "unusualfishmod:relucent_tile_wall", - "count": 1 + "result": { + "id": "unusualfishmod:relucent_tile_wall", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_wall_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_wall_stonecutting.json similarity index 55% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tile_wall_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tile_wall_stonecutting.json index 2ba9103..0b8d4e8 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tile_wall_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tile_wall_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_bricks" }, - "result": "unusualfishmod:relucent_tile_wall", - "count": 1 + "result": { + "id": "unusualfishmod:relucent_tile_wall", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tiles.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tiles.json similarity index 82% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tiles.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tiles.json index f55877b..ae56747 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tiles.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tiles.json @@ -10,7 +10,7 @@ } }, "result": { - "item": "unusualfishmod:relucent_tiles", + "id": "unusualfishmod:relucent_tiles", "count": 4 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/relucent_tiles_stonecutting.json b/src/main/resources/data/unusualfishmod/recipe/relucent_tiles_stonecutting.json similarity index 57% rename from src/main/resources/data/unusualfishmod/recipes/relucent_tiles_stonecutting.json rename to src/main/resources/data/unusualfishmod/recipe/relucent_tiles_stonecutting.json index 84d5436..ee37443 100644 --- a/src/main/resources/data/unusualfishmod/recipes/relucent_tiles_stonecutting.json +++ b/src/main/resources/data/unusualfishmod/recipe/relucent_tiles_stonecutting.json @@ -3,6 +3,8 @@ "ingredient": { "item": "unusualfishmod:relucent_bricks" }, - "result": "unusualfishmod:relucent_tiles", - "count": 1 + "result": { + "id": "unusualfishmod:relucent_tiles", + "count": 1 + } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/ripsaw_smithing.json b/src/main/resources/data/unusualfishmod/recipe/ripsaw_smithing.json similarity index 88% rename from src/main/resources/data/unusualfishmod/recipes/ripsaw_smithing.json rename to src/main/resources/data/unusualfishmod/recipe/ripsaw_smithing.json index bdf4b3e..6cb150b 100644 --- a/src/main/resources/data/unusualfishmod/recipes/ripsaw_smithing.json +++ b/src/main/resources/data/unusualfishmod/recipe/ripsaw_smithing.json @@ -10,6 +10,6 @@ "item": "unusualfishmod:weapon_parts" }, "result": { - "item": "unusualfishmod:ripsaw" + "id": "unusualfishmod:ripsaw" } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/sea_boom.json b/src/main/resources/data/unusualfishmod/recipe/sea_boom.json similarity index 89% rename from src/main/resources/data/unusualfishmod/recipes/sea_boom.json rename to src/main/resources/data/unusualfishmod/recipe/sea_boom.json index a70c92d..f16938c 100644 --- a/src/main/resources/data/unusualfishmod/recipes/sea_boom.json +++ b/src/main/resources/data/unusualfishmod/recipe/sea_boom.json @@ -17,7 +17,7 @@ } }, "result": { - "item": "unusualfishmod:sea_boom", + "id": "unusualfishmod:sea_boom", "count": 2 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/strange_broth.json b/src/main/resources/data/unusualfishmod/recipe/strange_broth.json similarity index 90% rename from src/main/resources/data/unusualfishmod/recipes/strange_broth.json rename to src/main/resources/data/unusualfishmod/recipe/strange_broth.json index c4101ea..fa0ff1b 100644 --- a/src/main/resources/data/unusualfishmod/recipes/strange_broth.json +++ b/src/main/resources/data/unusualfishmod/recipe/strange_broth.json @@ -23,7 +23,7 @@ } }, "result": { - "item": "unusualfishmod:strange_broth", + "id": "unusualfishmod:strange_broth", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/unusual_sandwich.json b/src/main/resources/data/unusualfishmod/recipe/unusual_sandwich.json similarity index 86% rename from src/main/resources/data/unusualfishmod/recipes/unusual_sandwich.json rename to src/main/resources/data/unusualfishmod/recipe/unusual_sandwich.json index b1e365d..b81406e 100644 --- a/src/main/resources/data/unusualfishmod/recipes/unusual_sandwich.json +++ b/src/main/resources/data/unusualfishmod/recipe/unusual_sandwich.json @@ -17,7 +17,7 @@ } }, "result": { - "item": "unusualfishmod:unusual_sandwich", + "id": "unusualfishmod:unusual_sandwich", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/volt_detector.json b/src/main/resources/data/unusualfishmod/recipe/volt_detector.json similarity index 89% rename from src/main/resources/data/unusualfishmod/recipes/volt_detector.json rename to src/main/resources/data/unusualfishmod/recipe/volt_detector.json index ce43bd5..1cb945e 100644 --- a/src/main/resources/data/unusualfishmod/recipes/volt_detector.json +++ b/src/main/resources/data/unusualfishmod/recipe/volt_detector.json @@ -20,7 +20,7 @@ } }, "result": { - "item": "unusualfishmod:volt_detector", + "id": "unusualfishmod:volt_detector", "count": 1 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/recipes/weird_goldfish.json b/src/main/resources/data/unusualfishmod/recipe/weird_goldfish.json similarity index 87% rename from src/main/resources/data/unusualfishmod/recipes/weird_goldfish.json rename to src/main/resources/data/unusualfishmod/recipe/weird_goldfish.json index 797a1c2..c061649 100644 --- a/src/main/resources/data/unusualfishmod/recipes/weird_goldfish.json +++ b/src/main/resources/data/unusualfishmod/recipe/weird_goldfish.json @@ -15,7 +15,7 @@ } ], "result": { - "item": "unusualfishmod:weird_goldfish", + "id": "unusualfishmod:weird_goldfish", "count": 3 } } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/tags/blocks/squid_eggs.json b/src/main/resources/data/unusualfishmod/tags/block/squid_eggs.json similarity index 100% rename from src/main/resources/data/unusualfishmod/tags/blocks/squid_eggs.json rename to src/main/resources/data/unusualfishmod/tags/block/squid_eggs.json diff --git a/src/main/resources/data/unusualfishmod/tags/blocks/unchoppable.json b/src/main/resources/data/unusualfishmod/tags/block/unchoppable.json similarity index 51% rename from src/main/resources/data/unusualfishmod/tags/blocks/unchoppable.json rename to src/main/resources/data/unusualfishmod/tags/block/unchoppable.json index d6649e7..a22514f 100644 --- a/src/main/resources/data/unusualfishmod/tags/blocks/unchoppable.json +++ b/src/main/resources/data/unusualfishmod/tags/block/unchoppable.json @@ -1,4 +1,5 @@ { + "replace": false, "values": [ ] } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/tags/entity_types/cephalopods.json b/src/main/resources/data/unusualfishmod/tags/entity_type/cephalopods.json similarity index 100% rename from src/main/resources/data/unusualfishmod/tags/entity_types/cephalopods.json rename to src/main/resources/data/unusualfishmod/tags/entity_type/cephalopods.json diff --git a/src/main/resources/data/unusualfishmod/tags/entity_types/crustaceans.json b/src/main/resources/data/unusualfishmod/tags/entity_type/crustaceans.json similarity index 94% rename from src/main/resources/data/unusualfishmod/tags/entity_types/crustaceans.json rename to src/main/resources/data/unusualfishmod/tags/entity_type/crustaceans.json index 524220c..e08e076 100644 --- a/src/main/resources/data/unusualfishmod/tags/entity_types/crustaceans.json +++ b/src/main/resources/data/unusualfishmod/tags/entity_type/crustaceans.json @@ -1,4 +1,5 @@ { + "replace": false, "values": [ "unusualfishmod:sea_spider", "unusualfishmod:squoddle", diff --git a/src/main/resources/data/unusualfishmod/tags/entity_types/snails.json b/src/main/resources/data/unusualfishmod/tags/entity_type/snails.json similarity index 85% rename from src/main/resources/data/unusualfishmod/tags/entity_types/snails.json rename to src/main/resources/data/unusualfishmod/tags/entity_type/snails.json index 117445b..ae693e3 100644 --- a/src/main/resources/data/unusualfishmod/tags/entity_types/snails.json +++ b/src/main/resources/data/unusualfishmod/tags/entity_type/snails.json @@ -1,4 +1,5 @@ { + "replace": false, "values": [ "unusualfishmod:brick_snail", "unusualfishmod:blackcap_snail", diff --git a/src/main/resources/data/unusualfishmod/tags/entity_types/tiger_puffer_prey.json b/src/main/resources/data/unusualfishmod/tags/entity_type/tiger_puffer_prey.json similarity index 100% rename from src/main/resources/data/unusualfishmod/tags/entity_types/tiger_puffer_prey.json rename to src/main/resources/data/unusualfishmod/tags/entity_type/tiger_puffer_prey.json diff --git a/src/main/resources/data/unusualfishmod/tags/entity_types/volt_undetected.json b/src/main/resources/data/unusualfishmod/tags/entity_type/volt_undetected.json similarity index 51% rename from src/main/resources/data/unusualfishmod/tags/entity_types/volt_undetected.json rename to src/main/resources/data/unusualfishmod/tags/entity_type/volt_undetected.json index d6649e7..a22514f 100644 --- a/src/main/resources/data/unusualfishmod/tags/entity_types/volt_undetected.json +++ b/src/main/resources/data/unusualfishmod/tags/entity_type/volt_undetected.json @@ -1,4 +1,5 @@ { + "replace": false, "values": [ ] } \ No newline at end of file diff --git a/src/main/resources/data/unusualfishmod/tags/items/cooked_unusual_fish.json b/src/main/resources/data/unusualfishmod/tags/item/cooked_unusual_fish.json similarity index 91% rename from src/main/resources/data/unusualfishmod/tags/items/cooked_unusual_fish.json rename to src/main/resources/data/unusualfishmod/tags/item/cooked_unusual_fish.json index 8941ec4..20a569f 100644 --- a/src/main/resources/data/unusualfishmod/tags/items/cooked_unusual_fish.json +++ b/src/main/resources/data/unusualfishmod/tags/item/cooked_unusual_fish.json @@ -1,4 +1,5 @@ { + "replace": false, "values": [ "unusualfishmod:cooked_aero_mono_stick", "unusualfishmod:cooked_mossthorn", diff --git a/src/main/resources/data/unusualfishmod/tags/items/raw_unusual_fish.json b/src/main/resources/data/unusualfishmod/tags/item/raw_unusual_fish.json similarity index 92% rename from src/main/resources/data/unusualfishmod/tags/items/raw_unusual_fish.json rename to src/main/resources/data/unusualfishmod/tags/item/raw_unusual_fish.json index 90ea82a..a9dec23 100644 --- a/src/main/resources/data/unusualfishmod/tags/items/raw_unusual_fish.json +++ b/src/main/resources/data/unusualfishmod/tags/item/raw_unusual_fish.json @@ -1,8 +1,9 @@ { + "replace": false, "values": [ "unusualfishmod:raw_eyelash", "unusualfishmod:raw_spindlefish", - "unusualfishmod:raw_snowflake", + "unusualfishmod:raw_frosty_fin", "unusualfishmod:raw_aero_mono", "unusualfishmod:raw_sailor_barb", "unusualfishmod:raw_bark_angelfish", diff --git a/src/main/resources/data/unusualfishmod/tags/items/unusual_catch.json b/src/main/resources/data/unusualfishmod/tags/item/unusual_catch.json similarity index 94% rename from src/main/resources/data/unusualfishmod/tags/items/unusual_catch.json rename to src/main/resources/data/unusualfishmod/tags/item/unusual_catch.json index f632ec5..5bc69c2 100644 --- a/src/main/resources/data/unusualfishmod/tags/items/unusual_catch.json +++ b/src/main/resources/data/unusualfishmod/tags/item/unusual_catch.json @@ -1,4 +1,5 @@ { + "replace": false, "values": [ "#unusualfishmod:raw_unusual_fish", "unusualfishmod:lobster_spike", diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png new file mode 100644 index 0000000..8992c52 Binary files /dev/null and b/src/main/resources/logo.png differ diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index b00c310..7f02c72 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,7 +1,7 @@ { "pack": { "description": "unusualfish resources", - "pack_format": 6, + "pack_format": 34, "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/templates/META-INF/neoforge.mods.toml similarity index 54% rename from src/main/resources/META-INF/mods.toml rename to src/main/templates/META-INF/neoforge.mods.toml index df34167..3305a55 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/templates/META-INF/neoforge.mods.toml @@ -1,12 +1,12 @@ -# This is an example mods.toml file. It contains the data relating to the loading mods. +# This is an example neoforge.mods.toml file. It contains the data relating to the loading mods. # 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 forge version -loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +# A version range to match for said mod loader - for regular FML @Mod it will be the FML version. This is currently 2. +loaderVersion="${loader_version_range}" #mandatory # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. license="${mod_license}" @@ -20,51 +20,76 @@ modId="${mod_id}" #mandatory version="${mod_version}" #mandatory # A display name for the mod displayName="${mod_name}" #mandatory -# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/ +# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforged.net/docs/misc/updatechecker/ #updateJSONURL="https://change.me.example.invalid/updates.json" #optional + # A URL for the "homepage" for this mod, displayed in the mod UI #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional + # A file name (in the root of the mod JAR) containing a logo for display -#logoFile="examplemod.png" #optional +logoFile="logo.png" #optional + # A text field displayed in the mod UI credits="Mango (sound designer & composer)" #optional # A text field displayed in the mod UI authors="${mod_authors}" #optional -# Display Test controls the display for your mod in the server connection screen -# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod. -# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod. -# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. -# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. -# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. -#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) - -# The description text for the mod (multi line!) (#mandatory) -description='''${mod_description}''' -# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies.${mod_id}]] #optional -# the modid of the dependency -modId="forge" #mandatory -# Does this dependency have to exist - if not, ordering below must be specified -mandatory=true #mandatory -# The version range of the dependency -versionRange="${forge_version_range}" #mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory # BEFORE - This mod is loaded BEFORE the dependency # AFTER - This mod is loaded AFTER the dependency ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT, or SERVER side="BOTH" +# The description text for the mod (multi line!) (#mandatory) +description='''${mod_description}''' + +# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded. +#[[mixins]] +#config="${mod_id}.mixins.json" + +# The [[accessTransformers]] block allows you to declare where your AT file is. +# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg +#[[accessTransformers]] +#file="META-INF/accesstransformer.cfg" + +# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json + +# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. +[[dependencies.${mod_id}]] #optional + # the modid of the dependency + modId="neoforge" #mandatory + # The type of the dependency. Can be one of "required", "optional", "incompatible" or "discouraged" (case insensitive). + # 'required' requires the mod to exist, 'optional' does not + # 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning + type="required" #mandatory + # Optional field describing why the dependency is required or why it is incompatible + # reason="..." + # The version range of the dependency + versionRange="[${neo_version},)" #mandatory + # An ordering relationship for the dependency. + # BEFORE - This mod is loaded BEFORE the dependency + # AFTER - This mod is loaded AFTER the dependency + ordering="NONE" + # Side this dependency is applied on - BOTH, CLIENT, or SERVER + side="BOTH" + # Here's another dependency [[dependencies.${mod_id}]] -modId="minecraft" -mandatory=true -# This version range declares a minimum of the current minecraft version up to but not including the next major version -versionRange="${minecraft_version_range}" -ordering="NONE" -side="BOTH" + modId="minecraft" + type="required" + # This version range declares a minimum of the current minecraft version up to but not including the next major version + versionRange="${minecraft_version_range}" + ordering="NONE" + side="BOTH" +[[dependencies.${ mod_id }]] + modId = "geckolib" + type = "required" + referralUrl = "https://www.curseforge.com/minecraft/mc-mods/geckolib" + versionRange = "[${geckolib_version},]" + ordering = "NONE" + side = "BOTH" # Features are specific properties of the game environment, that you may want to declare you require. This example declares # that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't # stop your mod loading on the server for example. #[features.${mod_id}] -#openGLVersion="[3.2,)" \ No newline at end of file +#openGLVersion="[3.2,)"