Initial Commit

This commit is contained in:
2023-11-06 23:25:17 +02:00
commit 8481afa16d
30 changed files with 961 additions and 0 deletions

38
Fabric/build.gradle Normal file
View File

@@ -0,0 +1,38 @@
archivesBaseName = "ExampleMod-Fabric-${minecraft_version}"
dependencies {
// Add your own dependencies here
// Fabric API. Can be removed if not needed
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api}"
// Do not remove or edit!
implementation(project(":Common"))
}
/**
* ===============================================================================
* = DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING =
* ===============================================================================
*/
unimined.minecraft {
fabric {
loader fabric_loader
}
}
processResources {
from project(":Common").sourceSets.main.resources
def buildProps = project.properties.clone()
filesMatching(['fabric.mod.json']) {
expand buildProps
}
}
compileTestJava.enabled = false
tasks.withType(JavaCompile).configureEach {
source(project(":Common").sourceSets.main.allSource)
}

View File

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

View File

@@ -0,0 +1,18 @@
package com.author.examplemod.mixin.client;
import com.author.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.author.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.author.examplemod.platform.FabricPlatformHelper

View File

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

View File

@@ -0,0 +1,32 @@
{
"schemaVersion": 1,
"id": "${mod_id}",
"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.author.examplemod.ExampleFabricMod"
]
},
"mixins": [
"examplemod.mixins.json",
"examplemod-fabric.mixins.json"
],
"depends": {
"fabricloader": ">=0.14",
"fabric": "*",
"minecraft": "1.20.x",
"java": ">=17"
}
}