mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Multi-project
This commit is contained in:
parent
f438369f51
commit
f0509fbb28
8 changed files with 127 additions and 1 deletions
35
build.gradle
35
build.gradle
|
@ -15,7 +15,38 @@ minecraft {
|
|||
tweakClass = 'com.mumfrey.liteloader.launch.LiteLoaderTweaker'
|
||||
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 {
|
||||
def props = [
|
||||
|
@ -36,12 +67,16 @@ repositories.flatDir {
|
|||
dir 'liteloader'
|
||||
}
|
||||
dependencies {
|
||||
compile project('common')
|
||||
deobfProvided 'com.mumfrey:liteloader:1.8-SNAPSHOT:srgnames'
|
||||
provided voxellib
|
||||
}
|
||||
jar {
|
||||
manifest.attributes.remove 'TweakClass'
|
||||
|
||||
extension 'litemod'
|
||||
from project('common').sourceSets.main.output
|
||||
from project('forge').sourceSets.main.output
|
||||
}
|
||||
task standaloneJar(type: Jar, dependsOn: [{voxellib.build}, reobfJar]) {
|
||||
extension 'litemod'
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1 +1,3 @@
|
|||
include ':voxellib'
|
||||
rootProject.name = 'MineLittlePony'
|
||||
|
||||
include 'voxellib', 'common', 'forge'
|
||||
|
|
|
@ -43,6 +43,7 @@ public class MineLittlePony implements InitCompleteListener {
|
|||
|
||||
private PonyConfig config;
|
||||
private PonyManager ponyManager;
|
||||
private ProxyContainer proxy;
|
||||
|
||||
public MineLittlePony() {
|
||||
instance = this;
|
||||
|
@ -75,6 +76,7 @@ public class MineLittlePony implements InitCompleteListener {
|
|||
|
||||
this.config = new PonyConfig();
|
||||
this.ponyManager = new PonyManager(config);
|
||||
this.proxy = new ProxyContainer();
|
||||
|
||||
LiteLoader.getInstance().registerExposable(config, null);
|
||||
}
|
||||
|
@ -130,6 +132,10 @@ public class MineLittlePony implements InitCompleteListener {
|
|||
return this.ponyManager;
|
||||
}
|
||||
|
||||
public static ProxyContainer getProxy() {
|
||||
return getInstance().proxy;
|
||||
}
|
||||
|
||||
public static PonyConfig getConfig() {
|
||||
return getInstance().config;
|
||||
}
|
||||
|
|
18
src/main/java/com/brohoof/minelittlepony/ProxyContainer.java
Normal file
18
src/main/java/com/brohoof/minelittlepony/ProxyContainer.java
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue