Multi-project

This commit is contained in:
Matthew Messinger 2015-11-17 00:19:58 -05:00
parent f438369f51
commit f0509fbb28
8 changed files with 127 additions and 1 deletions

View file

@ -15,7 +15,38 @@ minecraft {
tweakClass = 'com.mumfrey.liteloader.launch.LiteLoaderTweaker' tweakClass = 'com.mumfrey.liteloader.launch.LiteLoaderTweaker'
replace '@VERSION@',project.version replace '@VERSION@',project.version
} }
project('common') {
apply plugin: 'java'
apply plugin: 'eclipse'
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceSets.main {
compileClasspath += rootProject.configurations.forgeGradleMc
}
eclipse.classpath.file.withXml {
def path = "$gradle.gradleUserHomeDir/caches/minecraft/net/minecraft/minecraft/$minecraft.version/${minecraft.mappings.replace('_','/')}/minecraftSrc-$minecraft.version"
it.asNode().appendNode('classpathentry',[
kind: "lib",
path: "${path}.jar",
sourcepath:"$path-sources.jar"
])
}
}
project('forge') {
apply plugin: 'net.minecraftforge.gradle.forge'
minecraft {
version = '1.8-11.14.3.1543'
mappings = rootProject.minecraft.mappings
runDir = '../run'
replace '@VERSION@',project.version
}
dependencies {
provided project(':common')
}
}
processResources { processResources {
def props = [ def props = [
@ -36,12 +67,16 @@ repositories.flatDir {
dir 'liteloader' dir 'liteloader'
} }
dependencies { dependencies {
compile project('common')
deobfProvided 'com.mumfrey:liteloader:1.8-SNAPSHOT:srgnames' deobfProvided 'com.mumfrey:liteloader:1.8-SNAPSHOT:srgnames'
provided voxellib provided voxellib
} }
jar { jar {
manifest.attributes.remove 'TweakClass' manifest.attributes.remove 'TweakClass'
extension 'litemod' extension 'litemod'
from project('common').sourceSets.main.output
from project('forge').sourceSets.main.output
} }
task standaloneJar(type: Jar, dependsOn: [{voxellib.build}, reobfJar]) { task standaloneJar(type: Jar, dependsOn: [{voxellib.build}, reobfJar]) {
extension 'litemod' extension 'litemod'

View file

@ -0,0 +1,12 @@
package com.brohoof.minelittlepony.common;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
public interface IPonyArmor {
String getArmorTexture(EntityLivingBase e, ItemStack item, String def, int slot, String type);
ModelBase getArmorModel(EntityLivingBase e, ItemStack item, int slot, ModelBase def);
}

View file

@ -0,0 +1,16 @@
package com.brohoof.minelittlepony.common;
public abstract class MLPCommonProxy {
private static MLPCommonProxy instance;
public static MLPCommonProxy getInstance() {
return instance;
}
public MLPCommonProxy() {
instance = this;
}
public abstract void setPonyArmors(IPonyArmor armors);
}

View file

@ -0,0 +1,14 @@
package com.brohoof.minelittlepony.forge;
import com.brohoof.minelittlepony.common.MLPCommonProxy;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
@Mod(modid = "minelp_forge", name = "Mine Little Pony Forge Hooks", version = "1.8")
public class MLPForge {
public void init(FMLPostInitializationEvent init) {
MLPCommonProxy.getInstance().setPonyArmors(new PonyArmors());
}
}

View file

@ -0,0 +1,23 @@
package com.brohoof.minelittlepony.forge;
import com.brohoof.minelittlepony.common.IPonyArmor;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
public class PonyArmors implements IPonyArmor {
@Override
public String getArmorTexture(EntityLivingBase entity, ItemStack armor, String def, int slot, String type) {
String result = armor.getItem().getArmorTexture(armor, entity, slot, type);
return result == null ? def : result;
}
@Override
public ModelBase getArmorModel(EntityLivingBase entity, ItemStack item, int slot, ModelBase def) {
ModelBase result = item.getItem().getArmorModel(entity, item, slot);
return result == null ? def : result;
}
}

View file

@ -1 +1,3 @@
include ':voxellib' rootProject.name = 'MineLittlePony'
include 'voxellib', 'common', 'forge'

View file

@ -43,6 +43,7 @@ public class MineLittlePony implements InitCompleteListener {
private PonyConfig config; private PonyConfig config;
private PonyManager ponyManager; private PonyManager ponyManager;
private ProxyContainer proxy;
public MineLittlePony() { public MineLittlePony() {
instance = this; instance = this;
@ -75,6 +76,7 @@ public class MineLittlePony implements InitCompleteListener {
this.config = new PonyConfig(); this.config = new PonyConfig();
this.ponyManager = new PonyManager(config); this.ponyManager = new PonyManager(config);
this.proxy = new ProxyContainer();
LiteLoader.getInstance().registerExposable(config, null); LiteLoader.getInstance().registerExposable(config, null);
} }
@ -130,6 +132,10 @@ public class MineLittlePony implements InitCompleteListener {
return this.ponyManager; return this.ponyManager;
} }
public static ProxyContainer getProxy() {
return getInstance().proxy;
}
public static PonyConfig getConfig() { public static PonyConfig getConfig() {
return getInstance().config; return getInstance().config;
} }

View file

@ -0,0 +1,18 @@
package com.brohoof.minelittlepony;
import com.brohoof.minelittlepony.common.IPonyArmor;
import com.brohoof.minelittlepony.common.MLPCommonProxy;
public class ProxyContainer extends MLPCommonProxy {
private IPonyArmor ponyArmors;
@Override
public void setPonyArmors(IPonyArmor armors) {
this.ponyArmors = armors;
}
public IPonyArmor getPonyArmors() {
return ponyArmors;
}
}