This commit is contained in:
seasnail8169 2021-03-21 17:48:17 +00:00
parent 8565e92526
commit 81df76869f
10 changed files with 45 additions and 63 deletions

View File

@ -1,6 +1,6 @@
# Meteor Addon Template # Meteor Addon Template
A template to allow easy usage of the Meteor Client API. A template to allow easy usage of the Meteor Addon API.
### How to use: ### How to use:
- Clone this project - Clone this project

View File

@ -1,7 +1,6 @@
plugins { plugins {
id 'fabric-loom' version '0.5-SNAPSHOT' id 'fabric-loom' version '0.6-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '6.0.0'
} }
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
@ -16,17 +15,12 @@ repositories {
} }
dependencies { dependencies {
// To change the versions see the gradle.properties file //Minecraft
minecraft "com.mojang:minecraft:${project.minecraft_version}" minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway. //Meteor
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
modImplementation "com.github.MeteorDevelopment:meteor-client:master-SNAPSHOT" modImplementation "com.github.MeteorDevelopment:meteor-client:master-SNAPSHOT"
} }
@ -39,37 +33,27 @@ processResources {
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8" it.options.encoding = "UTF-8"
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
// We'll use that if it's available, but otherwise we'll use the older option.
def targetVersion = 8 def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) { if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion it.options.release = targetVersion
} }
} }
java { java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar() withSourcesJar()
} }
jar { jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
} }
// configure the maven publication
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) { artifact(remapJar) {
builtBy remapJar builtBy remapJar
} }
@ -78,10 +62,4 @@ publishing {
} }
} }
} }
}
// Select the repositories you want to publish to
// To publish to maven local, no extra repositories are necessary. Just use the task `publishToMavenLocal`.
repositories {
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
}
}

View File

@ -1,16 +1,17 @@
# Done to increase the memory available to gradle. # Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx2G
# Fabric Properties # Minecraft
minecraft_version=1.16.5 minecraft_version=1.16.5
# Fabric Properties
fabric_version=0.30.3+1.16
yarn_mappings=1.16.5+build.4 yarn_mappings=1.16.5+build.4
loader_version=0.11.1 loader_version=0.11.1
# Mod Properties # Mod Properties
mod_version = 0.0.1 mod_version = 0.1
maven_group = meteordevelopment.exampleaddon maven_group = meteordevelopment.addons
archives_base_name = example-addon archives_base_name = example
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.30.3+1.16

View File

@ -1,7 +1,7 @@
package meteordevelopment.exampleaddon; package meteordevelopment.addons.example;
import meteordevelopment.exampleaddon.modules.ExampleModule; import meteordevelopment.addons.example.modules.ExampleModule;
import meteordevelopment.exampleaddon.modules.ExampleModule2; import meteordevelopment.addons.example.modules.ExampleModule2;
import minegame159.meteorclient.MeteorAddon; import minegame159.meteorclient.MeteorAddon;
import minegame159.meteorclient.modules.Category; import minegame159.meteorclient.modules.Category;
import minegame159.meteorclient.modules.Modules; import minegame159.meteorclient.modules.Modules;
@ -9,18 +9,20 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public class ExampleAddon extends MeteorAddon { public class ExampleAddon extends MeteorAddon {
public static final Logger LOG = LogManager.getLogger(); public static final Logger LOG = LogManager.getLogger();
public static final Category CATEGORY = new Category("Example"); public static final Category CATEGORY = new Category("Example");
@Override @Override
public void onInitialize() { public void onInitialize() {
LOG.info("Initializing Meteor Addon"); LOG.info("Initializing Meteor Addon");
Modules.get().addModule(new ExampleModule()); Modules.get().add(new ExampleModule());
Modules.get().addModule(new ExampleModule2()); Modules.get().add(new ExampleModule2());
} }
@Override @Override
public void onRegisterCategories() { public void onRegisterCategories() {
Modules.registerCategory(CATEGORY); Modules.registerCategory(CATEGORY);
} }
} }

View File

@ -0,0 +1,12 @@
package meteordevelopment.addons.example.modules;
import meteordevelopment.addons.example.ExampleAddon;
import minegame159.meteorclient.modules.Module;
public class ExampleModule extends Module {
public ExampleModule() {
super(ExampleAddon.CATEGORY, "example", "This is an example module inside a custom category.");
}
}

View File

@ -1,10 +1,12 @@
package meteordevelopment.exampleaddon.modules; package meteordevelopment.addons.example.modules;
import minegame159.meteorclient.modules.Categories; import minegame159.meteorclient.modules.Categories;
import minegame159.meteorclient.modules.Module; import minegame159.meteorclient.modules.Module;
public class ExampleModule2 extends Module { public class ExampleModule2 extends Module {
public ExampleModule2() { public ExampleModule2() {
super(Categories.Player, "example-module-2", "This is an example module that is in an existing category."); super(Categories.Player, "example-2", "This is an example module that is in an existing category.");
} }
} }

View File

@ -1,10 +0,0 @@
package meteordevelopment.exampleaddon.modules;
import meteordevelopment.exampleaddon.ExampleAddon;
import minegame159.meteorclient.modules.Module;
public class ExampleModule extends Module {
public ExampleModule() {
super(ExampleAddon.CATEGORY, "example-module", "This is an example module inside an example category.");
}
}

View File

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 172 KiB

View File

@ -1,9 +1,7 @@
{ {
"required": true, "required": true,
"package": "meteordevelopment.exampleaddon.mixins", "package": "meteordevelopment.addons.example.mixins",
"compatibilityLevel": "JAVA_8", "compatibilityLevel": "JAVA_8",
"mixins": [
],
"client": [ "client": [
], ],
"injectors": { "injectors": {

View File

@ -4,7 +4,7 @@
"version": "${version}", "version": "${version}",
"name": "Example Addon", "name": "Example Addon",
"description": "An addon template for the Meteor Client API.", "description": "An addon template for the Meteor Addon API.",
"authors": [ "authors": [
"seasnail8169" "seasnail8169"
], ],
@ -15,18 +15,17 @@
}, },
"license": "GPL-3.0", "license": "GPL-3.0",
"icon": "assets/example-addon/icon.png", "icon": "assets/example/icon.png",
"environment": "client", "environment": "client",
"entrypoints": { "entrypoints": {
"meteor": [ "meteor": [
"meteordevelopment.exampleaddon.ExampleAddon" "meteordevelopment.addons.example.ExampleAddon"
] ]
}, },
"mixins": [ "mixins": [
"example-addon.mixins.json" "example.mixins.json"
], ],
"depends": { "depends": {
"fabricloader": ">=0.7.4", "fabricloader": ">=0.7.4",
"fabric": "*", "fabric": "*",