Skip to content

Commit

Permalink
Merge pull request #1 from Erdragh/chore/update-1.20.5
Browse files Browse the repository at this point in the history
Update to 1.20.5
  • Loading branch information
Erdragh authored Apr 29, 2024
2 parents 202d7d2 + 5f79d1e commit 305cba8
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:

dependencies:
runs-on: ubuntu-latest
if: ${{github.ref == 'refs/heads/main' && github.event_name != 'pull_request'}}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -33,5 +34,4 @@ jobs:
fetch-tags: true

- name: Submit dependencies
if: ${{github.ref == 'refs/heads/main' && github.event_name != 'pull_request'}}
uses: gradle/actions/dependency-submission@v3
28 changes: 19 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.utils.extendsFrom
import java.util.Properties

plugins {
Expand All @@ -6,11 +7,11 @@ 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"
// Kotlin Dependencies
kotlin("jvm") version "1.9.22"
kotlin("jvm") version "1.9.23"
// OPTIONAL:
// kotlin("plugin.serialization") version "1.9.22"
// kotlin("plugin.serialization") version "1.9.23"
}

val mod_version: String by project
Expand All @@ -32,8 +33,8 @@ base {
archivesName.set(mod_id)
}

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
java.toolchain.languageVersion.set(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
Expand Down Expand Up @@ -91,6 +92,14 @@ sourceSets {
}
}

// 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 {
register("localRuntime")
runtimeClasspath.extendsFrom(named("localRuntime"))
}

dependencies {
val neo_version: String by project
Expand All @@ -106,12 +115,13 @@ dependencies {
val kff_version: String by project
implementation("thedarkcolour:kotlinforforge-neoforge:$kff_version")

// Example mod dependency with JEI
// Example optional mod dependency with JEI
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// val jei_vesion: String by project
// compileOnly("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
// compileOnly("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}")
// runtimeOnly("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")
// compileOnly("mezz.jei:jei-${minecraft_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-${minecraft_version}-neoforge:${jei_version}")

// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${minecraft_version}-${coolmod_version}.jar
Expand Down Expand Up @@ -141,7 +151,7 @@ tasks.withType<ProcessResources>().configureEach {

inputs.properties(loadedProperties)

filesMatching("META-INF/mods.toml") {
filesMatching("META-INF/neoforge.mods.toml") {
expand(loadedProperties)
}
}
Expand Down
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ 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,)
# Mods using Kotlin entrypoints use KFF as a loader, which has different versioning
kff_version=4.10.0
kff_version_range=[4.10,)
kff_version=5.0.1
kff_version_range=[5,)

## Mod Properties

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/example/examplemod/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ 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.EventBusSubscriber
import net.neoforged.fml.common.EventBusSubscriber
import net.neoforged.fml.event.config.ModConfigEvent
import net.neoforged.neoforge.common.ModConfigSpec
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
// Demonstrates how to use Neo's config APIs
@EventBusSubscriber(modid = ExampleMod.MODID, bus = EventBusSubscriber.Bus.MOD)
object Config {
private val BUILDER = ModConfigSpec.Builder()
Expand Down
12 changes: 6 additions & 6 deletions src/main/kotlin/com/example/examplemod/ExampleMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ 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.Mod
import net.neoforged.fml.common.Mod.EventBusSubscriber
import net.neoforged.fml.common.EventBusSubscriber
import net.neoforged.fml.config.ModConfig
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent
Expand All @@ -32,9 +32,9 @@ import net.neoforged.neoforge.registries.DeferredHolder
import net.neoforged.neoforge.registries.DeferredItem
import net.neoforged.neoforge.registries.DeferredRegister

// The value here should match an entry in the META-INF/mods.toml file
// The value here should match an entry in the META-INF/neoforge.mods.toml file
@Mod(ExampleMod.MODID)
class ExampleMod(modEventBus: IEventBus) {
class ExampleMod(modEventBus: IEventBus, modContainer: ModContainer) {
companion object {
// Define mod id in a common place for everything to reference
const val MODID = "examplemod"
Expand Down Expand Up @@ -65,7 +65,7 @@ class ExampleMod(modEventBus: IEventBus) {
val EXAMPLE_ITEM: DeferredItem<Item> = ITEMS.registerSimpleItem(
"example_item", Item.Properties().food(
FoodProperties.Builder()
.alwaysEat().nutrition(1).saturationMod(2f).build()
.alwaysEdible().nutrition(1).saturationModifier(2f).build()
)
)

Expand Down Expand Up @@ -104,7 +104,7 @@ class ExampleMod(modEventBus: IEventBus) {
CREATIVE_MODE_TABS.register(modEventBus)
NeoForge.EVENT_BUS.register(this)
modEventBus.addListener(this::addCreative)
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC)
modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC)
}

private fun commonSetup(event: FMLCommonSetupEvent) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# This is an example neoforge.mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
Expand Down

0 comments on commit 305cba8

Please sign in to comment.