aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/bwcrossmod
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/bwcrossmod')
-rw-r--r--src/main/java/bwcrossmod/BartWorksCrossmod.java89
-rw-r--r--src/main/java/bwcrossmod/GTpp/loader/RadioHatchCompat.java284
-rw-r--r--src/main/java/bwcrossmod/cls/CLSCompat.java104
-rw-r--r--src/main/java/bwcrossmod/galacticgreg/MTEVoidMinerBase.java309
-rw-r--r--src/main/java/bwcrossmod/galacticgreg/MTEVoidMiners.java115
-rw-r--r--src/main/java/bwcrossmod/galacticgreg/VoidMinerUtility.java275
-rw-r--r--src/main/java/bwcrossmod/galacticraft/GalacticraftProxy.java82
-rw-r--r--src/main/java/bwcrossmod/galacticraft/PlanetsHelperClass.java33
-rw-r--r--src/main/java/bwcrossmod/galacticraft/UniversalTeleportType.java78
-rw-r--r--src/main/java/bwcrossmod/galacticraft/atmosphere/BWAtmosphereManager.java121
-rw-r--r--src/main/java/bwcrossmod/galacticraft/planets/AbstractWorldProviderSpace.java37
-rw-r--r--src/main/java/bwcrossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java185
-rw-r--r--src/main/java/bwcrossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java25
-rw-r--r--src/main/java/bwcrossmod/galacticraft/planets/ross128b/WorldProviderRoss128b.java154
-rw-r--r--src/main/java/bwcrossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java107
-rw-r--r--src/main/java/bwcrossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java112
-rw-r--r--src/main/java/bwcrossmod/galacticraft/solarsystems/Ross128SolarSystem.java91
-rw-r--r--src/main/java/bwcrossmod/openComputers/GTNBTDataBase.java97
-rw-r--r--src/main/java/bwcrossmod/openComputers/TileEntityGTDataServer.java202
-rw-r--r--src/main/java/bwcrossmod/tectech/TecTechResearchLoader.java88
-rw-r--r--src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaser.java120
-rw-r--r--src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaserBase.java155
-rw-r--r--src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserBox.java171
-rw-r--r--src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserDynamo.java76
-rw-r--r--src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserHatch.java60
-rw-r--r--src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserPipe.java162
-rw-r--r--src/main/java/bwcrossmod/tgregworks/MaterialsInjector.java81
-rw-r--r--src/main/java/bwcrossmod/thaumcraft/util/ThaumcraftHandler.java58
28 files changed, 3471 insertions, 0 deletions
diff --git a/src/main/java/bwcrossmod/BartWorksCrossmod.java b/src/main/java/bwcrossmod/BartWorksCrossmod.java
new file mode 100644
index 0000000000..e7e2ca44ed
--- /dev/null
+++ b/src/main/java/bwcrossmod/BartWorksCrossmod.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod;
+
+import static gregtech.api.enums.Mods.GalacticraftCore;
+
+import java.io.StringReader;
+
+import net.minecraft.util.StringTranslate;
+
+import org.apache.commons.io.input.ReaderInputStream;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import bwcrossmod.GTpp.loader.RadioHatchCompat;
+import bwcrossmod.galacticraft.GalacticraftProxy;
+import bwcrossmod.tectech.TecTechResearchLoader;
+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 gregtech.GT_Version;
+
+@Mod(
+ modid = BartWorksCrossmod.MOD_ID,
+ name = BartWorksCrossmod.NAME,
+ version = BartWorksCrossmod.VERSION,
+ dependencies = """
+ required-after:IC2;\
+ required-after:gregtech;\
+ required-after:bartworks;\
+ after:GalacticraftMars;\
+ after:GalacticraftCore;\
+ after:Micdoodlecore;\
+ after:miscutils;\
+ after:EMT;\
+ after:tectech;""")
+public class BartWorksCrossmod {
+
+ public static final String NAME = "BartWorks Mod Additions";
+ public static final String VERSION = GT_Version.VERSION;
+ public static final String MOD_ID = "bartworkscrossmod";
+ public static final Logger LOGGER = LogManager.getLogger(BartWorksCrossmod.NAME);
+
+ @Mod.Instance(BartWorksCrossmod.MOD_ID)
+ public static BartWorksCrossmod instance;
+
+ @Mod.EventHandler
+ public void preInit(FMLPreInitializationEvent preinit) {
+ if (GalacticraftCore.isModLoaded()) {
+ GalacticraftProxy.preInit(preinit);
+ }
+ }
+
+ @Mod.EventHandler
+ public void init(FMLInitializationEvent init) {
+ if (GalacticraftCore.isModLoaded()) {
+ GalacticraftProxy.init(init);
+ }
+ }
+
+ @Mod.EventHandler
+ public void postInit(FMLPostInitializationEvent init) {
+ if (GalacticraftCore.isModLoaded()) {
+ GalacticraftProxy.postInit(init);
+ }
+ RadioHatchCompat.run();
+ TecTechResearchLoader.runResearches();
+ }
+
+ @Mod.EventHandler
+ public void onFMLServerStart(FMLServerStartingEvent event) {
+ for (Object s : RadioHatchCompat.TranslateSet) {
+ StringTranslate.inject(new ReaderInputStream(new StringReader((String) s)));
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/GTpp/loader/RadioHatchCompat.java b/src/main/java/bwcrossmod/GTpp/loader/RadioHatchCompat.java
new file mode 100644
index 0000000000..b410ec7e3e
--- /dev/null
+++ b/src/main/java/bwcrossmod/GTpp/loader/RadioHatchCompat.java
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.GTpp.loader;
+
+import static gregtech.api.enums.Mods.GTPlusPlus;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.Set;
+
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.RegistryNamespaced;
+import net.minecraftforge.oredict.OreDictionary;
+
+import bartworks.API.IRadMaterial;
+import bartworks.util.log.DebugLog;
+import bwcrossmod.BartWorksCrossmod;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.ModContainer;
+import cpw.mods.fml.common.registry.GameData;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+public class RadioHatchCompat {
+
+ private static Class<?> intf;
+ private static Class<?> materialClass;
+ private static Class<?> enu;
+ private static Class<?> materialStackClass;
+
+ private static Field isRadioactive;
+ private static Field f;
+ private static Field componentType;
+ private static Field radlevel;
+ private static Field protons;
+
+ private static Field vMaterialInput;
+ private static Field stackMaterial;
+ private static Field RGBA;
+ private static Field localizedName;
+ private static Field unlocalizedName;
+
+ private static Object rod;
+ private static Object longRod;
+
+ public static HashSet<String> TranslateSet = new HashSet<>();
+
+ static {
+ try {
+ RadioHatchCompat.intf = Class.forName("gtPlusPlus.core.item.base.BaseItemComponent");
+ RadioHatchCompat.enu = Class.forName("gtPlusPlus.core.item.base.BaseItemComponent$ComponentTypes");
+ RadioHatchCompat.materialClass = Class.forName("gtPlusPlus.core.material.Material");
+ RadioHatchCompat.materialStackClass = Class.forName("gtPlusPlus.core.material.MaterialStack");
+
+ RadioHatchCompat.f = RadioHatchCompat.intf.getField("componentMaterial");
+ RadioHatchCompat.isRadioactive = RadioHatchCompat.materialClass.getField("isRadioactive");
+ RadioHatchCompat.componentType = RadioHatchCompat.intf.getDeclaredField("componentType");
+ RadioHatchCompat.radlevel = RadioHatchCompat.materialClass.getField("vRadiationLevel");
+
+ RadioHatchCompat.vMaterialInput = RadioHatchCompat.materialClass.getDeclaredField("vMaterialInput");
+ RadioHatchCompat.stackMaterial = RadioHatchCompat.materialStackClass.getDeclaredField("stackMaterial");
+ RadioHatchCompat.protons = RadioHatchCompat.materialClass.getDeclaredField("vProtons");
+ RadioHatchCompat.RGBA = RadioHatchCompat.materialClass.getDeclaredField("RGBA");
+ RadioHatchCompat.localizedName = RadioHatchCompat.materialClass.getDeclaredField("localizedName");
+ RadioHatchCompat.unlocalizedName = RadioHatchCompat.materialClass.getDeclaredField("unlocalizedName");
+
+ RadioHatchCompat.vMaterialInput.setAccessible(true);
+ RadioHatchCompat.stackMaterial.setAccessible(true);
+ RadioHatchCompat.protons.setAccessible(true);
+ RadioHatchCompat.RGBA.setAccessible(true);
+ RadioHatchCompat.localizedName.setAccessible(true);
+ RadioHatchCompat.unlocalizedName.setAccessible(true);
+
+ Object[] arr = RadioHatchCompat.enu.getEnumConstants();
+ for (Object o : arr) {
+ if (RadioHatchCompat.rod != null && RadioHatchCompat.longRod != null) break;
+ if ("ROD".equalsIgnoreCase(o.toString())) RadioHatchCompat.rod = o;
+ else if ("RODLONG".equalsIgnoreCase(o.toString())) RadioHatchCompat.longRod = o;
+ }
+
+ } catch (NoSuchFieldException | ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void run() {
+ DebugLog.log("Starting Generation of missing GT++ rods/longrods");
+ try {
+ Class<? extends Item> rodclass = (Class<? extends Item>) Class
+ .forName("gtPlusPlus.core.item.base.rods.BaseItemRod");
+ Class<? extends Item> longrodclass = (Class<? extends Item>) Class
+ .forName("gtPlusPlus.core.item.base.rods.BaseItemRodLong");
+ Constructor<? extends Item> c1 = rodclass.getConstructor(RadioHatchCompat.materialClass);
+ Constructor<? extends Item> c2 = longrodclass.getConstructor(RadioHatchCompat.materialClass);
+ Field cOwners = GameData.class.getDeclaredField("customOwners");
+ cOwners.setAccessible(true);
+ Field map = RegistryNamespaced.class.getDeclaredField("field_148758_b");
+ map.setAccessible(true);
+ Map<Item, String> UniqueIdentifierMap = (Map<Item, String>) map.get(GameData.getItemRegistry());
+
+ Map<GameRegistry.UniqueIdentifier, ModContainer> ownerItems = (Map<GameRegistry.UniqueIdentifier, ModContainer>) cOwners
+ .get(null);
+ ModContainer gtpp = null;
+ ModContainer bartworks = null;
+
+ for (ModContainer container : Loader.instance()
+ .getModList()) {
+ if (gtpp != null && bartworks != null) break;
+ if (BartWorksCrossmod.MOD_ID.equalsIgnoreCase(container.getModId())) bartworks = container;
+ else if (container.getModId()
+ .equalsIgnoreCase(GTPlusPlus.ID)) gtpp = container;
+ }
+
+ for (Object mats : (Set<?>) RadioHatchCompat.materialClass.getField("mMaterialMap")
+ .get(null)) {
+ if (RadioHatchCompat.isRadioactive.getBoolean(mats)) {
+
+ if (OreDictionary.getOres("stick" + RadioHatchCompat.unlocalizedName.get(mats))
+ .isEmpty()) {
+ Item it = c1.newInstance(mats);
+ UniqueIdentifierMap.replace(it, "miscutils:" + it.getUnlocalizedName());
+ GameRegistry.UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor(it);
+ ownerItems.replace(ui, bartworks, gtpp);
+
+ String tanslate = it.getUnlocalizedName() + ".name="
+ + RadioHatchCompat.localizedName.get(mats)
+ + " Rod";
+ RadioHatchCompat.TranslateSet.add(tanslate);
+
+ DebugLog.log(tanslate);
+ DebugLog.log("Generate: " + RadioHatchCompat.rod + RadioHatchCompat.unlocalizedName.get(mats));
+ }
+ if (OreDictionary.getOres("stickLong" + RadioHatchCompat.unlocalizedName.get(mats))
+ .isEmpty()) {
+ Item it2 = c2.newInstance(mats);
+ UniqueIdentifierMap.replace(it2, "miscutils:" + it2.getUnlocalizedName());
+ GameRegistry.UniqueIdentifier ui2 = GameRegistry.findUniqueIdentifierFor(it2);
+ ownerItems.replace(ui2, bartworks, gtpp);
+
+ DebugLog
+ .log("Generate: " + RadioHatchCompat.longRod + RadioHatchCompat.unlocalizedName.get(mats));
+ }
+ }
+ }
+ } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException
+ | InstantiationException | ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static IRadMaterial GTppRadChecker(ItemStack lStack) {
+ try {
+ if (RadioHatchCompat.intf.isAssignableFrom(
+ lStack.getItem()
+ .getClass())) {
+ if (!RadioHatchCompat.isRadioactive.getBoolean(RadioHatchCompat.f.get(lStack.getItem()))) return null;
+ int amount = RadioHatchCompat.componentType.get(lStack.getItem())
+ .equals(RadioHatchCompat.rod) ? 1
+ : RadioHatchCompat.componentType.get(lStack.getItem())
+ .equals(RadioHatchCompat.longRod) ? 2 : 0;
+ if (amount == 0) return null;
+ return new RadioHatchCompat.GTPPRadAdapter(amount, RadioHatchCompat.f.get(lStack.getItem()));
+ }
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ static class GTPPRadAdapter implements IRadMaterial {
+
+ static final HashMap<Object, Integer> BUFFER = new HashMap<>();
+
+ GTPPRadAdapter(Object m) {
+ this.m = m;
+ }
+
+ GTPPRadAdapter(int amount, Object m) {
+ this.amount = (byte) amount;
+ this.m = m;
+ }
+
+ byte amount;
+ final Object m;
+
+ private static ArrayList<?> getMaterialInput(Object GTPPMaterial) throws IllegalAccessException {
+ Object ret = RadioHatchCompat.vMaterialInput.get(GTPPMaterial);
+ return ret instanceof ArrayList ? (ArrayList<?>) ret : new ArrayList<>();
+ }
+
+ private static boolean isElement(Object GTPPMaterial) throws IllegalAccessException {
+ return RadioHatchCompat.GTPPRadAdapter.getMaterialInput(GTPPMaterial)
+ .isEmpty();
+ }
+
+ private static List<?> getElemets(Object GTPPMaterial) throws IllegalAccessException {
+ ArrayList<Object> elements = new ArrayList<>();
+ Queue<Object> toCheck = new LinkedList<>();
+ ArrayList<?> materialInputs = RadioHatchCompat.GTPPRadAdapter.getMaterialInput(GTPPMaterial);
+ if (materialInputs.isEmpty()) return Collections.singletonList(GTPPMaterial);
+ for (Object materialStack : materialInputs) {
+ if (!RadioHatchCompat.GTPPRadAdapter.isElement(RadioHatchCompat.stackMaterial.get(materialStack)))
+ toCheck.add(RadioHatchCompat.stackMaterial.get(materialStack));
+ else elements.add(RadioHatchCompat.stackMaterial.get(materialStack));
+ }
+ while (!toCheck.isEmpty()) {
+ elements.addAll(GTPPRadAdapter.getElemets(toCheck.poll()));
+ }
+ return elements;
+ }
+
+ private static Integer calulateRad(Object m) {
+ int ret = 0;
+ try {
+ List<?> pureElements = RadioHatchCompat.GTPPRadAdapter.getElemets(m);
+ for (Object materialObj : pureElements) if (RadioHatchCompat.isRadioactive.getBoolean(materialObj))
+ ret += RadioHatchCompat.radlevel.getByte(m)
+ + RadioHatchCompat.GTPPRadAdapter.clampToZero(RadioHatchCompat.protons.getLong(materialObj));
+ else ret += RadioHatchCompat.radlevel.getByte(m);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return ret;
+ }
+
+ @Override
+ public int getRadiationLevel(ItemStack aStack) {
+ return RadioHatchCompat.GTPPRadAdapter.BUFFER
+ .computeIfAbsent(this.m, radlvl -> RadioHatchCompat.GTPPRadAdapter.calulateRad(this.m));
+ }
+
+ private static long clampToZero(long number) {
+ return number > 0 ? number : 0;
+ }
+
+ @Override
+ public byte getAmountOfMaterial(ItemStack aStack) {
+ return this.amount;
+ }
+
+ @Override
+ public short[] getColorForGUI(ItemStack aStack) {
+ short[] rgba = { 0, 0, 0, 0 };
+ try {
+ rgba = (short[]) RadioHatchCompat.RGBA.get(this.m);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return rgba;
+ }
+
+ @Override
+ public String getNameForGUI(ItemStack aStack) {
+ String ret = "";
+ try {
+ ret = (String) RadioHatchCompat.localizedName.get(this.m);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return ret;
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/cls/CLSCompat.java b/src/main/java/bwcrossmod/cls/CLSCompat.java
new file mode 100644
index 0000000000..9cb9c6fc9c
--- /dev/null
+++ b/src/main/java/bwcrossmod/cls/CLSCompat.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.cls;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Optional;
+
+import bartworks.system.material.Werkstoff;
+
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class CLSCompat {
+
+ private CLSCompat() {}
+
+ private static final long MINIMAL_UPDATE_INTERVAL = 1000 / 30; // target 30 fps
+ private static long lastUpdate = 0;
+ private static Class alexiilMinecraftDisplayer;
+ private static Class alexiilProgressDisplayer;
+ private static Method displayProgress;
+ private static Field isRegisteringBartWorks;
+
+ static {
+ try {
+ alexiilMinecraftDisplayer = Class.forName("alexiil.mods.load.MinecraftDisplayer");
+ alexiilProgressDisplayer = Class.forName("alexiil.mods.load.ProgressDisplayer");
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+
+ Optional.ofNullable(alexiilMinecraftDisplayer)
+ .ifPresent(e -> {
+ try {
+ isRegisteringBartWorks = e.getField("isRegisteringBartWorks");
+ } catch (NoSuchFieldException ex) {
+ ex.printStackTrace();
+ }
+ });
+
+ Optional.ofNullable(alexiilProgressDisplayer)
+ .ifPresent(e -> {
+ try {
+ displayProgress = e.getMethod("displayProgress", String.class, float.class);
+ } catch (NoSuchMethodException ex) {
+ ex.printStackTrace();
+ }
+ });
+ }
+
+ public static Integer[] initCls() {
+ int sizeStep;
+ int sizeStep2 = 1;
+
+ try {
+ isRegisteringBartWorks.set(null, true);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ if (Werkstoff.werkstoffHashSet.size() >= 100) sizeStep = Werkstoff.werkstoffHashSet.size() / 100 - 1;
+ else sizeStep = sizeStep2 = Werkstoff.werkstoffHashSet.size();
+
+ return new Integer[] { sizeStep, sizeStep2, sizeStep };
+ }
+
+ public static int invokeStepSize(Werkstoff werkstoff, Integer[] steps, int size) {
+ --steps[0];
+
+ long time = System.currentTimeMillis();
+ if (time - lastUpdate >= MINIMAL_UPDATE_INTERVAL) {
+ try {
+ displayProgress.invoke(null, werkstoff.getDefaultName(), (float) size / 10000);
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ lastUpdate = time;
+ }
+
+ if (steps[0] == 0 && Werkstoff.werkstoffHashSet.size() >= 100) steps[0] = steps[2];
+
+ size += steps[1];
+ return size;
+ }
+
+ public static void disableCls() {
+ try {
+ isRegisteringBartWorks.set(null, false);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticgreg/MTEVoidMinerBase.java b/src/main/java/bwcrossmod/galacticgreg/MTEVoidMinerBase.java
new file mode 100644
index 0000000000..1eb6d8e312
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticgreg/MTEVoidMinerBase.java
@@ -0,0 +1,309 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticgreg;
+
+import static bartworks.util.BWTooltipReference.MULTIBLOCK_ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS;
+import static gregtech.api.enums.GTValues.VN;
+import static gregtech.api.enums.HatchElement.Energy;
+import static gregtech.api.enums.HatchElement.InputBus;
+import static gregtech.api.enums.HatchElement.InputHatch;
+import static gregtech.api.enums.HatchElement.Maintenance;
+import static gregtech.api.enums.HatchElement.OutputBus;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.gen.ChunkProviderServer;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+import com.google.common.collect.ImmutableList;
+
+import gregtech.api.enums.GTValues;
+import gregtech.api.interfaces.IHatchElement;
+import gregtech.api.objects.XSTR;
+import gregtech.api.util.GTUtility;
+import gregtech.api.util.MultiblockTooltipBuilder;
+import gregtech.api.util.shutdown.ShutDownReasonRegistry;
+import gregtech.common.tileentities.machines.multi.MTEDrillerBase;
+
+public abstract class MTEVoidMinerBase extends MTEDrillerBase {
+
+ private VoidMinerUtility.DropMap dropMap = null;
+ private VoidMinerUtility.DropMap extraDropMap = null;
+ private float totalWeight;
+ private int multiplier = 1;
+
+ protected final byte TIER_MULTIPLIER;
+
+ private boolean mBlacklist = false;
+
+ /**
+ * @Deprecated Use {@link VoidMinerUtility#addBlockToDimensionList}
+ */
+ @Deprecated
+ public static void addBlockToDimensionList(int dimId, Block block, int meta, float weight) {
+ VoidMinerUtility.addBlockToDimensionList(dimId, block, meta, weight);
+ }
+
+ public MTEVoidMinerBase(int aID, String aName, String aNameRegional, int tier) {
+ super(aID, aName, aNameRegional);
+ this.TIER_MULTIPLIER = (byte) Math.max(tier, 1);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mBlacklist", this.mBlacklist);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mBlacklist = aNBT.getBoolean("mBlacklist");
+ }
+
+ public MTEVoidMinerBase(String aName, int tier) {
+ super(aName);
+ this.TIER_MULTIPLIER = (byte) tier;
+ }
+
+ @Override
+ protected int getMinTier() {
+ return this.TIER_MULTIPLIER + 5; // min tier = LuV
+ }
+
+ @Override
+ protected boolean checkHatches() {
+ return true;
+ }
+
+ @Override
+ protected void setElectricityStats() {
+ try {
+ this.mEUt = this.isPickingPipes ? 60 : Math.toIntExact(GTValues.V[this.getMinTier()]);
+ } catch (ArithmeticException e) {
+ e.printStackTrace();
+ this.mEUt = Integer.MAX_VALUE - 7;
+ }
+ this.mOutputItems = new ItemStack[0];
+ this.mProgresstime = 0;
+ this.mMaxProgresstime = 10;
+ this.mEfficiency = this.getCurrentEfficiency(null);
+ this.mEfficiencyIncrease = 10000;
+ this.mEUt = this.mEUt > 0 ? -this.mEUt : this.mEUt;
+ }
+
+ @Override
+ protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe,
+ int yHead, int oldYHead) {
+ // if the dropMap has never been initialised or if the dropMap is empty
+ if (this.dropMap == null || this.totalWeight == 0) this.calculateDropMap();
+
+ if (this.totalWeight != 0.f) {
+ this.handleFluidConsumption();
+ this.handleOutputs();
+ return true;
+ } else {
+ this.stopMachine(ShutDownReasonRegistry.NONE);
+ return false;
+ }
+ }
+
+ @Override
+ protected MultiblockTooltipBuilder createTooltip() {
+ String casings = this.getCasingBlockItem()
+ .get(0)
+ .getDisplayName();
+
+ final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder();
+ tt.addMachineType("Miner")
+ .addInfo("Controller Block for the Void Miner " + GTValues.VN[this.getMinTier()])
+ .addInfo("Consumes " + GTValues.V[this.getMinTier()] + "EU/t")
+ .addInfo(
+ "Can be supplied with 2L/s of Neon(x4), Krypton(x8), Xenon(x16) or Oganesson(x64) for higher outputs.")
+ .addInfo(
+ "Will output " + 2 * this.TIER_MULTIPLIER
+ + " Ores per Second depending on the Dimension it is build in")
+ .addInfo("Put the Ore into the input bus to set the Whitelist/Blacklist")
+ .addInfo("Use a screwdriver to toggle Whitelist/Blacklist")
+ .addInfo(
+ "Blacklist or non Whitelist Ore will be " + EnumChatFormatting.DARK_RED
+ + "VOIDED"
+ + EnumChatFormatting.RESET
+ + ".")
+ .addSeparator()
+ .beginStructureBlock(3, 7, 3, false)
+ .addController("Front bottom")
+ .addOtherStructurePart(casings, "form the 3x1x3 Base")
+ .addOtherStructurePart(casings, "1x3x1 pillar above the center of the base (2 minimum total)")
+ .addOtherStructurePart(
+ this.getFrameMaterial().mName + " Frame Boxes",
+ "Each pillar's side and 1x3x1 on top")
+ .addEnergyHatch(VN[this.getMinTier()] + "+, Any base casing")
+ .addMaintenanceHatch("Any base casing")
+ .addInputBus("Mining Pipes or Ores, optional, any base casing")
+ .addInputHatch("Optional noble gas, any base casing")
+ .addOutputBus("Any base casing")
+ .toolTipFinisher(MULTIBLOCK_ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS);
+ return tt;
+ }
+
+ @Override
+ protected List<IHatchElement<? super MTEDrillerBase>> getAllowedHatches() {
+ return ImmutableList.of(InputHatch, InputBus, OutputBus, Maintenance, Energy);
+ }
+
+ /**
+ * method used to pick the next ore in the dropMap.
+ *
+ * @return the chosen ore
+ */
+ private ItemStack nextOre() {
+ float currentWeight = 0.f;
+ while (true) {
+ float randomNumber = XSTR.XSTR_INSTANCE.nextFloat() * this.totalWeight;
+ for (Map.Entry<GTUtility.ItemId, Float> entry : this.dropMap.getInternalMap()
+ .entrySet()) {
+ currentWeight += entry.getValue();
+ if (randomNumber < currentWeight) return entry.getKey()
+ .getItemStack();
+ }
+ for (Map.Entry<GTUtility.ItemId, Float> entry : this.extraDropMap.getInternalMap()
+ .entrySet()) {
+ currentWeight += entry.getValue();
+ if (randomNumber < currentWeight) return entry.getKey()
+ .getItemStack();
+ }
+ }
+ }
+
+ /**
+ * Method used to check the current gat and its corresponding multiplier
+ *
+ * @return the noble gas in the hatch. returns null if there is no noble gas found.
+ */
+ private FluidStack getNobleGasInputAndSetMultiplier() {
+ for (FluidStack s : this.getStoredFluids()) {
+ for (int i = 0; i < VoidMinerUtility.NOBLE_GASSES.length; i++) {
+ FluidStack ng = VoidMinerUtility.NOBLE_GASSES[i];
+ if (ng.isFluidEqual(s)) {
+ this.multiplier = this.TIER_MULTIPLIER * VoidMinerUtility.NOBEL_GASSES_MULTIPLIER[i];
+ return s;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * method used to decrement the quantity of gas in the hatch
+ *
+ * @param gasToConsume the fluid stack in the hatch
+ * @return if yes or no it was able to decrement the quantity of the fluidStack
+ */
+ private boolean consumeNobleGas(FluidStack gasToConsume) {
+ for (FluidStack s : this.getStoredFluids()) {
+ if (s.isFluidEqual(gasToConsume) && s.amount >= 1) {
+ s.amount -= 1;
+ this.updateSlots();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * handler for the fluid consumption
+ */
+ private void handleFluidConsumption() {
+ FluidStack storedNobleGas = this.getNobleGasInputAndSetMultiplier();
+ if (storedNobleGas == null || !this.consumeNobleGas(storedNobleGas)) this.multiplier = this.TIER_MULTIPLIER;
+ }
+
+ /**
+ * Handles the ores added manually with {@link VoidMinerUtility#addMaterialToDimensionList}
+ *
+ * @param id the specified dim id
+ */
+ private void handleExtraDrops(int id) {
+ if (VoidMinerUtility.extraDropsDimMap.containsKey(id)) {
+ extraDropMap = VoidMinerUtility.extraDropsDimMap.get(id);
+ }
+ }
+
+ /**
+ * Gets the DropMap of the dim for the specified dim id
+ *
+ * @param id the dim number
+ */
+ private void handleModDimDef(int id) {
+ if (VoidMinerUtility.dropMapsByDimId.containsKey(id)) {
+ this.dropMap = VoidMinerUtility.dropMapsByDimId.get(id);
+ } else {
+ String chunkProviderName = ((ChunkProviderServer) this.getBaseMetaTileEntity()
+ .getWorld()
+ .getChunkProvider()).currentChunkProvider.getClass()
+ .getName();
+
+ if (VoidMinerUtility.dropMapsByChunkProviderName.containsKey(chunkProviderName)) {
+ this.dropMap = VoidMinerUtility.dropMapsByChunkProviderName.get(chunkProviderName);
+ }
+ }
+ }
+
+ /**
+ * Computes first the ores related to the dim the VM is in, then the ores added manually, then it computes the
+ * totalWeight for normalisation
+ */
+ private void calculateDropMap() {
+ this.dropMap = new VoidMinerUtility.DropMap();
+ this.extraDropMap = new VoidMinerUtility.DropMap();
+ int id = this.getBaseMetaTileEntity()
+ .getWorld().provider.dimensionId;
+ this.handleModDimDef(id);
+ this.handleExtraDrops(id);
+ this.totalWeight = dropMap.getTotalWeight() + extraDropMap.getTotalWeight();
+ }
+
+ /**
+ * Output logic of the VM
+ */
+ private void handleOutputs() {
+ final List<ItemStack> inputOres = this.getStoredInputs()
+ .stream()
+ .filter(GTUtility::isOre)
+ .collect(Collectors.toList());;
+ final ItemStack output = this.nextOre();
+ output.stackSize = multiplier;
+ if (inputOres.size() == 0 || this.mBlacklist && inputOres.stream()
+ .noneMatch(is -> GTUtility.areStacksEqual(is, output))
+ || !this.mBlacklist && inputOres.stream()
+ .anyMatch(is -> GTUtility.areStacksEqual(is, output)))
+ this.addOutput(output);
+ this.updateSlots();
+ }
+
+ @Override
+ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ this.mBlacklist = !this.mBlacklist;
+ GTUtility.sendChatToPlayer(aPlayer, "Mode: " + (this.mBlacklist ? "Blacklist" : "Whitelist"));
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticgreg/MTEVoidMiners.java b/src/main/java/bwcrossmod/galacticgreg/MTEVoidMiners.java
new file mode 100644
index 0000000000..03caf26a25
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticgreg/MTEVoidMiners.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticgreg;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+public class MTEVoidMiners {
+
+ public static class VMLUV extends MTEVoidMinerBase {
+
+ public VMLUV(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional, 1);
+ }
+
+ public VMLUV(String aName, int tier) {
+ super(aName, tier);
+ }
+
+ @Override
+ protected ItemList getCasingBlockItem() {
+ return ItemList.Casing_UV;
+ }
+
+ @Override
+ protected Materials getFrameMaterial() {
+ return Materials.Europium;
+ }
+
+ @Override
+ protected int getCasingTextureIndex() {
+ return 8;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
+ return new VMLUV(this.mName, this.TIER_MULTIPLIER);
+ }
+ }
+
+ public static class VMZPM extends MTEVoidMinerBase {
+
+ public VMZPM(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional, 2);
+ }
+
+ public VMZPM(String aName, int tier) {
+ super(aName, tier);
+ }
+
+ @Override
+ protected ItemList getCasingBlockItem() {
+ return ItemList.Casing_MiningBlackPlutonium;
+ }
+
+ @Override
+ protected Materials getFrameMaterial() {
+ return Materials.BlackPlutonium;
+ }
+
+ @Override
+ protected int getCasingTextureIndex() {
+ return 179;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
+ return new VMZPM(this.mName, this.TIER_MULTIPLIER);
+ }
+ }
+
+ public static class VMUV extends MTEVoidMinerBase {
+
+ public VMUV(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional, 3);
+ }
+
+ public VMUV(String aName, int tier) {
+ super(aName, tier);
+ }
+
+ @Override
+ protected ItemList getCasingBlockItem() {
+ return ItemList.Casing_MiningNeutronium;
+ }
+
+ @Override
+ protected Materials getFrameMaterial() {
+ return Materials.Neutronium;
+ }
+
+ @Override
+ protected int getCasingTextureIndex() {
+ return 178;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
+ return new VMUV(this.mName, this.TIER_MULTIPLIER);
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticgreg/VoidMinerUtility.java b/src/main/java/bwcrossmod/galacticgreg/VoidMinerUtility.java
new file mode 100644
index 0000000000..b0782f91ae
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticgreg/VoidMinerUtility.java
@@ -0,0 +1,275 @@
+package bwcrossmod.galacticgreg;
+
+import static galacticgreg.registry.GalacticGregRegistry.getModContainers;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Predicate;
+
+import net.minecraft.block.Block;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import bartworks.common.configs.ConfigHandler;
+import bartworks.system.material.Werkstoff;
+import bartworks.system.material.WerkstoffLoader;
+import bartworks.system.oregen.BWOreLayer;
+import cpw.mods.fml.common.registry.GameRegistry;
+import galacticgreg.GalacticGreg;
+import galacticgreg.WorldgenOreLayerSpace;
+import galacticgreg.WorldgenOreSmallSpace;
+import galacticgreg.api.ModContainer;
+import galacticgreg.api.ModDimensionDef;
+import gregtech.api.GregTechAPI;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.ISubTagContainer;
+import gregtech.api.util.GTUtility;
+import gregtech.common.WorldgenGTOreLayer;
+import gregtech.common.WorldgenGTOreSmallPieces;
+
+public class VoidMinerUtility {
+
+ public static final FluidStack[] NOBLE_GASSES = { WerkstoffLoader.Neon.getFluidOrGas(1),
+ WerkstoffLoader.Krypton.getFluidOrGas(1), WerkstoffLoader.Xenon.getFluidOrGas(1),
+ WerkstoffLoader.Oganesson.getFluidOrGas(1) };
+ public static final int[] NOBEL_GASSES_MULTIPLIER = { 4, 8, 16, 64 };
+
+ public static class DropMap {
+
+ private float totalWeight;
+ private final Map<GTUtility.ItemId, Float> internalMap;
+
+ public DropMap() {
+ internalMap = new HashMap<>();
+ totalWeight = 0;
+ }
+
+ /**
+ * Method used to add an ore to the DropMap
+ *
+ * @param weight the non normalised weight
+ * @param isBWOres true for BW ores, false for GT ores
+ */
+ public void addDrop(int meta, float weight, boolean isBWOres) {
+ if (isBWOres) {
+ addDrop(WerkstoffLoader.BWOres, meta, weight);
+ } else {
+ addDrop(GregTechAPI.sBlockOres1, meta, weight);
+ }
+ }
+
+ /**
+ * Method used to add any item to the DropMap. Will be blocked if blacklisted.
+ *
+ * @param weight the non normalised weight
+ */
+ public void addDrop(Block block, int meta, float weight) {
+ if (ConfigHandler.voidMinerBlacklist.contains(
+ String.format(
+ "%s:%d",
+ GameRegistry.findUniqueIdentifierFor(block)
+ .toString(),
+ meta)))
+ return;
+ Item item = Item.getItemFromBlock(block);
+ addDrop(item, meta, weight);
+ }
+
+ /**
+ * Method used to add any item to the DropMap. Will be blocked if blacklisted.
+ *
+ * @param weight the non normalised weight
+ */
+ public void addDrop(ItemStack itemStack, float weight) {
+ Item item = itemStack.getItem();
+ int meta = Items.feather.getDamage(itemStack);
+ if (ConfigHandler.voidMinerBlacklist.contains(
+ String.format(
+ "%s:%d",
+ GameRegistry.findUniqueIdentifierFor(Block.getBlockFromItem(item))
+ .toString(),
+ meta)))
+ return;
+ addDrop(item, meta, weight);
+ }
+
+ private void addDrop(Item item, int meta, float weight) {
+ GTUtility.ItemId ore = GTUtility.ItemId.createNoCopy(item, meta, null);
+ internalMap.merge(ore, weight, Float::sum);
+ totalWeight += weight;
+ }
+
+ public float getTotalWeight() {
+ return totalWeight;
+ }
+
+ public Map<GTUtility.ItemId, Float> getInternalMap() {
+ return internalMap;
+ }
+ }
+
+ public static final Map<Integer, DropMap> dropMapsByDimId = new HashMap<>();
+ public static final Map<String, DropMap> dropMapsByChunkProviderName = new HashMap<>();
+ public static final Map<Integer, DropMap> extraDropsDimMap = new HashMap<>();
+
+ // Adds tellurium to OW to ensure a way to get it, as it's used in Magneto Resonatic
+ // Dust and Circuit Compound MK3 Dust
+ static {
+ addMaterialToDimensionList(0, Materials.Tellurium, 8.0f);
+ }
+
+ /**
+ * Computes the ores of the dims
+ */
+ public static void generateDropMaps() {
+ // vanilla dims
+ dropMapsByDimId.put(-1, getDropMapVanilla(-1));
+ dropMapsByDimId.put(0, getDropMapVanilla(0));
+ dropMapsByDimId.put(1, getDropMapVanilla(1));
+ // Twilight Forest
+ dropMapsByDimId.put(7, getDropMapVanilla(7));
+
+ // ross dims
+ dropMapsByDimId.put(ConfigHandler.ross128BID, getDropMapRoss(ConfigHandler.ross128BID));
+ dropMapsByDimId.put(ConfigHandler.ross128BAID, getDropMapRoss(ConfigHandler.ross128BAID));
+
+ // other space dims
+ for (ModContainer modContainer : getModContainers()) {
+ for (ModDimensionDef dimDef : modContainer.getDimensionList()) {
+ dropMapsByChunkProviderName.put(dimDef.getChunkProviderName(), getDropMapSpace(dimDef));
+ }
+ }
+ }
+
+ /**
+ * Method to generate a DropMap that contains ores of a vanilla GT worldgen
+ */
+ private static DropMap getDropMapVanilla(int dimId) {
+ DropMap dropMap = new DropMap();
+
+ // Ore Veins
+ Predicate<WorldgenGTOreLayer> oreLayerPredicate = makeOreLayerPredicate(dimId);
+ WorldgenGTOreLayer.sList.stream()
+ .filter(gt_worldgen -> gt_worldgen.mEnabled && oreLayerPredicate.test(gt_worldgen))
+ .forEach(element -> {
+ dropMap.addDrop(element.mPrimaryMeta, element.mWeight, false);
+ dropMap.addDrop(element.mSecondaryMeta, element.mWeight, false);
+ dropMap.addDrop(element.mSporadicMeta, element.mWeight / 8f, false);
+ dropMap.addDrop(element.mBetweenMeta, element.mWeight / 8f, false);
+ });
+
+ // Small Ores
+ Predicate<WorldgenGTOreSmallPieces> smallOresPredicate = makeSmallOresPredicate(dimId);
+ WorldgenGTOreSmallPieces.sList.stream()
+ .filter(gt_worldgen -> gt_worldgen.mEnabled && smallOresPredicate.test(gt_worldgen))
+ .forEach(element -> dropMap.addDrop(element.mMeta, element.mAmount, false));
+ return dropMap;
+ }
+
+ /**
+ * Makes a predicate for the GT normal ore veins worldgen
+ *
+ * @return the predicate
+ */
+ private static Predicate<WorldgenGTOreLayer> makeOreLayerPredicate(int dimensionId) {
+ return switch (dimensionId) {
+ case -1 -> gt_worldgen -> gt_worldgen.mNether;
+ case 0 -> gt_worldgen -> gt_worldgen.mOverworld;
+ case 1 -> gt_worldgen -> gt_worldgen.mEnd || gt_worldgen.mEndAsteroid;
+ case 7 -> gt_worldgen -> gt_worldgen.twilightForest;
+ default -> throw new IllegalStateException();
+ };
+ }
+
+ /**
+ * Makes a predicate for the GT normal small ore worldgen
+ *
+ * @return the predicate
+ */
+ private static Predicate<WorldgenGTOreSmallPieces> makeSmallOresPredicate(int dimensionId) {
+ return switch (dimensionId) {
+ case -1 -> gt_worldgen -> gt_worldgen.mNether;
+ case 0 -> gt_worldgen -> gt_worldgen.mOverworld;
+ case 1 -> gt_worldgen -> gt_worldgen.mEnd;
+ case 7 -> gt_worldgen -> gt_worldgen.twilightForest;
+ default -> throw new IllegalStateException();
+ };
+ }
+
+ /**
+ * Create a DropMap that contains ores of Ross dims
+ *
+ * @param aID dim id of Ross128b or Ross128ba
+ */
+ private static DropMap getDropMapRoss(int aID) {
+ DropMap dropMap = new DropMap();
+ for (BWOreLayer oreLayer : BWOreLayer.sList) {
+ if (oreLayer.mEnabled && oreLayer.isGenerationAllowed("", aID, 0)) {
+ List<ItemStack> data = oreLayer.getStacks();
+ dropMap.addDrop(data.get(0), oreLayer.mWeight);
+ dropMap.addDrop(data.get(1), oreLayer.mWeight);
+ dropMap.addDrop(data.get(2), oreLayer.mWeight / 8f);
+ dropMap.addDrop(data.get(3), oreLayer.mWeight / 8f);
+ }
+ }
+ return dropMap;
+ }
+
+ /**
+ * Create a DropMap contains the ores from the galacticGreg space worldgen corresponding to the target dim
+ *
+ * @param finalDef ModDimensionDef corresponding to the target dim
+ */
+ private static DropMap getDropMapSpace(ModDimensionDef finalDef) {
+ DropMap dropMap = new DropMap();
+
+ // Normal Ore Veins
+ GalacticGreg.oreVeinWorldgenList.stream()
+ .filter(
+ gt_worldgen -> gt_worldgen.mEnabled && gt_worldgen instanceof WorldgenOreLayerSpace oreLayerSpace
+ && oreLayerSpace.isEnabledForDim(finalDef))
+ .map(gt_worldgen -> (WorldgenOreLayerSpace) gt_worldgen)
+ .forEach(element -> {
+ dropMap.addDrop(element.mPrimaryMeta, element.mWeight, false);
+ dropMap.addDrop(element.mSecondaryMeta, element.mWeight, false);
+ dropMap.addDrop(element.mSporadicMeta, element.mWeight / 8f, false);
+ dropMap.addDrop(element.mBetweenMeta, element.mWeight / 8f, false);
+ });
+
+ // Normal Small Ores
+ GalacticGreg.smallOreWorldgenList.stream()
+ .filter(
+ gt_worldgen -> gt_worldgen.mEnabled && gt_worldgen instanceof WorldgenOreSmallSpace oreSmallPiecesSpace
+ && oreSmallPiecesSpace.isEnabledForDim(finalDef))
+ .map(gt_worldgen -> (WorldgenOreSmallSpace) gt_worldgen)
+ .forEach(element -> dropMap.addDrop(element.mMeta, element.mAmount, false));
+ return dropMap;
+ }
+
+ public static void addBlockToDimensionList(int dimId, Block block, int meta, float weight) {
+ if (!extraDropsDimMap.containsKey(dimId)) {
+ extraDropsDimMap.put(dimId, new DropMap());
+ }
+ extraDropsDimMap.get(dimId)
+ .addDrop(block, meta, weight);
+ }
+
+ /**
+ * Public method giving other mods the ability to add manually a material with an ore version into the external
+ * dropMap for a specified dim id
+ *
+ * @param DimensionID the dim id targeted
+ * @param Material the material with an ore version
+ * @param weight the non normalised version of the given weight
+ */
+ public static void addMaterialToDimensionList(int DimensionID, ISubTagContainer Material, float weight) {
+ if (Material instanceof Materials gtMaterial) {
+ addBlockToDimensionList(DimensionID, GregTechAPI.sBlockOres1, gtMaterial.mMetaItemSubID, weight);
+ } else if (Material instanceof Werkstoff werkstoff) {
+ addBlockToDimensionList(DimensionID, WerkstoffLoader.BWOres, werkstoff.getmID(), weight);
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticraft/GalacticraftProxy.java b/src/main/java/bwcrossmod/galacticraft/GalacticraftProxy.java
new file mode 100644
index 0000000000..d6ee41c48b
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/GalacticraftProxy.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft;
+
+import net.minecraftforge.common.MinecraftForge;
+
+import bartworks.API.SideReference;
+import bartworks.common.configs.ConfigHandler;
+import bartworks.system.oregen.BWWorldGenRoss128b;
+import bartworks.system.oregen.BWWorldGenRoss128ba;
+import bwcrossmod.galacticraft.atmosphere.BWAtmosphereManager;
+import bwcrossmod.galacticraft.solarsystems.Ross128SolarSystem;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+
+public class GalacticraftProxy {
+
+ private GalacticraftProxy() {}
+
+ public static void postInit(FMLPostInitializationEvent e) {
+ if (SideReference.Side.Server || SideReference.EffectiveSide.Server) {
+ GalacticraftProxy.serverPostInit(e);
+ } else {
+ GalacticraftProxy.clientPostInit(e);
+ }
+ GalacticraftProxy.commonPostInit(e);
+ }
+
+ public static void preInit(FMLPreInitializationEvent e) {
+ if (SideReference.Side.Server || SideReference.EffectiveSide.Server) {
+ GalacticraftProxy.serverpreInit(e);
+ } else {
+ GalacticraftProxy.clientpreInit(e);
+ }
+ GalacticraftProxy.commonpreInit(e);
+ }
+
+ private static void serverpreInit(FMLPreInitializationEvent e) {}
+
+ private static void clientpreInit(FMLPreInitializationEvent e) {}
+
+ private static void commonpreInit(FMLPreInitializationEvent e) {
+ BWWorldGenRoss128b.initOres();
+ BWWorldGenRoss128ba.init_Ores();
+ MinecraftForge.EVENT_BUS.register(BWAtmosphereManager.INSTANCE);
+ }
+
+ public static void init(FMLInitializationEvent e) {
+ if (SideReference.Side.Server || SideReference.EffectiveSide.Server) {
+ GalacticraftProxy.serverInit(e);
+ } else {
+ GalacticraftProxy.clientInit(e);
+ }
+ GalacticraftProxy.commonInit(e);
+ }
+
+ private static void serverInit(FMLInitializationEvent e) {}
+
+ private static void clientInit(FMLInitializationEvent e) {}
+
+ private static void commonInit(FMLInitializationEvent e) {
+ 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/bwcrossmod/galacticraft/PlanetsHelperClass.java b/src/main/java/bwcrossmod/galacticraft/PlanetsHelperClass.java
new file mode 100644
index 0000000000..eecd5bd8fe
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/PlanetsHelperClass.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft;
+
+import net.minecraft.entity.player.EntityPlayerMP;
+
+import bartworks.common.configs.ConfigHandler;
+import micdoodle8.mods.galacticraft.core.entities.EntityLander;
+import micdoodle8.mods.galacticraft.core.entities.EntityLanderBase;
+import micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityEntryPod;
+import micdoodle8.mods.galacticraft.planets.mars.entities.EntityLandingBalloons;
+
+public class PlanetsHelperClass {
+
+ public static EntityLanderBase getLanderType(EntityPlayerMP player) {
+ return switch (ConfigHandler.landerType) {
+ case 1 -> new EntityLander(player);
+ case 2 -> new EntityLandingBalloons(player);
+ default -> new EntityEntryPod(player);
+ };
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticraft/UniversalTeleportType.java b/src/main/java/bwcrossmod/galacticraft/UniversalTeleportType.java
new file mode 100644
index 0000000000..4507cadca2
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/UniversalTeleportType.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft;
+
+import static gregtech.api.enums.Mods.GalacticraftMars;
+
+import java.util.Random;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+
+import micdoodle8.mods.galacticraft.api.vector.Vector3;
+import micdoodle8.mods.galacticraft.api.world.ITeleportType;
+import micdoodle8.mods.galacticraft.core.entities.EntityLander;
+import micdoodle8.mods.galacticraft.core.entities.EntityLanderBase;
+import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats;
+
+public class UniversalTeleportType implements ITeleportType {
+
+ @Override
+ public boolean useParachute() {
+ return false;
+ }
+
+ @Override
+ public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) {
+ return this.getEntitySpawnLocation(world, player);
+ }
+
+ @Override
+ public Vector3 getEntitySpawnLocation(WorldServer world, Entity entity) {
+ if (entity instanceof EntityPlayerMP) {
+ GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) entity);
+ return new Vector3(stats.coordsTeleportedFromX, 500D, stats.coordsTeleportedFromZ);
+ }
+ return new Vector3(entity.posX, 500D, entity.posZ);
+ }
+
+ @Override
+ public Vector3 getParaChestSpawnLocation(WorldServer world, EntityPlayerMP player, Random rand) {
+ return null;
+ }
+
+ @Override
+ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boolean ridingAutoRocket) {
+ if (ridingAutoRocket) return;
+ if (player != null && GCPlayerStats.get(player).teleportCooldown <= 0) {
+ if (player.capabilities.isFlying) {
+ player.capabilities.isFlying = false;
+ }
+
+ EntityLanderBase elb;
+ if (GalacticraftMars.isModLoaded()) elb = PlanetsHelperClass.getLanderType(player);
+ else elb = new EntityLander(player);
+
+ if (!newWorld.isRemote) {
+ newWorld.spawnEntityInWorld(elb);
+ }
+ GCPlayerStats.get(player).teleportCooldown = 10;
+ }
+ }
+
+ @Override
+ public void setupAdventureSpawn(EntityPlayerMP player) {}
+}
diff --git a/src/main/java/bwcrossmod/galacticraft/atmosphere/BWAtmosphereManager.java b/src/main/java/bwcrossmod/galacticraft/atmosphere/BWAtmosphereManager.java
new file mode 100644
index 0000000000..0bae6f4546
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/atmosphere/BWAtmosphereManager.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft.atmosphere;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import com.google.common.collect.ArrayListMultimap;
+
+import bartworks.system.material.Werkstoff;
+import bartworks.system.material.WerkstoffLoader;
+import bartworks.util.Pair;
+import bwcrossmod.BartWorksCrossmod;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.ISubTagContainer;
+import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody;
+import micdoodle8.mods.galacticraft.api.galaxies.GalaxyRegistry;
+import micdoodle8.mods.galacticraft.api.world.IAtmosphericGas;
+
+public final class BWAtmosphereManager {
+
+ private static final Map<Integer, Integer[]> COEFFICIENT_MAP = new HashMap<>();
+
+ private BWAtmosphereManager() {
+ BWAtmosphereManager.COEFFICIENT_MAP.put(1, new Integer[] { 100 });
+ BWAtmosphereManager.COEFFICIENT_MAP.put(2, new Integer[] { 70, 30 });
+ BWAtmosphereManager.COEFFICIENT_MAP.put(3, new Integer[] { 60, 25, 15 });
+ BWAtmosphereManager.COEFFICIENT_MAP.put(4, new Integer[] { 50, 25, 15, 10 });
+ BWAtmosphereManager.COEFFICIENT_MAP.put(5, new Integer[] { 45, 25, 15, 10, 5 });
+ BWAtmosphereManager.COEFFICIENT_MAP.put(6, new Integer[] { 45, 20, 15, 10, 5, 5 });
+ BWAtmosphereManager.COEFFICIENT_MAP.put(7, new Integer[] { 40, 20, 15, 10, 5, 5, 5 });
+ BWAtmosphereManager.COEFFICIENT_MAP.put(8, new Integer[] { 35, 20, 15, 10, 5, 5, 5, 5 });
+ BWAtmosphereManager.COEFFICIENT_MAP.put(9, new Integer[] { 35, 15, 15, 10, 5, 5, 5, 5, 5 });
+ }
+
+ public static final BWAtmosphereManager INSTANCE = new BWAtmosphereManager();
+
+ private static final ArrayListMultimap<Integer, Pair<ISubTagContainer, Integer>> gasConcentration = ArrayListMultimap
+ .create();
+
+ public static List<Pair<ISubTagContainer, Integer>> getGasFromWorldID(int worldID) {
+ return BWAtmosphereManager.gasConcentration.get(worldID);
+ }
+
+ public static void removeGasFromWorld(int worldID, ISubTagContainer gas) {
+ for (Pair<ISubTagContainer, Integer> pair : BWAtmosphereManager.gasConcentration.get(worldID)) {
+ if (pair.getKey()
+ .equals(gas)) {
+ BWAtmosphereManager.gasConcentration.get(worldID)
+ .remove(pair);
+ return;
+ }
+ }
+ }
+
+ public static void addGasToWorld(int worldID, ISubTagContainer gas, int amount) {
+ Pair<ISubTagContainer, Integer> toadd = new Pair<>(gas, amount);
+ BWAtmosphereManager.gasConcentration.put(worldID, toadd);
+ }
+
+ public static void addGasToWorld(int worldID, Pair<ISubTagContainer, Integer> toPut) {
+ BWAtmosphereManager.gasConcentration.put(worldID, toPut);
+ }
+
+ @SafeVarargs
+ public static void addGasToWorld(int worldID, Pair<ISubTagContainer, Integer>... toPut) {
+ Arrays.stream(toPut)
+ .forEach(toadd -> BWAtmosphereManager.gasConcentration.put(worldID, toadd));
+ }
+
+ private static boolean addGCGasToWorld(int worldID, IAtmosphericGas gas, int aNumber, int aMaxNumber) {
+ if (IAtmosphericGas.CO2.equals(gas)) {
+ BWAtmosphereManager.addGasToWorld(
+ worldID,
+ Materials.CarbonDioxide,
+ BWAtmosphereManager.COEFFICIENT_MAP.get(aMaxNumber)[aNumber]);
+ return true;
+ }
+ String name = gas.toString();
+ name = name.charAt(0) + name.substring(1)
+ .toLowerCase(Locale.US);
+ ISubTagContainer mat = Materials.get(name);
+ if (mat == Materials._NULL) {
+ mat = WerkstoffLoader.getWerkstoff(name);
+ }
+ if (mat == Werkstoff.default_null_Werkstoff) {
+ return false;
+ }
+ BWAtmosphereManager.addGasToWorld(worldID, mat, BWAtmosphereManager.COEFFICIENT_MAP.get(aMaxNumber)[aNumber]);
+ return true;
+ }
+
+ @SubscribeEvent
+ public void gcAutoRegister(GalaxyRegistry.PlanetRegisterEvent event) {
+ CelestialBody planet = GalaxyRegistry.getRegisteredPlanets()
+ .get(event.planetName);
+ for (int i = 0; i < planet.atmosphere.size(); i++) {
+ if (!BWAtmosphereManager
+ .addGCGasToWorld(planet.getDimensionID(), planet.atmosphere.get(i), i, planet.atmosphere.size()))
+ BartWorksCrossmod.LOGGER.warn(
+ "Unidentified Fluid (" + planet.atmosphere.get(i)
+ + ") in the Atmosphere of: "
+ + planet.getLocalizedName());
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticraft/planets/AbstractWorldProviderSpace.java b/src/main/java/bwcrossmod/galacticraft/planets/AbstractWorldProviderSpace.java
new file mode 100644
index 0000000000..7f69e87cfb
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/planets/AbstractWorldProviderSpace.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft.planets;
+
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace;
+import micdoodle8.mods.galacticraft.api.world.IExitHeight;
+import micdoodle8.mods.galacticraft.api.world.ISolarLevel;
+
+public abstract class AbstractWorldProviderSpace extends WorldProviderSpace implements IExitHeight, ISolarLevel {
+
+ @Override
+ public boolean canRainOrSnow() {
+ return false;
+ }
+
+ @Override
+ public String getDimensionName() {
+ return this.getCelestialBody()
+ .getLocalizedName();
+ }
+
+ @Override
+ public boolean hasSunset() {
+ return true;
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java b/src/main/java/bwcrossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java
new file mode 100644
index 0000000000..7682e61d09
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/planets/ross128b/ChunkProviderRoss128b.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft.planets.ross128b;
+
+import static gregtech.api.enums.Mods.Thaumcraft;
+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE;
+import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFalling;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.ChunkProviderGenerate;
+import net.minecraft.world.gen.MapGenBase;
+import net.minecraft.world.gen.MapGenCaves;
+import net.minecraft.world.gen.MapGenRavine;
+import net.minecraft.world.gen.feature.WorldGenLakes;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.terraingen.PopulateChunkEvent;
+import net.minecraftforge.event.terraingen.TerrainGen;
+
+import bartworks.common.configs.ConfigHandler;
+import bartworks.system.oregen.BWWordGenerator;
+import bartworks.system.worldgen.MapGenRuins;
+import bwcrossmod.thaumcraft.util.ThaumcraftHandler;
+import gregtech.api.objects.XSTR;
+
+public class ChunkProviderRoss128b extends ChunkProviderGenerate {
+
+ XSTR rand = new XSTR();
+ private BiomeGenBase[] biomesForGeneration;
+ public static final BWWordGenerator BWOreGen = new BWWordGenerator();
+ private final World worldObj;
+ private final MapGenBase caveGenerator = new MapGenCaves();
+ private final MapGenBase ravineGenerator = new MapGenRavine();
+ private final MapGenRuins.RuinsBase ruinsBase = new MapGenRuins.RuinsBase();
+
+ public ChunkProviderRoss128b(World par1World, long seed, boolean mapFeaturesEnabled) {
+ super(par1World, seed, mapFeaturesEnabled);
+ this.worldObj = par1World;
+ }
+
+ @Override
+ public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_,
+ int p_73155_4_) {
+ return null;
+ }
+
+ @Override
+ public Chunk provideChunk(int p_73154_1_, int p_73154_2_) {
+ this.rand.setSeed(p_73154_1_ * 341873128712L + p_73154_2_ * 132897987541L);
+ Block[] ablock = new Block[65536];
+ byte[] abyte = new byte[65536];
+ this.func_147424_a(p_73154_1_, p_73154_2_, ablock);
+ this.biomesForGeneration = this.worldObj.getWorldChunkManager()
+ .loadBlockGeneratorData(this.biomesForGeneration, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16);
+ for (int i = 0; i < this.biomesForGeneration.length; i++) {
+ BiomeGenBase biomeGenBase = this.biomesForGeneration[i];
+ if (biomeGenBase.biomeID == BiomeGenBase.mushroomIsland.biomeID) {
+ this.biomesForGeneration[i] = BiomeGenBase.taiga;
+ } else if (biomeGenBase.biomeID == BiomeGenBase.mushroomIslandShore.biomeID) {
+ this.biomesForGeneration[i] = BiomeGenBase.stoneBeach;
+ }
+ if (Thaumcraft.isModLoaded()) {
+ if (ThaumcraftHandler.isTaintBiome(biomeGenBase.biomeID))
+ this.biomesForGeneration[i] = BiomeGenBase.taiga;
+ else if (ConfigHandler.disableMagicalForest
+ && ThaumcraftHandler.isMagicalForestBiome(biomeGenBase.biomeID))
+ this.biomesForGeneration[i] = BiomeGenBase.birchForest;
+ }
+ }
+ this.replaceBlocksForBiome(p_73154_1_, p_73154_2_, ablock, abyte, this.biomesForGeneration);
+ this.caveGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);
+ this.ravineGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);
+
+ Chunk chunk = new Chunk(this.worldObj, ablock, abyte, p_73154_1_, p_73154_2_);
+ byte[] abyte1 = chunk.getBiomeArray();
+
+ for (int k = 0; k < abyte1.length; ++k) {
+ abyte1[k] = (byte) this.biomesForGeneration[k].biomeID;
+ }
+
+ chunk.generateSkylightMap();
+ return chunk;
+ }
+
+ @Override
+ public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_) {
+ BlockFalling.fallInstantly = true;
+ int k = p_73153_2_ * 16;
+ int l = p_73153_3_ * 16;
+ BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
+ this.rand.setSeed(this.worldObj.getSeed());
+ if (p_73153_2_ % 4 == 0 || p_73153_3_ % 4 == 0) {
+ long i1 = this.rand.nextLong() / 2L * 2L + 1L;
+ long j1 = this.rand.nextLong() / 2L * 2L + 1L;
+ this.rand.setSeed(p_73153_2_ * i1 + p_73153_3_ * j1 ^ this.worldObj.getSeed());
+ }
+
+ MinecraftForge.EVENT_BUS
+ .post(new PopulateChunkEvent.Pre(p_73153_1_, this.worldObj, this.rand, p_73153_2_, p_73153_3_, false));
+
+ int x1;
+ int y1;
+ int z1;
+ if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills
+ && TerrainGen.populate(p_73153_1_, this.worldObj, this.rand, p_73153_2_, p_73153_3_, false, LAKE)) {
+ x1 = k + this.rand.nextInt(16) + 8;
+ y1 = this.rand.nextInt(256);
+ z1 = l + this.rand.nextInt(16) + 8;
+ int rni = this.rand.nextInt(8);
+ if (rni == 0) new WorldGenLakes(Blocks.ice).generate(this.worldObj, this.rand, x1, y1, z1);
+ else if (rni == 4) new WorldGenLakes(Blocks.water).generate(this.worldObj, this.rand, x1, y1, z1);
+ }
+ if (biomegenbase != BiomeGenBase.ocean && biomegenbase != BiomeGenBase.deepOcean
+ && biomegenbase != BiomeGenBase.river
+ && biomegenbase != BiomeGenBase.frozenOcean
+ && biomegenbase != BiomeGenBase.frozenRiver
+ && this.rand.nextInt(ConfigHandler.ross128bRuinChance) == 0) {
+ x1 = k + this.rand.nextInt(16) + 3;
+ y1 = this.rand.nextInt(256);
+ z1 = l + this.rand.nextInt(16) + 3;
+ this.ruinsBase.generate(this.worldObj, this.rand, x1, y1, z1);
+ }
+
+ biomegenbase.decorate(this.worldObj, this.rand, k, l);
+
+ k += 8;
+ l += 8;
+
+ boolean doGen = TerrainGen.populate(p_73153_1_, this.worldObj, this.rand, p_73153_2_, p_73153_3_, false, ICE);
+ for (x1 = 0; doGen && x1 < 16; ++x1) {
+ for (y1 = 0; y1 < 16; ++y1) {
+ z1 = this.worldObj.getPrecipitationHeight(k + x1, l + y1);
+
+ if (this.worldObj.isBlockFreezable(x1 + k, z1 - 1, y1 + l)) {
+ this.worldObj.setBlock(x1 + k, z1 - 1, y1 + l, Blocks.ice, 0, 2);
+ }
+
+ if (this.worldObj.func_147478_e(x1 + k, z1, y1 + l, true)) {
+ this.worldObj.setBlock(x1 + k, z1, y1 + l, Blocks.snow_layer, 0, 2);
+ }
+ }
+ }
+
+ BWOreGen.generate(this.rand, p_73153_2_, p_73153_3_, this.worldObj, this, this);
+ MinecraftForge.EVENT_BUS
+ .post(new PopulateChunkEvent.Post(p_73153_1_, this.worldObj, this.rand, p_73153_2_, p_73153_3_, false));
+
+ BlockFalling.fallInstantly = false;
+ }
+
+ @Override
+ public void recreateStructures(int p_82695_1_, int p_82695_2_) {}
+
+ @Override
+ public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] blocks, byte[] metas,
+ BiomeGenBase[] p_147422_5_) {
+ super.replaceBlocksForBiome(p_147422_1_, p_147422_2_, blocks, metas, p_147422_5_);
+ for (int i = 0; i < blocks.length; i++) {
+ if (blocks[i] == Blocks.grass) {
+ blocks[i] = Blocks.dirt;
+ metas[i] = 2;
+ }
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java b/src/main/java/bwcrossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java
new file mode 100644
index 0000000000..9a4fe472b3
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/planets/ross128b/SkyProviderRoss128b.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft.planets.ross128b;
+
+import net.minecraft.util.ResourceLocation;
+
+import bwcrossmod.BartWorksCrossmod;
+
+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/bwcrossmod/galacticraft/planets/ross128b/WorldProviderRoss128b.java b/src/main/java/bwcrossmod/galacticraft/planets/ross128b/WorldProviderRoss128b.java
new file mode 100644
index 0000000000..a21cbd0cbf
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/planets/ross128b/WorldProviderRoss128b.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft.planets.ross128b;
+
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.Vec3;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.chunk.IChunkProvider;
+
+import bwcrossmod.galacticraft.planets.AbstractWorldProviderSpace;
+import bwcrossmod.galacticraft.solarsystems.Ross128SolarSystem;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody;
+import micdoodle8.mods.galacticraft.api.vector.Vector3;
+
+public class WorldProviderRoss128b extends AbstractWorldProviderSpace {
+
+ @Override
+ public boolean canRespawnHere() {
+ return true;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public Vec3 getFogColor(float cy, float noidea) {
+ float angle = MathHelper.cos(cy * (float) Math.PI * 2.0F) * 2.0F + 0.5F;
+
+ if (angle < 0.0F) {
+ angle = 0.0F;
+ }
+
+ if (angle > 1.0F) {
+ angle = 1.0F;
+ }
+
+ float red = 200 / 255f;
+ float green = 80 / 255f;
+ float blue = 0.0F;
+ red *= angle * 0.94F + 0.06F;
+ green *= angle * 0.94F + 0.06F;
+ return Vec3.createVectorHelper(red, green, blue);
+ }
+
+ @Override
+ public Vector3 getFogColor() {
+ // unused
+ return null;
+ }
+
+ @Override
+ public float getSunBrightness(float par1) {
+ return super.getSunBrightness(par1) * 0.975f;
+ }
+
+ @Override
+ public float calculateCelestialAngle(long par1, float par3) {
+ return super.calculateCelestialAngle(par1, par3);
+ }
+
+ @Override
+ public Vector3 getSkyColor() {
+ float red = 200 / 255f;
+ float green = 120 / 255f;
+ float blue = 0.0F;
+ return new Vector3(red, green, blue);
+ }
+
+ @Override
+ public long getDayLength() {
+ return (long) (24000 * 9.9f);
+ }
+
+ @Override
+ public Class<? extends IChunkProvider> getChunkProviderClass() {
+ return ChunkProviderRoss128b.class;
+ }
+
+ @Override
+ public Class<? extends WorldChunkManager> getWorldChunkManagerClass() {
+ return WorldChunkManager.class;
+ }
+
+ @Override
+ public float getGravity() {
+ return -0.0035F;
+ }
+
+ @Override
+ public double getMeteorFrequency() {
+ return 0D;
+ }
+
+ @Override
+ public double getFuelUsageMultiplier() {
+ return 1.35D;
+ }
+
+ @Override
+ public boolean canSpaceshipTierPass(int tier) {
+ return Ross128SolarSystem.Ross128b.getTierRequirement() <= tier;
+ }
+
+ @Override
+ public float getFallDamageModifier() {
+ return 1.35F;
+ }
+
+ @Override
+ public float getSoundVolReductionAmount() {
+ return 1F;
+ }
+
+ @Override
+ public float getThermalLevelModifier() {
+ return 0.01f;
+ }
+
+ @Override
+ public float getWindLevel() {
+ return 1.35f;
+ }
+
+ @Override
+ public CelestialBody getCelestialBody() {
+ return Ross128SolarSystem.Ross128b;
+ }
+
+ @Override
+ public double getYCoordinateToTeleport() {
+ return 500D;
+ }
+
+ @Override
+ public double getSolarEnergyMultiplier() {
+ return 1.38D;
+ }
+
+ @Override
+ public boolean hasBreathableAtmosphere() {
+ return true;
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java b/src/main/java/bwcrossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java
new file mode 100644
index 0000000000..67b776f473
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/planets/ross128ba/ChunkProviderRoss128ba.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft.planets.ross128ba;
+
+import java.util.Arrays;
+import java.util.Random;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockFalling;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+
+import bartworks.util.NoiseUtil.BartsNoise;
+import bwcrossmod.galacticraft.planets.ross128b.ChunkProviderRoss128b;
+import gregtech.api.objects.XSTR;
+import micdoodle8.mods.galacticraft.api.prefab.world.gen.MapGenBaseMeta;
+import micdoodle8.mods.galacticraft.core.blocks.GCBlocks;
+import micdoodle8.mods.galacticraft.core.world.gen.BiomeGenBaseMoon;
+import micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderMoon;
+import micdoodle8.mods.galacticraft.core.world.gen.MapGenCavesMoon;
+
+public class ChunkProviderRoss128ba extends ChunkProviderMoon {
+
+ private final XSTR rand = new XSTR();
+ private final World worldObj;
+ private BiomeGenBase[] biomesForGeneration;
+ private final MapGenBaseMeta caveGenerator;
+
+ public ChunkProviderRoss128ba(World world, long seed, boolean mapFeaturesEnabled) {
+ super(world, seed, mapFeaturesEnabled);
+ this.biomesForGeneration = new BiomeGenBase[] { BiomeGenBaseMoon.moonFlat };
+ this.caveGenerator = new MapGenCavesMoon();
+ this.worldObj = world;
+ }
+
+ @Override
+ public Chunk provideChunk(int cx, int cz) {
+ this.rand.setSeed(cx * 341873128712L + cz * 132897987541L);
+ Block[] ids = new Block[65536];
+ byte[] meta = new byte[65536];
+ Arrays.fill(ids, Blocks.air);
+ this.generateTerrain(cx, cz, ids, meta);
+ this.biomesForGeneration = this.worldObj.getWorldChunkManager()
+ .loadBlockGeneratorData(this.biomesForGeneration, cx * 16, cz * 16, 16, 16);
+ this.createCraters(cx, cz, ids, meta);
+ this.replaceBlocksForBiome(cx, cz, ids, meta, this.biomesForGeneration);
+ this.caveGenerator.generate(this, this.worldObj, cx, cz, ids, meta);
+ Chunk Chunk = new Chunk(this.worldObj, ids, meta, cx, cz);
+ Chunk.generateSkylightMap();
+ return Chunk;
+ }
+
+ @Override
+ public void decoratePlanet(World par1World, Random par2Random, int par3, int par4) {}
+
+ @Override
+ public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
+ super.populate(par1IChunkProvider, par2, par3);
+ BlockFalling.fallInstantly = true;
+ ChunkProviderRoss128b.BWOreGen.generate(this.rand, par2, par3, this.worldObj, this, this);
+ BlockFalling.fallInstantly = false;
+ }
+
+ private int getIndex(int x, int y, int z) {
+ return (x * 16 + z) * 256 + y;
+ }
+
+ final Block lowerBlockID = GCBlocks.blockMoon;
+ final BartsNoise noiseGen = new BartsNoise(2, 0.008F, 1D, System.nanoTime());
+ final BartsNoise noiseGen2 = new BartsNoise(2, 0.01F, 1D, System.nanoTime());
+ final BartsNoise noiseGen3 = new BartsNoise(2, 0.002F, 1D, System.nanoTime());
+
+ @Override
+ public void generateTerrain(int chunkX, int chunkZ, Block[] idArray, byte[] metaArray) {
+ for (int x = 0; x < 16; ++x) {
+ for (int z = 0; z < 16; ++z) {
+ double d = this.noiseGen.getNoise(x + chunkX * 16, z + chunkZ * 16);
+ double d2 = this.noiseGen2.getNoise(x + chunkX * 16, z + chunkZ * 16);
+ double d3 = this.noiseGen3.getCosNoise(x + chunkX * 16, z + chunkZ * 16);
+
+ double yDev = d * 4 + d2 * 2 + d3;
+
+ for (int y = 0; y < 128; ++y) {
+ if (y < 60.0D + yDev) {
+ idArray[this.getIndex(x, y, z)] = this.lowerBlockID;
+ int var10001 = this.getIndex(x, y, z);
+ metaArray[var10001] = 4;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java b/src/main/java/bwcrossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java
new file mode 100644
index 0000000000..8acb289c85
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/planets/ross128ba/WorldProviderRoss128ba.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft.planets.ross128ba;
+
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.chunk.IChunkProvider;
+
+import bartworks.util.MathUtils;
+import bwcrossmod.galacticraft.planets.AbstractWorldProviderSpace;
+import bwcrossmod.galacticraft.solarsystems.Ross128SolarSystem;
+import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody;
+import micdoodle8.mods.galacticraft.api.vector.Vector3;
+import micdoodle8.mods.galacticraft.core.world.gen.WorldChunkManagerMoon;
+
+public class WorldProviderRoss128ba extends AbstractWorldProviderSpace {
+
+ @Override
+ public Vector3 getFogColor() {
+ return new Vector3(0, 0, 0);
+ }
+
+ @Override
+ public Vector3 getSkyColor() {
+ return new Vector3(0, 0, 0);
+ }
+
+ @Override
+ public long getDayLength() {
+ return MathUtils.floorLong(24000f * 9.9f / 100f);
+ }
+
+ @Override
+ public boolean hasSunset() {
+ return false;
+ }
+
+ @Override
+ public Class<? extends IChunkProvider> getChunkProviderClass() {
+ return ChunkProviderRoss128ba.class;
+ }
+
+ @Override
+ public Class<? extends WorldChunkManager> getWorldChunkManagerClass() {
+ return WorldChunkManagerMoon.class;
+ }
+
+ @Override
+ public double getYCoordinateToTeleport() {
+ return 500;
+ }
+
+ @Override
+ public float getGravity() {
+ return 0.060f;
+ }
+
+ @Override
+ public double getMeteorFrequency() {
+ return 9D;
+ }
+
+ @Override
+ public double getFuelUsageMultiplier() {
+ return 0.7D;
+ }
+
+ @Override
+ public boolean canSpaceshipTierPass(int i) {
+ return i >= Ross128SolarSystem.Ross128ba.getTierRequirement();
+ }
+
+ @Override
+ public float getFallDamageModifier() {
+ return 0.2f;
+ }
+
+ @Override
+ public float getSoundVolReductionAmount() {
+ return 20f;
+ }
+
+ @Override
+ public float getThermalLevelModifier() {
+ return 0;
+ }
+
+ @Override
+ public float getWindLevel() {
+ return 0;
+ }
+
+ @Override
+ public CelestialBody getCelestialBody() {
+ return Ross128SolarSystem.Ross128ba;
+ }
+
+ @Override
+ public double getSolarEnergyMultiplier() {
+ return 1.9D;
+ }
+}
diff --git a/src/main/java/bwcrossmod/galacticraft/solarsystems/Ross128SolarSystem.java b/src/main/java/bwcrossmod/galacticraft/solarsystems/Ross128SolarSystem.java
new file mode 100644
index 0000000000..050c26b087
--- /dev/null
+++ b/src/main/java/bwcrossmod/galacticraft/solarsystems/Ross128SolarSystem.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.galacticraft.solarsystems;
+
+import static gregtech.api.enums.Mods.GalaxySpace;
+
+import java.util.Arrays;
+
+import net.minecraft.util.ResourceLocation;
+
+import bartworks.common.configs.ConfigHandler;
+import bwcrossmod.BartWorksCrossmod;
+import bwcrossmod.galacticraft.UniversalTeleportType;
+import bwcrossmod.galacticraft.planets.ross128b.WorldProviderRoss128b;
+import bwcrossmod.galacticraft.planets.ross128ba.WorldProviderRoss128ba;
+import micdoodle8.mods.galacticraft.api.GalacticraftRegistry;
+import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody;
+import micdoodle8.mods.galacticraft.api.galaxies.GalaxyRegistry;
+import micdoodle8.mods.galacticraft.api.galaxies.Moon;
+import micdoodle8.mods.galacticraft.api.galaxies.Planet;
+import micdoodle8.mods.galacticraft.api.galaxies.SolarSystem;
+import micdoodle8.mods.galacticraft.api.galaxies.Star;
+import micdoodle8.mods.galacticraft.api.vector.Vector3;
+import micdoodle8.mods.galacticraft.api.world.IAtmosphericGas;
+import micdoodle8.mods.galacticraft.core.GalacticraftCore;
+
+public class Ross128SolarSystem {
+
+ public static SolarSystem Ross128System;
+ public static Star Ross128;
+ public static Planet Ross128b;
+ public static Moon Ross128ba;
+
+ private Ross128SolarSystem() {}
+
+ public static void init() {
+
+ Ross128SolarSystem.Ross128System = new SolarSystem("Ross128System", "milkyWay")
+ .setMapPosition(new Vector3(-0.5D, 0.65D, 0.0D));
+ Ross128SolarSystem.Ross128 = (Star) new Star("Ross128").setParentSolarSystem(Ross128SolarSystem.Ross128System)
+ .setTierRequired(-1);
+ Ross128SolarSystem.Ross128.setUnreachable();
+ Ross128SolarSystem.Ross128
+ .setBodyIcon(new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/MapObjs/Ross128.png"));
+ Ross128SolarSystem.Ross128System.setMainStar(Ross128SolarSystem.Ross128);
+
+ Ross128SolarSystem.Ross128b = new Planet("Ross128b").setParentSolarSystem(Ross128SolarSystem.Ross128System);
+ Ross128SolarSystem.Ross128b.setRingColorRGB(0x9F / 255f, 0x8A / 255f, 0x79 / 255f);
+ Ross128SolarSystem.Ross128b.setPhaseShift(1.25F);
+ Ross128SolarSystem.Ross128b.setBodyIcon(
+ new ResourceLocation(BartWorksCrossmod.MOD_ID + ":galacticraft/Ross128b/MapObjs/Ross128b.png"));
+ Ross128SolarSystem.Ross128b.setRelativeDistanceFromCenter(new CelestialBody.ScalableDistance(0.75F, 1.75F));
+ 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(ConfigHandler.ross128btier);
+
+ 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(GalaxySpace.isModLoaded() ? Math.min(ConfigHandler.ross128btier + 2, 8) : 3);
+
+ GalaxyRegistry.registerSolarSystem(Ross128SolarSystem.Ross128System);
+ GalaxyRegistry.registerPlanet(Ross128SolarSystem.Ross128b);
+ GalaxyRegistry.registerMoon(Ross128SolarSystem.Ross128ba);
+ 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());
+ }
+}
diff --git a/src/main/java/bwcrossmod/openComputers/GTNBTDataBase.java b/src/main/java/bwcrossmod/openComputers/GTNBTDataBase.java
new file mode 100644
index 0000000000..b03b70b2ba
--- /dev/null
+++ b/src/main/java/bwcrossmod/openComputers/GTNBTDataBase.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.openComputers;
+
+import net.minecraft.nbt.NBTTagCompound;
+
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+
+public class GTNBTDataBase {
+
+ private static final BiMap<NBTTagCompound, Long> tagIdBiMap = HashBiMap.create();
+ private static final BiMap<GTNBTDataBase, Long> GTNBTBIMAP = HashBiMap.create();
+
+ private static long maxID = Long.MIN_VALUE + 1;
+
+ private final NBTTagCompound tagCompound;
+
+ private final String mDataName;
+ private final String mDataTitle;
+ private long id;
+
+ GTNBTDataBase(String mDataName, String mDataTitle, NBTTagCompound tagCompound) {
+ this.mDataName = mDataName;
+ this.mDataTitle = mDataTitle;
+ this.tagCompound = tagCompound;
+ this.id = GTNBTDataBase.maxID;
+ GTNBTDataBase.tagIdBiMap.put(tagCompound, this.id);
+ GTNBTDataBase.GTNBTBIMAP.put(this, this.id);
+ ++GTNBTDataBase.maxID;
+ }
+
+ static GTNBTDataBase getGTTagFromId(Long id) {
+ return GTNBTDataBase.GTNBTBIMAP.inverse()
+ .get(id);
+ }
+
+ static Long getIdFromGTTag(GTNBTDataBase tagCompound) {
+ return GTNBTDataBase.GTNBTBIMAP.get(tagCompound);
+ }
+
+ static NBTTagCompound getTagFromId(Long id) {
+ return GTNBTDataBase.tagIdBiMap.inverse()
+ .get(id);
+ }
+
+ static Long getIdFromTag(NBTTagCompound tagCompound) {
+ return GTNBTDataBase.tagIdBiMap.get(tagCompound);
+ }
+
+ public NBTTagCompound getTagCompound() {
+ return this.tagCompound;
+ }
+
+ public String getmDataName() {
+ return this.mDataName;
+ }
+
+ static long getMaxID() {
+ return GTNBTDataBase.maxID;
+ }
+
+ public String getmDataTitle() {
+ return this.mDataTitle;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ private GTNBTDataBase(NBTTagCompound tagCompound, String mDataName, String mDataTitle, long id) {
+ this.tagCompound = tagCompound;
+ this.mDataName = mDataName;
+ this.mDataTitle = mDataTitle;
+ this.id = id;
+ }
+
+ public static GTNBTDataBase makeNewWithoutRegister(String mDataName, String mDataTitle,
+ NBTTagCompound tagCompound) {
+ return new GTNBTDataBase(tagCompound, mDataName, mDataTitle, Long.MIN_VALUE);
+ }
+}
diff --git a/src/main/java/bwcrossmod/openComputers/TileEntityGTDataServer.java b/src/main/java/bwcrossmod/openComputers/TileEntityGTDataServer.java
new file mode 100644
index 0000000000..c59ba39c12
--- /dev/null
+++ b/src/main/java/bwcrossmod/openComputers/TileEntityGTDataServer.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.openComputers;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
+
+import bartworks.API.ITileAddsInformation;
+import bartworks.API.ITileHasDifferentTextureSides;
+import bartworks.API.SideReference;
+import cpw.mods.fml.common.Optional;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Mods;
+import gregtech.api.util.GTUtility;
+import gregtech.common.items.behaviors.BehaviourDataOrb;
+import li.cil.oc.api.machine.Arguments;
+import li.cil.oc.api.machine.Callback;
+import li.cil.oc.api.machine.Context;
+import li.cil.oc.api.network.SimpleComponent;
+
+@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = Mods.Names.OPEN_COMPUTERS)
+public class TileEntityGTDataServer extends TileEntity
+ implements ISidedInventory, ITileAddsInformation, ITileHasDifferentTextureSides, SimpleComponent {
+
+ private final BiMap<Long, GTNBTDataBase> OrbDataBase = HashBiMap.create();
+
+ private ItemStack[] mItems = new ItemStack[2];
+ private byte TickTimer;
+
+ @Optional.Method(modid = Mods.Names.OPEN_COMPUTERS)
+ public String getComponentName() {
+ return "GT-Data Server";
+ }
+
+ @Optional.Method(modid = Mods.Names.OPEN_COMPUTERS)
+ @Callback
+ public Object[] listData(Context context, Arguments args) {
+ Set<String> ret = new HashSet<>();
+ for (Map.Entry<Long, GTNBTDataBase> entry : this.OrbDataBase.entrySet()) {
+ ret.add(
+ entry.getValue()
+ .getId() + Long.MAX_VALUE
+ + ". "
+ + entry.getValue()
+ .getmDataTitle());
+ }
+ return ret.toArray(new String[0]);
+ }
+
+ @Optional.Method(modid = Mods.Names.OPEN_COMPUTERS)
+ @Callback
+ public Object[] imprintOrb(Context context, Arguments args) {
+ return new Object[] { false };
+ }
+
+ private boolean isServerSide() {
+ return !this.worldObj.isRemote || SideReference.Side.Server;
+ }
+
+ @Override
+ public void updateEntity() {
+ if (this.TickTimer++ % 20 != 0) return;
+
+ if (this.isServerSide()) {
+ if (GTUtility.areStacksEqual(this.mItems[0], ItemList.Tool_DataOrb.get(1))
+ && this.mItems[0].hasTagCompound()) {
+ if (GTNBTDataBase.getIdFromTag(this.mItems[0].getTagCompound()) == null) {
+ this.OrbDataBase.put(
+ GTNBTDataBase.getMaxID(),
+ new GTNBTDataBase(
+ BehaviourDataOrb.getDataName(this.mItems[0]),
+ BehaviourDataOrb.getDataTitle(this.mItems[0]),
+ this.mItems[0].getTagCompound()));
+ } else {
+ long id = GTNBTDataBase.getIdFromTag(this.mItems[0].getTagCompound());
+ this.OrbDataBase.put(id, GTNBTDataBase.getGTTagFromId(id));
+ }
+ }
+ if (GTUtility.areStacksEqual(this.mItems[0], ItemList.Tool_DataStick.get(1))
+ && this.mItems[0].hasTagCompound()) {
+
+ String bookTitle = GTUtility.ItemNBT.getBookTitle(this.mItems[0]);
+ String punchcardData = GTUtility.ItemNBT.getPunchCardData(this.mItems[0]);
+ short mapID = GTUtility.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 (GTNBTDataBase.getIdFromTag(this.mItems[0].getTagCompound()) == null) {
+ this.OrbDataBase
+ .put(GTNBTDataBase.getMaxID(), new GTNBTDataBase(name, title, this.mItems[0].getTagCompound()));
+ } else {
+ long id = GTNBTDataBase.getIdFromTag(this.mItems[0].getTagCompound());
+ this.OrbDataBase.put(id, GTNBTDataBase.getGTTagFromId(id));
+ }
+ }
+ }
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[0];
+ }
+
+ @Override
+ public void registerBlockIcons(IIconRegister par1IconRegister) {}
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
+ return new int[0];
+ }
+
+ @Override
+ public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return this.mItems.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int slotIn) {
+ return slotIn == 0 ? this.mItems[0] : this.mItems[1];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int index, int count) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int index) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int index, ItemStack stack) {
+ if (index > 1 || index < 0) return;
+ this.mItems[index] = stack;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return null;
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 1;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer player) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {}
+
+ @Override
+ public void closeInventory() {}
+
+ @Override
+ public boolean isItemValidForSlot(int index, ItemStack stack) {
+ return index == 0;
+ }
+}
diff --git a/src/main/java/bwcrossmod/tectech/TecTechResearchLoader.java b/src/main/java/bwcrossmod/tectech/TecTechResearchLoader.java
new file mode 100644
index 0000000000..2a1a66d6e0
--- /dev/null
+++ b/src/main/java/bwcrossmod/tectech/TecTechResearchLoader.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.tectech;
+
+import static gregtech.api.util.GTRecipeBuilder.MINUTES;
+
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+import bartworks.common.loaders.ItemRegistry;
+import bartworks.system.material.WerkstoffLoader;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.TierEU;
+import gregtech.api.util.GTOreDictUnificator;
+import tectech.recipe.TTRecipeAdder;
+
+public class TecTechResearchLoader {
+
+ public static void runResearches() {
+ Fluid solderIndalloy = FluidRegistry.getFluid("molten.indalloy140") != null
+ ? FluidRegistry.getFluid("molten.indalloy140")
+ : FluidRegistry.getFluid("molten.solderingalloy");
+
+ TTRecipeAdder.addResearchableAssemblylineRecipe(
+ ItemRegistry.voidminer[0].copy(),
+ 1024000,
+ 256,
+ (int) TierEU.RECIPE_ZPM,
+ 24,
+ new Object[] { ItemRegistry.voidminer[0].copy(),
+ GTOreDictUnificator.get(OrePrefixes.frameGt, Materials.BlackPlutonium, 9L),
+ Materials.BlackPlutonium.getPlates(3), ItemList.Electric_Motor_ZPM.get(9L), ItemList.Sensor_ZPM.get(9L),
+ ItemList.Field_Generator_ZPM.get(9L),
+ GTOreDictUnificator.get(OrePrefixes.screw, Materials.BlackPlutonium, 36L) },
+ new FluidStack[] { new FluidStack(solderIndalloy, 1440), WerkstoffLoader.Krypton.getFluidOrGas(20000) },
+ ItemRegistry.voidminer[1].copy(),
+ 5 * MINUTES,
+ (int) TierEU.RECIPE_ZPM);
+
+ TTRecipeAdder.addResearchableAssemblylineRecipe(
+ ItemRegistry.voidminer[1].copy(),
+ 8192000,
+ 512,
+ (int) TierEU.RECIPE_UV,
+ 64,
+ new Object[] { ItemRegistry.voidminer[1].copy(),
+ GTOreDictUnificator.get(OrePrefixes.frameGt, Materials.Neutronium, 9L),
+ Materials.Neutronium.getPlates(3), ItemList.Electric_Motor_UV.get(9L), ItemList.Sensor_UV.get(9L),
+ ItemList.Field_Generator_UV.get(9L),
+ GTOreDictUnificator.get(OrePrefixes.screw, Materials.Neutronium, 36L) },
+ new FluidStack[] { new FluidStack(solderIndalloy, 1440), WerkstoffLoader.Oganesson.getFluidOrGas(20000) },
+ ItemRegistry.voidminer[2].copy(),
+ 5 * MINUTES,
+ (int) TierEU.RECIPE_UV);
+
+ TTRecipeAdder.addResearchableAssemblylineRecipe(
+ ItemList.Machine_Multi_ImplosionCompressor.get(1L),
+ 64000,
+ 48,
+ (int) TierEU.RECIPE_UV,
+ 8,
+ new Object[] { ItemList.Machine_Multi_ImplosionCompressor.get(1L), Materials.Neutronium.getBlocks(5),
+ GTOreDictUnificator.get(OrePrefixes.stickLong, Materials.Osmium, 64),
+ GTOreDictUnificator.get(OrePrefixes.ring, Materials.Osmium, 64),
+ GTOreDictUnificator.get(OrePrefixes.wireGt01, Materials.SuperconductorUHV, 64),
+ ItemList.Electric_Piston_UV.get(64), },
+ new FluidStack[] { new FluidStack(solderIndalloy, 1440), Materials.Osmium.getMolten(1440),
+ Materials.Neutronium.getMolten(1440) },
+ ItemRegistry.eic.copy(),
+ 5 * MINUTES,
+ (int) TierEU.RECIPE_UV);
+
+ }
+}
diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaser.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaser.java
new file mode 100644
index 0000000000..7dc3eca2f8
--- /dev/null
+++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaser.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.tectech.tileentites.tiered;
+
+import net.minecraftforge.common.util.ForgeDirection;
+
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import tectech.mechanics.pipe.IConnectsToEnergyTunnel;
+import tectech.thing.metaTileEntity.pipe.MTEPipeEnergy;
+
+public interface LowPowerLaser extends IMetaTileEntity, IConnectsToEnergyTunnel {
+
+ boolean isSender();
+
+ boolean isReceiver();
+
+ boolean isTunnel();
+
+ default boolean isConnectedCorrectly(ForgeDirection side) {
+ return false;
+ }
+
+ default void setEUVar(long aEnergy) {}
+
+ default long getAMPERES() {
+ return -1;
+ }
+
+ default long maxEUInput() {
+ return -1;
+ }
+
+ default long maxEUOutput() {
+ return -1;
+ }
+
+ default long maxEUStore() {
+ return -1;
+ }
+
+ default long getTotalPower() {
+ return this.getAMPERES() * Math.max(this.maxEUOutput(), this.maxEUInput()) - this.getAMPERES() / 20;
+ }
+
+ default void moveAroundLowPower(IGregTechTileEntity aBaseMetaTileEntity) {
+ byte color = this.getBaseMetaTileEntity()
+ .getColorization();
+ if (color >= 0) {
+ ForgeDirection front = aBaseMetaTileEntity.getFrontFacing();
+ ForgeDirection opposite = front.getOpposite();
+
+ for (short dist = 1; dist < 250; ++dist) {
+ IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity
+ .getIGregTechTileEntityAtSideAndDistance(front, dist);
+ if (tGTTileEntity == null || tGTTileEntity.getColorization() != color) {
+ return;
+ }
+
+ IMetaTileEntity aMetaTileEntity = tGTTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return;
+ }
+
+ if (aMetaTileEntity instanceof LowPowerLaser lowPowerLaser && lowPowerLaser.isReceiver()
+ && opposite == tGTTileEntity.getFrontFacing()) {
+ if (this.maxEUOutput() > lowPowerLaser.maxEUInput()
+ || this.getAMPERES() > lowPowerLaser.getAMPERES()) {
+ aMetaTileEntity.doExplosion(this.maxEUOutput());
+ this.setEUVar(aBaseMetaTileEntity.getStoredEU() - this.maxEUOutput());
+ return;
+ }
+
+ if (this.maxEUOutput() == lowPowerLaser.maxEUInput()) {
+ long diff = Math.min(
+ this.getAMPERES() * 20L * this.maxEUOutput(),
+ Math.min(
+ lowPowerLaser.maxEUStore() - aMetaTileEntity.getBaseMetaTileEntity()
+ .getStoredEU(),
+ aBaseMetaTileEntity.getStoredEU()));
+ this.setEUVar(aBaseMetaTileEntity.getStoredEU() - diff);
+ lowPowerLaser.setEUVar(
+ aMetaTileEntity.getBaseMetaTileEntity()
+ .getStoredEU() + diff);
+ }
+ return;
+ }
+
+ if ((!(aMetaTileEntity instanceof LowPowerLaser lowPowerLaser) || !lowPowerLaser.isTunnel())
+ && !(aMetaTileEntity instanceof MTEPipeEnergy)) {
+ return;
+ }
+
+ if (aMetaTileEntity instanceof MTEPipeEnergy tePipeEnergy) {
+ if (tePipeEnergy.connectionCount < 2) {
+ return;
+ }
+ tePipeEnergy.markUsed();
+ return;
+ }
+
+ if (aMetaTileEntity instanceof LowPowerLaser lowPowerLaser && lowPowerLaser.isTunnel()
+ && !lowPowerLaser.isConnectedCorrectly(front)) {
+ return;
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaserBase.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaserBase.java
new file mode 100644
index 0000000000..a4e21be96f
--- /dev/null
+++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaserBase.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.tectech.tileentites.tiered;
+
+import java.util.Optional;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import gregtech.api.enums.GTValues;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.MTETieredMachineBlock;
+
+public abstract class LowPowerLaserBase extends MTETieredMachineBlock implements LowPowerLaser {
+
+ protected long AMPERES;
+
+ public LowPowerLaserBase(int aID, String aName, String aNameRegional, int aTier, long aAmperes, int aInvSlotCount,
+ String aDescription, ITexture... aTextures) {
+ super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
+ this.AMPERES = aAmperes;
+ }
+
+ public LowPowerLaserBase(int aID, String aName, String aNameRegional, int aTier, long aAmperes, int aInvSlotCount,
+ String[] aDescription, ITexture... aTextures) {
+ super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
+ this.AMPERES = aAmperes;
+ }
+
+ public LowPowerLaserBase(String aName, int aTier, long aAmperes, int aInvSlotCount, String aDescription,
+ ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ this.AMPERES = aAmperes;
+ }
+
+ public LowPowerLaserBase(String aName, int aTier, long aAmperes, int aInvSlotCount, String[] aDescription,
+ ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ this.AMPERES = aAmperes;
+ }
+
+ @Override
+ public long getAMPERES() {
+ return this.AMPERES;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side,
+ ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side,
+ ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public boolean isInputFacing(ForgeDirection side) {
+ return true;
+ }
+
+ @Override
+ public boolean isOutputFacing(ForgeDirection side) {
+ return true;
+ }
+
+ @Override
+ public boolean shouldJoinIc2Enet() {
+ return true;
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound nbtTagCompound) {
+ Optional.ofNullable(nbtTagCompound)
+ .ifPresent(tag -> tag.setLong("AMPERES", this.AMPERES));
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound nbtTagCompound) {
+ if (nbtTagCompound != null && nbtTagCompound.hasKey("AMPERES")) {
+ this.AMPERES = nbtTagCompound.getLong("AMPERES");
+ }
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(ForgeDirection facing) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return false;
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return false;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return GTValues.V[this.mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return GTValues.V[this.mTier];
+ }
+
+ @Override
+ public boolean isTeleporterCompatible() {
+ return false;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return GTValues.V[this.mTier + 1];
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 512L + GTValues.V[this.mTier + 1] * 24L * this.AMPERES;
+ }
+}
diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserBox.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserBox.java
new file mode 100644
index 0000000000..e4eba7d464
--- /dev/null
+++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserBox.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.tectech.tileentites.tiered;
+
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import bartworks.util.BWTooltipReference;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GTUtility;
+
+public class MTELowPowerLaserBox extends LowPowerLaserBase {
+
+ public MTELowPowerLaserBox(int aID, String aName, String aNameRegional, int aTier, long aAmperes,
+ ITexture... aTextures) {
+ super(aID, aName, aNameRegional, aTier, aAmperes, 0, new String[0], aTextures);
+ }
+
+ public MTELowPowerLaserBox(String aName, int aTier, long aAmperes, String[] aDescription,
+ ITexture[][][] aTextures) {
+ super(aName, aTier, aAmperes, 0, aDescription, aTextures);
+ }
+
+ @Override
+ public boolean isSender() {
+ return this.getBaseMetaTileEntity()
+ .isAllowedToWork();
+ }
+
+ @Override
+ public boolean isReceiver() {
+ return !this.getBaseMetaTileEntity()
+ .isAllowedToWork();
+ }
+
+ @Override
+ public boolean isTunnel() {
+ return false;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return !this.getBaseMetaTileEntity()
+ .isAllowedToWork() ? this.AMPERES : 0;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return this.getBaseMetaTileEntity()
+ .isAllowedToWork() ? this.AMPERES + this.AMPERES / 4 : 0;
+ }
+
+ @Override
+ public boolean hasAlternativeModeText() {
+ return true;
+ }
+
+ @Override
+ public String getAlternativeModeText() {
+ return this.isReceiver() ? "Set to receiving mode" : "Set to sending mode";
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return this.getBaseMetaTileEntity()
+ .isAllowedToWork();
+ }
+
+ @Override
+ public boolean isEnetOutput() {
+ return !this.getBaseMetaTileEntity()
+ .isAllowedToWork();
+ }
+
+ @Override
+ public boolean canConnect(ForgeDirection side) {
+ return side == this.getBaseMetaTileEntity()
+ .getFrontFacing();
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
+ return new MTELowPowerLaserBox(this.mName, this.mTier, this.AMPERES, this.mDescriptionArray, this.mTextures);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork());
+
+ byte Tick = (byte) (int) (aTick % 20L);
+ if (16 == Tick) {
+ if (aBaseMetaTileEntity.getStoredEU() > 0L) {
+ this.setEUVar(aBaseMetaTileEntity.getStoredEU() - this.AMPERES);
+ if (aBaseMetaTileEntity.getStoredEU() < 0L) {
+ this.setEUVar(0L);
+ }
+ }
+ if (this.getBaseMetaTileEntity()
+ .isAllowedToWork() && aBaseMetaTileEntity.getStoredEU() > this.getMinimumStoredEU()) {
+ this.moveAroundLowPower(aBaseMetaTileEntity);
+ }
+ }
+ }
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[12][17][];
+
+ for (byte i = -1; i < 16; ++i) {
+ rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[this.mTier] };
+ rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[this.mTier] };
+ rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[this.mTier] };
+ rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_LASER_TT[this.mTier] };
+ rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_LASER_TT[this.mTier] };
+ rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_LASER_TT[this.mTier] };
+ rTextures[6][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] };
+ rTextures[7][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] };
+ rTextures[8][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] };
+ rTextures[9][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_LASER_TT[this.mTier] };
+ rTextures[10][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_LASER_TT[this.mTier] };
+ rTextures[11][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
+ tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_LASER_TT[this.mTier] };
+ }
+
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
+ int aColorIndex, boolean aActive, boolean aRedstone) {
+ return this.mTextures[Math.min(2, side.ordinal()) + (side == facing ? 3 : 0) + (aActive ? 0 : 6)][aColorIndex
+ + 1];
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] { "Like a transformer... but for LASERS!",
+ "Transfer rate: " + EnumChatFormatting.YELLOW
+ + GTUtility.formatNumbers(this.getTotalPower())
+ + EnumChatFormatting.WHITE
+ + " EU/t",
+ BWTooltipReference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() };
+ }
+}
diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserDynamo.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserDynamo.java
new file mode 100644
index 0000000000..da3e3e4ac2
--- /dev/null
+++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserDynamo.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.tectech.tileentites.tiered;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import tectech.thing.metaTileEntity.hatch.MTEHatchDynamoTunnel;
+
+public class MTELowPowerLaserDynamo extends MTEHatchDynamoTunnel implements LowPowerLaser {
+
+ public MTELowPowerLaserDynamo(int aID, String aName, String aNameRegional, int aTier, int aAmp) {
+ super(aID, aName, aNameRegional, aTier, aAmp);
+ }
+
+ public MTELowPowerLaserDynamo(String aName, int aTier, int aAmp, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aAmp, aDescription, aTextures);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new MTELowPowerLaserDynamo(this.mName, this.mTier, this.Amperes, this.mDescriptionArray, this.mTextures);
+ }
+
+ @Override
+ public boolean isSender() {
+ return true;
+ }
+
+ @Override
+ public boolean isReceiver() {
+ return false;
+ }
+
+ @Override
+ public boolean isTunnel() {
+ return false;
+ }
+
+ @Override
+ public long getAMPERES() {
+ return this.Amperes;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return mDescriptionArray;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ byte Tick = (byte) (int) (aTick % 20L);
+ if (16 == Tick && aBaseMetaTileEntity.getStoredEU() > 0L) {
+ this.setEUVar(aBaseMetaTileEntity.getStoredEU() - this.Amperes);
+ if (aBaseMetaTileEntity.getStoredEU() < 0L) {
+ this.setEUVar(0L);
+ }
+ }
+ if (aBaseMetaTileEntity.getStoredEU() > this.getMinimumStoredEU()) {
+ this.moveAroundLowPower(aBaseMetaTileEntity);
+ }
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserHatch.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserHatch.java
new file mode 100644
index 0000000000..b9fa9c14b6
--- /dev/null
+++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserHatch.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.tectech.tileentites.tiered;
+
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import tectech.thing.metaTileEntity.hatch.MTEHatchEnergyTunnel;
+
+public class MTELowPowerLaserHatch extends MTEHatchEnergyTunnel implements LowPowerLaser {
+
+ public MTELowPowerLaserHatch(int aID, String aName, String aNameRegional, int aTier, int aAmp) {
+ super(aID, aName, aNameRegional, aTier, aAmp);
+ }
+
+ public MTELowPowerLaserHatch(String aName, int aTier, int aAmp, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aAmp, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return mDescriptionArray;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new MTELowPowerLaserHatch(this.mName, this.mTier, this.Amperes, this.mDescriptionArray, this.mTextures);
+ }
+
+ @Override
+ public boolean isSender() {
+ return false;
+ }
+
+ @Override
+ public boolean isReceiver() {
+ return true;
+ }
+
+ @Override
+ public boolean isTunnel() {
+ return false;
+ }
+
+ @Override
+ public long getAMPERES() {
+ return this.Amperes;
+ }
+}
diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserPipe.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserPipe.java
new file mode 100644
index 0000000000..0a8ddb19d3
--- /dev/null
+++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserPipe.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.tectech.tileentites.tiered;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import net.minecraft.block.Block;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import bartworks.util.BWTooltipReference;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.MTECable;
+import gregtech.api.render.TextureFactory;
+import gregtech.api.util.CoverBehavior;
+import gregtech.common.GTClient;
+import ic2.core.Ic2Items;
+
+public class MTELowPowerLaserPipe extends MTECable implements LowPowerLaser {
+
+ public MTELowPowerLaserPipe(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional, 0.25f, Materials.BorosilicateGlass, 0, 0, 0, false, false);
+ }
+
+ public MTELowPowerLaserPipe(String aName, float aThickNess, Materials aMaterial, long aCableLossPerMeter,
+ long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) {
+ super(aName, aThickNess, aMaterial, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
+ return new MTELowPowerLaserPipe(
+ this.mName,
+ this.mThickNess,
+ this.mMaterial,
+ this.mCableLossPerMeter,
+ this.mAmperage,
+ this.mVoltage,
+ this.mInsulated,
+ this.mCanShock);
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aTick % 20 == 13 && aBaseMetaTileEntity.isClientSide() && GTClient.changeDetected == 4) {
+ aBaseMetaTileEntity.issueTextureUpdate();
+ }
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection siide, byte aConnections,
+ int aColorIndex, boolean aConnected, boolean aRedstone) {
+ return new ITexture[] { TextureFactory.of(
+ Block.getBlockFromItem(Ic2Items.glassFiberCableBlock.getItem()),
+ Ic2Items.glassFiberCableBlock.getItemDamage(),
+ siide) };
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] { "Primitive Laser Cable intended for Low Power Applications", "Does not auto-connect",
+ "Does not turn or bend",
+ EnumChatFormatting.WHITE + "Must be "
+ + EnumChatFormatting.YELLOW
+ + "c"
+ + EnumChatFormatting.RED
+ + "o"
+ + EnumChatFormatting.BLUE
+ + "l"
+ + EnumChatFormatting.DARK_PURPLE
+ + "o"
+ + EnumChatFormatting.GOLD
+ + "r"
+ + EnumChatFormatting.DARK_RED
+ + "e"
+ + EnumChatFormatting.DARK_GREEN
+ + "d"
+ + EnumChatFormatting.WHITE
+ + " in order to work",
+ BWTooltipReference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() };
+ }
+
+ @Override
+ public boolean isSender() {
+ return false;
+ }
+
+ @Override
+ public boolean isReceiver() {
+ return false;
+ }
+
+ @Override
+ public boolean isTunnel() {
+ return true;
+ }
+
+ public boolean canConnect(ForgeDirection side) {
+ return true;
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return false;
+ }
+
+ @Override
+ public boolean isConnectedCorrectly(ForgeDirection side) {
+ return this.isConnectedAtSide(side) && this.isConnectedAtSide(side.getOpposite());
+ }
+
+ @Override
+ public boolean shouldJoinIc2Enet() {
+ return false;
+ }
+
+ @Override
+ public long injectEnergyUnits(ForgeDirection side, long aVoltage, long aAmperage) {
+ return 0L;
+ }
+
+ @Override
+ @Deprecated
+ public long transferElectricity(ForgeDirection side, long aVoltage, long aAmperage,
+ ArrayList<TileEntity> aAlreadyPassedTileEntityList) {
+ return 0L;
+ }
+
+ @Override
+ public long transferElectricity(ForgeDirection side, long aVoltage, long aAmperage,
+ HashSet<TileEntity> aAlreadyPassedSet) {
+ return 0L;
+ }
+
+ @Override
+ public boolean letsIn(CoverBehavior coverBehavior, ForgeDirection side, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
+ return true;
+ }
+
+ @Override
+ public boolean letsOut(CoverBehavior coverBehavior, ForgeDirection side, int aCoverID, int aCoverVariable,
+ ICoverable aTileEntity) {
+ return true;
+ }
+}
diff --git a/src/main/java/bwcrossmod/tgregworks/MaterialsInjector.java b/src/main/java/bwcrossmod/tgregworks/MaterialsInjector.java
new file mode 100644
index 0000000000..a8e65e51f2
--- /dev/null
+++ b/src/main/java/bwcrossmod/tgregworks/MaterialsInjector.java
@@ -0,0 +1,81 @@
+package bwcrossmod.tgregworks;
+
+import static gregtech.api.enums.Mods.TinkersGregworks;
+
+import net.minecraftforge.common.config.Property;
+
+import bartworks.MainMod;
+import bartworks.system.material.Werkstoff;
+import cpw.mods.fml.common.Mod;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import gregtech.GT_Version;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import vexatos.tgregworks.TGregworks;
+import vexatos.tgregworks.item.ItemTGregPart;
+import vexatos.tgregworks.reference.Config;
+
+@Mod(
+ modid = MaterialsInjector.MOD_ID,
+ name = MaterialsInjector.NAME,
+ version = MaterialsInjector.VERSION,
+ dependencies = """
+ required-after:IC2;\
+ required-after:gregtech;\
+ required-after:bartworks;\
+ before:TGregworks;\
+ before:miscutils;""")
+public class MaterialsInjector {
+
+ public static final String NAME = "BartWorks Mod Additions - TGregworks Container";
+ public static final String VERSION = GT_Version.VERSION;
+ public static final String MOD_ID = "bartworkscrossmodtgregworkscontainer";
+
+ @Mod.EventHandler
+ public void init(FMLInitializationEvent init) {
+ if (TinkersGregworks.isModLoaded()) {
+ MaterialsInjector.run();
+ }
+ }
+
+ public static void run() {
+ MainMod.LOGGER.info("Registering TGregworks - BartWorks tool parts.");
+ Werkstoff.werkstoffHashSet.stream()
+ .filter(x -> x.hasItemType(OrePrefixes.gem) || x.hasItemType(OrePrefixes.plate))
+ .map(Werkstoff::getBridgeMaterial)
+ .filter(x -> x.mMetaItemSubID == -1)
+ .filter(x -> x.mDurability != 0)
+ .forEach(m -> {
+ setConfigProps(m);
+ registerParts(m);
+ });
+
+ TGregworks.registry.configProps.clear();
+ TGregworks.registry.configIDs.clear();
+
+ ItemTGregPart.toolMaterialNames = TGregworks.registry.toolMaterialNames;
+ }
+
+ private static void registerParts(Materials m) {
+ TGregworks.registry.toolMaterialNames.add(m.mDefaultLocalName);
+ int matID = TGregworks.registry.getMaterialID(m);
+
+ TGregworks.registry.addToolMaterial(matID, m);
+ TGregworks.registry.addBowMaterial(matID, m);
+ TGregworks.registry.addArrowMaterial(matID, m);
+
+ TGregworks.registry.matIDs.put(m, matID);
+ TGregworks.registry.materialIDMap.put(matID, m);
+ }
+
+ private static void setConfigProps(Materials m) {
+ if (TGregworks.config.get(Config.Category.Enable, m.mName, true)
+ .getBoolean(true)) {
+ TGregworks.registry.toolMaterials.add(m);
+ Property configProp = TGregworks.config
+ .get(Config.onMaterial(Config.MaterialID), m.mName, 0, null, 0, 100000);
+ TGregworks.registry.configProps.put(m, configProp);
+ TGregworks.registry.configIDs.add(configProp.getInt());
+ }
+ }
+}
diff --git a/src/main/java/bwcrossmod/thaumcraft/util/ThaumcraftHandler.java b/src/main/java/bwcrossmod/thaumcraft/util/ThaumcraftHandler.java
new file mode 100644
index 0000000000..caaf8aea60
--- /dev/null
+++ b/src/main/java/bwcrossmod/thaumcraft/util/ThaumcraftHandler.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2018-2020 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 bwcrossmod.thaumcraft.util;
+
+import net.minecraft.item.ItemStack;
+
+import bartworks.API.APIConfigValues;
+import bartworks.util.Pair;
+import bartworks.util.log.DebugLog;
+import thaumcraft.api.ThaumcraftApi;
+import thaumcraft.api.aspects.Aspect;
+import thaumcraft.api.aspects.AspectList;
+import thaumcraft.common.lib.world.ThaumcraftWorldGenerator;
+
+public class ThaumcraftHandler {
+
+ public static boolean isMagicalForestBiome(int biomeID) {
+ return biomeID == ThaumcraftWorldGenerator.biomeMagicalForest.biomeID;
+ }
+
+ public static boolean isTaintBiome(int biomeID) {
+ return biomeID == ThaumcraftWorldGenerator.biomeTaint.biomeID;
+ }
+
+ public static class AspectAdder {
+
+ @SafeVarargs
+ public static void addAspectViaBW(ItemStack stack, Pair<Object, Integer>... aspectPair) {
+ if (stack == null || stack.getItem() == null || stack.getUnlocalizedName() == null) return;
+ AspectList aspectList = new AspectList();
+ for (Pair<Object, Integer> a : aspectPair) {
+ Aspect aspect = (Aspect) a.getKey();
+ int amount = a.getValue();
+ if (APIConfigValues.debugLog) DebugLog.log(
+ "Stack:" + stack.getDisplayName()
+ + " Damage:"
+ + stack.getItemDamage()
+ + " aspectPair: "
+ + aspect.getName()
+ + " / "
+ + amount);
+ aspectList.add(aspect, amount);
+ }
+ ThaumcraftApi.registerObjectTag(stack, aspectList);
+ }
+ }
+}