mirror of
https://github.com/Lucaslah/WeatherChanger.git
synced 2026-01-09 04:29:26 +00:00
Start on NEXT (version 1.0) branch
- update gradle wrapper version (8.4 to 8.5) - update logo and add banner - change to gradle kotlin DSL (from groovy) - update README.md - update project layout for planned forge support - move common logic to common module - change environment to 'client' to prevent servers from loading the mod (#2) - cleanup unneeded files - update LICENSE.md to use Markdown format for easier reading - update version number to prepare for version 1.0 Signed-off-by: Lucas Petrino <nsx1lucas@gmail.com>
This commit is contained in:
82
fabric/build.gradle.kts
Normal file
82
fabric/build.gradle.kts
Normal file
@@ -0,0 +1,82 @@
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
fabric()
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = project(":common").loom.accessWidenerPath
|
||||
}
|
||||
|
||||
val common: Configuration by configurations.creating
|
||||
val shadowCommon: Configuration by configurations.creating
|
||||
|
||||
configurations {
|
||||
compileOnly.configure { extendsFrom(common) }
|
||||
runtimeOnly.configure { extendsFrom(common) }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("fabric.loader_version")}")
|
||||
modImplementation("net.fabricmc.fabric-api:fabric-api:${rootProject.property("fabric.version")}")
|
||||
|
||||
common(project(":common", "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
|
||||
shadowCommon(project(":common", "transformProductionFabric")){
|
||||
isTransitive = false
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
processResources {
|
||||
inputs.property("version", project.version)
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(mapOf(
|
||||
"version" to project.version,
|
||||
"mod_id" to rootProject.property("mod_id"),
|
||||
"minecraft_version" to rootProject.property("minecraft_version"),
|
||||
"minecraft_base_version" to rootProject.property("minecraft_base"),
|
||||
"fabric_loader_version" to rootProject.property("fabric.loader_version")
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
remapJar {
|
||||
injectAccessWidener.set(true)
|
||||
}
|
||||
|
||||
jar {
|
||||
from("../LICENSE.md")
|
||||
from("../assets/logo.png") {
|
||||
rename { "assets/weatherchanger/icon.png" }
|
||||
}
|
||||
|
||||
dependsOn(":common:transformProductionFabric")
|
||||
|
||||
from({
|
||||
shadowCommon.filter { it.name.endsWith("jar") }.map { zipTree(it) }
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
|
||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||
repositories {
|
||||
// Add repositories to publish to here.
|
||||
// Notice: This block does NOT have the same function as the block in the top level.
|
||||
// The repositories here will be used for publishing your artifact, not for
|
||||
// retrieving dependencies.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package me.lucaslah.weatherchanger.fabric;
|
||||
|
||||
import me.lucaslah.weatherchanger.keybinding.Key;
|
||||
import me.lucaslah.weatherchanger.keybinding.KeybindingManager;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
|
||||
public class FabricKeybindingManager extends KeybindingManager {
|
||||
@Override
|
||||
public void registerKeys() {
|
||||
for (Key key : getEntries()) {
|
||||
KeyBindingHelper.registerKeyBinding(key.getKeyBinding());
|
||||
}
|
||||
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
for (Key key : getEntries()) {
|
||||
if (key.isEnabled() && key.getKeyBinding().wasPressed()) {
|
||||
key.onPress(client);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package me.lucaslah.weatherchanger.fabric;
|
||||
|
||||
import me.lucaslah.weatherchanger.keybinding.KeybindingManager;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class WeatherChangerExpectPlatformImpl {
|
||||
public static Path getConfigDirectory() {
|
||||
return FabricLoader.getInstance().getConfigDir();
|
||||
}
|
||||
|
||||
public static KeybindingManager getKeybindingManager() {
|
||||
return new FabricKeybindingManager();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package me.lucaslah.weatherchanger.fabric;
|
||||
|
||||
import me.lucaslah.weatherchanger.WeatherChanger;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class WeatherChangerFabric implements ClientModInitializer {
|
||||
public static final Logger LOGGER = LogManager.getLogger("weather-changer");
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
WeatherChanger.init();
|
||||
ClientLifecycleEvents.CLIENT_STOPPING.register(client -> WeatherChanger.shutdown());
|
||||
}
|
||||
}
|
||||
31
fabric/src/main/resources/fabric.mod.json
Normal file
31
fabric/src/main/resources/fabric.mod.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "${mod_id}",
|
||||
"version": "${version}",
|
||||
"name": "WeatherChanger",
|
||||
"description": "Client side weather change for Minecraft",
|
||||
"authors": [
|
||||
"Lucaslah"
|
||||
],
|
||||
"contact": {
|
||||
"sources": "https://github.com/Lucaslah/WeatherChanger",
|
||||
"homepage": "https://lucaslah.github.com/WeatherChanger",
|
||||
"issues": "https://github.com/Lucaslah/WeatherChanger/issues"
|
||||
},
|
||||
"license": "LGPL-3.0",
|
||||
"icon": "assets/weatherchanger/icon.png",
|
||||
"environment": "client",
|
||||
"entrypoints": {
|
||||
"client": [
|
||||
"me.lucaslah.weatherchanger.fabric.WeatherChangerFabric"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"weatherchanger.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=${fabric_loader_version}",
|
||||
"fabric": "*",
|
||||
"minecraft": ">=${minecraft_base_version}"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user