forked from firstdarkdev/fdd-xplat
Initial Commit
This commit is contained in:
36
Forge/build.gradle
Normal file
36
Forge/build.gradle
Normal file
@@ -0,0 +1,36 @@
|
||||
archivesBaseName = "ExampleMod-Forge-${minecraft_version}"
|
||||
|
||||
dependencies {
|
||||
// Add your dependencies here
|
||||
|
||||
// Do not edit or remove
|
||||
implementation project(":Common")
|
||||
}
|
||||
|
||||
/**
|
||||
* ===============================================================================
|
||||
* = DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING =
|
||||
* ===============================================================================
|
||||
*/
|
||||
|
||||
unimined.minecraft {
|
||||
minecraftForge {
|
||||
loader forge_version
|
||||
mixinConfig("${mod_id}.mixins.json", "${mod_id}-forge.mixins.json")
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
from project(":Common").sourceSets.main.resources
|
||||
def buildProps = project.properties.clone()
|
||||
|
||||
filesMatching("META-INF/mods.toml") {
|
||||
expand buildProps
|
||||
}
|
||||
}
|
||||
|
||||
compileTestJava.enabled = false
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
source(project(":Common").sourceSets.main.allSource)
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.author.examplemod;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod(ModConstants.MOD_ID)
|
||||
public class ExampleModForge {
|
||||
|
||||
public ExampleModForge() {
|
||||
ModConstants.LOGGER.info("Hello Forge!");
|
||||
ExampleModCommon.initialize();
|
||||
MinecraftForge.EVENT_BUS.addListener(this::onItemTooltip);
|
||||
}
|
||||
|
||||
private void onItemTooltip(ItemTooltipEvent event) {
|
||||
ExampleModCommon.onItemTooltip(event.getItemStack(), event.getFlags(), event.getToolTip());
|
||||
}
|
||||
}
|
@@ -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 ExampleForgeMixin {
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "init()V")
|
||||
private void init(CallbackInfo ci) {
|
||||
ModConstants.LOGGER.info("This line is printed by a mixin from Forge!");
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.author.examplemod.services;
|
||||
|
||||
import com.author.examplemod.platform.IPlatformHelper;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
|
||||
public class ForgePlatformHelper implements IPlatformHelper {
|
||||
|
||||
@Override
|
||||
public String getPlatformName() {
|
||||
return "Forge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModLoaded(String modId) {
|
||||
return ModList.get().isLoaded(modId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDevelopmentEnvironment() {
|
||||
return !FMLLoader.isProduction();
|
||||
}
|
||||
}
|
35
Forge/src/main/resources/META-INF/mods.toml
Normal file
35
Forge/src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,35 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[48,)"
|
||||
license="MIT"
|
||||
issueTrackerURL="https://github.com/minecraftforge/"
|
||||
|
||||
[[mods]]
|
||||
modId="examplemod"
|
||||
version="${version}"
|
||||
displayName="Example Mod"
|
||||
#updateJSONURL="https://change.me.example.invalid/updates.json"
|
||||
displayURL="https://minecraftforge.net"
|
||||
logoFile="assets/examplemod/icon.png"
|
||||
credits="Thanks for this example mod goes to Java"
|
||||
authors="ExampleAuthor"
|
||||
description='''
|
||||
This is a long form description of the mod. You can write whatever you want here
|
||||
|
||||
Have some lorem ipsum.
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
'''
|
||||
|
||||
[[dependencies.examplemod]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="[48,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.examplemod]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.20.2,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
@@ -0,0 +1 @@
|
||||
com.author.examplemod.services.ForgePlatformHelper
|
16
Forge/src/main/resources/examplemod-forge.mixins.json
Normal file
16
Forge/src/main/resources/examplemod-forge.mixins.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.author.examplemod.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"client.ExampleForgeMixin"
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user