1
0

Initial Commit

This commit is contained in:
2023-06-11 13:26:01 +02:00
commit 43bcd45b00
32 changed files with 1189 additions and 0 deletions

52
Fabric/build.gradle Normal file
View File

@@ -0,0 +1,52 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'idea'
}
archivesBaseName = "${mod_id}-fabric-${minecraft_version}"
dependencies {
// Core
minecraft "com.mojang:minecraft:${minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
implementation project(path: ':Common', configuration: 'namedElements')
// Add your deps here
}
loom {
shareCaches()
runs {
client {
client()
setConfigName("Fabric Client")
ideConfigGenerated(true)
runDir("run")
}
server {
server()
setConfigName("Fabric Server")
ideConfigGenerated(true)
runDir("run")
}
}
}
processResources {
from project(':Common').sourceSets.main.resources
inputs.property 'version', project.version
filesMatching('fabric.mod.json') {
expand 'version': project.version
}
filesMatching("${mod_id}.mixins.json") {
expand "refmap_target": "${archivesBaseName}-"
}
}
tasks.withType(JavaCompile) {
source(project(':Common').sourceSets.main.allSource)
}

View File

@@ -0,0 +1,14 @@
package com.example.examplemod;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback;
public class ExampleModFabric implements ModInitializer {
@Override
public void onInitialize() {
ModConstants.LOGGER.info("Hello Fabric!");
ExampleMod.initialize();
ItemTooltipCallback.EVENT.register(ExampleMod::onItemTooltip);
}
}

View File

@@ -0,0 +1,18 @@
package com.example.examplemod.mixin.client;
import com.example.examplemod.ModConstants;
import net.minecraft.client.gui.screens.TitleScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(TitleScreen.class)
public class ExampleFabricMixin {
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo ci) {
ModConstants.LOGGER.info("This line is printed by a mixin from Fabric!");
}
}

View File

@@ -0,0 +1,21 @@
package com.example.examplemod.platform;
import net.fabricmc.loader.api.FabricLoader;
public class FabricPlatformHelper implements IPlatformHelper {
@Override
public String getPlatformName() {
return "Fabric";
}
@Override
public boolean isModLoaded(String modId) {
return FabricLoader.getInstance().isModLoaded(modId);
}
@Override
public boolean isDevelopmentEnvironment() {
return FabricLoader.getInstance().isDevelopmentEnvironment();
}
}

View File

@@ -0,0 +1 @@
com.example.examplemod.platform.FabricPlatformHelper

View File

@@ -0,0 +1,16 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.example.examplemod.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
"client.ExampleFabricMixin"
],
"server": [
],
"injectors": {
"defaultRequire": 1
}
}

View File

@@ -0,0 +1,32 @@
{
"schemaVersion": 1,
"id": "examplemod",
"version": "${version}",
"name": "Example Mod",
"description": "This is an example description! Tell everyone what your mod is about!",
"authors": [
"ExampleAuthor"
],
"contact": {
"homepage": "https://fabricmc.net/",
"sources": "https://github.com/fabricmc/"
},
"license": "MIT",
"icon": "assets/examplemod/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"com.example.examplemod.ExampleModFabric"
]
},
"mixins": [
"examplemod.mixins.json",
"examplemod-fabric.mixins.json"
],
"depends": {
"fabricloader": ">=0.14",
"fabric": "*",
"minecraft": "1.20.x",
"java": ">=17"
}
}