Skip to content

Commit

Permalink
Ported to NF 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
KlemenDEV committed Feb 24, 2024
1 parent eea28ee commit db091a4
Show file tree
Hide file tree
Showing 99 changed files with 1,592 additions and 614 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,5 @@ gradle-app.setting
# End of https://www.gitignore.io/api/java,gradle,intellij

classes/
run/
run/
runs/
1 change: 1 addition & 0 deletions .idea/MCreatorLink.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions .idea/runConfigurations/runClient.xml

This file was deleted.

18 changes: 0 additions & 18 deletions .idea/runConfigurations/runServer.xml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ MCreator Link enables you to connect hardware devices such as Arduino and Raspbe

Setup instructions can be found on the MCreator Link official website: https://mcreator.net/link

![MCreator Link](https://www.pylo.co/static/mcreator/link/demolight.gif?)
![MCreator Link](https://mcreator.net/image/link/tiny.gif)

## Concept

![MCreator Link Concept](https://www.pylo.co/static/mcreator/link/diagramnobg2.png?)
![MCreator Link Concept](https://mcreator.net/image/link/diagramnobg.png)

## Implementations

Expand Down
159 changes: 27 additions & 132 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,160 +1,65 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '[6.0,6.2)', changing: true
classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
}
plugins {
id 'java-library'
id 'net.neoforged.gradle.userdev' version '7.0.94'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'com.github.johnrengelman.shadow'

version = "1.3"
group = "net.mcreator.minecraft.link" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "mcreator_link"

project.tasks.build.dependsOn project.tasks.shadowJar
base.archivesName = "mcreator_link"

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
mappings channel: 'official', version: '1.20.1'

runs {
client {
workingDirectory project.file('run')
jarJar.enable()

property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'

mods {
examplemod {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
runs {
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
systemProperty 'forge.logging.console.level', 'debug'
modSource project.sourceSets.main

mods {
examplemod {
source sourceSets.main
}
}
dependencies {
runtime 'com.fazecast:jSerialComm:2.7.0'
}
}
}

configurations {
shadowpack
implementation.extendsFrom(shadowpack)
client {}
server {}
}

dependencies {
minecraft 'net.minecraftforge:forge:1.20.1-47.0.3'
implementation 'net.neoforged:neoforge:20.4.171'

shadowpack 'com.fazecast:jSerialComm:2.7.0'
implementation 'com.fazecast:jSerialComm:2.7.0'
}

shadowJar {
configurations = [project.configurations.shadowpack]

from('.') {
include 'LICENSE'
include 'NOTICE'
into '/'
}
from('src/main/resources/META-INF/') {
include 'jSerialComm-LICENSE'
include 'jSerialComm-NOTICE'
into '/'
}

exclude "module-info.class"
}

task devJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
dependsOn build

configurations = [project.configurations.shadowpack]

from sourceSets.main.output
from sourceSets.main.allJava

from('.') {
include 'LICENSE'
include 'NOTICE'
into '/'
jarJar(group: 'com.fazecast', name: 'jSerialComm', version: '[2.7,2.8)') {
jarJar.pin(it, '2.7.0')
}

from('src/main/resources/META-INF/') {
include 'jSerialComm-LICENSE'
include 'jSerialComm-NOTICE'
into '/'
}

exclude "module-info.class"
}

reobf {
shadowJar {}
}

javadoc {
source sourceSets.main.allJava
}

task copyModIntoFinalBuild(type: Copy) {
project.afterEvaluate {
dependsOn reobfJar
}
dependsOn build

tasks.register('copyModIntoFinalBuild', Copy) {
from('build/libs/')
include ('mcreator_link-' + version + '-all.jar')
include('mcreator_link-' + version + '-all.jar')
into('build/export/')
rename { "MCreator Link " + project.version + " [1.20.1].jar" }
rename { "MCreator Link " + project.version + " [1.20.4].jar" }
}

task copyDevModIntoFinalBuild(type: Copy) {
dependsOn devJar

from('build/libs/')
include ('mcreator_link-' + version + '.jar')
into('build/export/')
rename { "MCreator Link " + project.version + " [1.20.1] - Dev.jar" }
}
tasks.named('copyModIntoFinalBuild').configure { dependsOn('jarJar') }

task exportArduinoLibrary(type: Zip) {
tasks.register('exportArduinoLibrary', Zip) {
archiveFileName = "MCreator Link " + project.version + " Arduino Library.zip"
destinationDirectory = file('build/export/')
from(files('./arduino'))
}

/*task exportRaspberryPiLibrary(type: Copy) {
from('raspberrypi/build/libs/')
include 'mcreator-link-raspberrypi.jar'
into('build/export/')
rename { "mcreator_link_" + project.version + "_pi.jar" }
}
task exportRaspberryPiSetupScript(type: Copy) {
from('raspberrypi/')
include 'setup.sh'
into('build/export/')
rename { "rpisetup.sh" }
}*/

task exportJavadoc(type: Copy) {
tasks.register('exportJavadoc', Copy) {
from('build/docs/javadoc')
into('docs/')

Expand All @@ -163,19 +68,9 @@ task exportJavadoc(type: Copy) {
group = 'mcreatorlink'
}

task exportAllButDev() {
tasks.register('exportAll') {
group = 'mcreatorlink'

dependsOn copyModIntoFinalBuild
dependsOn exportArduinoLibrary
// dependsOn ':mcreator-link-raspberrypi:build'
// dependsOn exportRaspberryPiLibrary
// dependsOn exportRaspberryPiSetupScript
}

task exportDev() {
group = 'mcreatorlink'

dependsOn devJar
dependsOn copyDevModIntoFinalBuild
}
Loading

0 comments on commit db091a4

Please sign in to comment.