aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java28
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java2
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/system/material/ThreadedLoader.java134
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java14
-rw-r--r--src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java2
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java4
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java2
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/CustomAspects.java41
-rw-r--r--src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java2
9 files changed, 120 insertions, 109 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
index 7de924d625..2156adb295 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java
@@ -36,35 +36,25 @@ import com.github.bartimaeusnek.bartworks.common.loaders.GTNHBlocks;
import com.github.bartimaeusnek.bartworks.common.loaders.LoaderRegistry;
import com.github.bartimaeusnek.bartworks.common.net.BW_Network;
import com.github.bartimaeusnek.bartworks.system.log.DebugLog;
+import com.github.bartimaeusnek.bartworks.system.material.ThreadedLoader;
import com.github.bartimaeusnek.bartworks.system.material.Werkstoff;
import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader;
-import com.github.bartimaeusnek.bartworks.util.BW_Util;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
-import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.SubTag;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Utility;
import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
-import java.util.HashSet;
-
-import static com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ElectricImplosionCompressor.eicMap;
@Mod(
modid = MainMod.MOD_ID, name = MainMod.NAME, version = MainMod.VERSION,
@@ -128,8 +118,12 @@ public final class MainMod {
new LoaderRegistry().run();
if (ConfigHandler.BioLab)
new BioLabLoader().run();
- if (ConfigHandler.newStuff)
- WerkstoffLoader.INSTANCE.runInit();
+ if (ConfigHandler.newStuff) {
+ if (ConfigHandler.experimentalThreadedLoader)
+ new ThreadedLoader().runInit();
+ else
+ WerkstoffLoader.INSTANCE.runInit();
+ }
}
@Mod.EventHandler
@@ -138,8 +132,12 @@ public final class MainMod {
if (ConfigHandler.BioLab)
new GTNHBlocks().run();
BioObjectAdder.regenerateBioFluids();
- if (ConfigHandler.newStuff)
- WerkstoffLoader.INSTANCE.run();
+ if (ConfigHandler.newStuff) {
+ if (ConfigHandler.experimentalThreadedLoader)
+ new ThreadedLoader().run();
+ else
+ WerkstoffLoader.INSTANCE.run();
+ }
ConfigHandler.setUpComments();
}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java
index 2321c5e413..186f12c4e6 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/configs/ConfigHandler.java
@@ -44,6 +44,7 @@ public class ConfigHandler {
public static int mbWaterperSec = 150;
private static boolean ezmode = false;
public static boolean debugLog = false;
+ public static boolean experimentalThreadedLoader = false;
public ConfigHandler(@Nonnull FMLPreInitializationEvent e) {
c = new Configuration(new File(e.getModConfigurationDirectory().toString() + "/" + MainMod.MOD_ID + ".cfg"));
@@ -63,6 +64,7 @@ public class ConfigHandler {
c.get("System", "ID Offset", 12600, "ID Offset for this mod. This Mod uses " + IDU + " IDs. DO NOT CHANGE IF YOU DONT KNOW WHAT THIS IS").set(12600);
}
debugLog=c.get("System","Enable Debug Log",false,"Enables or Disables the debug log.").getBoolean(false);
+ experimentalThreadedLoader =c.get("System","Enable Experimental Threaded Material Loader",false,"Enables or Disables the Experimental Threaded Material Loader.").getBoolean(false);
if (c.hasChanged())
c.save();
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/ThreadedLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/ThreadedLoader.java
index e6f80e5e95..cc366d63f0 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/ThreadedLoader.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/ThreadedLoader.java
@@ -1,74 +1,60 @@
-///*
-// * Copyright (c) 2019 bartimaeusnek
-// *
-// * Permission is hereby granted, free of charge, to any person obtaining a copy
-// * of this software and associated documentation files (the "Software"), to deal
-// * in the Software without restriction, including without limitation the rights
-// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// * copies of the Software, and to permit persons to whom the Software is
-// * furnished to do so, subject to the following conditions:
-// *
-// * The above copyright notice and this permission notice shall be included in all
-// * copies or substantial portions of the Software.
-// *
-// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// * SOFTWARE.
-// */
-//
-//package com.github.bartimaeusnek.bartworks.system.material;
-//
-//import com.github.bartimaeusnek.bartworks.MainMod;
-//import cpw.mods.fml.common.ProgressManager;
-//
-//import java.util.ArrayList;
-//import java.util.List;
-//
-//import static com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader.*;
-//
-//public class ThreadedLoader implements Runnable {
-//
-// List<Thread> threads = new ArrayList<>();
-//
-// @Override
-// public synchronized void run() {
-// threads.add(new AllRecipes());
-//
-// threads.forEach(Thread::start);
-//
-//
-// }
-//
-//
-// class AllRecipes extends Thread {
-//
-// public synchronized void run() {
-// MainMod.LOGGER.info("Loading Processing Recipes for BW Materials");
-// long timepre = System.nanoTime();
-// ProgressManager.ProgressBar progressBar = ProgressManager.push("Register BW Materials", Werkstoff.werkstoffHashMap.size());
-//
-// for (short i = 0; i < Werkstoff.werkstoffHashMap.size(); i++) {
-// Werkstoff werkstoff = Werkstoff.werkstoffHashMap.get(i);
-// if (werkstoff == null || werkstoff.getmID() < 0) {
-// progressBar.step("");
-// continue;
-// }
-// addDustRecipes(werkstoff);
-// addGemRecipes(werkstoff);
-// addOreRecipes(werkstoff);
-// addCrushedRecipes(werkstoff);
-// progressBar.step(werkstoff.getDefaultName());
-// }
-// ProgressManager.pop(progressBar);
-// long timepost = System.nanoTime();
-// MainMod.LOGGER.info("Loading Processing Recipes for BW Materials took " + (timepost - timepre) + "ns/" + ((timepost - timepre) / 1000000) + "ms/" + ((timepost - timepre) / 1000000000) + "s!");
-// }
-// }
-//
-//
-//
-//}
+/*
+ * Copyright (c) 2019 bartimaeusnek
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package com.github.bartimaeusnek.bartworks.system.material;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ThreadedLoader implements Runnable {
+
+ List<Thread> threads = new ArrayList<>();
+ List<Thread> threadsInit = new ArrayList<>();
+
+
+ @Override
+ public synchronized void run() {
+ threads.add(new AllRecipes());
+ threads.forEach(Thread::start);
+ }
+
+ public synchronized void runInit() {
+ threadsInit.add(new MaterialGen());
+ threadsInit.forEach(Thread::start);
+ }
+
+ class AllRecipes extends Thread {
+
+ public synchronized void run() {
+ WerkstoffLoader.INSTANCE.run();
+ }
+ }
+
+ class MaterialGen extends Thread {
+ public synchronized void run() {
+ WerkstoffLoader.INSTANCE.runInit();
+ }
+ }
+
+
+
+}
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java
index f732932eed..c1bd80e0ea 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/Werkstoff.java
@@ -314,6 +314,13 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer {
public byte toGenerate = 0b0001001;
public byte blacklist;
+ /*
+ * Auto add Chemical Recipes 1
+ * Auto add mixer Recipes 10
+ * Auto add Sifter Recipe 100
+ */
+ public byte extraRecipes;
+
public Werkstoff.GenerationFeatures setBlacklist(OrePrefixes p){
if (p == OrePrefixes.dustTiny || p == OrePrefixes.dust || p == OrePrefixes.dustSmall || p == OrePrefixes.crateGtDust){
this.blacklist |= 1;
@@ -348,12 +355,6 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer {
this.toGenerate = (byte) (this.toGenerate ^ 0b1000);
return this;
}
- /*
- * Auto add Chemical Recipes 1
- * Auto add mixer Recipes 10
- * Auto add Sifter Recipe 100
- */
- public byte extraRecipes;
public Werkstoff.GenerationFeatures addChemicalRecipes(){
this.extraRecipes = (byte) (this.extraRecipes | 1);
@@ -376,7 +377,6 @@ public class Werkstoff implements IColorModulationContainer, ISubTagContainer {
return this;
}
-
public Werkstoff.GenerationFeatures disable() {
this.toGenerate = (byte) (0);
return this;
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java
index 50190d49a4..29300cdbbe 100644
--- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java
+++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/processingLoaders/AdditionalRecipes.java
@@ -35,10 +35,12 @@ import net.minecraftforge.fluids.FluidStack;
import static gregtech.api.enums.OrePrefixes.*;
public class AdditionalRecipes implements Runnable {
+
@Override
public void run() {
GT_Values.RA.addChemicalRecipe(Materials.Yttrium.getDust(2), GT_Utility.getIntegratedCircuit(11),Materials.Oxygen.getGas(3000),null, WerkstoffLoader.YttriumOxide.get(dust),64, BW_Util.getMachineVoltageFromTier(4));
GT_Recipe.GT_Recipe_Map.sBlastRecipes.addRecipe(false, new ItemStack[]{WerkstoffLoader.Zirconium.get(dust,10), WerkstoffLoader.YttriumOxide.get(dust)}, new ItemStack[]{WerkstoffLoader.YttriumOxide.get(dust), WerkstoffLoader.Zirconia.get(gemFlawed, 40)}, (Object) null, (int[]) null, new FluidStack[]{Materials.Oxygen.getGas(20000)}, null, 14400, BW_Util.getMachineVoltageFromTier(4), 2953);
GT_Values.RA.addBlastRecipe(WerkstoffLoader.YttriumOxide.get(dustSmall,2),WerkstoffLoader.Thorianit.get(dustSmall,2),Materials.Glass.getMolten(144),null,new ItemStack(ItemRegistry.bw_glasses[0],1,12),null,800,BW_Util.getMachineVoltageFromTier(5),3663);
}
+
}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java
index 2571ecf8a0..36e017d626 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WordGenerator.java
@@ -41,8 +41,8 @@ import java.util.Random;
public class BW_WordGenerator implements IWorldGenerator {
public BW_WordGenerator() {
- //GT_NH Override...
-// GameRegistry.registerWorldGenerator(this, 1073741823);
+ //GT_NH Override... wont be actually registered to force its generation directly in the ChunkProvider
+ //GameRegistry.registerWorldGenerator(this, 1073741823);
}
public synchronized void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java
index f355bb9a21..d01e782acf 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128/world/oregen/BW_WorldGenRoss128.java
@@ -42,7 +42,7 @@ public class BW_WorldGenRoss128 extends BW_OreLayer {
public static void init_OresRoss128() {
new BW_WorldGenRoss128("ore.mix.ross128.Thorianit", true, 30, 60, 17, 1, 16, WerkstoffLoader.Thorianit, Materials.Uraninite, Materials.Lepidolite, Materials.Spodumene);
- new BW_WorldGenRoss128("ore.mix.ross128.carbon", true, 5, 25, 5, 4, 12, Materials.Graphite, Materials.Diamond, Materials.Coal, Materials.Graphene);
+ new BW_WorldGenRoss128("ore.mix.ross128.carbon", true, 5, 25, 5, 4, 12, Materials.Graphite, Materials.Diamond, Materials.Coal, Materials.Graphite);
new BW_WorldGenRoss128("ore.mix.ross128.bismuth", true, 5, 80, 30, 1, 16, WerkstoffLoader.Bismuthinit, Materials.Stibnite, Materials.Bismuth, WerkstoffLoader.Bismutite);
new BW_WorldGenRoss128("ore.mix.ross128.TurmalinAlkali", true, 5, 200, 15, 4, 48, WerkstoffLoader.Olenit, WerkstoffLoader.FluorBuergerit, WerkstoffLoader.ChromoAluminoPovondrait, WerkstoffLoader.VanadioOxyDravit);
new BW_WorldGenRoss128("ore.mix.ross128.Roquesit", true, 5, 250, 3, 1, 12, WerkstoffLoader.Arsenopyrite, WerkstoffLoader.Ferberite, WerkstoffLoader.Loellingit, WerkstoffLoader.Roquesit);
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/CustomAspects.java b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/CustomAspects.java
index bb419228d1..542501ccce 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/CustomAspects.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/CustomAspects.java
@@ -22,15 +22,38 @@
package com.github.bartimaeusnek.crossmod.thaumcraft;
-//import com.github.bartimaeusnek.bartworks.MainMod;
-//import net.minecraft.util.ResourceLocation;
-//import thaumcraft.api.aspects.Aspect;
-//
-//import static thaumcraft.api.aspects.Aspect.*;
+import com.github.bartimaeusnek.bartworks.MainMod;
-public class CustomAspects {
-// final static Aspect TRADE = new Aspect("Artis",0x00FF00,new Aspect[]{EXCHANGE, MAN},new ResourceLocation(MainMod.MOD_ID+":Aspects/Artis.png"),1);
-// final static Aspect UNIVERSE = new Aspect("Universum",0x0000FF,new Aspect[]{MAGIC, ELDRITCH},new ResourceLocation(MainMod.MOD_ID+":Aspects/Universum.png"),1);
-// final static Aspect SCIENCE = new Aspect("Scientia",0x00FFFF,new Aspect[]{MAN, UNIVERSE},new ResourceLocation(MainMod.MOD_ID+":Aspects/Scientia.png"),1);
+import com.github.bartimaeusnek.crossmod.thaumcraft.util.ThaumcraftHandler;
+import net.minecraft.util.ResourceLocation;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+public class CustomAspects {
+// static Constructor aspectConstructor;
+// static Object TRADE;
+// static Object UNIVERSE;
+// static Object SCIENCE;
+// static Object[] tmpArray = new Object[3];
+// static{
+// try {
+// aspectConstructor = ThaumcraftHandler.AspectAdder.mAspectClass.getConstructor(String.class,int.class, Array.newInstance(ThaumcraftHandler.AspectAdder.mAspectClass,1).getClass(), ResourceLocation.class,int.class);
+// tmpArray[0] = Array.newInstance(ThaumcraftHandler.AspectAdder.mAspectClass,2);
+// tmpArray[1] = Array.newInstance(ThaumcraftHandler.AspectAdder.mAspectClass,2);
+// tmpArray[2] = Array.newInstance(ThaumcraftHandler.AspectAdder.mAspectClass,2);
+// Array.set(tmpArray[0],0,ThaumcraftHandler.AspectAdder.mAspectClass.getField("EXCHANGE").get(null));
+// Array.set(tmpArray[0],1,ThaumcraftHandler.AspectAdder.mAspectClass.getField("GREED").get(null));
+// TRADE = aspectConstructor.newInstance("Artis",0x00FF00, tmpArray[0],new ResourceLocation(MainMod.MOD_ID+":Aspects/Artis.png"),1);
+// Array.set(tmpArray[1],0,ThaumcraftHandler.AspectAdder.mAspectClass.getField("MAGIC").get(null));
+// Array.set(tmpArray[1],1,ThaumcraftHandler.AspectAdder.mAspectClass.getField("ELDRITCH").get(null));
+// UNIVERSE = aspectConstructor.newInstance("Universum",0x0000FF, tmpArray[1],new ResourceLocation(MainMod.MOD_ID+":Aspects/Universum.png"),1);
+// Array.set(tmpArray[2],0,ThaumcraftHandler.AspectAdder.mAspectClass.getField("MAN").get(null));
+// Array.set(tmpArray[2],1,UNIVERSE);
+// SCIENCE = aspectConstructor.newInstance("Scientia",0x00FFFF, tmpArray[2],new ResourceLocation(MainMod.MOD_ID+":Aspects/Scientia.png"),1);
+// } catch (NoSuchMethodException | NoSuchFieldException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
+// e.printStackTrace();
+// }
+// }
}
diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java
index c9dfe96835..d0df9188a2 100644
--- a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java
+++ b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java
@@ -54,7 +54,7 @@ public class ThaumcraftHandler {
public static class AspectAdder {
private static Class mAspectListClass;
- private static Class mAspectClass;
+ public static Class mAspectClass;
private static Method registerObjectTag;
private static Method addToList;
private static Method getName;