diff options
author | â€huajijam <strhuaji@gmail.com> | 2019-04-24 17:38:38 +0800 |
---|---|---|
committer | â€huajijam <strhuaji@gmail.com> | 2019-04-24 17:38:38 +0800 |
commit | 7ac411aa448abf71b12879395c155bd61873e1bb (patch) | |
tree | 259b7c23b93831801e84031fdb9d2818a27223b5 | |
parent | 4c965eba82e0233dfa0844d4c513c30aefbbea85 (diff) | |
parent | 3ee2e33630d3346d9ab04c9e4c56f101f18399d2 (diff) | |
download | GT5-Unofficial-7ac411aa448abf71b12879395c155bd61873e1bb.tar.gz GT5-Unofficial-7ac411aa448abf71b12879395c155bd61873e1bb.tar.bz2 GT5-Unofficial-7ac411aa448abf71b12879395c155bd61873e1bb.zip |
Automatic synchronization
Former-commit-id: 8e96e0e7e4c4c08c80ca34a35082a589d428ec67
33 files changed, 734 insertions, 152 deletions
diff --git a/.travis.yml b/.travis.yml index 66204e3e0f..0ce2ec14a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,13 +15,13 @@ jdk: - oraclejdk8 jobs: include: - - stage: sonar - addons: - sonarcloud: - organization: "bartimaeusnek-github" - token: - secure: "KW2U8HenTpLQOXT+OxCsu4noCKH6ZkUATld36YTbwAwzVKt6aesqtKHkZuo+Y+a143GI184pdnhMcRB1F49Wf0IQTkOhvopfnSEg+AKWZJb+gAbZQaYkaoe04pVzdwnpBXPDZR0DnTJX09VJGlES0RMiYfaQDHAYuPRQRBf17mLWvhXf7ZfNshGLikmzQcXWoXMpB+z9BaJ9Vr9/+Jn4Geuh9MWsbc2xZyQU8hoTTtKxqj5sTVRkwmxTf0ooGrMKohoOQ5JeZLDWM0Z/7KW64kFCE3xDrKg2gnKyKNLU6qIwbgCtVkcqGb28tXuqNdRSZ5BHb70dZb0E2+9VGhS7xPA8iUVmktJRKKG+f34HtDlsXqA00SEF2u+fq+TDz7fcPHLM8z1IcUI2XF5c5A/6E1k161i3kMB9xpd5Rq4waywo+/2j+L2CE6u5aj7BeL7KUQKD7k5gx3bXUyIo2QdjzeJeUJTSaxchcae9iIO+W6rwc68fD5/UNHVp+O75QNz2B+pklz6hCFVaoUep8rl4LO58ODBU1GL4JfeTM0RzOofOFepPXIi39iCk89c61WBtxX8RPkv3nBDsrXCGU7UNH1thP1nmgCfB4HGRxixWBAnmPDHNLEW81RG+meGRpHX7RkWISmrl95x15QXb016hldvK3sAegxxVPUdyJxRplgE=" - script: "./gradlew sonarqube" +# - stage: sonar +# addons: +# sonarcloud: +# organization: "bartimaeusnek-github" +# token: +# secure: "KW2U8HenTpLQOXT+OxCsu4noCKH6ZkUATld36YTbwAwzVKt6aesqtKHkZuo+Y+a143GI184pdnhMcRB1F49Wf0IQTkOhvopfnSEg+AKWZJb+gAbZQaYkaoe04pVzdwnpBXPDZR0DnTJX09VJGlES0RMiYfaQDHAYuPRQRBf17mLWvhXf7ZfNshGLikmzQcXWoXMpB+z9BaJ9Vr9/+Jn4Geuh9MWsbc2xZyQU8hoTTtKxqj5sTVRkwmxTf0ooGrMKohoOQ5JeZLDWM0Z/7KW64kFCE3xDrKg2gnKyKNLU6qIwbgCtVkcqGb28tXuqNdRSZ5BHb70dZb0E2+9VGhS7xPA8iUVmktJRKKG+f34HtDlsXqA00SEF2u+fq+TDz7fcPHLM8z1IcUI2XF5c5A/6E1k161i3kMB9xpd5Rq4waywo+/2j+L2CE6u5aj7BeL7KUQKD7k5gx3bXUyIo2QdjzeJeUJTSaxchcae9iIO+W6rwc68fD5/UNHVp+O75QNz2B+pklz6hCFVaoUep8rl4LO58ODBU1GL4JfeTM0RzOofOFepPXIi39iCk89c61WBtxX8RPkv3nBDsrXCGU7UNH1thP1nmgCfB4HGRxixWBAnmPDHNLEW81RG+meGRpHX7RkWISmrl95x15QXb016hldvK3sAegxxVPUdyJxRplgE=" +# script: "./gradlew sonarqube" - stage: buildAndDeploy script: "./gradlew build" deploy: diff --git a/build.gradle b/build.gradle index 229a4f71c1..42805998bb 100644 --- a/build.gradle +++ b/build.gradle @@ -86,7 +86,9 @@ repositories { name = "gt" url = "https://gregtech.overminddl1.com/" } - + maven { + url = "http://maven.cil.li/" + } } dependencies { @@ -95,6 +97,7 @@ dependencies { compile "micdoodle8.mods:MicdoodleCore:${config.galacticraft.version}:Dev" compile "micdoodle8.mods:GalacticraftCore:${config.galacticraft.version}:Dev" compile "micdoodle8.mods:Galacticraft-Planets:${config.galacticraft.version}:Dev" + compile "li.cil.oc:OpenComputers:MC1.7.10-1.5.+:api" } //task getGregTech(type: Download) { diff --git a/build.properties b/build.properties index 3aa71fe6c6..4f072d27ec 100644 --- a/build.properties +++ b/build.properties @@ -23,7 +23,7 @@ mc_version=1.7.10 majorUpdate=0 minorUpdate=4 -buildNumber=9 +buildNumber=12 APIVersion=6 ic2.version=2.2.828-experimental gregtech.version=5.09.32.36 diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java index 9c76b3dd82..031ff30512 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCore.java @@ -22,11 +22,13 @@ package com.github.bartimaeusnek.ASM; +import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.LoadController; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModMetadata; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.versioning.ArtifactVersion; @@ -37,23 +39,28 @@ import org.apache.logging.log4j.Logger; import java.util.ArrayList; import java.util.List; +import static com.github.bartimaeusnek.ASM.BWCoreTransformer.shouldTransform; + public class BWCore extends DummyModContainer { public static final String BWCORE_NAME = "BartWorks ASM Core"; - public static final Logger BWCORE_LOG = LogManager.getLogger(BWCORE_NAME); + public static final Logger BWCORE_LOG = LogManager.getLogger(BWCore.BWCORE_NAME); public BWCore() { super(new ModMetadata()); - ModMetadata metadata = getMetadata(); + ModMetadata metadata = this.getMetadata(); metadata.modId = "BWCore"; - metadata.name = BWCORE_NAME; + metadata.name = BWCore.BWCORE_NAME; metadata.version = "0.0.1"; metadata.authorList.add("bartimaeusnek"); - metadata.dependants = getDependants(); + metadata.dependants = this.getDependants(); } @Subscribe public void preInit(FMLPreInitializationEvent event) { + shouldTransform[0] = Loader.isModLoaded("ExtraUtilities") && ConfigHandler.enabledPatches[0]; + shouldTransform[1] = Loader.isModLoaded("ExtraUtilities") && ConfigHandler.enabledPatches[1]; + BWCore.BWCORE_LOG.info("Extra Utilities found? " + shouldTransform[0]); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java index 2093b6a092..97f4702d4c 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCorePlugin.java @@ -28,25 +28,27 @@ import cpw.mods.fml.relauncher.IFMLLoadingPlugin; import net.minecraftforge.common.config.Configuration; import java.io.File; +import java.util.ArrayList; import java.util.Map; @IFMLLoadingPlugin.SortingIndex(999999999)//Load as late as possible (after fastcraft/OptiFine). @IFMLLoadingPlugin.MCVersion("1.7.10") -@IFMLLoadingPlugin.TransformerExclusions({"com.github.bartimaeusnek.ASM"}) +@IFMLLoadingPlugin.TransformerExclusions("com.github.bartimaeusnek.ASM") @IFMLLoadingPlugin.Name(BWCorePlugin.BWCORE_PLUGIN_NAME) public class BWCorePlugin implements IFMLLoadingPlugin { public static final String BWCORE_PLUGIN_NAME = "BartWorks ASM Core Plugin"; - public static File minecraftDir = null; + public static File minecraftDir; public BWCorePlugin() { //Injection Code taken from CodeChickenLib - if (minecraftDir != null) + if (BWCorePlugin.minecraftDir != null) return;//get called twice, once for IFMLCallHook - minecraftDir = (File) FMLInjectionData.data()[6]; + BWCorePlugin.minecraftDir = (File) FMLInjectionData.data()[6]; //do all the configuration already now... - new ConfigHandler(new Configuration(new File(new File(minecraftDir, "config"), "bartworks.cfg"))); + new ConfigHandler(new Configuration(new File(new File(BWCorePlugin.minecraftDir, "config"), "bartworks.cfg"))); + BWCoreTransformer.shouldTransform[2] = false; } @Override @@ -69,6 +71,14 @@ public class BWCorePlugin implements IFMLLoadingPlugin { if (data.get("runtimeDeobfuscationEnabled") != null) { BWCoreTransformer.obfs = (boolean) data.get("runtimeDeobfuscationEnabled"); } + if (data.get("coremodList") != null) { + for (Object o : (ArrayList) data.get("coremodList")) { + if (o.toString().contains("MicdoodlePlugin")) { + BWCoreTransformer.shouldTransform[2] = ConfigHandler.enabledPatches[2]; + break; + } + } + } } @Override diff --git a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java index c40faa0c98..bcc67b18d3 100644 --- a/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java +++ b/src/main/java/com/github/bartimaeusnek/ASM/BWCoreTransformer.java @@ -23,12 +23,15 @@ package com.github.bartimaeusnek.ASM; import net.minecraft.launchwrapper.IClassTransformer; +import net.minecraft.launchwrapper.Launch; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.*; +import java.io.File; import java.util.Arrays; import java.util.List; +import java.util.jar.JarFile; import static org.objectweb.asm.Opcodes.*; @@ -47,23 +50,25 @@ public class BWCoreTransformer implements IClassTransformer { public static boolean[] shouldTransform = new boolean[CLASSESBEEINGTRANSFORMED.length]; - static { - //hacky way to detect if the mods are loaded - try{ - Class.forName("com.rwtema.extrautils.worldgen.endoftime.WorldProviderEndOfTime"); - shouldTransform[0] = true; - shouldTransform[1] = true; - }catch (ClassNotFoundException e){ - shouldTransform[0] = false; - shouldTransform[1] = false; - } - try{ - Class.forName("micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld"); - shouldTransform[2] = true; - }catch (ClassNotFoundException e){ - shouldTransform[2] = false; - } - } +// public void checkForMods() { +// //hacky way to detect if the mods are loaded +// try{ +// Class.forName("com.rwtema.extrautils.core.Tuple"); +// shouldTransform[0] = true; +// shouldTransform[1] = true; +// }catch (ClassNotFoundException e){ +// BWCore.BWCORE_LOG.info("Extra Utilities not found!"); +// shouldTransform[0] = false; +// shouldTransform[1] = false; +// } +// try{ +// Class.forName("micdoodle8.mods.galacticraft.core.Constants"); +// shouldTransform[2] = true; +// }catch (ClassNotFoundException e){ +// BWCore.BWCORE_LOG.info("micdoodle Core not found!"); +// shouldTransform[2] = false; +// } +// } public static byte[] transform(int id, byte[] basicClass) { if (!BWCoreTransformer.shouldTransform[id]) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java index 99ac6fda7e..e5ee488b2f 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/MainMod.java @@ -35,34 +35,50 @@ import com.github.bartimaeusnek.bartworks.common.loaders.BioLabLoader; 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.common.tileentities.multis.GT_TileEntity_THTR; 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 cpw.mods.fml.common.registry.GameData; +import cpw.mods.fml.common.registry.GameRegistry; +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.Item; +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 java.util.Iterator; + +import static com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ElectricImplosionCompressor.eicMap; @Mod( modid = MainMod.MOD_ID, name = MainMod.NAME, version = MainMod.VERSION, dependencies = "required-after:IC2; " + "required-after:gregtech; " - + "after:berriespp;" -) + + "after:berriespp; " + + "after:GalacticraftMars; " + + "after:GalacticraftCore; " + ) public final class MainMod { public static final String NAME = "BartWorks"; public static final String VERSION = "@version@"; @@ -80,12 +96,14 @@ public final class MainMod { @Mod.EventHandler public void preInit(FMLPreInitializationEvent preinit) { - //fixing BorosilicateGlass... -_-' - Materials.BorosilicateGlass.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_RECYCLING, SubTag.SMELTING_TO_FLUID); + if (!(API_REFERENCE.VERSION.equals(APIVERSION))) { LOGGER.error("Something has loaded an old API. Please contact the Mod authors to update!"); } + //fixing BorosilicateGlass... -_-' + Materials.BorosilicateGlass.add(SubTag.CRYSTAL, SubTag.NO_SMASHING, SubTag.NO_RECYCLING, SubTag.SMELTING_TO_FLUID); + if (Loader.isModLoaded("dreamcraft")) { ConfigHandler.GTNH = true; } @@ -138,31 +156,43 @@ public final class MainMod { else WerkstoffLoader.INSTANCE.run(); } - ConfigHandler.setUpComments(); } -// @Mod.EventHandler -// public void onServerStarted(FMLServerStartedEvent event) { -// eicMap = new GT_Recipe.GT_Recipe_Map(new HashSet(GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList.size()), "gt.recipe.electricimplosioncompressor", "Electric Implosion Compressor", (String) null, "gregtech:textures/gui/basicmachines/Default", 1, 2, 1, 0, 1, "", 1, "", true, true); -// for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList) { -// if (recipe == null || recipe.mInputs == null) -// continue; -// ItemStack input = recipe.mInputs[0]; -// int i = 0; -// while (checkForExplosives(input)) { -// try { -// i++; -// input = recipe.mInputs[i]; -// } catch (ArrayIndexOutOfBoundsException e) { -// LOGGER.error("CAUGHT DEFECTIVE IMPLOSION COMPRESSOR RECIPE."); -// e.printStackTrace(); -// } -// } -// eicMap.addRecipe(true, new ItemStack[]{input}, recipe.mOutputs, null, null, null, recipe.mDuration, BW_Util.getMachineVoltageFromTier(10), 0); -// } -// } -// -// private boolean checkForExplosives(ItemStack input) { -// return (GT_Utility.areStacksEqual(input, new ItemStack(Blocks.tnt)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("dynamite", 1L)) || GT_Utility.areStacksEqual(input, ItemList.Block_Powderbarrel.get(1L))); -// } + @Mod.EventHandler + public void onServerStarted(FMLServerStartedEvent event) { + eicMap = new GT_Recipe.GT_Recipe_Map(new HashSet(GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList.size()), "gt.recipe.electricimplosioncompressor", "Electric Implosion Compressor", (String) null, "gregtech:textures/gui/basicmachines/Default", 1, 2, 1, 0, 1, "", 1, "", true, true); + recipeLoop: + for (GT_Recipe recipe : GT_Recipe.GT_Recipe_Map.sImplosionRecipes.mRecipeList) { + if (recipe == null || recipe.mInputs == null) + continue; + try { + ItemStack input = recipe.mInputs[0]; + int i = 0; + float durMod = 0; + if (checkForExplosives(recipe.mInputs[1])) { + if (GT_Utility.areStacksEqual(recipe.mInputs[1], GT_ModHandler.getIC2Item("industrialTnt", 1L))) + durMod += ((float) input.stackSize * 2f); + else + continue recipeLoop; + } + while (checkForExplosives(input)) { + if (GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L))) + durMod += ((float) input.stackSize * 2f); + else + continue recipeLoop; + i++; + input = recipe.mInputs[i]; + } + + eicMap.addRecipe(true, new ItemStack[]{input}, recipe.mOutputs, null, null, null, (int)Math.floor(Math.max((float)recipe.mDuration*durMod,20f)), BW_Util.getMachineVoltageFromTier(10), 0); + } catch (ArrayIndexOutOfBoundsException e) { + LOGGER.error("CAUGHT DEFECTIVE IMPLOSION COMPRESSOR RECIPE!"); + e.printStackTrace(); + } + } + } + + private boolean checkForExplosives(ItemStack input) { + return (GT_Utility.areStacksEqual(input, new ItemStack(Blocks.tnt)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("industrialTnt", 1L)) || GT_Utility.areStacksEqual(input, GT_ModHandler.getIC2Item("dynamite", 1L)) || GT_Utility.areStacksEqual(input, ItemList.Block_Powderbarrel.get(1L))); + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java index 5888b88ef2..d2277817c5 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/ClientEventHandler/ClientEventHandler.java @@ -25,7 +25,7 @@ package com.github.bartimaeusnek.bartworks.client.ClientEventHandler; import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.common.blocks.BW_Blocks; -import com.github.bartimaeusnek.bartworks.system.material.OreDictHandler; +import com.github.bartimaeusnek.bartworks.system.oredict.OreDictHandler; import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; 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 cce52a223d..669417a345 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 @@ -26,6 +26,8 @@ package com.github.bartimaeusnek.bartworks.common.configs; import com.github.bartimaeusnek.ASM.BWCoreTransformer;; import net.minecraftforge.common.config.Configuration; +import java.util.Arrays; + public class ConfigHandler { private static final int IDU = 10 * 8 + 5; public static int IDOffset = 12600; @@ -44,7 +46,7 @@ public class ConfigHandler { public static boolean experimentalThreadedLoader; public static boolean GTNH; public static boolean ezmode; - + public static boolean[] enabledPatches ; public ConfigHandler(Configuration C) { ConfigHandler.c = C; @@ -67,6 +69,8 @@ public class ConfigHandler { for (int i = 0; i < BWCoreTransformer.CLASSESBEEINGTRANSFORMED.length; i++) { BWCoreTransformer.shouldTransform[i] = ConfigHandler.c.get("ASM fixes", BWCoreTransformer.DESCRIPTIONFORCONFIG[i] + " in class: " + BWCoreTransformer.CLASSESBEEINGTRANSFORMED[i], true).getBoolean(true); } + enabledPatches = new boolean[BWCoreTransformer.shouldTransform.length]; + enabledPatches = Arrays.copyOf(BWCoreTransformer.shouldTransform,BWCoreTransformer.shouldTransform.length); ConfigHandler.ross128BID = ConfigHandler.c.get("CrossMod Interactions", "DimID - Ross128b", -64, "The Dim ID for Ross128b").getInt(-64); ConfigHandler.ross128BAID = ConfigHandler.c.get("CrossMod Interactions", "DimID - Ross128ba", -63, "The Dim ID for Ross128ba (Ross128b's Moon)").getInt(-63); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index ca12a39636..e5db33bc5c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -122,7 +122,7 @@ public class ItemRegistry { }, BWT), }; - public static ItemStack dehp; + public static ItemStack[] diode2A = new ItemStack[GT_Values.VN.length]; public static ItemStack[] diode4A = new ItemStack[GT_Values.VN.length]; public static ItemStack[] diode8A = new ItemStack[GT_Values.VN.length]; @@ -131,11 +131,14 @@ public class ItemRegistry { public static ItemStack[] energyDistributor = new ItemStack[GT_Values.VN.length]; public static ItemStack[] acidGens = new ItemStack[3]; public static ItemStack[] megaMachines = new ItemStack[2]; + public static ItemStack dehp; public static ItemStack thtr; + public static ItemStack eic; public static void run() { if (newStuff) { + eic=new GT_TileEntity_ElectricImplosionCompressor(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 6,"ElectricImplosionCompressor","Electric Implosion Compressor").getStackForm(1L); thtr=new GT_TileEntity_THTR(ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 5,"THTR","Thorium High Temperature Reactor").getStackForm(1L); GT_TileEntity_THTR.THTRMaterials.registeraTHR_Materials(); GameRegistry.registerBlock(ItemRegistry.bw_glasses[0], BW_ItemBlocks.class, "BW_GlasBlocks"); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java index 9c958e25fa..ffcddc4706 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java @@ -739,8 +739,27 @@ public class RecipeLoader implements Runnable { 'R',GT_ModHandler.getModItem("IC2","blockGenerator",1,5), 'Z',"circuitUltimate" } - ); + ); + GT_Values.RA.addAssemblylineRecipe( + ItemList.Machine_Multi_ImplosionCompressor.get(1L),24000, + new ItemStack[]{ + ItemList.Machine_Multi_ImplosionCompressor.get(1L), + Materials.Neutronium.getBlocks(5), + GT_OreDictUnificator.get(OrePrefixes.stickLong,Materials.Osmium,64), + GT_OreDictUnificator.get(OrePrefixes.ring,Materials.Osmium,64), + GT_OreDictUnificator.get(OrePrefixes.wireGt01,Materials.Superconductor,64), + ItemList.Electric_Piston_UV.get(64), + }, + new FluidStack[]{ + Materials.SolderingAlloy.getMolten(1440), + Materials.Osmium.getMolten(1440), + Materials.Neutronium.getMolten(1440) + }, + ItemRegistry.eic.copy(), + 240000, + BW_Util.getMachineVoltageFromTier(8) + ); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java index 74efa145e5..cd45301d4f 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java @@ -22,6 +22,7 @@ package com.github.bartimaeusnek.bartworks.common.tileentities.multis; +import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -32,6 +33,7 @@ import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ImplosionCo import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -186,7 +188,7 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity IGregTechTileEntity te = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, z + zDir); if (y == -2 || y == 6) { if (!(x == 0 && z == 0)) { - if (!this.addMaintenanceToMachineList(te, 16) && !this.addMufflerToMachineList(te, 16) && !this.addInputToMachineList(te, 16) && !this.addOutputToMachineList(te, 16)) { + if (!this.addMaintenanceToMachineList(te, 16) && !this.addInputToMachineList(te, 16) && !this.addOutputToMachineList(te, 16)) { Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z); byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z); if ((tBlock != GregTech_API.sBlockCasings2 || tMeta != 0) && (tBlock != GregTech_API.sBlockCasings3 || tMeta != 4)) { @@ -248,6 +250,12 @@ public class GT_TileEntity_ElectricImplosionCompressor extends GT_MetaTileEntity @Override public String[] getDescription() { - return new String[0]; + String[] dsc = StatCollector.translateToLocal("tooltip.tile.eic.0.name").split(";"); + String[] mDescription = new String[dsc.length + 1]; + for (int i = 0; i < dsc.length; i++) { + mDescription[i] = dsc[i]; + mDescription[dsc.length] = StatCollector.translateToLocal("tooltip.bw.1.name") + ChatColorHelper.DARKGREEN + " BartWorks"; + } + return mDescription; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java index 42eeada394..471373e3dd 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_LESU.java @@ -397,8 +397,9 @@ public class GT_TileEntity_LESU extends GT_MetaTileEntity_MultiBlockBase { this.getBaseMetaTileEntity().setActive(true); long finishedTime = System.nanoTime(); + //System.out.println("LESU LookUp: "+((finishedTime - startingTime) / 1000000)+"ms"); if (finishedTime - startingTime > 5000000) - MainMod.LOGGER.warn("LESU LookUp took longer than 5ms!(" + (finishedTime - startingTime) + "ns / " + ((finishedTime - startingTime) / 1000000) + "ms) Check at x:" + this.getBaseMetaTileEntity().getXCoord() + " y:" + this.getBaseMetaTileEntity().getYCoord() + " z:" + this.getBaseMetaTileEntity().getZCoord() + " DIM-ID: " + this.getBaseMetaTileEntity().getWorld().provider.dimensionId); + MainMod.LOGGER.warn("LESU LookUp took longer than 5ms!(" + (finishedTime - startingTime) + "ns / " + ((finishedTime - startingTime) / 1000000) + "ms) Owner:"+this.getBaseMetaTileEntity().getOwnerName()+" Check at x:" + this.getBaseMetaTileEntity().getXCoord() + " y:" + this.getBaseMetaTileEntity().getYCoord() + " z:" + this.getBaseMetaTileEntity().getZCoord() + " DIM-ID: " + this.getBaseMetaTileEntity().getWorld().provider.dimensionId); return true; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java index b21e97aead..193a1ffacb 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java @@ -41,6 +41,7 @@ import gregtech.api.objects.XSTR; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; @@ -57,6 +58,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { private int HeliumSupply; private int BISOPeletSupply; private int TRISOPeletSupply; + private boolean empty; public GT_TileEntity_THTR(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -77,6 +79,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { HeliumSupply=aNBT.getInteger("HeliumSupply"); BISOPeletSupply=aNBT.getInteger("BISOPeletSupply"); TRISOPeletSupply=aNBT.getInteger("TRISOPeletSupply"); + empty=aNBT.getBoolean("EmptyMode"); } @Override @@ -85,6 +88,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { aNBT.setInteger("HeliumSupply",HeliumSupply); aNBT.setInteger("BISOPeletSupply",BISOPeletSupply); aNBT.setInteger("TRISOPeletSupply",TRISOPeletSupply); + aNBT.setBoolean("EmptyMode",empty); } @Override @@ -155,6 +159,17 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { @Override public boolean onRunningTick(ItemStack aStack) { + + if (empty){ + this.addOutput(Materials.Helium.getGas(HeliumSupply)); + this.addOutput(new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials, TRISOPeletSupply, 3)); + this.addOutput(new ItemStack(GT_TileEntity_THTR.THTRMaterials.aTHTR_Materials, BISOPeletSupply, 1)); + this.HeliumSupply = 0; + this.TRISOPeletSupply = 0; + this.BISOPeletSupply = 0; + return true; + } + long accessibleCoolant = 0; long toProduce=0; for (FluidStack fluidStack : this.getStoredFluids()) { @@ -176,7 +191,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { // 0.01f, // ExplosionIC2.Type.Nuclear // ).doExplosion(); - return false; + toProduce=accessibleCoolant; } accessibleCoolant=toProduce; @@ -198,16 +213,17 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4; - for (int x = -4; x <= 4; x++) { - for (int z = -4; z <= 4; z++) { + final byte xz = 5; + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * xz; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * xz; + for (int x = -xz; x <= xz; x++) { + for (int z = -xz; z <= xz; z++) { for (int y = 0; y < 12; y++) { if (y == 0 || y == 11) { if ( - !((Math.abs(z) == 3 && Math.abs(x) == 4)) && - !((Math.abs(z) == 4 && Math.abs(x) == 3)) && - !((Math.abs(x) == Math.abs(z) && Math.abs(x) == 4)) + !((Math.abs(z) == xz-1 && Math.abs(x) == xz)) && + !((Math.abs(z) == xz && Math.abs(x) == xz-1)) && + !((Math.abs(x) == Math.abs(z) && Math.abs(x) == xz)) ) { if (x + xDir == 0 && y == 0 && z + zDir == 0) continue; @@ -223,10 +239,18 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { } } } - else if (!((Math.abs(x) == 4 && Math.abs(z) == 4) || (Math.abs(x) == 3 && Math.abs(z) == 3)) && !(Math.abs(x) < 3 || Math.abs(z) < 3) && !((Math.abs(x) == Math.abs(z) && Math.abs(x) == 3) || Math.abs(x) == 4 || Math.abs(z) == 4)) { - if (!(aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z) == 12)) { + + +// else if (!((Math.abs(x) == 4 && Math.abs(z) == 4) || (Math.abs(x) == 3 && Math.abs(z) == 3)) && !(Math.abs(x) < 3 || Math.abs(z) < 3) && !((Math.abs(x) == Math.abs(z) && Math.abs(x) == 3) || Math.abs(x) == 4 || Math.abs(z) == 4)) { + else if (!((Math.abs(z) == xz-1 && Math.abs(x) == xz))) + if (!((Math.abs(z) == xz && Math.abs(x) == xz-1))) + if (!((Math.abs(x) == Math.abs(z) && Math.abs(x) == xz))) + if (!(Math.abs(x) < xz && Math.abs(z) != xz)) + + { + if (!(aBaseMetaTileEntity.getBlockOffset(xDir + x, y, zDir + z) == GregTech_API.sBlockCasings3 && aBaseMetaTileEntity.getMetaIDOffset(xDir + x, y, zDir + z) == 12)) { if ( - !this.addMaintenanceToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), BASECASINGINDEX)) + !this.addMaintenanceToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, y, zDir + z), BASECASINGINDEX)) { return false; } @@ -237,10 +261,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { } - if (this.mMaintenanceHatches.size() != 1) - return false; - - return true; + return this.mMaintenanceHatches.size() == 1; } @Override @@ -276,7 +297,7 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { "BISO-Pebbles:", this.BISOPeletSupply + "pcs.", "TRISO-Pebbles:", this.TRISOPeletSupply + "pcs.", "Helium-Level:", this.HeliumSupply+"L / "+HELIUM_NEEDED+"L", - "Coolant/sec:", this.BISOPeletSupply+this.TRISOPeletSupply >= 100000 ? (long) ((0.03471*(float)this.TRISOPeletSupply + 0.0267*(float)this.BISOPeletSupply))+"L/t" : "0L/t", + "Coolant/t:", this.BISOPeletSupply+this.TRISOPeletSupply >= 100000 ? (long) ((0.03471*(float)this.TRISOPeletSupply + 0.0267*(float)this.BISOPeletSupply))+"L/t" : "0L/t", "Problems:", String.valueOf(this.getIdealStatus() - this.getRepairStatus()) }; } @@ -297,6 +318,11 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_MultiBlockBase { return aSide == aFacing ? new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[BASECASINGINDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)} : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[BASECASINGINDEX]}; } + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + empty = !empty; + GT_Utility.sendChatToPlayer(aPlayer,empty ? "THTR will now empty itself." : "THTR is back in normal Operation"); + } public static class THTRMaterials{ static final SimpleSubItemClass aTHTR_Materials = new SimpleSubItemClass("BISOPelletCompound","BISOPellet","TRISOPelletCompound","TRISOPellet","BISOPelletBall","TRISOPelletBall"); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java index d50081c9e9..552548c4d6 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java @@ -22,8 +22,10 @@ package com.github.bartimaeusnek.bartworks.system.material; +import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; +import com.github.bartimaeusnek.bartworks.system.oredict.OreDictAdder; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; -import cpw.mods.fml.common.Loader; +import com.github.bartimaeusnek.bartworks.util.Pair; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Materials; @@ -42,7 +44,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.StatCollector; -import net.minecraftforge.oredict.OreDictionary; import java.util.List; @@ -71,7 +72,10 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item { continue; GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(tStack) + ".name", this.getDefaultLocalization(w)); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(tStack) + ".tooltip", w.getToolTip()); - GT_OreDictUnificator.registerOre(this.orePrefixes.name() + w.getDefaultName().replaceAll(" ",""), tStack); + if (ConfigHandler.experimentalThreadedLoader) + OreDictAdder.addToMap(new Pair<>(this.orePrefixes.name() + w.getDefaultName().replaceAll(" ",""), tStack)); + else + GT_OreDictUnificator.registerOre(this.orePrefixes.name() + w.getDefaultName().replaceAll(" ",""), tStack); } } 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 d34fd03818..bb3bea4915 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 @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.bartworks.system.material; import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.system.oredict.OreDictAdder; import cpw.mods.fml.common.FMLCommonHandler; import java.util.ArrayList; @@ -40,6 +41,7 @@ public class ThreadedLoader implements Runnable { MainMod.LOGGER.info("Starting to register BartWorks Materials Recipes to Gregtech"); threads.add(new AllRecipes()); threads.forEach(Thread::start); + } public synchronized void runInit() { @@ -57,9 +59,11 @@ public class ThreadedLoader implements Runnable { } } MainMod.LOGGER.info("Successfully joined the Material Generation Thread, Registering the Items/Blocks to the GameRegistry"); + if ((WerkstoffLoader.toGenerateGlobal) != 0){ + OreDictAdder.addToOreDict(); + } 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 7256b12a43..e5848f2789 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 @@ -28,6 +28,8 @@ 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.system.oredict.OreDictAdder; +import com.github.bartimaeusnek.bartworks.system.oredict.OreDictHandler; import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; import com.github.bartimaeusnek.bartworks.util.Pair; import com.github.bartimaeusnek.crossmod.thaumcraft.util.ThaumcraftHandler; @@ -607,14 +609,25 @@ public class WerkstoffLoader implements Runnable { } private void runAdditionalOreDict(){ - for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { - if (werkstoff.getGenerationFeatures().hasOres()) - GT_OreDictUnificator.registerOre(ore + werkstoff.getDefaultName().replaceAll(" ",""), werkstoff.get(ore)); - if (werkstoff.getGenerationFeatures().hasGems()) - OreDictionary.registerOre("craftingLens" + BW_ColorUtil.getDyeFromColor(werkstoff.getRGBA()).mName.replace(" ", ""), werkstoff.get(lens)); - } + if (ConfigHandler.experimentalThreadedLoader){ + for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { + if (werkstoff.getGenerationFeatures().hasOres()) + OreDictAdder.addToMap(new Pair<>(ore + werkstoff.getDefaultName().replaceAll(" ", ""), werkstoff.get(ore))); + if (werkstoff.getGenerationFeatures().hasGems()) + OreDictAdder.addToMap(new Pair<>("craftingLens" + BW_ColorUtil.getDyeFromColor(werkstoff.getRGBA()).mName.replace(" ", ""), werkstoff.get(lens))); + } - GT_OreDictUnificator.registerOre("craftingIndustrialDiamond", WerkstoffLoader.Zirconia.get(gemExquisite)); + OreDictAdder.addToMap(new Pair<>("craftingIndustrialDiamond", WerkstoffLoader.Zirconia.get(gemExquisite))); + }else { + for (Werkstoff werkstoff : Werkstoff.werkstoffHashSet) { + if (werkstoff.getGenerationFeatures().hasOres()) + GT_OreDictUnificator.registerOre(ore + werkstoff.getDefaultName().replaceAll(" ", ""), werkstoff.get(ore)); + if (werkstoff.getGenerationFeatures().hasGems()) + OreDictionary.registerOre("craftingLens" + BW_ColorUtil.getDyeFromColor(werkstoff.getRGBA()).mName.replace(" ", ""), werkstoff.get(lens)); + } + + GT_OreDictUnificator.registerOre("craftingIndustrialDiamond", WerkstoffLoader.Zirconia.get(gemExquisite)); + } } private void addGemRecipes(Werkstoff werkstoff) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oredict/OreDictAdder.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oredict/OreDictAdder.java new file mode 100644 index 0000000000..25e3598df0 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oredict/OreDictAdder.java @@ -0,0 +1,51 @@ +/* + * 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.oredict; + +import com.github.bartimaeusnek.bartworks.util.Pair; +import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.item.ItemStack; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class OreDictAdder { + + private static ConcurrentHashMap<String, ItemStack> toAddMap = new ConcurrentHashMap<>(); + + public static synchronized void addToMap(Pair<String, ItemStack> element){ + OreDictAdder.toAddMap.put(element.getKey(),element.getValue()); + } + + public static synchronized void addToMap(Pair<String, ItemStack>... elements){ + for (Pair<String, ItemStack> p : elements) + OreDictAdder.toAddMap.put(p.getKey(),p.getValue()); + } + + public static void addToOreDict(){ + for (Map.Entry<String, ItemStack> entry: toAddMap.entrySet()){ + GT_OreDictUnificator.registerOre(entry.getKey(),entry.getValue()); + } + } + +}
\ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/OreDictHandler.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oredict/OreDictHandler.java index 0715d00a90..e86d55acce 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/OreDictHandler.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oredict/OreDictHandler.java @@ -20,7 +20,7 @@ * SOFTWARE. */ -package com.github.bartimaeusnek.bartworks.system.material; +package com.github.bartimaeusnek.bartworks.system.oredict; import gregtech.api.enums.OrePrefixes; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java index 92f42ad9e0..d5d13aea13 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java @@ -23,15 +23,12 @@ package com.github.bartimaeusnek.bartworks.system.oregen; import com.github.bartimaeusnek.bartworks.MainMod; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE; import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; -import com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.interfaces.ISubTagContainer; import gregtech.api.world.GT_Worldgen; -import gregtech.common.blocks.GT_Block_Ores; import gregtech.common.blocks.GT_TileEntity_Ores; import net.minecraft.block.Block; import net.minecraft.init.Blocks; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java index a1535ff8f5..95a69f00b0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WorldGenRoss128b.java @@ -63,7 +63,6 @@ public class BW_WorldGenRoss128b extends BW_OreLayer { uo_dimensionList.SetConfigValues(ross128b, ross128b, "veryheavyoil", "liquid_extra_heavy_oil", 0, 625, 40, 5); uo_dimensionList.SetConfigValues(ross128b, ross128b, "lava", FluidRegistry.getFluidName(FluidRegistry.LAVA), 0, 32767, 5, 5); uo_dimensionList.SetConfigValues(ross128b, ross128b, "gas_natural_gas", "gas_natural_gas", 0, 625, 65, 5); - } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksChecker.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksChecker.java index e1502041ed..1a0f189fd7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksChecker.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksChecker.java @@ -29,22 +29,17 @@ import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import java.util.HashSet; +import java.util.LinkedHashSet; public class ConnectedBlocksChecker { - public final HashSet<Coords> hashset = new HashSet<Coords>(); + public final HashSet<Coords> hashset = new HashSet<Coords>(2048); public static byte check_sourroundings(Coords C, Block b) { byte ret = 0; World w = DimensionManager.getWorld(C.wID); int x = C.x, y = C.y, z = C.z; - if (w.getBlock(x, y + 1, z).equals(b)) - ret = (byte) (ret | 0b000001); - - if (w.getBlock(x, y - 1, z).equals(b)) - ret = (byte) (ret | 0b000010); - if (w.getBlock(x + 1, y, z).equals(b)) ret = (byte) (ret | 0b000100); @@ -57,6 +52,13 @@ public class ConnectedBlocksChecker { if (w.getBlock(x, y, z - 1).equals(b)) ret = (byte) (ret | 0b100000); + if (w.getBlock(x, y + 1, z).equals(b)) + ret = (byte) (ret | 0b000001); + + if (w.getBlock(x, y - 1, z).equals(b)) + ret = (byte) (ret | 0b000010); + + return ret; } @@ -67,16 +69,6 @@ public class ConnectedBlocksChecker { byte sides = check_sourroundings(w, x, y, z, b); - if (((sides | 0b111110) == 0b111111) && !hashset.contains(new Coords(x, y + 1, z, wID))) { - ret++; - ret += get_connected(w, x, y + 1, z, b); - } - - if (((sides | 0b111101) == 0b111111) && !hashset.contains(new Coords(x, y - 1, z, wID))) { - ret++; - ret += get_connected(w, x, y - 1, z, b); - } - if (((sides | 0b111011) == 0b111111) && !hashset.contains(new Coords(x + 1, y, z, wID))) { ret++; ret += get_connected(w, x + 1, y, z, b); @@ -97,6 +89,17 @@ public class ConnectedBlocksChecker { ret += get_connected(w, x, y, z - 1, b); } + + if (((sides | 0b111110) == 0b111111) && !hashset.contains(new Coords(x, y + 1, z, wID))) { + ret++; + ret += get_connected(w, x, y + 1, z, b); + } + + if (((sides | 0b111101) == 0b111111) && !hashset.contains(new Coords(x, y - 1, z, wID))) { + ret++; + ret += get_connected(w, x, y - 1, z, b); + } + return ret; } @@ -110,12 +113,6 @@ public class ConnectedBlocksChecker { hashset.add(new Coords(x, y, z, wID)); - if (w.getBlock(x, y + 1, z).equals(b)) - ret = (byte) (ret | 0b000001); - - if (w.getBlock(x, y - 1, z).equals(b)) - ret = (byte) (ret | 0b000010); - if (w.getBlock(x + 1, y, z).equals(b)) ret = (byte) (ret | 0b000100); @@ -128,6 +125,12 @@ public class ConnectedBlocksChecker { if (w.getBlock(x, y, z - 1).equals(b)) ret = (byte) (ret | 0b100000); + if (w.getBlock(x, y + 1, z).equals(b)) + ret = (byte) (ret | 0b000001); + + if (w.getBlock(x, y - 1, z).equals(b)) + ret = (byte) (ret | 0b000010); + return ret; } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksCheckerIteration.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksCheckerIteration.java new file mode 100644 index 0000000000..707b374888 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/ConnectedBlocksCheckerIteration.java @@ -0,0 +1,143 @@ +/* + * 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.util; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Queue; + + +/** + * This implementation is for some reason slower than the Recursive Check.... + * For ~3400 blocks this takes 8ms, the Recursive Check 5ms. + */ +public class ConnectedBlocksCheckerIteration { + + public final HashSet<Coords> hashset = new HashSet<Coords>(2048); + public final HashSet<Coords> checked = new HashSet<Coords>(4096); + private final Queue<Coords> kwoe = new LinkedList<Coords>(); + + public long get_connected(World w, int x, int y, int z, Block b){ + kwoe.add(new Coords(x,y,z,w.provider.dimensionId)); + hashset.add(new Coords(x,y,z,w.provider.dimensionId)); + while (!kwoe.isEmpty()){ + Coords tocheck = kwoe.poll(); + int wID = w.provider.dimensionId; + checked.add(tocheck); + Coords c; + if (!checked.contains(c = new Coords(tocheck.x + 1, tocheck.y, tocheck.z, wID)) && w.getBlock(tocheck.x + 1, tocheck.y, tocheck.z).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x - 1, tocheck.y, tocheck.z, wID)) && w.getBlock(tocheck.x - 1, tocheck.y, tocheck.z).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x, tocheck.y, tocheck.z + 1, wID)) && w.getBlock(tocheck.x, tocheck.y, tocheck.z + 1).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x, tocheck.y, tocheck.z - 1, wID)) && w.getBlock(tocheck.x, tocheck.y, tocheck.z - 1).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x, tocheck.y + 1, tocheck.z, wID)) && w.getBlock(tocheck.x, tocheck.y + 1, tocheck.z).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + if (!checked.contains(c = new Coords(tocheck.x, tocheck.y - 1, tocheck.z, wID)) && w.getBlock(tocheck.x, tocheck.y - 1, tocheck.z).equals(b)) { + kwoe.add(c); + hashset.add(c); + } + } + return hashset.size(); + } + + public boolean get_meta_of_sideblocks(World w, int n, int[] xyz, boolean GT) { + + int wID = w.provider.dimensionId; + Coords Controller = new Coords(xyz[0], xyz[1], xyz[2], wID); + + for (Coords C : hashset) { + if (GT) { + TileEntity t; + t = w.getTileEntity(C.x, C.y + 1, C.z); + if (t != null && !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x, C.y - 1, C.z); + if (t != null && !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x + 1, C.y, C.z); + if (t != null && !new Coords(C.x + 1, C.y, C.z, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x - 1, C.y, C.z); + if (t != null && !new Coords(C.x - 1, C.y, C.z, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x, C.y, C.z + 1); + if (t != null && !new Coords(C.x, C.y, C.z + 1, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + t = w.getTileEntity(C.x, C.y, C.z - 1); + if (t != null && !new Coords(C.x, C.y, C.z - 1, wID).equals(Controller)) { + if (t instanceof IGregTechTileEntity) + if (((IGregTechTileEntity) t).getMetaTileID() == n) + return true; + } + } else { + if (n == w.getBlockMetadata(C.x, C.y + 1, C.z) && !new Coords(C.x, C.y + 1, C.z, wID).equals(Controller)) + return true; + if (n == w.getBlockMetadata(C.x, C.y - 1, C.z) && !new Coords(C.x, C.y - 1, C.z, wID).equals(Controller)) + return true; + if (n == w.getBlockMetadata(C.x + 1, C.y, C.z) && !new Coords(C.x + 1, C.y, C.z, wID).equals(Controller)) + return true; + if (n == w.getBlockMetadata(C.x - 1, C.y, C.z) && !new Coords(C.x - 1, C.y, C.z, wID).equals(Controller)) + return true; + if (n == w.getBlockMetadata(C.x, C.y, C.z + 1) && !new Coords(C.x, C.y, C.z + 1, wID).equals(Controller)) + return true; + if (n == w.getBlockMetadata(C.x, C.y, C.z - 1) && !new Coords(C.x, C.y, C.z - 1, wID).equals(Controller)) + return true; + } + } + return false; + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/Coords.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/Coords.java index f285b7b6e2..c27054eb01 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/Coords.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/Coords.java @@ -55,20 +55,20 @@ public class Coords { @Override public int hashCode() { byte[] data = new byte[14]; - data[0] = (byte) (this.x & 0b1111); - data[1] = (byte) (this.x >> 4 & 0b1111); - data[2] = (byte) (this.x >> 8 & 0b1111); - data[3] = (byte) (this.x >> 12 & 0b1111); - data[4] = (byte) (this.y & 0b1111); - data[5] = (byte) (this.y >> 4 & 0b1111); - data[6] = (byte) (this.z & 0b1111); - data[7] = (byte) (this.z >> 4 & 0b1111); - data[8] = (byte) (this.z >> 8 & 0b1111); - data[9] = (byte) (this.z >> 12 & 0b1111); - data[10] = (byte) (this.wID & 0b1111); - data[11] = (byte) (this.wID >> 4 & 0b1111); - data[12] = (byte) (this.wID >> 8 & 0b1111); - data[13] = (byte) (this.wID >> 12 & 0b1111); + data[0] = (byte) (this.x & 0xff); + data[1] = (byte) (this.x >> 4 & 0xff); + data[2] = (byte) (this.x >> 8 & 0xff); + data[3] = (byte) (this.x >> 12 & 0xff); + data[4] = (byte) (this.y & 0xff); + data[5] = (byte) (this.y >> 4 & 0xff); + data[6] = (byte) (this.z & 0xff); + data[7] = (byte) (this.z >> 4 & 0xff); + data[8] = (byte) (this.z >> 8 & 0xff); + data[9] = (byte) (this.z >> 12 & 0xff); + data[10] = (byte) (this.wID & 0xff); + data[11] = (byte) (this.wID >> 4 & 0xff); + data[12] = (byte) (this.wID >> 8 & 0xff); + data[13] = (byte) (this.wID >> 12 & 0xff); return MurmurHash3.murmurhash3_x86_32(data, 0, 14, 31); } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java index da78891b8c..65fbb0f6a7 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java @@ -28,6 +28,7 @@ import com.github.bartimaeusnek.crossmod.thaumcraft.CustomAspects; 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.FMLServerStartingEvent; import org.apache.logging.log4j.LogManager; @@ -38,7 +39,9 @@ import org.apache.logging.log4j.Logger; dependencies = "required-after:IC2; " + "required-after:gregtech; " + "required-after:bartworks;" - + "after:GalacticraftCore;" + + "after:GalacticraftMars; " + + "after:GalacticraftCore; " + + "after:Micdoodlecore; " ) public class BartWorksCrossmod { public static final String NAME = "BartWorks Mod Additions"; @@ -64,6 +67,13 @@ public class BartWorksCrossmod { } @Mod.EventHandler + public void postInit(FMLPostInitializationEvent init) { + if (Loader.isModLoaded("GalacticraftCore")) + GalacticraftProxy.postInit(init); + } + + + @Mod.EventHandler public void onFMLServerStart(FMLServerStartingEvent event) { event.registerServerCommand(new SummonRuin()); } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java index a8c9a218b1..2c126759b8 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/GalacticraftProxy.java @@ -26,6 +26,7 @@ import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.crossmod.galacticraft.solarsystems.Ross128SolarSystem; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import gregtech.api.objects.GT_UO_DimensionList; import net.minecraftforge.common.config.Configuration; @@ -41,6 +42,15 @@ public class GalacticraftProxy { private GalacticraftProxy() { } + public static void postInit(FMLPostInitializationEvent e){ + if (FMLCommonHandler.instance().getSide().isServer() || FMLCommonHandler.instance().getEffectiveSide().isServer()) { + GalacticraftProxy.serverPostInit(e); + } else { + GalacticraftProxy.clientPostInit(e); + } + GalacticraftProxy.commonPostInit(e); + } + public static void preInit(FMLPreInitializationEvent e) { if (FMLCommonHandler.instance().getSide().isServer() || FMLCommonHandler.instance().getEffectiveSide().isServer()) { GalacticraftProxy.serverpreInit(e); @@ -87,4 +97,15 @@ public class GalacticraftProxy { if (ConfigHandler.Ross128Enabled) Ross128SolarSystem.init(); } + private static void serverPostInit(FMLPostInitializationEvent e) { + + } + + private static void clientPostInit(FMLPostInitializationEvent e) { + + } + + private static void commonPostInit(FMLPostInitializationEvent e) { + + } } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java index c3b87bf15c..988920cae6 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/AbstractWorldProviderSpace.java @@ -33,6 +33,11 @@ public abstract class AbstractWorldProviderSpace extends WorldProviderSpace impl } @Override + public String getDimensionName() { + return this.getCelestialBody().getLocalizedName(); + } + + @Override public boolean hasSunset() { return true; } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java index 24c8e8573e..d575bd7dd8 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java @@ -23,11 +23,9 @@ package com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128b; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; -import micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld; import net.minecraft.util.ResourceLocation; -public class SkyProviderRoss128b extends SkyProviderOverworld { - +public class SkyProviderRoss128b { //ASM enables this texture public static final ResourceLocation sunTex = new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/World/SunRoss128.png"); } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128Ba.java index c28374d2ca..eeb306018c 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/planets/ross128ba/WorldProviderRoss128Ba.java @@ -30,7 +30,7 @@ import micdoodle8.mods.galacticraft.core.world.gen.WorldChunkManagerMoon; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.chunk.IChunkProvider; -public class WorldProviderRoss128ba extends AbstractWorldProviderSpace { +public class WorldProviderRoss128Ba extends AbstractWorldProviderSpace { @Override public Vector3 getFogColor() { return new Vector3(0,0,0); diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java index 5035090c2e..7f9befe058 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/solarsystems/Ross128SolarSystem.java @@ -26,13 +26,16 @@ import com.github.bartimaeusnek.bartworks.common.configs.ConfigHandler; import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; import com.github.bartimaeusnek.crossmod.galacticraft.UniversalTeleportType; import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128b.WorldProviderRoss128b; -import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba.WorldProviderRoss128ba; +import com.github.bartimaeusnek.crossmod.galacticraft.planets.ross128ba.WorldProviderRoss128Ba; import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; import micdoodle8.mods.galacticraft.api.GalacticraftRegistry; import micdoodle8.mods.galacticraft.api.galaxies.*; import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.IAtmosphericGas; +import micdoodle8.mods.galacticraft.core.GalacticraftCore; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.DimensionManager; import java.util.Arrays; @@ -62,21 +65,23 @@ public class Ross128SolarSystem { Ross128SolarSystem.Ross128b.setRelativeOrbitTime(0.65F); Ross128SolarSystem.Ross128b.atmosphere.addAll(Arrays.asList(IAtmosphericGas.OXYGEN, IAtmosphericGas.NITROGEN, IAtmosphericGas.ARGON)); Ross128SolarSystem.Ross128b.setDimensionInfo(ConfigHandler.ross128BID, WorldProviderRoss128b.class); - Ross128SolarSystem.Ross128b.setTierRequired(Loader.isModLoaded("galaxyspace") ? 4 : Loader.isModLoaded("GalacticraftMars") ? 3 : -1); + Ross128SolarSystem.Ross128b.setTierRequired(3); Ross128SolarSystem.Ross128ba = new Moon("Ross128ba").setParentPlanet(Ross128SolarSystem.Ross128b); Ross128SolarSystem.Ross128ba.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(10f, 15f)).setRelativeOrbitTime(1 / 0.01F); Ross128SolarSystem.Ross128ba.setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/MapObjs/Ross128ba.png")); - Ross128SolarSystem.Ross128ba.setDimensionInfo(ConfigHandler.ross128BAID, WorldProviderRoss128ba.class); - Ross128SolarSystem.Ross128ba.setTierRequired(Loader.isModLoaded("galaxyspace") ? 5 : Loader.isModLoaded("GalacticraftMars") ? 3 : -1); +// Ross128SolarSystem.Ross128ba.setDimensionInfo(ConfigHandler.ross128BAID, WorldProviderRoss128Ba.class); + Ross128SolarSystem.Ross128ba.setTierRequired(Loader.isModLoaded("galaxyspace") ? 4 : 3); Ross128SolarSystem.Ross128ba.setUnreachable(); GalaxyRegistry.registerPlanet(Ross128SolarSystem.Ross128b); GalaxyRegistry.registerMoon(Ross128SolarSystem.Ross128ba); GalaxyRegistry.registerSolarSystem(Ross128SolarSystem.Ross128System); + GalacticraftRegistry.registerRocketGui(WorldProviderRoss128b.class, new ResourceLocation(GalacticraftCore.ASSET_PREFIX, "textures/gui/overworldRocketGui.png")); +// GalacticraftRegistry.registerRocketGui(WorldProviderRoss128Ba.class, new ResourceLocation(GalacticraftCore.ASSET_PREFIX, "textures/gui/moonRocketGui.png")); GalacticraftRegistry.registerTeleportType(WorldProviderRoss128b.class, new UniversalTeleportType()); - GalacticraftRegistry.registerTeleportType(WorldProviderRoss128ba.class, new UniversalTeleportType()); +// GalacticraftRegistry.registerTeleportType(WorldProviderRoss128Ba.class, new UniversalTeleportType()); } } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/openComputers/GT_NBT_DataBase.java b/src/main/java/com/github/bartimaeusnek/crossmod/openComputers/GT_NBT_DataBase.java new file mode 100644 index 0000000000..4974a5725d --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/openComputers/GT_NBT_DataBase.java @@ -0,0 +1,88 @@ +/* + * 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.crossmod.openComputers; + +import net.minecraft.nbt.NBTTagCompound; + +import java.util.HashMap; + +public class GT_NBT_DataBase { + + private static HashMap<NBTTagCompound, Long> tagToIdMap = new HashMap<>(); + + private static long maxID = Long.MIN_VALUE+1; + + private final NBTTagCompound tagCompound; + + private final String mDataName; + private final String mDataTitle; + private long id; + + GT_NBT_DataBase(String mDataName, String mDataTitle, NBTTagCompound tagCompound) { + this.mDataName = mDataName; + this.mDataTitle = mDataTitle; + this.tagCompound = tagCompound; + this.id = GT_NBT_DataBase.maxID; + GT_NBT_DataBase.tagToIdMap.put(tagCompound,id); + ++GT_NBT_DataBase.maxID; + } + + static Long getIdFromTag(NBTTagCompound tagCompound){ + return GT_NBT_DataBase.tagToIdMap.get(tagCompound); + } + + public NBTTagCompound getTagCompound() { + return this.tagCompound; + } + + public String getmDataName() { + return this.mDataName; + } + + static long getMaxID() { + return GT_NBT_DataBase.maxID; + } + + public String getmDataTitle() { + return this.mDataTitle; + } + + public long getId() { + return this.id; + } + + public void setId(long id) { + this.id = id; + } + + private GT_NBT_DataBase(NBTTagCompound tagCompound, String mDataName, String mDataTitle, long id) { + this.tagCompound = tagCompound; + this.mDataName = mDataName; + this.mDataTitle = mDataTitle; + this.id = id; + } + + public static GT_NBT_DataBase makeNewWithoutRegister(String mDataName, String mDataTitle, NBTTagCompound tagCompound){ + return new GT_NBT_DataBase(tagCompound,mDataName,mDataTitle,Long.MIN_VALUE); + } +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/openComputers/TileEntity_GTDataServer.java b/src/main/java/com/github/bartimaeusnek/crossmod/openComputers/TileEntity_GTDataServer.java new file mode 100644 index 0000000000..635ceb9fee --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/openComputers/TileEntity_GTDataServer.java @@ -0,0 +1,122 @@ +/* + * 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.crossmod.openComputers; + +import com.github.bartimaeusnek.bartworks.API.ITileAddsInformation; +import com.github.bartimaeusnek.bartworks.API.ITileHasDifferentTextureSides; +import com.github.bartimaeusnek.bartworks.API.ITileWithGUI; +import cpw.mods.fml.common.FMLCommonHandler; +import gregtech.api.enums.ItemList; +import gregtech.api.util.GT_Utility; +import gregtech.common.items.behaviors.Behaviour_DataOrb; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import java.util.HashMap; + +//@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers") +public class TileEntity_GTDataServer extends TileEntity implements ITileWithGUI, ITileAddsInformation, ITileHasDifferentTextureSides/*, SimpleComponent*/ { + + private static HashMap<Long,GT_NBT_DataBase> OrbDataBase = new HashMap<>(); + + private ItemStack[] mItems = new ItemStack[2]; + + + private byte TickTimer = 0; + + public String getComponentName() { + return "GT-Data Server"; + } + +// @Callback +// @Optional.Method(modid = "OpenComputers") +// public Object[] listData(Context context, Arguments args) { +// return new String[] +// } + + private boolean isServerSide(){ + return !this.worldObj.isRemote || FMLCommonHandler.instance().getSide().isServer(); + } + + + @Override + public void updateEntity() { + if (this.TickTimer++ % 20 != 0) + return; + + if (this.isServerSide()) { + if (GT_Utility.areStacksEqual(this.mItems[0],ItemList.Tool_DataOrb.get(1))) { + if (this.mItems[0].hasTagCompound()) { + if (GT_NBT_DataBase.getIdFromTag(this.mItems[0].getTagCompound()) == null) { + TileEntity_GTDataServer.OrbDataBase.put( + GT_NBT_DataBase.getMaxID(), + new GT_NBT_DataBase( + Behaviour_DataOrb.getDataName(this.mItems[0]), + Behaviour_DataOrb.getDataTitle(this.mItems[0]), + this.mItems[0].getTagCompound() + ) + ); + } + } + } + if (GT_Utility.areStacksEqual(this.mItems[0],ItemList.Tool_DataStick.get(1))) { + if (this.mItems[0].hasTagCompound()) { + + String bookTitle = GT_Utility.ItemNBT.getBookTitle(this.mItems[0]); + String punchcardData = GT_Utility.ItemNBT.getPunchCardData(this.mItems[0]); + short mapID = GT_Utility.ItemNBT.getMapID(this.mItems[0]); + byte data = (byte) (bookTitle.isEmpty() ? punchcardData.isEmpty() ? mapID != -1 ? 3 : -1 : 2 : 1); + + String title = data == 1 ? bookTitle : data == 2 ? punchcardData : data == 3 ? ""+mapID : "Custom Data"; + String name = data == 1 ? "eBook" : data == 2 ? "Punch Card Data" : data == 3 ? "Map Data" : "Custom Data"; + if (GT_NBT_DataBase.getIdFromTag(this.mItems[0].getTagCompound()) == null) { + TileEntity_GTDataServer.OrbDataBase.put( + GT_NBT_DataBase.getMaxID(), + new GT_NBT_DataBase( + name, + title, + this.mItems[0].getTagCompound() + ) + ); + } + } + } + } + } + + @Override + public String[] getInfoData() { + return new String[0]; + } + + @Override + public void registerBlockIcons(IIconRegister par1IconRegister) { + + } + + @Override + public int getGUIID() { + return 0; + } +} diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index d035c87472..0388c0cb46 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -144,7 +144,7 @@ tile.radiohatch.name=Radio Hatch tile.bw.windmill.name=Windmill tile.manutrafo.name=Manual Trafo -tooltip.tile.htr.0.name=Controller Block for the Thorium High Temperature Reactor;Size(WxHxD): 9x12x9 (Hollow);Corners and the 2 touching blocks are air;Once build, Helium is inserted into the Fluid Input Hatch until it doesnt accept any more;1+ Output Hatch (Any Bottom casing);1+ Input Hatch (Any Top casing);1+ Input Bus (Any Top casing);1x Maintenance Hatch (Any casing);Raidation Proof Casings for the Rest;Needs a constant supply of coolant or will shut down;Needs at least 100k Fuel pebbles to start operation (can hold up to 675k pebbles);Consumes 1 Fuel Pellet per Operation;TRISO pebbles provide 30% more Energy;Each pebble increases the amount of converted coolant;One Operation takes 27 Ingame Days +tooltip.tile.htr.0.name=Controller Block for the Thorium High Temperature Reactor;Size(WxHxD): 11x12x11 (Hollow);Controller: Front Center, Lowest Layer;Corners and the 2 touching blocks are air;Once build, Helium is inserted into the Fluid Input Hatch until it doesnt accept any more;1+ Output Hatch (Any Bottom casing);1+ Input Hatch (Any Top casing);1+ Input Bus (Any Top casing);1x Maintenance Hatch (Any casing);Raidation Proof Casings for the Rest;Needs a constant supply of coolant while running, will output after complete Operation;Needs at least 100k Fuel pebbles to start operation (can hold up to 675k pebbles);Consumes 1 Fuel Pellet per Operation;TRISO pebbles provide 30% more Energy;Each pebble increases the amount of converted coolant;One Operation takes 27 Ingame Days item.TRISOPellet.name=TRISO pebble item.TRISOPelletBall.name=TRISO pebble ball item.BISOPelletBall.name=BISO pebble ball @@ -153,6 +153,9 @@ item.TRISOPelletCompound.name=TRISO pebble compund item.BISOPelletCompound.name=BISO pebble compund itemGroup.bartworksMetaMaterials=BartWorks' Meta Materials +tooltip.tile.eic.0.name=Controller Block for the Electric Implosion Compressor;Size(WxHxD): 3x9x3;Uses Electricity instead of Explosives;Controller: Layer 3, front, center;Layer 1 and Layer 9: Solid Steel Machine Casings, each: 1 Energy Hatch in the middle;Layer 2,3,7,8: Middle: Nickel-Zinc-Ferrit Blocks, Outer: Transformer-Winding Blocks;Layer 4,5,6: Neutronium Blocks;1+ Input Bus, 1+ Output Bus, 1 Maintenance Hatch at any Solid Steel Machine Casing;Do NOT Obstruct or mine the Moving parts while in Operation, will explode if you do so! + + planet.Ross128b=Ross128b moon.Ross128ba=Ross128ba star.Ross128=Ross128 |