Unverified Commit 91133dbd by modmuss Committed by GitHub

Update to 1.20

Now uses split-sourceset's
parent 38f93b4e
...@@ -6,6 +6,10 @@ plugins { ...@@ -6,6 +6,10 @@ plugins {
version = project.mod_version version = project.mod_version
group = project.maven_group group = project.maven_group
base {
archivesName = project.archives_base_name
}
repositories { repositories {
// Add repositories to retrieve artifacts from in here. // Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because // You should only use this when depending on other mods because
...@@ -14,6 +18,18 @@ repositories { ...@@ -14,6 +18,18 @@ repositories {
// for more information about repositories. // for more information about repositories.
} }
loom {
splitEnvironmentSourceSets()
mods {
"modid" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}
dependencies { dependencies {
// To change the versions see the gradle.properties file // To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
...@@ -29,10 +45,6 @@ dependencies { ...@@ -29,10 +45,6 @@ dependencies {
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
} }
base {
archivesName = project.archives_base_name
}
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
...@@ -42,7 +54,6 @@ processResources { ...@@ -42,7 +54,6 @@ processResources {
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17 it.options.release = 17
} }
...@@ -58,7 +69,7 @@ java { ...@@ -58,7 +69,7 @@ java {
jar { jar {
from("LICENSE") { from("LICENSE") {
rename { "${it}_${base.archivesName.get()}"} rename { "${it}_${project.archivesBaseName}"}
} }
} }
......
...@@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G ...@@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true org.gradle.parallel=true
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.19.4 minecraft_version=1.20
yarn_mappings=1.19.4+build.2 yarn_mappings=1.20+build.1
loader_version=0.14.19 loader_version=0.14.21
# Mod Properties # Mod Properties
mod_version = 1.0.0 mod_version=1.0.0
maven_group = com.example maven_group=com.example
archives_base_name = fabric-example-mod archives_base_name=modid
# Dependencies # Dependencies
fabric_version=0.79.0+1.19.4 fabric_version=0.83.0+1.20
\ No newline at end of file
package com.example;
import net.fabricmc.api.ClientModInitializer;
public class ExampleModClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
}
}
\ No newline at end of file
package com.example.mixin.client;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(MinecraftClient.class)
public class ExampleClientMixin {
@Inject(at = @At("HEAD"), method = "run")
private void run(CallbackInfo info) {
// This code is injected into the start of MinecraftClient.run()V
}
}
\ No newline at end of file
{
"required": true,
"package": "com.example.mixin.client",
"compatibilityLevel": "JAVA_17",
"client": [
"ExampleClientMixin"
],
"injectors": {
"defaultRequire": 1
}
}
\ No newline at end of file
package net.fabricmc.example; package com.example;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
......
package net.fabricmc.example.mixin; package com.example.mixin;
import net.fabricmc.example.ExampleMod; import net.minecraft.server.MinecraftServer;
import net.minecraft.client.gui.screen.TitleScreen;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(TitleScreen.class) @Mixin(MinecraftServer.class)
public class ExampleMixin { public class ExampleMixin {
@Inject(at = @At("HEAD"), method = "init()V") @Inject(at = @At("HEAD"), method = "loadWorld")
private void init(CallbackInfo info) { private void init(CallbackInfo info) {
ExampleMod.LOGGER.info("This line is printed by an example mod mixin!"); // This code is injected into the start of MinecraftServer.loadWorld()V
} }
} }
\ No newline at end of file
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
"schemaVersion": 1, "schemaVersion": 1,
"id": "modid", "id": "modid",
"version": "${version}", "version": "${version}",
"name": "Example mod",
"name": "Example Mod",
"description": "This is an example description! Tell everyone what your mod is about!", "description": "This is an example description! Tell everyone what your mod is about!",
"authors": [ "authors": [
"Me!" "Me!"
...@@ -12,25 +11,29 @@ ...@@ -12,25 +11,29 @@
"homepage": "https://fabricmc.net/", "homepage": "https://fabricmc.net/",
"sources": "https://github.com/FabricMC/fabric-example-mod" "sources": "https://github.com/FabricMC/fabric-example-mod"
}, },
"license": "CC0-1.0", "license": "CC0-1.0",
"icon": "assets/modid/icon.png", "icon": "assets/modid/icon.png",
"environment": "*", "environment": "*",
"entrypoints": { "entrypoints": {
"main": [ "main": [
"net.fabricmc.example.ExampleMod" "com.example.ExampleMod"
],
"client": [
"com.example.ExampleModClient"
] ]
}, },
"mixins": [ "mixins": [
"modid.mixins.json" "modid.mixins.json",
{
"config": "modid.client.mixins.json",
"environment": "client"
}
], ],
"depends": { "depends": {
"fabricloader": ">=0.14.19", "fabricloader": ">=0.14.21",
"fabric-api": "*", "minecraft": "~1.20",
"minecraft": "~1.19.4", "java": ">=17",
"java": ">=17" "fabric-api": "*"
}, },
"suggests": { "suggests": {
"another-mod": "*" "another-mod": "*"
......
{ {
"required": true, "required": true,
"minVersion": "0.8", "package": "com.example.mixin",
"package": "net.fabricmc.example.mixin",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_17",
"mixins": [ "mixins": [
],
"client": [
"ExampleMixin" "ExampleMixin"
], ],
"injectors": { "injectors": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment