Last active
October 8, 2016 14:46
-
-
Save matshou/a171a54b0b1300bde5a4f8691c2d997a to your computer and use it in GitHub Desktop.
Mod framework for Minecraft 1.10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<projectDescription> | |
<name>Generic-Mod</name> | |
<comment>Project Generic-Mod created by Buildship.</comment> | |
<projects> | |
</projects> | |
<buildSpec> | |
<buildCommand> | |
<name>org.eclipse.jdt.core.javabuilder</name> | |
<arguments> | |
</arguments> | |
</buildCommand> | |
<buildCommand> | |
<name>org.eclipse.buildship.core.gradleprojectbuilder</name> | |
<arguments> | |
</arguments> | |
</buildCommand> | |
</buildSpec> | |
<natures> | |
<nature>org.eclipse.buildship.core.gradleprojectnature</nature> | |
<nature>org.eclipse.jdt.core.javanature</nature> | |
</natures> | |
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For those who want the bleeding edge | |
buildscript { | |
repositories { | |
jcenter() | |
maven { | |
name = "forge" | |
url = "http://files.minecraftforge.net/maven" | |
} | |
} | |
dependencies { | |
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' | |
} | |
} | |
apply plugin: 'net.minecraftforge.gradle.forge' | |
/* | |
// for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot | |
plugins { | |
id "net.minecraftforge.gradle.forge" version "2.0.2" | |
} | |
*/ | |
version = "1.0.0" | |
group= "com.user.genericmod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html | |
archivesBaseName = "genericmod" | |
minecraft { | |
version = "1.10.2-12.18.1.2011" | |
runDir = "run" | |
// the mappings can be changed at any time, and must be in the following format. | |
// snapshot_YYYYMMDD snapshot are built nightly. | |
// stable_# stables are built at the discretion of the MCP team. | |
// Use non-default mappings at your own risk. they may not allways work. | |
// simply re-run your setup task after changing the mappings to update your workspace. | |
mappings = "snapshot_20160518" | |
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. | |
} | |
dependencies { | |
// you may put jars on which you depend on in ./libs | |
// or you may define them like so.. | |
//compile "some.group:artifact:version:classifier" | |
//compile "some.group:artifact:version" | |
// real examples | |
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env | |
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env | |
// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. | |
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' | |
// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, | |
// except that these dependencies get remapped to your current MCP mappings | |
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' | |
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' | |
// for more info... | |
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html | |
// http://www.gradle.org/docs/current/userguide/dependency_management.html | |
} | |
processResources | |
{ | |
// this will ensure that this task is redone when the versions change. | |
inputs.property "version", project.version | |
inputs.property "mcversion", project.minecraft.version | |
// replace stuff in mcmod.info, nothing else | |
from(sourceSets.main.resources.srcDirs) { | |
include 'mcmod.info' | |
// replace version and mcversion | |
expand 'version':project.version, 'mcversion':project.minecraft.version | |
} | |
// copy everything else, thats not the mcmod.info | |
from(sourceSets.main.resources.srcDirs) { | |
exclude 'mcmod.info' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.user.genericmod.common; | |
import net.minecraftforge.fml.common.event.FMLInitializationEvent; | |
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; | |
public class CommonProxy | |
{ | |
/** Called by {@link GenericMod#preInit } in the preInit phase of mod loading. */ | |
public void preInit(FMLPreInitializationEvent event) | |
{ | |
// Read your config, create blocks, items, etc, and register them with the GameRegistry. | |
} | |
/** Called by {@link GenericMod#init } in the init phase of mod loading. */ | |
public void init(FMLInitializationEvent event) | |
{ | |
// Build whatever data structures you care about. Register recipes. | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.user.genericmod.common; | |
import org.apache.logging.log4j.LogManager; | |
import org.apache.logging.log4j.Logger; | |
import net.minecraftforge.fml.common.event.FMLInitializationEvent; | |
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; | |
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; | |
import net.minecraftforge.fml.common.SidedProxy; | |
import net.minecraftforge.fml.common.Mod; | |
import net.minecraftforge.fml.relauncher.Side; | |
import net.minecraftforge.fml.relauncher.SideOnly; | |
@Mod(modid = GenericMod.MODID, version = GenericMod.VERSION, name= GenericMod.NAME, acceptedMinecraftVersions = "[1.10,1.10.2]") | |
public class GenericMod | |
{ | |
public static final String MODID = "genericmod"; | |
public static final String NAME = "Generic Mod"; | |
public static final String VERSION = "1.0.0"; | |
// Use this thing to print in the console: | |
public static final Logger logger = LogManager.getLogger(MODID); | |
/** The instance of our mod that Forge uses. */ | |
@Mod.Instance(MODID) | |
public static GenericMod instance; | |
public static CommonProxy proxy = new CommonProxy(); | |
/** Run before anything else. Read your config, create blocks, items, etc, and register them with the GameRegistry. */ | |
@Mod.EventHandler | |
public void preInit(FMLPreInitializationEvent event) | |
{ | |
proxy.preInit(event); | |
} | |
/** Do your mod setup. Build whatever data structures you care about. Register recipes. */ | |
@Mod.EventHandler | |
public void init(FMLInitializationEvent event) | |
{ | |
proxy.init(event); | |
} | |
/** Handle interaction with other mods, register event handlers, complete your setup based on this. */ | |
@Mod.EventHandler | |
public void postInit(FMLPostInitializationEvent event) | |
{ | |
// Register event handler here. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment