From ed20f5d6b48a04e363ae81709290621f739e1a3e Mon Sep 17 00:00:00 2001 From: DavidDGTNT Date: Tue, 31 Dec 2024 17:13:24 -0600 Subject: [PATCH] Update to 1.19.4 --- build.gradle | 15 +++++---- gradle.properties | 12 +++---- .../java/me/daviddgtnt/stringtools/Main.java | 32 +++++++++++++++---- src/main/resources/pack.mcmeta | 15 +++++---- 4 files changed, 49 insertions(+), 25 deletions(-) diff --git a/build.gradle b/build.gradle index b1bacd0..cf0b591 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ minecraft { // 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://github.com/ParchmentMC/Parchment/wiki/Getting-Started + // 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. @@ -118,7 +118,8 @@ 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: + // 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' // } @@ -132,10 +133,11 @@ dependencies { // 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}" - // Real mod deobf dependency examples - these get remapped to your current mappings - // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency - // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency - // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency + // 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 @@ -189,6 +191,7 @@ tasks.named('jar', Jar).configure { // dependsOn 'reobfJar' // } +// Example configuration to allow publishing using the maven-publish plugin publishing { publications { register('mavenJava', MavenPublication) { diff --git a/gradle.properties b/gradle.properties index 0e522da..cd391d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,17 +7,17 @@ org.gradle.daemon=false ## Environment Properties # The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=1.19.2 +minecraft_version=1.19.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.19.2,1.20) +minecraft_version_range=[1.19.4,1.20) # The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=43.4.0 +forge_version=45.3.0 # The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[43,) +forge_version_range=[45,) # The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[43,) +loader_version_range=[45,) # 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. @@ -35,7 +35,7 @@ loader_version_range=[43,) 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.19.2 +mapping_version=1.19.4 ## Mod Properties diff --git a/src/main/java/me/daviddgtnt/stringtools/Main.java b/src/main/java/me/daviddgtnt/stringtools/Main.java index fb1e35e..1d2649a 100644 --- a/src/main/java/me/daviddgtnt/stringtools/Main.java +++ b/src/main/java/me/daviddgtnt/stringtools/Main.java @@ -2,7 +2,9 @@ package me.daviddgtnt.stringtools; import net.minecraft.world.item.*; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.CreativeModeTabEvent; import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; @@ -17,12 +19,12 @@ public class Main public static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - public static final RegistryObject STRING_STICK = ITEMS.register("string_stick", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS))); - public static final RegistryObject STRING_SWORD = ITEMS.register("string_sword", () -> new SwordItem(StringToolMaterial.INSTANCE, 4, 1.6F, new Item.Properties().tab(CreativeModeTab.TAB_COMBAT))); - public static final RegistryObject STRING_PICKAXE = ITEMS.register("string_pickaxe", () -> new PickaxeItem(StringToolMaterial.INSTANCE, 2, 2.4F, new Item.Properties().tab(CreativeModeTab.TAB_TOOLS))); - public static final RegistryObject STRING_AXE = ITEMS.register("string_axe", () -> new AxeItem(StringToolMaterial.INSTANCE, 7.0F, 0.8F, new Item.Properties().tab(CreativeModeTab.TAB_TOOLS))); - public static final RegistryObject STRING_SHOVEL = ITEMS.register("string_shovel", () -> new ShovelItem(StringToolMaterial.INSTANCE, 2.5F, 1.0F, new Item.Properties().tab(CreativeModeTab.TAB_TOOLS))); - public static final RegistryObject STRING_HOE = ITEMS.register("string_hoe", () -> new HoeItem(StringToolMaterial.INSTANCE, 1, 1.0F, new Item.Properties().tab(CreativeModeTab.TAB_TOOLS))); + public static final RegistryObject STRING_STICK = ITEMS.register("string_stick", () -> new Item(new Item.Properties())); + public static final RegistryObject STRING_SWORD = ITEMS.register("string_sword", () -> new SwordItem(StringToolMaterial.INSTANCE, 4, 1.6F, new Item.Properties())); + public static final RegistryObject STRING_PICKAXE = ITEMS.register("string_pickaxe", () -> new PickaxeItem(StringToolMaterial.INSTANCE, 2, 2.4F, new Item.Properties())); + public static final RegistryObject STRING_AXE = ITEMS.register("string_axe", () -> new AxeItem(StringToolMaterial.INSTANCE, 7.0F, 0.8F, new Item.Properties())); + public static final RegistryObject STRING_SHOVEL = ITEMS.register("string_shovel", () -> new ShovelItem(StringToolMaterial.INSTANCE, 2.5F, 1.0F, new Item.Properties())); + public static final RegistryObject STRING_HOE = ITEMS.register("string_hoe", () -> new HoeItem(StringToolMaterial.INSTANCE, 1, 1.0F, new Item.Properties())); public Main() { @@ -31,7 +33,25 @@ public class Main // Register the Deferred Register to the mod event bus so items get registered ITEMS.register(modEventBus); + modEventBus.addListener(this::buildContents); + // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } + @SubscribeEvent + public void buildContents(CreativeModeTabEvent.BuildContents event) { + if (event.getTab() == CreativeModeTabs.INGREDIENTS) { + event.accept(STRING_STICK); + } + if (event.getTab() == CreativeModeTabs.COMBAT) { + event.accept(STRING_SWORD); + event.accept(STRING_AXE); + } + if (event.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES) { + event.accept(STRING_PICKAXE); + event.accept(STRING_AXE); + event.accept(STRING_SHOVEL); + event.accept(STRING_HOE); + } + } } diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 81a429d..0cd9061 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,8 +1,9 @@ { - "pack": { - "description": "${mod_id} resources", - "pack_format": 9, - "forge:resource_pack_format": 9, - "forge:data_pack_format": 10 - } -} + "pack": { + "description": { + "text": "${mod_id} resources" + }, + "forge:server_data_pack_format": 12, + "pack_format": 13 + } +} \ No newline at end of file