diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-04-12 16:50:30 +0200 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-04-12 16:50:30 +0200 |
commit | c5f23f6dcfc44dacf907b19e09c67632b6f5aaa9 (patch) | |
tree | 02722df728a10711750b019eac6f47ff76e7aa3e | |
parent | 86137b22f30dd5bd76f52d40cf2955b31a6f0d9d (diff) | |
download | GT5-Unofficial-c5f23f6dcfc44dacf907b19e09c67632b6f5aaa9.tar.gz GT5-Unofficial-c5f23f6dcfc44dacf907b19e09c67632b6f5aaa9.tar.bz2 GT5-Unofficial-c5f23f6dcfc44dacf907b19e09c67632b6f5aaa9.zip |
Improved Threaded Loader
+un-threaded GameRegistry stuff
+version increase
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Former-commit-id: 6a1eb48d1e35e96f235ba5b743f7ce6d4cf33af5
3 files changed, 33 insertions, 9 deletions
diff --git a/build.properties b/build.properties index ab5c5addf1..3d69f35b15 100644 --- a/build.properties +++ b/build.properties @@ -23,7 +23,7 @@ mc_version=1.7.10 majorUpdate=0 minorUpdate=4 -buildNumber=5 +buildNumber=6 APIVersion=5 ic2.version=2.2.828-experimental gregtech.version=5.09.32.36 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 cc366d63f0..d34fd03818 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 @@ -22,6 +22,9 @@ package com.github.bartimaeusnek.bartworks.system.material; +import com.github.bartimaeusnek.bartworks.MainMod; +import cpw.mods.fml.common.FMLCommonHandler; + import java.util.ArrayList; import java.util.List; @@ -33,13 +36,30 @@ public class ThreadedLoader implements Runnable { @Override public synchronized void run() { + MainMod.LOGGER.warn("EXPERIMENTAL THREADED-LOADER ENABLED!"); + MainMod.LOGGER.info("Starting to register BartWorks Materials Recipes to Gregtech"); threads.add(new AllRecipes()); threads.forEach(Thread::start); } public synchronized void runInit() { + MainMod.LOGGER.warn("EXPERIMENTAL THREADED-LOADER ENABLED!"); + MainMod.LOGGER.info("Starting the Material Generation Thread"); threadsInit.add(new MaterialGen()); threadsInit.forEach(Thread::start); + for (Thread thread : threadsInit) { + try { + MainMod.LOGGER.info("Trying to join the Material Generation Thread"); + thread.join(); + }catch (InterruptedException e){ + e.printStackTrace(); + FMLCommonHandler.instance().exitJava(500,true); + } + } + MainMod.LOGGER.info("Successfully joined the Material Generation Thread, Registering the Items/Blocks to the GameRegistry"); + if ((WerkstoffLoader.toGenerateGlobal & 0b1000) != 0) + WerkstoffLoader.INSTANCE.gameRegistryHandler(); + } class AllRecipes extends Thread { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java index 18ea765786..1a805cd8d0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java @@ -25,6 +25,7 @@ package com.github.bartimaeusnek.bartworks.system.material; import com.github.bartimaeusnek.bartworks.API.WerkstoffAdderRegistry; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.client.renderer.BW_Renderer_Block_Ores; +import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.bartworks.system.log.DebugLog; import com.github.bartimaeusnek.bartworks.system.material.processingLoaders.AdditionalRecipes; import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; @@ -541,9 +542,8 @@ public class WerkstoffLoader implements Runnable { } } + public static int toGenerateGlobal = 0b0000000; private void addItemsForGeneration() { - int toGenerateGlobal = 0b0000000; - for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { for (OrePrefixes p : values()) if ((werkstoff.getGenerationFeatures().toGenerate & p.mMaterialGenerationBits) != 0 && OreDictHandler.getItemStack(werkstoff.getDefaultName(),p,1) != null) { @@ -571,12 +571,8 @@ public class WerkstoffLoader implements Runnable { WerkstoffLoader.items.put(lens,new BW_MetaGenerated_Items(lens)); } if ((toGenerateGlobal & 0b1000) != 0) { - if (FMLCommonHandler.instance().getSide().isClient()) - RenderingRegistry.registerBlockHandler(BW_Renderer_Block_Ores.INSTANCE); - GameRegistry.registerTileEntity(BW_MetaGeneratedOreTE.class, "bw.blockoresTE"); - WerkstoffLoader.BWOres = new BW_MetaGenerated_Ores(Material.rock, BW_MetaGeneratedOreTE.class, "bw.blockores"); - GameRegistry.registerBlock(WerkstoffLoader.BWOres, BW_MetaGeneratedOre_Item.class, "bw.blockores.01"); - + if (!ConfigHandler.experimentalThreadedLoader) + gameRegistryHandler(); WerkstoffLoader.items.put(crushed, new BW_MetaGenerated_Items(crushed)); WerkstoffLoader.items.put(crushedPurified, new BW_MetaGenerated_Items(crushedPurified)); WerkstoffLoader.items.put(crushedCentrifuged, new BW_MetaGenerated_Items(crushedCentrifuged)); @@ -585,6 +581,14 @@ public class WerkstoffLoader implements Runnable { } } + public void gameRegistryHandler(){ + if (FMLCommonHandler.instance().getSide().isClient()) + RenderingRegistry.registerBlockHandler(BW_Renderer_Block_Ores.INSTANCE); + GameRegistry.registerTileEntity(BW_MetaGeneratedOreTE.class, "bw.blockoresTE"); + WerkstoffLoader.BWOres = new BW_MetaGenerated_Ores(Material.rock, BW_MetaGeneratedOreTE.class, "bw.blockores"); + GameRegistry.registerBlock(WerkstoffLoader.BWOres, BW_MetaGeneratedOre_Item.class, "bw.blockores.01"); + } + private void runAdditionalOreDict(){ for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { if (werkstoff.getGenerationFeatures().hasOres()) |