summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle6
-rw-r--r--gradle.properties12
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--src/main/java/com/example/examplemod/Config.java12
-rw-r--r--src/main/java/com/example/examplemod/ExampleMod.java15
5 files changed, 25 insertions, 22 deletions
diff --git a/build.gradle b/build.gradle
index 8bd9e19..c25acb4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,7 +3,7 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
- id 'net.neoforged.gradle.userdev' version '7.0.97'
+ id 'net.neoforged.gradle.userdev' version '7.0.109'
}
version = mod_version
@@ -17,8 +17,8 @@ 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)
+// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
+java.toolchain.languageVersion = JavaLanguageVersion.of(21)
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
diff --git a/gradle.properties b/gradle.properties
index 346805d..ce1dfcd 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -5,20 +5,20 @@ org.gradle.debug=false
#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
-neogradle.subsystems.parchment.minecraftVersion=1.20.3
-neogradle.subsystems.parchment.mappingsVersion=2023.12.31
+neogradle.subsystems.parchment.minecraftVersion=1.20.4
+neogradle.subsystems.parchment.mappingsVersion=2024.04.14
# 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.20.4
+minecraft_version=1.20.5
# 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.4,1.21)
+minecraft_version_range=[1.20.5,1.21)
# The Neo version must agree with the Minecraft version to get a valid artifact
-neo_version=20.4.147-beta
+neo_version=20.5.17-beta
# The Neo version range can use any version of Neo as bounds
-neo_version_range=[20.4,)
+neo_version_range=[20.5,)
# The loader version range can only use the major version of FML as bounds
loader_version_range=[2,)
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a80b22c..b82aa23 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/src/main/java/com/example/examplemod/Config.java b/src/main/java/com/example/examplemod/Config.java
index 38dcbcd..b96d525 100644
--- a/src/main/java/com/example/examplemod/Config.java
+++ b/src/main/java/com/example/examplemod/Config.java
@@ -1,20 +1,20 @@
package com.example.examplemod;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.neoforged.bus.api.SubscribeEvent;
-import net.neoforged.fml.common.Mod;
+import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.event.config.ModConfigEvent;
import net.neoforged.neoforge.common.ModConfigSpec;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
// Demonstrates how to use Forge's config APIs
-@Mod.EventBusSubscriber(modid = ExampleMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
+@EventBusSubscriber(modid = ExampleMod.MODID, bus = EventBusSubscriber.Bus.MOD)
public class Config
{
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
diff --git a/src/main/java/com/example/examplemod/ExampleMod.java b/src/main/java/com/example/examplemod/ExampleMod.java
index 9096c03..259b3da 100644
--- a/src/main/java/com/example/examplemod/ExampleMod.java
+++ b/src/main/java/com/example/examplemod/ExampleMod.java
@@ -1,6 +1,9 @@
package com.example.examplemod;
+import org.slf4j.Logger;
+
import com.mojang.logging.LogUtils;
+
import net.minecraft.client.Minecraft;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
@@ -17,7 +20,8 @@ import net.minecraft.world.level.material.MapColor;
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.ModContainer;
+import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
@@ -29,7 +33,6 @@ import net.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredItem;
import net.neoforged.neoforge.registries.DeferredRegister;
-import org.slf4j.Logger;
// The value here should match an entry in the META-INF/mods.toml file
@Mod(ExampleMod.MODID)
@@ -53,7 +56,7 @@ public class ExampleMod
// Creates a new food item with the id "examplemod:example_id", nutrition 1 and saturation 2
public static final DeferredItem<Item> EXAMPLE_ITEM = ITEMS.registerSimpleItem("example_item", new Item.Properties().food(new FoodProperties.Builder()
- .alwaysEat().nutrition(1).saturationMod(2f).build()));
+ .alwaysEdible().nutrition(1).saturationModifier(2f).build()));
// Creates a creative tab with the id "examplemod:example_tab" for the example item, that is placed after the combat tab
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder()
@@ -66,7 +69,7 @@ public class ExampleMod
// The constructor for the mod class is the first code that is run when your mod is loaded.
// FML will recognize some parameter types like IEventBus or ModContainer and pass them in automatically.
- public ExampleMod(IEventBus modEventBus)
+ public ExampleMod(IEventBus modEventBus, ModContainer modContainer)
{
// Register the commonSetup method for modloading
modEventBus.addListener(this::commonSetup);
@@ -87,7 +90,7 @@ public class ExampleMod
modEventBus.addListener(this::addCreative);
// Register our mod's ModConfigSpec so that FML can create and load the config file for us
- ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC);
+ modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
}
private void commonSetup(final FMLCommonSetupEvent event)
@@ -119,7 +122,7 @@ public class ExampleMod
}
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
- @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
+ @EventBusSubscriber(modid = MODID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public static class ClientModEvents
{
@SubscribeEvent