mirror of
https://github.com/trafficlunar/options-profiles.git
synced 2026-06-28 06:34:11 +00:00
port to 26.1 part 1
This commit is contained in:
parent
b64f9b6741
commit
3a17ce9f60
33 changed files with 581 additions and 344 deletions
|
|
@ -1,65 +1,49 @@
|
|||
plugins {
|
||||
id 'com.gradleup.shadow'
|
||||
id 'multiloader-loader'
|
||||
id 'net.fabricmc.fabric-loom'
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
fabric()
|
||||
}
|
||||
|
||||
configurations {
|
||||
common {
|
||||
canBeResolved = true
|
||||
canBeConsumed = false
|
||||
}
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentFabric.extendsFrom common
|
||||
|
||||
// Files in this configuration will be bundled into your mod using the Shadow plugin.
|
||||
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
|
||||
shadowBundle {
|
||||
canBeResolved = true
|
||||
canBeConsumed = false
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "Terraformers"
|
||||
url = "https://maven.terraformersmc.com/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
|
||||
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version"
|
||||
|
||||
// Architectury API
|
||||
modImplementation "dev.architectury:architectury-fabric:$rootProject.architectury_api_version"
|
||||
|
||||
// Mod Menu API
|
||||
modImplementation("com.terraformersmc:modmenu:16.0.0-rc.1")
|
||||
|
||||
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||
shadowBundle project(path: ':common', configuration: 'transformProductionFabric')
|
||||
minecraft "com.mojang:minecraft:${minecraft_version}"
|
||||
implementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
||||
implementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property 'version', project.version
|
||||
|
||||
filesMatching('fabric.mod.json') {
|
||||
expand version: project.version
|
||||
loom {
|
||||
def aw = project(':common').file("src/main/resources/${mod_id}.accesswidener")
|
||||
if (aw.exists()) {
|
||||
accessWidenerPath.set(aw)
|
||||
}
|
||||
runs {
|
||||
client {
|
||||
client()
|
||||
setConfigName('Fabric Client')
|
||||
ideConfigGenerated(true)
|
||||
runDir('runs/client')
|
||||
}
|
||||
server {
|
||||
server()
|
||||
setConfigName('Fabric Server')
|
||||
ideConfigGenerated(true)
|
||||
runDir('runs/server')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowBundle]
|
||||
archiveClassifier = 'dev-shadow'
|
||||
// Implement mcgradleconventions loader attribute
|
||||
def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String)
|
||||
['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements', 'includeInternal', 'modCompileClasspath'].each { variant ->
|
||||
configurations.named("$variant") {
|
||||
attributes {
|
||||
attribute(loaderAttribute, 'fabric')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
remapJar {
|
||||
input.set shadowJar.archiveFile
|
||||
sourceSets.configureEach {
|
||||
[it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName].each { variant->
|
||||
configurations.named("$variant") {
|
||||
attributes {
|
||||
attribute(loaderAttribute, 'fabric')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,26 @@
|
|||
package net.trafficlunar.optionsprofiles.fabric;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.trafficlunar.optionsprofiles.Commands;
|
||||
import net.trafficlunar.optionsprofiles.Keybinds;
|
||||
import net.trafficlunar.optionsprofiles.OptionsProfilesMod;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
|
||||
public class OptionsProfilesModFabric implements ModInitializer {
|
||||
public class OptionsProfilesModFabric implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
public void onInitializeClient() {
|
||||
OptionsProfilesMod.init();
|
||||
Keybinds.registerKeybinds(KeyMappingHelper::registerKeyMapping);
|
||||
ClientTickEvents.END_CLIENT_TICK.register(_ -> Keybinds.tick());
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, _, _) -> Commands.registerCommands(dispatcher::register));
|
||||
|
||||
ClientLifecycleEvents.CLIENT_STARTED.register(_ -> OptionsProfilesMod.handleClientLoad());
|
||||
|
||||
ClientPlayConnectionEvents.JOIN.register((listener, sender, client) -> OptionsProfilesMod.handleClientPlayerEvent(client.player, false));
|
||||
ClientPlayConnectionEvents.DISCONNECT.register((listener, client) -> OptionsProfilesMod.handleClientPlayerEvent(client.player, true));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package net.trafficlunar.optionsprofiles.fabric.platform;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.trafficlunar.optionsprofiles.platform.services.IPlatformHelper;
|
||||
|
||||
public class FabricPlatformHelper implements IPlatformHelper {
|
||||
@Override
|
||||
public String getPlatformName() {
|
||||
return "Fabric";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModLoaded(String modId) {
|
||||
return FabricLoader.getInstance().isModLoaded(modId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
net.trafficlunar.optionsprofiles.fabric.platform.FabricPlatformHelper
|
||||
|
|
@ -1,28 +1,29 @@
|
|||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "optionsprofiles",
|
||||
"version": "${version}",
|
||||
"name": "Options Profiles",
|
||||
"description": "Load and save your options from in-game.",
|
||||
"authors": ["trafficlunar"],
|
||||
"id": "${mod_id}",
|
||||
"version": "${mod_version}",
|
||||
"name": "${mod_name}",
|
||||
"description": "${mod_description}",
|
||||
"authors": ["${mod_author}"],
|
||||
"contact": {
|
||||
"homepage": "https://github.com/trafficlunar/options-profiles",
|
||||
"sources": "https://github.com/trafficlunar/options-profiles",
|
||||
"issues": "https://github.com/trafficlunar/options-profiles/issues"
|
||||
},
|
||||
"license": "GNU GPL 3.0",
|
||||
"icon": "assets/optionsprofiles/icon.png",
|
||||
"license": "${license}",
|
||||
"icon": "assets/${mod_id}/icon.png",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": ["net.trafficlunar.optionsprofiles.fabric.OptionsProfilesModFabric"],
|
||||
"modmenu": ["net.trafficlunar.optionsprofiles.fabric.ModMenuApiImpl"]
|
||||
},
|
||||
"mixins": ["optionsprofiles.mixins.json"],
|
||||
"mixins": [
|
||||
"${mod_id}.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.17.2",
|
||||
"minecraft": "~1.21",
|
||||
"java": ">=21",
|
||||
"architectury": ">=18.0.3",
|
||||
"fabric-api": "*"
|
||||
"fabricloader": ">=${fabric_loader_version}",
|
||||
"fabric-api": "*",
|
||||
"minecraft": "~${minecraft_version}",
|
||||
"java": ">=${java_version}"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue