diff --git a/.gitignore b/.gitignore index 3704778..069002b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,6 @@ forge*changelog.txt logs +runs + *.xcf \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2fc4386..d38c611 100644 --- a/build.gradle +++ b/build.gradle @@ -1,209 +1,164 @@ -plugins { - id 'eclipse' - id 'idea' - id 'maven-publish' - id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' -} - -version = mod_version -group = mod_group_id - -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') - - // 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' - - // 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' - - mods { - "randomloot" { - source sourceSets.main - } - } - } - - client { - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', mod_id - } - - server { - property 'forge.enabledGameTestNamespaces', mod_id - args '--nogui' - } - - // 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 - } - - data { - // example of overriding the workingDirectory set in configureEach above - workingDirectory 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/') - } - } -} - -// Include resources generated by data generators. -sourceSets.main.resources { srcDir 'src/generated/resources' } - -repositories { - // Put repositories for dependencies here - // ForgeGradle automatically adds the Forge maven and Maven Central for you - - // If you have mod jar dependencies in ./libs, you can declare them as a repository like so. - // See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver - // flatDir { - // dir 'libs' - // } -} - -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}" - - // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings - // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime - // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}") - // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}") - // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${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 fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") - - implementation('cpw.mods:securejarhandler') { version { strictly '0.9.45' } } - - // 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 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, - ] - 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' -} - -// 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' -// } - -// Example configuration to allow publishing using the maven-publish plugin -publishing { - publications { - register('mavenJava', MavenPublication) { - artifact jar - } - } - repositories { - maven { - url "file://${project.projectDir}/mcmodsrepo" - } - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} +plugins { + id 'java-library' + id 'eclipse' + id 'idea' + id 'maven-publish' + id 'net.neoforged.gradle.userdev' version '7.0.97' +} + +version = mod_version +group = mod_group_id + +repositories { + mavenLocal() +} + +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) + +//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg') +//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager + +// Default run configurations. +// These can be tweaked, removed, or duplicated as needed. +runs { + // applies to all the run configs below + 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 + systemProperty 'forge.logging.console.level', 'debug' + + modSource project.sourceSets.main + } + + client { + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id + } + + server { + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id + programArgument '--nogui' + } + + // 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 { + systemProperty 'forge.enabledGameTestNamespaces', project.mod_id + } + + data { + // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it + // workingDirectory project.file('run-data') + + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. + programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() + } +} + +// Include resources generated by data generators. +sourceSets.main.resources { srcDir 'src/generated/resources' } + +// 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. + // Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above. + // The group for userdev is net.neoforged, the module name is neoforge, and the version is the same as the neoforge version. + // You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader. + // And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version. + // For all intends and purposes: You can treat this dependency as if it is a normal library you would use. + implementation "net.neoforged:neoforge:${neo_version}" + + // 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") + + // 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.withType(ProcessResources).configureEach { + var replaceProperties = [ + minecraft_version : minecraft_version, + minecraft_version_range: minecraft_version_range, + neo_version : neo_version, + neo_version_range : neo_version_range, + loader_version_range : loader_version_range, + mod_id : mod_id, + mod_name : mod_name, + mod_license : mod_license, + mod_version : mod_version, + mod_authors : mod_authors, + mod_description : mod_description + ] + inputs.properties replaceProperties + + filesMatching(['META-INF/mods.toml']) { + expand replaceProperties + } +} + +// Example configuration to allow publishing using the maven-publish plugin +publishing { + publications { + register('mavenJava', MavenPublication) { + from components.java + } + } + repositories { + maven { + url "file://${project.projectDir}/repo" + } + } +} + +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 + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index b04424f..3cfe5e4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,42 +1,27 @@ # 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.jvmargs= org.gradle.daemon=false - +org.gradle.debug=false ## Environment Properties -# The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=1.20.2 +# Read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings +# You can find the latest versions here: https://parchmentmc.org/docs/getting-started +neogradle.subsystems.parchment.minecraftVersion=1.20.3 +neogradle.subsystems.parchment.mappingsVersion=2023.12.31 + +# The Minecraft version must agree with the Neo version to get a valid artifact +minecraft_version=1.20.4 # 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.20.2,1.20.3,1.20.4,1.21) -# The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=48.1.0 -# The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[48,) -# The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[48,) -# 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.2 - +minecraft_version_range=[1.20.4,1.21) +# The Neo version must agree with the Minecraft version to get a valid artifact +neo_version=20.4.237 +# The Neo version range can use any version of Neo as bounds or match the loader version range +neo_version_range=[20.4,) +# The loader version range can only use the major version of Neo/FML as bounds +loader_version_range=[2,) ## Mod Properties @@ -48,7 +33,7 @@ mod_name=RandomLoot 2 # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=All Rights Reserved # The mod version. See https://semver.org/ -mod_version=0.0.0 +mod_version=1.0.0 # 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 @@ -56,4 +41,4 @@ mod_group_id=dev.marston.randomloot # The authors of the mod. This is a simple text string that is used for display purposes in the mod list. mod_authors=Marston Connell # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. -mod_description=An RPG style loot system built from the ground up to make Minecraft loot feel more personal. \ No newline at end of file +mod_description=An RPG style loot system built from the ground up to make Minecraft loot feel more personal.# Pack version - this changes each minecraft release, in general. \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..e644113 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..a441313 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-8.8-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,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 +83,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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,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 +145,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 +153,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,11 +198,15 @@ 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, 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" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85..7101f8e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,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,11 +57,11 @@ 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 diff --git a/settings.gradle b/settings.gradle index 6c0f2cd..3f80422 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,13 +1,11 @@ pluginManagement { repositories { + mavenLocal() gradlePluginPortal() - maven { - name = 'MinecraftForge' - url = 'https://maven.minecraftforge.net/' - } + maven { url = 'https://maven.neoforged.net/releases' } } } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } \ No newline at end of file diff --git a/src/main/java/dev/marston/randomloot/CaseModifier.java b/src/main/java/dev/marston/randomloot/CaseModifier.java.old similarity index 83% rename from src/main/java/dev/marston/randomloot/CaseModifier.java rename to src/main/java/dev/marston/randomloot/CaseModifier.java.old index 647527e..69cfc25 100644 --- a/src/main/java/dev/marston/randomloot/CaseModifier.java +++ b/src/main/java/dev/marston/randomloot/CaseModifier.java.old @@ -1,5 +1,6 @@ package dev.marston.randomloot; +import net.minecraft.core.registries.Registries; import org.jetbrains.annotations.NotNull; import com.google.common.base.Supplier; @@ -13,15 +14,15 @@ 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.minecraftforge.registries.ForgeRegistries; +import net.neoforged.neoforge.common.loot.IGlobalLootModifier; +import net.neoforged.neoforge.common.loot.LootModifier; +import net.neoforged.neoforge.registries.ForgeRegistries; public class CaseModifier extends LootModifier { private final Item item; public static final Supplier> CODEC = Suppliers.memoize(() -> RecordCodecBuilder.create( - inst -> codecStart(inst).and(ForgeRegistries.ITEMS.getCodec().fieldOf("item").forGetter(m -> m.item)) + inst -> codecStart(inst).and(Registries.ITEM..fieldOf("item").forGetter(m -> m.item)) .apply(inst, CaseModifier::new))); protected CaseModifier(LootItemCondition[] conditionsIn, Item item) { diff --git a/src/main/java/dev/marston/randomloot/Config.java b/src/main/java/dev/marston/randomloot/Config.java index bbe8fdd..bd58693 100644 --- a/src/main/java/dev/marston/randomloot/Config.java +++ b/src/main/java/dev/marston/randomloot/Config.java @@ -1,30 +1,30 @@ package dev.marston.randomloot; +import dev.marston.randomloot.loot.modifiers.Modifier; +import dev.marston.randomloot.loot.modifiers.ModifierRegistry; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.event.config.ModConfigEvent; +import net.neoforged.neoforge.common.ModConfigSpec; +import net.neoforged.neoforge.common.ModConfigSpec.BooleanValue; + import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import dev.marston.randomloot.loot.modifiers.Modifier; -import dev.marston.randomloot.loot.modifiers.ModifierRegistry; -import net.minecraftforge.common.ForgeConfigSpec; -import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.event.config.ModConfigEvent; - @Mod.EventBusSubscriber(modid = RandomLootMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class Config { - private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); + private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); - private static ForgeConfigSpec.DoubleValue CASE_CHANCE; + private static ModConfigSpec.DoubleValue CASE_CHANCE; - private static ForgeConfigSpec.DoubleValue MOD_CHANCE; + private static ModConfigSpec.DoubleValue MOD_CHANCE; - private static ForgeConfigSpec.DoubleValue GOODNESS; + private static ModConfigSpec.DoubleValue GOODNESS; - static final ForgeConfigSpec SPEC = build(); + static final ModConfigSpec SPEC = build(); - public static ForgeConfigSpec build() { + public static ModConfigSpec build() { init(); return BUILDER.build(); } @@ -33,7 +33,7 @@ public static ForgeConfigSpec build() { public static double ModChance; public static double Goodness; - private static Map MODIFIERS_ENABLED; + private static Map MODIFIERS_ENABLED; private static Map ModsEnabled; public static void init() { @@ -45,7 +45,7 @@ public static void init() { BUILDER.pop(); BUILDER.push("Modifiers Enabled"); - MODIFIERS_ENABLED = new HashMap(); + MODIFIERS_ENABLED = new HashMap(); for (Entry entry : ModifierRegistry.Modifiers.entrySet()) { String key = entry.getKey(); diff --git a/src/main/java/dev/marston/randomloot/GenWiki.java b/src/main/java/dev/marston/randomloot/GenWiki.java index 540b95c..a16bff9 100644 --- a/src/main/java/dev/marston/randomloot/GenWiki.java +++ b/src/main/java/dev/marston/randomloot/GenWiki.java @@ -1,23 +1,18 @@ package dev.marston.randomloot; -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; - import dev.marston.randomloot.loot.modifiers.Modifier; import dev.marston.randomloot.loot.modifiers.ModifierRegistry; import net.minecraft.resources.ResourceLocation; +import java.io.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + public class GenWiki { private static void write(String s, FileWriter f) throws IOException { diff --git a/src/main/java/dev/marston/randomloot/ModLootModifiers.java b/src/main/java/dev/marston/randomloot/ModLootModifiers.java index 7f93bc5..aef37b0 100644 --- a/src/main/java/dev/marston/randomloot/ModLootModifiers.java +++ b/src/main/java/dev/marston/randomloot/ModLootModifiers.java @@ -1,21 +1,13 @@ package dev.marston.randomloot; -import com.mojang.serialization.Codec; - -import net.minecraftforge.common.loot.IGlobalLootModifier; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegistryObject; - public class ModLootModifiers { - public static final DeferredRegister> LOOT_MODIFIER_SERIALIZERS = DeferredRegister - .create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, RandomLootMod.MODID); - - public static final RegistryObject> ADD_ITEM = LOOT_MODIFIER_SERIALIZERS - .register("case_item", CaseModifier.CODEC); - - public static void register(IEventBus bus) { - LOOT_MODIFIER_SERIALIZERS.register(bus); - } +// public static final DeferredRegister> LOOT_MODIFIER_SERIALIZERS = DeferredRegister +// .create(BuiltInRegistries..GLOBAL_LOOT_MODIFIER_SERIALIZERS, RandomLootMod.MODID); +// +// public static final DeferredRegister> ADD_ITEM = LOOT_MODIFIER_SERIALIZERS +// .register("case_item", CaseModifier.CODEC); + +// public static void register(IEventBus bus) { +// LOOT_MODIFIER_SERIALIZERS.register(bus); +// } } diff --git a/src/main/java/dev/marston/randomloot/RandomLootMod.java b/src/main/java/dev/marston/randomloot/RandomLootMod.java index 37b9420..4cf7bd0 100644 --- a/src/main/java/dev/marston/randomloot/RandomLootMod.java +++ b/src/main/java/dev/marston/randomloot/RandomLootMod.java @@ -1,15 +1,9 @@ package dev.marston.randomloot; -import java.util.Map; - -import org.slf4j.Logger; - import com.mojang.logging.LogUtils; - import dev.marston.randomloot.loot.LootCase; import dev.marston.randomloot.loot.LootRegistry; import dev.marston.randomloot.loot.LootUtils; -import dev.marston.randomloot.recipes.Recipies; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; @@ -17,29 +11,28 @@ import net.minecraft.world.item.CreativeModeTabs; import net.minecraft.world.item.Item; import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.level.block.Block; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; -import net.minecraftforge.event.server.ServerStartingEvent; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; -import net.minecraftforge.registries.ForgeRegistries; -import net.minecraftforge.registries.RegisterEvent; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.ModLoadingContext; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.config.ModConfig; +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; +import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent; +import net.neoforged.neoforge.event.server.ServerStartingEvent; +import net.neoforged.neoforge.registries.DeferredRegister; +import net.neoforged.neoforge.registries.RegisterEvent; +import org.slf4j.Logger; + +import java.util.Map; @Mod(RandomLootMod.MODID) public class RandomLootMod { public static final String MODID = "randomloot"; public static final Logger LOGGER = LogUtils.getLogger(); - public static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); + public static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks(MODID); public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister .create(Registries.CREATIVE_MODE_TAB, MODID); @@ -49,28 +42,26 @@ public class RandomLootMod { static RandomLootMod INSTANCE; - public RandomLootMod() { + public RandomLootMod(IEventBus bus) { if (INSTANCE != null) { throw new IllegalStateException(); } INSTANCE = this; - IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); - bus.addListener((RegisterEvent event) -> { if (!event.getRegistryKey().equals(Registries.BLOCK)) { return; } - Recipies.init(ForgeRegistries.RECIPE_SERIALIZERS); +// Recipies.init(BuiltInRegistries.RECIPE_SERIALIZER); }); bus.addListener(this::commonSetup); bus.addListener(this::addCreative); - MinecraftForge.EVENT_BUS.register(this); + NeoForge.EVENT_BUS.register(this); - ModLootModifiers.register(bus); +// ModLootModifiers.register(bus); ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); @@ -110,13 +101,13 @@ public static void onClientSetup(FMLClientSetupEvent event) { } } - @EventBusSubscriber(modid = MODID, bus = EventBusSubscriber.Bus.MOD) + @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void registerItems(RegisterEvent event) { - event.register(ForgeRegistries.Keys.ITEMS, helper -> { + event.register(Registries.ITEM, helper -> { for (Map.Entry entry : LootRegistry.Items.entrySet()) { String key = entry.getKey(); Item val = entry.getValue(); diff --git a/src/main/java/dev/marston/randomloot/loot/LootCase.java b/src/main/java/dev/marston/randomloot/loot/LootCase.java index af84aac..2a861af 100644 --- a/src/main/java/dev/marston/randomloot/loot/LootCase.java +++ b/src/main/java/dev/marston/randomloot/loot/LootCase.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.modifiers.Modifier; import net.minecraft.ChatFormatting; import net.minecraft.core.Direction; @@ -12,7 +8,6 @@ import net.minecraft.core.dispenser.DefaultDispenseItemBehavior; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.MutableComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.stats.StatType; @@ -27,6 +22,9 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.DispenserBlock; +import javax.annotation.Nullable; +import java.util.List; + public class LootCase extends Item { public static void initDispenser() { @@ -100,7 +98,7 @@ public InteractionResultHolder use(Level level, Player player, Intera @Override public void appendHoverText(ItemStack stack, @Nullable Level level, List tipList, TooltipFlag flag) { - MutableComponent comp = MutableComponent.create(ComponentContents.EMPTY); + MutableComponent comp = Component.empty(); comp.append("Right-click for loot!"); comp = comp.withStyle(ChatFormatting.GRAY); diff --git a/src/main/java/dev/marston/randomloot/loot/LootItem.java b/src/main/java/dev/marston/randomloot/loot/LootItem.java index d533876..a5d4602 100644 --- a/src/main/java/dev/marston/randomloot/loot/LootItem.java +++ b/src/main/java/dev/marston/randomloot/loot/LootItem.java @@ -1,27 +1,13 @@ package dev.marston.randomloot.loot; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import javax.annotation.Nullable; - import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; - import dev.marston.randomloot.Config; -import dev.marston.randomloot.loot.modifiers.BlockBreakModifier; -import dev.marston.randomloot.loot.modifiers.EntityHurtModifier; -import dev.marston.randomloot.loot.modifiers.HoldModifier; -import dev.marston.randomloot.loot.modifiers.Modifier; -import dev.marston.randomloot.loot.modifiers.StatsModifier; -import dev.marston.randomloot.loot.modifiers.Unbreaking; -import dev.marston.randomloot.loot.modifiers.UseModifier; +import dev.marston.randomloot.loot.modifiers.*; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.MutableComponent; import net.minecraft.server.level.ServerPlayer; import net.minecraft.stats.StatType; @@ -38,11 +24,7 @@ import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.Tiers; -import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.*; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentCategory; @@ -51,6 +33,11 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; +import javax.annotation.Nullable; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + public class LootItem extends Item { public static enum ToolType { PICKAXE, SHOVEL, AXE, SWORD, NULL; @@ -199,7 +186,7 @@ public boolean isCorrectToolForDrops(ItemStack stack, BlockState state) { } return state.is(blocks) - && net.minecraftforge.common.TierSortingRegistry.isCorrectTierForDrops(Tiers.DIAMOND, state); + && net.neoforged.neoforge.common.TierSortingRegistry.isCorrectTierForDrops(Tiers.DIAMOND, state); } @Override @@ -406,7 +393,7 @@ public InteractionResultHolder use(Level level, Player player, Intera } private MutableComponent makeComp(String text, ChatFormatting color) { - MutableComponent comp = MutableComponent.create(ComponentContents.EMPTY); + MutableComponent comp = Component.empty(); comp.append(text); comp = comp.withStyle(color); @@ -485,11 +472,11 @@ public int compare(final Modifier object1, final Modifier object2) { if (!show && !showDescription) { newLine(tipList); - MutableComponent comp = MutableComponent.create(ComponentContents.EMPTY); + MutableComponent comp = Component.empty(); comp.append("[Shift for more]"); comp = comp.withStyle(ChatFormatting.GRAY); tipList.add(comp); - MutableComponent descComp = MutableComponent.create(ComponentContents.EMPTY); + MutableComponent descComp = Component.empty(); descComp.append("[Ctrl for trait info]"); descComp = descComp.withStyle(ChatFormatting.GRAY); tipList.add(descComp); diff --git a/src/main/java/dev/marston/randomloot/loot/LootRegistry.java b/src/main/java/dev/marston/randomloot/loot/LootRegistry.java index b6201a4..920b660 100644 --- a/src/main/java/dev/marston/randomloot/loot/LootRegistry.java +++ b/src/main/java/dev/marston/randomloot/loot/LootRegistry.java @@ -1,9 +1,9 @@ package dev.marston.randomloot.loot; -import java.util.HashMap; - import net.minecraft.world.item.Item; +import java.util.HashMap; + public class LootRegistry { public static final HashMap Items = new HashMap(); diff --git a/src/main/java/dev/marston/randomloot/loot/LootUtils.java b/src/main/java/dev/marston/randomloot/loot/LootUtils.java index d427f4f..c76144e 100644 --- a/src/main/java/dev/marston/randomloot/loot/LootUtils.java +++ b/src/main/java/dev/marston/randomloot/loot/LootUtils.java @@ -1,13 +1,6 @@ package dev.marston.randomloot.loot; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; - import com.google.gson.JsonObject; - import dev.marston.randomloot.Config; import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.Modifier; @@ -29,6 +22,12 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; + public class LootUtils { private static int PICKAXE_COUNT = 18; @@ -299,7 +298,7 @@ private static void generateLore(ItemStack lootItem, Level level, Player player) if (player != null) { Holder biome = level.getBiome(player.blockPosition()); - Biome b = biome.get(); + Biome b = biome.value(); temp = b.getBaseTemperature(); diff --git a/src/main/java/dev/marston/randomloot/loot/ModTemplate.java b/src/main/java/dev/marston/randomloot/loot/ModTemplate.java index 79cd4d4..002bc76 100644 --- a/src/main/java/dev/marston/randomloot/loot/ModTemplate.java +++ b/src/main/java/dev/marston/randomloot/loot/ModTemplate.java @@ -1,14 +1,9 @@ package dev.marston.randomloot.loot; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.modifiers.Modifier; import net.minecraft.ChatFormatting; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; @@ -18,6 +13,9 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class ModTemplate extends Item { final boolean add; @@ -57,7 +55,7 @@ public InteractionResultHolder use(Level level, Player player, Intera @Override public void appendHoverText(ItemStack stack, @Nullable Level level, List tipList, TooltipFlag flag) { - MutableComponent comp = MutableComponent.create(ComponentContents.EMPTY); + MutableComponent comp = Component.empty(); comp.append("Right-click to change function"); comp = comp.withStyle(ChatFormatting.GRAY); diff --git a/src/main/java/dev/marston/randomloot/loot/NameGenerator.java b/src/main/java/dev/marston/randomloot/loot/NameGenerator.java index 9c3dc80..55a6b01 100644 --- a/src/main/java/dev/marston/randomloot/loot/NameGenerator.java +++ b/src/main/java/dev/marston/randomloot/loot/NameGenerator.java @@ -1,9 +1,9 @@ package dev.marston.randomloot.loot; -import java.util.Random; - import dev.marston.randomloot.Globals; +import java.util.Random; + public class NameGenerator { public static final String[] Prefixes = new String[] { "Fyten", "Fetter", "Red", "Tita", "Ty", "A", "Demu", "Tra", "Yam", "Hal", "Wel", "Hel", "Min", "Ju", "Hwa", "Kit", "Kat", "Kib", "Lib", "Sla", "Sli", "Slu", "Effe", diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/Modifier.java b/src/main/java/dev/marston/randomloot/loot/modifiers/Modifier.java index 778c273..924d985 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/Modifier.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/Modifier.java @@ -1,25 +1,23 @@ package dev.marston.randomloot.loot.modifiers; -import java.util.List; -import java.util.Random; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import net.minecraft.ChatFormatting; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.MutableComponent; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; +import java.util.Random; + public interface Modifier { public static MutableComponent makeComp(String text, ChatFormatting color) { - MutableComponent comp = MutableComponent.create(ComponentContents.EMPTY); + MutableComponent comp = Component.empty(); comp.append(text); comp = comp.withStyle(color); @@ -27,7 +25,7 @@ public static MutableComponent makeComp(String text, ChatFormatting color) { } public static MutableComponent makeComp(String text, String color) { - MutableComponent comp = MutableComponent.create(ComponentContents.EMPTY); + MutableComponent comp = Component.empty(); comp.append(text); comp = comp.withStyle(ChatFormatting.getByName(color)); @@ -35,7 +33,7 @@ public static MutableComponent makeComp(String text, String color) { } public static MutableComponent makeComp(Component compIn) { - MutableComponent comp = MutableComponent.create(ComponentContents.EMPTY); + MutableComponent comp = Component.empty(); comp.append(compIn); return comp; } diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/ModifierRegistry.java b/src/main/java/dev/marston/randomloot/loot/modifiers/ModifierRegistry.java index 12db1a7..75ae08a 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/ModifierRegistry.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/ModifierRegistry.java @@ -1,27 +1,9 @@ package dev.marston.randomloot.loot.modifiers; -import java.util.HashMap; -import java.util.Set; - import dev.marston.randomloot.RandomLootMod; -import dev.marston.randomloot.loot.modifiers.breakers.Attracting; -import dev.marston.randomloot.loot.modifiers.breakers.Explode; -import dev.marston.randomloot.loot.modifiers.breakers.Learning; -import dev.marston.randomloot.loot.modifiers.breakers.Melting; -import dev.marston.randomloot.loot.modifiers.breakers.Veiny; -import dev.marston.randomloot.loot.modifiers.holders.Effect; -import dev.marston.randomloot.loot.modifiers.holders.Hasty; -import dev.marston.randomloot.loot.modifiers.holders.Healing; -import dev.marston.randomloot.loot.modifiers.holders.OreFinder; -import dev.marston.randomloot.loot.modifiers.holders.Rainy; -import dev.marston.randomloot.loot.modifiers.holders.TreasureFinder; -import dev.marston.randomloot.loot.modifiers.hurter.Bezerk; -import dev.marston.randomloot.loot.modifiers.hurter.Charging; -import dev.marston.randomloot.loot.modifiers.hurter.Combo; -import dev.marston.randomloot.loot.modifiers.hurter.Critical; -import dev.marston.randomloot.loot.modifiers.hurter.Draining; -import dev.marston.randomloot.loot.modifiers.hurter.Fire; -import dev.marston.randomloot.loot.modifiers.hurter.HurtEffect; +import dev.marston.randomloot.loot.modifiers.breakers.*; +import dev.marston.randomloot.loot.modifiers.holders.*; +import dev.marston.randomloot.loot.modifiers.hurter.*; import dev.marston.randomloot.loot.modifiers.stats.Busted; import dev.marston.randomloot.loot.modifiers.users.DirtPlace; import dev.marston.randomloot.loot.modifiers.users.FireBall; @@ -30,6 +12,9 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.world.effect.MobEffects; +import java.util.HashMap; +import java.util.Set; + public class ModifierRegistry { public static HashMap Modifiers = new HashMap(); diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/Unbreaking.java b/src/main/java/dev/marston/randomloot/loot/modifiers/Unbreaking.java index e40317b..0c3ce1f 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/Unbreaking.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/Unbreaking.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; import net.minecraft.ChatFormatting; @@ -12,6 +8,9 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Unbreaking implements Modifier { final String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Attracting.java b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Attracting.java index f343708..2d7077a 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Attracting.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Attracting.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.breakers; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.BlockBreakModifier; import dev.marston.randomloot.loot.modifiers.Modifier; @@ -18,6 +14,9 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; +import javax.annotation.Nullable; +import java.util.List; + public class Attracting implements BlockBreakModifier { private String name; @@ -43,7 +42,9 @@ public boolean startBreak(ItemStack itemstack, BlockPos pos, LivingEntity player Level l = player.level(); - AABB box = new AABB(pos.east().south().below(), pos.west().north().above()); + + + AABB box = new AABB(pos.east().south().below().getCenter(), pos.west().north().above().getCenter()); Thread thread = new Thread() { public void run() { diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Explode.java b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Explode.java index 068c521..344d01e 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Explode.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Explode.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.breakers; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.BlockBreakModifier; import dev.marston.randomloot.loot.modifiers.Modifier; @@ -16,6 +12,9 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.Level.ExplosionInteraction; +import javax.annotation.Nullable; +import java.util.List; + public class Explode implements BlockBreakModifier { private String name; @@ -41,8 +40,9 @@ public boolean startBreak(ItemStack itemstack, BlockPos pos, LivingEntity player Level l = player.level(); - l.explode(player, null, null, pos.getX(), pos.getY(), pos.getZ(), power, false, ExplosionInteraction.BLOCK, - false); + l.explode(player, null, null, pos.getX(), pos.getY(), pos.getZ(), power, false, ExplosionInteraction.BLOCK + ); + return false; } diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Learning.java b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Learning.java index 04b9df7..c2a4bbb 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Learning.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Learning.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.breakers; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; import dev.marston.randomloot.loot.modifiers.BlockBreakModifier; @@ -18,6 +14,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Learning implements BlockBreakModifier { private String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Melting.java b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Melting.java index 124edc8..32acfdb 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Melting.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Melting.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.breakers; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.RandomLootMod; import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.BlockBreakModifier; @@ -26,6 +22,9 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; +import javax.annotation.Nullable; +import java.util.List; + public class Melting implements BlockBreakModifier { private String name; @@ -51,7 +50,7 @@ public boolean startBreak(ItemStack itemstack, BlockPos pos, LivingEntity player Level l = player.level(); - AABB box = new AABB(pos.east().south().below(), pos.west().north().above()); + AABB box = new AABB(pos.east().south().below().getCenter(), pos.west().north().above().getCenter()); RegistryAccess access = l.registryAccess(); RecipeManager manager = l.getRecipeManager(); diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Veiny.java b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Veiny.java index 5fa3be9..6620b1f 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Veiny.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/breakers/Veiny.java @@ -1,12 +1,5 @@ package dev.marston.randomloot.loot.modifiers.breakers; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem; import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.BlockBreakModifier; @@ -25,6 +18,12 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import javax.annotation.Nullable; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + public class Veiny implements BlockBreakModifier { private String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Effect.java b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Effect.java index aae7c76..668bd9e 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Effect.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Effect.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.holders; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; import dev.marston.randomloot.loot.modifiers.HoldModifier; @@ -20,6 +16,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Effect implements HoldModifier { private String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Hasty.java b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Hasty.java index 93b063b..f885a05 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Hasty.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Hasty.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.holders; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; import dev.marston.randomloot.loot.modifiers.HoldModifier; @@ -20,6 +16,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Hasty implements HoldModifier { private String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Healing.java b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Healing.java index ba7a832..40cc01e 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Healing.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Healing.java @@ -1,21 +1,19 @@ package dev.marston.randomloot.loot.modifiers.holders; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.HoldModifier; import dev.marston.randomloot.loot.modifiers.Modifier; import net.minecraft.ChatFormatting; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Healing implements HoldModifier { private String name; @@ -110,7 +108,7 @@ public void hold(ItemStack stack, Level level, Entity holder) { stack.setDamageValue(Math.max(stack.getDamageValue() - 1, 0)); if (f < power / 5) { - MutableComponent comp = MutableComponent.create(ComponentContents.EMPTY); + MutableComponent comp = Component.empty(); comp.append("pssst..."); comp = comp.withStyle(ChatFormatting.GRAY); diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/OreFinder.java b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/OreFinder.java index ecb7740..7cd7fce 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/OreFinder.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/OreFinder.java @@ -1,10 +1,5 @@ package dev.marston.randomloot.loot.modifiers.holders; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.RandomLootMod; import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.HoldModifier; @@ -24,10 +19,14 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.AABB; -import net.minecraftforge.event.TickEvent.ServerTickEvent; -import net.minecraftforge.event.server.ServerStoppingEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.event.TickEvent.ServerTickEvent; +import net.neoforged.neoforge.event.server.ServerStoppingEvent; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; @Mod.EventBusSubscriber(modid = RandomLootMod.MODID) public class OreFinder implements HoldModifier { diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Rainy.java b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Rainy.java index c1086cb..1afae90 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Rainy.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/Rainy.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.holders; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.HoldModifier; import dev.marston.randomloot.loot.modifiers.Modifier; @@ -19,6 +15,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Rainy implements HoldModifier { private String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/TreasureFinder.java b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/TreasureFinder.java index 26d3944..4f9fe43 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/holders/TreasureFinder.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/holders/TreasureFinder.java @@ -1,10 +1,5 @@ package dev.marston.randomloot.loot.modifiers.holders; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.RandomLootMod; import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.HoldModifier; @@ -24,10 +19,14 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.AABB; -import net.minecraftforge.event.TickEvent.ServerTickEvent; -import net.minecraftforge.event.server.ServerStoppingEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.event.TickEvent.ServerTickEvent; +import net.neoforged.neoforge.event.server.ServerStoppingEvent; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; @Mod.EventBusSubscriber(modid = RandomLootMod.MODID) public class TreasureFinder implements HoldModifier { diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Bezerk.java b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Bezerk.java index 5fc4119..fb77bdd 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Bezerk.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Bezerk.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.hurter; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem; import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; @@ -18,6 +14,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Bezerk implements EntityHurtModifier { private String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Charging.java b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Charging.java index 42cd93f..09034e6 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Charging.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Charging.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.hurter; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; import dev.marston.randomloot.loot.modifiers.EntityHurtModifier; @@ -19,6 +15,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Charging implements EntityHurtModifier { private String name; private int points; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Combo.java b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Combo.java index cc9b274..6d19e2e 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Combo.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Combo.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.hurter; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem; import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; @@ -18,6 +14,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Combo implements EntityHurtModifier { private String name; private int points; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Critical.java b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Critical.java index 686b8cb..dd934ef 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Critical.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Critical.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.hurter; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem; import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; @@ -19,6 +15,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Critical implements EntityHurtModifier { private String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Draining.java b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Draining.java index ca8523f..c389991 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Draining.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Draining.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.hurter; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem; import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; @@ -17,6 +13,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Draining implements EntityHurtModifier { private String name; private int points; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Fire.java b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Fire.java index eb98e98..833732a 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Fire.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/Fire.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.hurter; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; import dev.marston.randomloot.loot.modifiers.EntityHurtModifier; @@ -16,6 +12,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Fire implements EntityHurtModifier { private String name; private int points; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/HurtEffect.java b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/HurtEffect.java index e5354ac..c2f0d03 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/HurtEffect.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/hurter/HurtEffect.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.hurter; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.LootUtils; import dev.marston.randomloot.loot.modifiers.EntityHurtModifier; @@ -19,6 +15,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class HurtEffect implements EntityHurtModifier { private String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/stats/Busted.java b/src/main/java/dev/marston/randomloot/loot/modifiers/stats/Busted.java index 13148a7..d4f5a26 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/stats/Busted.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/stats/Busted.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.stats; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.Modifier; import dev.marston.randomloot.loot.modifiers.StatsModifier; @@ -14,6 +10,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import javax.annotation.Nullable; +import java.util.List; + public class Busted implements StatsModifier { private String name; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/users/DirtPlace.java b/src/main/java/dev/marston/randomloot/loot/modifiers/users/DirtPlace.java index a332eb8..9631d1a 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/users/DirtPlace.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/users/DirtPlace.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.users; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.NameGenerator; import dev.marston.randomloot.loot.modifiers.Modifier; @@ -36,6 +32,9 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.shapes.CollisionContext; +import javax.annotation.Nullable; +import java.util.List; + public class DirtPlace implements UseModifier { private String name; private int damage; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/users/FireBall.java b/src/main/java/dev/marston/randomloot/loot/modifiers/users/FireBall.java index 415b33e..f2f1192 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/users/FireBall.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/users/FireBall.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.users; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.Modifier; import dev.marston.randomloot.loot.modifiers.ModifierRegistry; @@ -20,6 +16,9 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; +import javax.annotation.Nullable; +import java.util.List; + public class FireBall implements UseModifier { private String name; private int damage; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/users/FirePlace.java b/src/main/java/dev/marston/randomloot/loot/modifiers/users/FirePlace.java index d0ebef1..4defbe7 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/users/FirePlace.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/users/FirePlace.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.users; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.Modifier; import dev.marston.randomloot.loot.modifiers.ModifierRegistry; @@ -32,6 +28,9 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.gameevent.GameEvent; +import javax.annotation.Nullable; +import java.util.List; + public class FirePlace implements UseModifier { private String name; private int damage; diff --git a/src/main/java/dev/marston/randomloot/loot/modifiers/users/TorchPlace.java b/src/main/java/dev/marston/randomloot/loot/modifiers/users/TorchPlace.java index 0671154..2e158ca 100644 --- a/src/main/java/dev/marston/randomloot/loot/modifiers/users/TorchPlace.java +++ b/src/main/java/dev/marston/randomloot/loot/modifiers/users/TorchPlace.java @@ -1,9 +1,5 @@ package dev.marston.randomloot.loot.modifiers.users; -import java.util.List; - -import javax.annotation.Nullable; - import dev.marston.randomloot.loot.LootItem.ToolType; import dev.marston.randomloot.loot.modifiers.Modifier; import dev.marston.randomloot.loot.modifiers.ModifierRegistry; @@ -40,6 +36,9 @@ import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.shapes.CollisionContext; +import javax.annotation.Nullable; +import java.util.List; + public class TorchPlace implements UseModifier { private String name; private int damage; diff --git a/src/main/java/dev/marston/randomloot/recipes/Recipies.java b/src/main/java/dev/marston/randomloot/recipes/Recipies.java index c09e8b1..fe705b5 100644 --- a/src/main/java/dev/marston/randomloot/recipes/Recipies.java +++ b/src/main/java/dev/marston/randomloot/recipes/Recipies.java @@ -1,27 +1,21 @@ package dev.marston.randomloot.recipes; -import dev.marston.randomloot.RandomLootMod; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraftforge.registries.IForgeRegistry; - public final class Recipies { private Recipies() { } - - public static void init(IForgeRegistry> recipeSerializers) { - RandomLootMod.LOGGER.info("registering recipes!"); - register(recipeSerializers, new ResourceLocation(RandomLootMod.MODID, "texture_change_recipe"), - TextureChangeRecipe.getMySerializer()); - register(recipeSerializers, new ResourceLocation(RandomLootMod.MODID, "trait_change"), - TraitAdditionRecipe.getMySerializer()); - - } - - private static void register(IForgeRegistry> registry, ResourceLocation id, - RecipeSerializer serializer) { - registry.register(id, serializer); - } +// +// public static void init(Registry> recipeSerializers) { +// RandomLootMod.LOGGER.info("registering recipes!"); +// register(recipeSerializers, new ResourceLocation(RandomLootMod.MODID, "texture_change_recipe"), +// TextureChangeRecipe.getMySerializer()); +// register(recipeSerializers, new ResourceLocation(RandomLootMod.MODID, "trait_change"), +// TraitAdditionRecipe.getMySerializer()); +// +// } +// +// private static void register(Registry> registry, ResourceLocation id, RecipeSerializer serializer) { +// registry. +// } } diff --git a/src/main/java/dev/marston/randomloot/recipes/TextureChangeRecipe.java b/src/main/java/dev/marston/randomloot/recipes/TextureChangeRecipe.java index c00239b..02d8ce3 100644 --- a/src/main/java/dev/marston/randomloot/recipes/TextureChangeRecipe.java +++ b/src/main/java/dev/marston/randomloot/recipes/TextureChangeRecipe.java @@ -8,11 +8,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.CraftingBookCategory; -import net.minecraft.world.item.crafting.CustomRecipe; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.RecipeSerializer; -import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer; +import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.Level; public class TextureChangeRecipe extends CustomRecipe { diff --git a/src/main/java/dev/marston/randomloot/recipes/TraitAdditionRecipe.java b/src/main/java/dev/marston/randomloot/recipes/TraitAdditionRecipe.java index 575366f..1df1a67 100644 --- a/src/main/java/dev/marston/randomloot/recipes/TraitAdditionRecipe.java +++ b/src/main/java/dev/marston/randomloot/recipes/TraitAdditionRecipe.java @@ -1,10 +1,7 @@ package dev.marston.randomloot.recipes; -import java.nio.charset.Charset; - import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; - import dev.marston.randomloot.loot.LootRegistry; import dev.marston.randomloot.loot.LootUtils; import dev.marston.randomloot.loot.modifiers.Modifier; @@ -18,6 +15,8 @@ import net.minecraft.world.item.crafting.SmithingRecipe; import net.minecraft.world.level.Level; +import java.nio.charset.Charset; + public class TraitAdditionRecipe implements SmithingRecipe { public static Serializer SERIALIZER = null; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 53be5bf..7524ea2 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,25 +1,24 @@ -modLoader="javafml" -loaderVersion="[46,)" -license="GNU General Public License v3.0" +modLoader="javafml" +loaderVersion="${loader_version_range}" #mandatory +license="${mod_license}" [[mods]] modId="randomloot" version="0.0.0" displayName="RandomLoot 2" displayURL="https://github.com/TheMarstonConnell/randomloot" #optional - logoFile="assets/randomloot/logo.png" #optional + logoFile="logo.png" #optional #credits="" #optional - authors="Marston Connell" - -# The description text for the mod (multi line!) (#mandatory) -description='''An RPG style loot system built from the ground up to make Minecraft loot feel more personal.''' + authors="Marston Connell" + # 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.randomloot]] #optional +[[dependencies.${mod_id}]] #optional # the modid of the dependency - modId="forge" #mandatory + modId="neoforge" #mandatory + type="required" #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 + versionRange="${neo_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 @@ -27,9 +26,9 @@ description='''An RPG style loot system built from the ground up to make Minecra # Side this dependency is applied on - BOTH, CLIENT, or SERVER side="BOTH" # Here's another dependency -[[dependencies.randomloot]] +[[dependencies.${mod_id}]] modId="minecraft" - mandatory=true + type="required" #mandatory # 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" diff --git a/src/main/resources/assets/randomloot/logo.png b/src/main/resources/logo.png similarity index 100% rename from src/main/resources/assets/randomloot/logo.png rename to src/main/resources/logo.png diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 8ce9594..7bcc5b9 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,8 +1,8 @@ { "pack": { "description": { - "text": "RandomLoot 2 Assets" + "text": "${mod_id} resources" }, - "pack_format": 15 + "pack_format": ${pack_format_number} } } \ No newline at end of file