Skip to content

Commit

Permalink
Jar shadowing, update mixins json, add mixin plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Drullkus committed Dec 19, 2023
1 parent f2912d4 commit 3efedb7
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 17 deletions.
45 changes: 35 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,42 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.57'
id 'net.neoforged.gradle.userdev' version '7.0.57' // Cannot be .70 or past (for now)
id 'net.neoforged.gradle.mixin' version '7.0.57'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'antlr'
}

version = mod_version
group = mod_group_id

configurations {
shade
}

shadowJar {
archiveClassifier.set('')
configurations = [project.configurations.shade]
}

repositories {
mavenLocal()

maven {
name 'EngineHub Repository'
url 'https://maven.enginehub.org/repo/'
}
}

base {
archivesName = mod_id
}

mixin {
//add(sourceSets.main, "worldedit-neoforge.refmap.json") // Neoforge doesn't need refmapping
config "worldedit-neoforge.mixins.json"
}

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

Expand All @@ -29,7 +50,7 @@ minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/
runs {
// applies to all the run configs below
configureEach {
dependencies {
dependencies { // Requires neogradle version lesser than .70 (for now)
runtime "net.kyori:text-api:${TEXT}"
runtime "net.kyori:text-serializer-gson:${TEXT}"
runtime "net.kyori:text-serializer-legacy:${TEXT}"
Expand Down Expand Up @@ -84,13 +105,6 @@ runs {
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {
maven {
name 'EngineHub Repository'
url 'https://maven.enginehub.org/repo/'
}
}

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.
Expand All @@ -104,10 +118,19 @@ dependencies {
implementation "net.kyori:text-serializer-gson:${TEXT}"
implementation "net.kyori:text-serializer-legacy:${TEXT}"
implementation "net.kyori:text-serializer-plain:${TEXT}"
implementation "com.sk89q.lib:jlibnoise:1.0.0"
implementation "org.enginehub.piston:core:${PISTON}"
implementation "org.enginehub.piston.core-ap:runtime:${PISTON}"
implementation "org.enginehub.piston:default-impl:${PISTON}"

shade "net.kyori:text-api:${TEXT}"
shade "net.kyori:text-serializer-gson:${TEXT}"
shade "net.kyori:text-serializer-legacy:${TEXT}"
shade "net.kyori:text-serializer-plain:${TEXT}"
shade "org.enginehub.piston:core:${PISTON}"
shade "org.enginehub.piston.core-ap:runtime:${PISTON}"
shade "org.enginehub.piston:default-impl:${PISTON}"

implementation "com.sk89q.lib:jlibnoise:1.0.0"
implementation "org.yaml:snakeyaml:2.0"
implementation "org.enginehub.piston.core-ap:annotations:${PISTON}"
implementation "org.enginehub.piston.core-ap:processor:${PISTON}"
Expand Down Expand Up @@ -230,3 +253,5 @@ publishing {
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

build.dependsOn shadowJar
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ minecraft_version=1.20.4
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.42-beta
neo_version=20.4.0-beta
neo_version=20.4.45-beta
# The Neo version range can use any version of Neo as bounds or match the loader version range
neo_version_range=[20.5,)
# The loader version range can only use the major version of Neo/FML as bounds
Expand Down
7 changes: 5 additions & 2 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ WorldEdit is an easy-to-use in-game world editor for Minecraft, supporting both
'''
[[dependencies.worldedit]]
modId="minecraft"
mandatory=true
type="required"
versionRange="[1.20.3,)"
ordering="NONE"
side="BOTH"
[[dependencies.worldedit]]
modId="neoforge"
mandatory=true
type="required"
versionRange="[20.3.1,)"
ordering="NONE"
side="BOTH"

[[mixins]]
config = "worldedit-neoforge.mixins.json"
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"required": true,
"package": "com.sk89q.worldedit.forge.mixin",
"package": "com.sk89q.worldedit.neoforge.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"AccessorServerPlayerGameMode",
"MixinLevelChunkSetBlockHook",
"MixinServerGamePacketListenerImpl"
],
"server": [
],
"injectors": {
"defaultRequire": 1
},
"refmap": "worldedit-forge.mixins.refmap.json"
"refmap": "worldedit-neoforge.refmap.json"
}

0 comments on commit 3efedb7

Please sign in to comment.