mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-24 22:04:23 +00:00
Java 8 finnally
This commit is contained in:
1 parent
40ec1f65c2
commit
4d684bf274
7 files changed
+66
-33
No files matched your search
@@ -5,8 +5,8 @@ apply plugin: 'maven'
|
||||
|
||||
version = ext.mineTweakerVersion
|
||||
|
||||
sourceCompatibility = '1.6'
|
||||
targetCompatibility = '1.6'
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
task makeRegistry(type: RegisterZenClassesTask) {
|
||||
inputDir = file('build/classes/main')
|
||||
|
||||
@@ -70,12 +70,12 @@ public class MineTweakerAPI {
|
||||
};
|
||||
|
||||
static {
|
||||
List<Class> apiClasses = new ArrayList<Class>();
|
||||
ClassRegistry.getClasses(apiClasses);
|
||||
|
||||
for (Class cls : apiClasses) {
|
||||
registerClass(cls);
|
||||
}
|
||||
// List<Class> apiClasses = new ArrayList<Class>();
|
||||
// ClassRegistry.getClasses(apiClasses);
|
||||
//
|
||||
// for (Class cls : apiClasses) {
|
||||
// registerClass(cls);
|
||||
// }
|
||||
|
||||
registerGlobalSymbol("logger", getJavaStaticGetterSymbol(MineTweakerAPI.class, "getLogger"));
|
||||
registerGlobalSymbol("recipes", getJavaStaticFieldSymbol(MineTweakerAPI.class, "recipes"));
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import minetweaker.tasks.RegisterZenClassesTask;
|
||||
|
||||
|
||||
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
@@ -15,6 +18,9 @@ buildscript {
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'maven'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
version = "1.10.2-" + ext.mineTweakerVersion
|
||||
archivesBaseName = project.projectDir.name
|
||||
|
||||
@@ -87,4 +93,4 @@ uploadArchives {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ package minetweaker.mc1102;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.MineTweakerImplementationAPI;
|
||||
import minetweaker.annotations.BracketHandler;
|
||||
import minetweaker.api.logger.FileLogger;
|
||||
import minetweaker.mc1102.brackets.ItemBracketHandler;
|
||||
import minetweaker.mc1102.brackets.LiquidBracketHandler;
|
||||
@@ -41,10 +42,16 @@ import net.minecraftforge.fml.common.event.*;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenExpansion;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static minetweaker.MineTweakerAPI.registerClass;
|
||||
|
||||
/**
|
||||
* Main mod class. Performs some general logic, initialization of the API and
|
||||
@@ -82,7 +89,7 @@ public class MineTweakerMod {
|
||||
MineTweakerImplementationAPI.platform = MCPlatformFunctions.INSTANCE;
|
||||
|
||||
File globalDir = new File("scripts");
|
||||
if (!globalDir.exists())
|
||||
if(!globalDir.exists())
|
||||
globalDir.mkdirs();
|
||||
scriptsIMC = new ScriptProviderCustom("intermod");
|
||||
scriptsGlobal = new ScriptProviderDirectory(globalDir);
|
||||
@@ -95,11 +102,11 @@ public class MineTweakerMod {
|
||||
|
||||
@EventHandler
|
||||
public void onIMCEvent(FMLInterModComms.IMCEvent event) {
|
||||
for (final FMLInterModComms.IMCMessage imcMessage : event.getMessages()) {
|
||||
if (imcMessage.key.equalsIgnoreCase("addMineTweakerScript")) {
|
||||
if (imcMessage.isStringMessage()) {
|
||||
for(final FMLInterModComms.IMCMessage imcMessage : event.getMessages()) {
|
||||
if(imcMessage.key.equalsIgnoreCase("addMineTweakerScript")) {
|
||||
if(imcMessage.isStringMessage()) {
|
||||
scriptsIMC.add(imcMessage.getSender() + "::imc", imcMessage.getStringValue());
|
||||
} else if (imcMessage.isNBTMessage()) {
|
||||
} else if(imcMessage.isNBTMessage()) {
|
||||
NBTTagCompound message = imcMessage.getNBTValue();
|
||||
scriptsIMC.add(imcMessage.getSender() + "::" + message.getString("name"), message.getString("content"));
|
||||
}
|
||||
@@ -111,14 +118,24 @@ public class MineTweakerMod {
|
||||
public void onLoad(FMLPreInitializationEvent ev) {
|
||||
MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
|
||||
FMLCommonHandler.instance().bus().register(new FMLEventHandler());
|
||||
// for (ASMDataTable.ASMData data : ev.getAsmData().getAll(ZenExpansion.class.getCanonicalName())) {
|
||||
// try {
|
||||
// Class<?> asmClass = Class.forName(data.getClassName());
|
||||
// MineTweakerAPI.registerClass(asmClass);
|
||||
// } catch (ClassNotFoundException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
List<Class> apiClasses = new ArrayList<Class>();
|
||||
String[] classNames = new String[]{ZenExpansion.class.getCanonicalName(), ZenClass.class.getCanonicalName(), BracketHandler.class.getCanonicalName()};
|
||||
for(String name : classNames) {
|
||||
ev.getAsmData().getAll(name).forEach(clazz -> {
|
||||
|
||||
try {
|
||||
Class<?> asmClass = Class.forName(clazz.getClassName());
|
||||
apiClasses.add(asmClass);
|
||||
} catch(ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ClassRegistry.getClasses(apiClasses);
|
||||
for(Class cls : apiClasses) {
|
||||
registerClass(cls);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -126,22 +143,22 @@ public class MineTweakerMod {
|
||||
public void onPostInit(FMLPostInitializationEvent ev) {
|
||||
MineTweakerAPI.registerClassRegistry(MineTweakerRegistry.class);
|
||||
|
||||
for (int i = 0; i < REGISTRIES.length; i++) {
|
||||
for(int i = 0; i < REGISTRIES.length; i++) {
|
||||
MineTweakerAPI.registerClassRegistry(REGISTRIES[i], REGISTRY_DESCRIPTIONS[i]);
|
||||
}
|
||||
|
||||
FuelTweaker.INSTANCE.register();
|
||||
if (Loader.isModLoaded("JEI")) {
|
||||
if(Loader.isModLoaded("JEI")) {
|
||||
try {
|
||||
Method register = Class.forName("minetweaker.mods.jei.JEI").getMethod("onRegister");
|
||||
register.invoke(null);
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch(NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch(ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
} catch(InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch(IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -170,12 +187,12 @@ public class MineTweakerMod {
|
||||
// starts before loading worlds
|
||||
// perfect place to start MineTweaker!
|
||||
|
||||
if (MineTweakerPlatformUtils.isClient()) {
|
||||
if(MineTweakerPlatformUtils.isClient()) {
|
||||
MineTweakerAPI.client = new MCClient();
|
||||
}
|
||||
|
||||
File scriptsDir = new File(MineTweakerHacks.getWorldDirectory(ev.getServer()), "scripts");
|
||||
if (!scriptsDir.exists()) {
|
||||
if(!scriptsDir.exists()) {
|
||||
scriptsDir.mkdir();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import minetweaker.tasks.RegisterZenClassesTask;
|
||||
|
||||
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -19,6 +21,9 @@ buildscript {
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
version = "1.10.2-" + ext.mineTweakerVersion
|
||||
archivesBaseName = project.projectDir.name
|
||||
|
||||
@@ -42,4 +47,4 @@ task makeRegistry(type: RegisterZenClassesTask) {
|
||||
className = 'minetweaker.mods.ic2.ClassRegistry'
|
||||
}
|
||||
|
||||
tasks.jar.dependsOn(makeRegistry)
|
||||
tasks.jar.dependsOn(makeRegistry)
|
||||
@@ -1,5 +1,7 @@
|
||||
import minetweaker.tasks.RegisterZenClassesTask;
|
||||
|
||||
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -19,6 +21,9 @@ buildscript {
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
version = "1.10.2-" + ext.mineTweakerVersion
|
||||
archivesBaseName = project.projectDir.name
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
|
||||
version = ext.mineTweakerVersion
|
||||
sourceCompatibility = '1.6'
|
||||
targetCompatibility = '1.6'
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
dependencies {
|
||||
compile 'org.ow2.asm:asm-debug-all:5.0.3'
|
||||
|
||||
Reference in new issue
Block a user