diff options
Diffstat (limited to 'src')
408 files changed, 21706 insertions, 6271 deletions
diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index 1e37c9be13..af7fe38f38 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -18,6 +18,7 @@ import gtPlusPlus.api.interfaces.IComparableRecipe; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.NoConflictGTRecipeMap; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.nei.GT_NEI_MultiBlockHandler; @@ -260,6 +261,23 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{ //Basic Washer Map public static final GT_Recipe_Map sSimpleWasherRecipes = new GT_Recipe_Map(new HashSet<GT_Recipe>(3), "gt.recipe.simplewasher", "Simple Dust Washer", null, RES_PATH_GUI + "basicmachines/PotionBrewer", 1, 1, 0, 0, 1, E, 1, E, true, true); + + public static final Gregtech_Recipe_Map sFluidChemicalReactorRecipes = new Gregtech_Recipe_Map( + new HashSet<Recipe_GT>(100), + "gt.recipe.fluidchemicaleactor", + "Chemical Plant", + null, + CORE.MODID+":textures/gui/FluidReactor", + 0, + 0, + 0, + 2, + 1, + "Tier: ", + 1, + E, + true, + false); //RTG Fuel Map diff --git a/src/Java/gtPlusPlus/COPYRIGHT.MD b/src/Java/gtPlusPlus/COPYRIGHT.MD new file mode 100644 index 0000000000..6c199fa5fe --- /dev/null +++ b/src/Java/gtPlusPlus/COPYRIGHT.MD @@ -0,0 +1,18 @@ +COPYRIGHT TEMPLATE + +Copyright (c) ${date} AlkCorp. + +All rights reserved. +Distribution of the software in any form is only allowed with explicit, +prior permission from the owner. + +This class is provided freely and may be decompiled and modified for private use, +either with a decompiler or a bytecode editor. Public use of modified or derivative versions +is prohibited unless you are given specific written permission. + +Distribution of the source code, modified (including custom compilation) or otherwise, +is prohibited by anyone except the author, except in the case of a derivative mod that has +been given prior approval. Creating derivative works for commercial use is expressly forbidden +and the owner reserves full right to seek damages. + +Contributors: https://github.com/alkcorp/GTplusplus/graphs/contributors
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index c51b2e2997..ee2bf6c940 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -69,7 +69,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @MCVersion(value = "1.7.10") -@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks; after:StevesCarts;") +@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks; after:StevesCarts; after:xreliquary;") public class GTplusplus implements ActionListener { public static enum INIT_PHASE { @@ -105,7 +105,6 @@ public class GTplusplus implements ActionListener { //Mod Instance @Mod.Instance(CORE.MODID) public static GTplusplus instance; - public static Meta_GT_Proxy instanceGtProxy; //Material Loader public static GT_Material_Loader mGregMatLoader; @@ -181,8 +180,7 @@ public class GTplusplus implements ActionListener { mChunkLoading.preInit(event); proxy.preInit(event); Logger.INFO("Setting up our own GT_Proxy."); - instanceGtProxy = Meta_GT_Proxy.instance; - instanceGtProxy.preInit(); + Meta_GT_Proxy.preInit(); Core_Manager.preInit(); } @@ -194,7 +192,7 @@ public class GTplusplus implements ActionListener { proxy.init(event); HazmatUtils.init(); proxy.registerNetworkStuff(); - instanceGtProxy.init(); + Meta_GT_Proxy.init(); Core_Manager.init(); //Used by foreign players to generate .lang files for translation. @@ -211,7 +209,7 @@ public class GTplusplus implements ActionListener { mChunkLoading.postInit(event); proxy.postInit(event); BookHandler.runLater(); - instanceGtProxy.postInit(); + Meta_GT_Proxy.postInit(); Core_Manager.postInit(); //SprinklerHandler.registerModFerts(); @@ -238,12 +236,14 @@ public class GTplusplus implements ActionListener { if (LoadedMods.Thaumcraft) { event.registerServerCommand(new CommandDumpAspects()); } + Core_Manager.serverStart(); INIT_PHASE.STARTED.setPhaseActive(true); } @Mod.EventHandler public synchronized void serverStopping(final FMLServerStoppingEvent event) { mChunkLoading.serverStopping(event); + Core_Manager.serverStop(); if (GregtechBufferThread.mBufferThreadAllocation.size() > 0) { for (GregtechBufferThread i : GregtechBufferThread.mBufferThreadAllocation.values()) { i.destroy(); diff --git a/src/Java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java b/src/Java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java new file mode 100644 index 0000000000..3acca269d7 --- /dev/null +++ b/src/Java/gtPlusPlus/api/helpers/GregtechPlusPlus_API.java @@ -0,0 +1,197 @@ +package gtPlusPlus.api.helpers; + +import java.util.HashMap; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.WeightedCollection; +import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +public class GregtechPlusPlus_API { + + public static class Multiblock_API { + + private static final HashMap<String, SpecialMultiBehaviour> mSpecialBehaviourItemMap; + + static { + mSpecialBehaviourItemMap = new HashMap<String, SpecialMultiBehaviour>(); + } + + /** + * Register a special behaviour for GT++ Multis to listen use. + * @param aBehaviour - An Object which has extended {@link SpecialMultiBehaviour}'s base implementation. + * @return - Did this behaviour register properly? + */ + public static boolean registerSpecialMultiBehaviour(SpecialMultiBehaviour aBehaviour) { + if (aBehaviour.getTriggerItem() == null || aBehaviour.getTriggerItemTooltip() == null || aBehaviour.getTriggerItemTooltip().length() <= 0) { + Logger.INFO("Failed to attach custom multiblock logic to "+ItemUtils.getItemName(aBehaviour.getTriggerItem())); + return false; + } + mSpecialBehaviourItemMap.put("UniqueKey_"+aBehaviour.hashCode(), aBehaviour); + SpecialBehaviourTooltipHandler.addTooltipForItem(aBehaviour.getTriggerItem(), aBehaviour.getTriggerItemTooltip()); + Logger.INFO("Attached custom multiblock logic to "+ItemUtils.getItemName(aBehaviour.getTriggerItem())); + return true; + } + + public static final HashMap<String, SpecialMultiBehaviour> getSpecialBehaviourItemMap() { + return mSpecialBehaviourItemMap; + } + + + } + + public static class VoidMiner_API { + + private static final HashMap<Integer, HashMap<String, WeightedCollection<Block>>> mMinerLootCache; + + static { + mMinerLootCache = new HashMap<Integer, HashMap<String, WeightedCollection<Block>>>(); + } + + + /** + * + * Registers an ore block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aOredictName - The OreDict name of the Ore to be mined. + * @return - If there was a valid Block found in the OreDict for the provided name. + */ + public static boolean registerOreForVoidMiner(int aDim, String aOredictName) { + return registerOreForVoidMiner(aDim, aOredictName, 100); + } + + /** + * + * Registers an ore block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aOredictName - The OreDict name of the Ore to be mined. + * @param aWeight - The weight of this ore Block. + * @return - If there was a valid Block found in the OreDict for the provided name. + */ + public static boolean registerOreForVoidMiner(int aDim, String aOredictName, int aWeight) { + Block b = null; + ItemStack[] aValidItems = ItemUtils.validItemsForOreDict(aOredictName); + for (ItemStack g : aValidItems) { + if (g != null) { + b = Block.getBlockFromItem(g.getItem()); + if (b != null) { + break; + } + } + } + if (b != null) { + registerOreForVoidMiner(aDim, b, aWeight); + return true; + } + return false; + } + + + /** + * Registers an ore block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aOreBlock - The Ore Block to be mined. + */ + public static void registerOreForVoidMiner(int aDim, Block aOreBlock) { + registerOreForVoidMiner(aDim, aOreBlock, 100); + } + + /** + * Registers an ore block for a dimension. + * @param aDim - The Dimension ID + * @param aOreBlock - The Ore Block to be mined. + * @param aWeight - The weight of this ore Block. + */ + public static void registerOreForVoidMiner(int aDim, Block aOreBlock, int aWeight) { + GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aOreBlock, aWeight); + } + + /** + * Registers a surface block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aDirtBlock - The Dirt/Grass Block to be mined. + */ + public static void registerEarthSurfaceForVoidMiner(int aDim, Block aDirtBlock) { + registerEarthSurfaceForVoidMiner(aDim, aDirtBlock, 100); + } + + /** + * Registers a surface block for a dimension. + * @param aDim - The Dimension ID + * @param aDirtBlock - The Dirt/Grass Block to be mined. + * @param aWeight - The weight of this Dirt/Grass Block. + */ + public static void registerEarthSurfaceForVoidMiner(int aDim, Block aDirtBlock, int aWeight) { + GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aDirtBlock, aWeight); + } + + /** + * Registers a stone block for a dimension. Uses a default weight of 100. + * @param aDim - The Dimension ID + * @param aStoneBlock - The Stone Block to be mined. + */ + public static void registerEarthStoneForVoidMiner(int aDim, Block aStoneBlock) { + registerEarthStoneForVoidMiner(aDim, aStoneBlock, 100); + } + + /** + * Registers a stone block for a dimension. + * @param aDim - The Dimension ID + * @param aStoneBlock - The Stone Block to be mined. + * @param aWeight - The weight of this Stone Block. + */ + public static void registerEarthStoneForVoidMiner(int aDim, Block aStoneBlock, int aWeight) { + GregtechPlusPlus_API_Internal.writeBlockToDimensionInCache(aDim, 0, aStoneBlock, aWeight); + } + + + + + public static WeightedCollection<Block> getAllRegisteredOresForDimension(int aDim) { + return mMinerLootCache.get(aDim).get("ore"); + } + + public static WeightedCollection<Block> getAllRegisteredDirtTypesForDimension(int aDim) { + return mMinerLootCache.get(aDim).get("dirt"); + } + + public static WeightedCollection<Block> getAllRegisteredStoneTypesForDimension(int aDim) { + return mMinerLootCache.get(aDim).get("stone"); + } + + public static final HashMap<Integer, HashMap<String, WeightedCollection<Block>>> getVoidMinerLootCache() { + return mMinerLootCache; + } + + } + + + private static class GregtechPlusPlus_API_Internal { + + private static void writeBlockToDimensionInCache(int aDim, int aType, Block aBlock, int aWeight) { + HashMap<String, WeightedCollection<Block>> aDimMap = VoidMiner_API.mMinerLootCache.get(aDim); + if (aDimMap == null) { + aDimMap = new HashMap<String, WeightedCollection<Block>>(); + } + WeightedCollection<Block> aMappedBlocks = getBlockMap(aType, aDimMap); + aMappedBlocks.put(aWeight, aBlock); + + } + + private static WeightedCollection<Block> getBlockMap(int aType, HashMap<String, WeightedCollection<Block>> aDimMap){ + WeightedCollection<Block> aMappedBlocks; + String aTypeName = ((aType == 0) ? "ore" : (aType == 1) ? "dirt" : (aType == 2) ? "stone" : "error"); + aMappedBlocks = aDimMap.get(aTypeName); + if (aMappedBlocks == null) { + aMappedBlocks = new WeightedCollection<Block>(); + } + return aMappedBlocks; + } + + } + + +} diff --git a/src/Java/gtPlusPlus/api/helpers/MaterialHelper.java b/src/Java/gtPlusPlus/api/helpers/MaterialHelper.java index 43f8ddeb19..9d2e894d99 100644 --- a/src/Java/gtPlusPlus/api/helpers/MaterialHelper.java +++ b/src/Java/gtPlusPlus/api/helpers/MaterialHelper.java @@ -10,6 +10,7 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; @@ -56,4 +57,20 @@ public class MaterialHelper { } return false; } + + public static ItemStack getCells(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.cell, aMaterial, i); + } + public static ItemStack getDust(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.dust, aMaterial, i); + } + public static ItemStack getDustSmall(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.dustSmall, aMaterial, i); + } + public static ItemStack getDustTiny(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.dustTiny, aMaterial, i); + } + public static ItemStack getGems(Materials aMaterial, int i) { + return ItemUtils.getOrePrefixStack(OrePrefixes.gem, aMaterial, i); + } } diff --git a/src/Java/gtPlusPlus/api/interfaces/IPlugin.java b/src/Java/gtPlusPlus/api/interfaces/IPlugin.java index c3840476e9..67be182402 100644 --- a/src/Java/gtPlusPlus/api/interfaces/IPlugin.java +++ b/src/Java/gtPlusPlus/api/interfaces/IPlugin.java @@ -34,4 +34,7 @@ public interface IPlugin { public boolean init(); public boolean postInit(); + public boolean serverStart(); + public boolean serverStop(); + } diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java index f994c40b52..9c1e3d4338 100644 --- a/src/Java/gtPlusPlus/api/objects/Logger.java +++ b/src/Java/gtPlusPlus/api/objects/Logger.java @@ -6,11 +6,12 @@ import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.relauncher.FMLRelaunchLog; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.proxy.ClientProxy; +import gtPlusPlus.preloader.asm.AsmConfig; public class Logger { - + public Logger(String string) { - + } // Logging Functions @@ -22,133 +23,170 @@ public class Logger { return gtPlusPlusLogger; } + private static final boolean enabled = !AsmConfig.disableAllLogging; + public static final org.apache.logging.log4j.Logger getLogger(){ return modLogger; } // Non-Dev Comments public static void INFO(final String s) { - modLogger.info(s); + if (enabled) { + modLogger.info(s); + } } // Non-Dev Comments public static void MACHINE_INFO(final String s) { - - boolean localPlayer = false; - try { - if (ClientProxy.playerName != null){ - if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){ - localPlayer = true; + if (enabled) { + + boolean localPlayer = false; + try { + if (ClientProxy.playerName != null){ + if (ClientProxy.playerName.toLowerCase().contains("draknyte1")){ + localPlayer = true; + } } } - } - catch (final Throwable t){ - - } - - if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) { - final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); - modLogger.info("Machine Info: " + s + " | " + name1); + catch (final Throwable t){ + + } + + if (CORE.ConfigSwitches.MACHINE_INFO || localPlayer) { + final String name1 = gtPlusPlus.core.util.reflect.ReflectionUtils.getMethodName(2); + modLogger.info("Machine Info: " + s + " | " + name1); + } } } // Developer Comments public static void WARNING(final String s) { - if (CORE.DEBUG) { - modLogger.warn(s); + if (enabled) { + if (CORE.DEBUG) { + modLogger.warn(s); + } } } // Errors public static void ERROR(final String s) { - if (CORE.DEBUG) { - modLogger.fatal(s); + if (enabled) { + if (CORE.DEBUG) { + modLogger.fatal(s); + } } } // Developer Logger public static void SPECIFIC_WARNING(final String whatToLog, final String msg, final int line) { - // if (!CORE.DEBUG){ - FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg); - // } + if (enabled) { + // if (!CORE.DEBUG){ + FMLLog.warning("GT++ |" + line + "| " + whatToLog + " | " + msg); + // } + } } // ASM Comments public static void LOG_ASM(final String s) { - FMLRelaunchLog.info("[Special ASM Logging] ", s); - } - - - - - - - - - - + if (enabled) { + FMLRelaunchLog.info("[Special ASM Logging] ", s); + } + } + + + + + + + + + + /** * Special Loggers */ - + /** * Special Logger for Bee related content */ public static void BEES(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Bees] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[Bees] "+s); + } + } } /** * Special Logger for Debugging Bee related content */ public static void DEBUG_BEES(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Debug][Bees] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[Debug][Bees] "+s); + } + } } - - - + + + /** * Special Logger for Materials related content */ public static void MATERIALS(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Materials] "+s); + if (enabled) { + if (/* CORE.DEVENV || */CORE.DEBUG) { + modLogger.info("[Materials] "+s); + } + } } /** * Special Logger for Debugging Materials related content */ public static void DEBUG_MATERIALS(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Debug][Materials] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[Debug][Materials] "+s); + } + } } - + /** * Special Logger for Reflection related content */ public static void REFLECTION(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Reflection] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[Reflection] "+s); + } + } } - + /** * Special Logger for Darkworld related content */ public static void WORLD(final String s) { - if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[WorldGen] "+s); + if (enabled) { + if (CORE.DEVENV || CORE.DEBUG) { + modLogger.info("[WorldGen] "+s); + } + } } public static void RECIPE(String string) { - if (/*CORE.DEVENV || */CORE.DEBUG) - modLogger.info("[Recipe] "+string); + if (enabled) { + if (/*CORE.DEVENV || */CORE.DEBUG) { + modLogger.info("[Recipe] "+string); + } + } } public static void SPACE(final String s) { - modLogger.info("[Space] "+s); + if (enabled) { + modLogger.info("[Space] "+s); + } } - - + + } diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 3583a04a74..02517097cf 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -70,6 +70,20 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect } } } + + /** + * Generates an AutoMap from a Array. + * @param aArray - Data to be inserted into the AutoMap. + */ + public AutoMap(V[] aArray) { + mInternalMap = new LinkedHashMap<Integer, V>(); + mInternalNameMap = new LinkedHashMap<String, Integer>(); + if (aArray != null && aArray.length > 0) { + for (V obj : aArray) { + add(obj); + } + } + } @Override public Iterator<V> iterator() { @@ -212,11 +226,12 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect @Override public boolean retainAll(Collection<?> c) { - AutoMap<?> aTempAllocation = new AutoMap(); + AutoMap<?> aTempAllocation = new AutoMap<Object>(); boolean aTrue = false; aTempAllocation = this; - aTempAllocation.removeAll(c); - aTrue = this.removeAll(aTempAllocation); + aTempAllocation.removeAll(c); + aTempAllocation.clear(); + aTrue = aTempAllocation.isEmpty(); aTempAllocation.clear(); return aTrue; } diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java new file mode 100644 index 0000000000..991908e402 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java @@ -0,0 +1,18 @@ +package gtPlusPlus.api.objects.data; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +public class ConcurrentHashSet<V> extends ConcurrentSet<V> { + + private static final long serialVersionUID = -1293478938482781728L; + + public ConcurrentHashSet() { + this(new ConcurrentHashMap<Integer, V>()); + } + + public ConcurrentHashSet(ConcurrentMap<Integer, V> defaultMapType) { + super(defaultMapType); + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java new file mode 100644 index 0000000000..1d3ffc1c01 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java @@ -0,0 +1,53 @@ +package gtPlusPlus.api.objects.data; + +import java.io.Serializable; +import java.util.AbstractSet; +import java.util.Iterator; +import java.util.concurrent.ConcurrentMap; + +public abstract class ConcurrentSet<E> extends AbstractSet<E> implements Serializable { + + private static final long serialVersionUID = -6761513279741915432L; + + private final ConcurrentMap<Integer, E> mInternalMap; + + private int mInternalID = 0; + + /** + * Creates a new instance which wraps the specified {@code map}. + */ + public ConcurrentSet(ConcurrentMap<Integer, E> aMap) { + mInternalMap = aMap; + } + + @Override + public int size() { + return mInternalMap.size(); + } + + @Override + public boolean contains(Object o) { + return mInternalMap.containsKey(o); + } + + @Override + public boolean add(E o) { + return mInternalMap.putIfAbsent(mInternalID++, o) == null; + } + + @Override + public boolean remove(Object o) { + return mInternalMap.remove(o) != null; + } + + @Override + public void clear() { + this.mInternalID = 0; + mInternalMap.clear(); + } + + @Override + public Iterator<E> iterator() { + return mInternalMap.values().iterator(); + } +} diff --git a/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java new file mode 100644 index 0000000000..64f57b4e5a --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java @@ -0,0 +1,39 @@ +package gtPlusPlus.api.objects.data; + +import java.io.Serializable; + +import com.google.common.base.Objects; + +public class FlexiblePair<K,V> implements Serializable { + + /** + * SVUID + */ + private static final long serialVersionUID = 1250550491092812443L; + private final K key; + private V value; + + public FlexiblePair(final K key, final V value){ + this.key = key; + this.value = value; + } + + final public K getKey(){ + return this.key; + } + + final public V getValue(){ + return this.value; + } + + final public void setValue(V aObj) { + value = aObj; + } + + @Override + public int hashCode() { + Integer aCode = Objects.hashCode(getKey(), getValue()); + return aCode != null ? aCode : super.hashCode(); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/api/objects/data/WeightedCollection.java b/src/Java/gtPlusPlus/api/objects/data/WeightedCollection.java new file mode 100644 index 0000000000..f9966474b0 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/data/WeightedCollection.java @@ -0,0 +1,102 @@ +package gtPlusPlus.api.objects.data; + +import java.util.Collection; +import java.util.Map; +import java.util.NavigableMap; +import java.util.Random; +import java.util.Set; +import java.util.TreeMap; + +import gtPlusPlus.api.objects.random.XSTR; + +public class WeightedCollection<E> implements Map<Integer, E> { + + private NavigableMap<Integer, E> map = new TreeMap<Integer, E>(); + private Random random; + private int total = 0; + + public WeightedCollection() { + this(new XSTR()); + } + + public WeightedCollection(Random random) { + this.random = random; + } + + public E add(int weight, E object) { + if (weight <= 0) return null; + total += weight; + return map.put(total, object); + } + + private E next() { + int value = random.nextInt(total) + 1; // Can also use floating-point weights + return map.ceilingEntry(value).getValue(); + } + + @Override + public int size() { + return map.size(); + } + + @Override + public boolean isEmpty() { + return map.isEmpty(); + } + + @Override + public boolean containsKey(Object key) { + return map.containsKey(key); + } + + @Override + public boolean containsValue(Object value) { + return map.containsValue(value); + } + + public E get() { + return next(); + } + + @Override + public E get(Object key) { + return next(); + } + + @Override + public void putAll(Map m) { + map.putAll(m); + } + + @Override + public void clear() { + map.clear(); + this.total = 0; + } + + @Override + public Set keySet() { + return map.keySet(); + } + + @Override + public Collection values() { + return map.values(); + } + + @Override + public Set entrySet() { + return map.entrySet(); + } + + @Override + public E put(Integer key, E value) { + return add(key, value); + } + + @Override + public E remove(Object key) { + return map.remove(key); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java index 7c11e7232b..ab359c3853 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/BlockPos.java @@ -19,7 +19,7 @@ public class BlockPos implements Serializable{ public final int yPos; public final int zPos; public final int dim; - public final World world; + public final transient World world; public static BlockPos generateBlockPos(String sUUID) { String[] s2 = sUUID.split("@"); diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java b/src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java new file mode 100644 index 0000000000..8c76513d09 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/CubicObject.java @@ -0,0 +1,62 @@ +package gtPlusPlus.api.objects.minecraft; + +import gtPlusPlus.api.objects.data.AutoMap; +import net.minecraftforge.common.util.ForgeDirection; + +public class CubicObject<T> { + + public final T NORTH; + public final T SOUTH; + + public final T WEST; + public final T EAST; + + public final T UP; + public final T DOWN; + + public CubicObject(AutoMap<T> aDataSet) { + this(aDataSet.get(0), aDataSet.get(1), aDataSet.get(2), aDataSet.get(3), aDataSet.get(4), aDataSet.get(5)); + } + + public CubicObject(T[] aDataSet) { + this(aDataSet[0], aDataSet[1], aDataSet[2], aDataSet[3], aDataSet[4], aDataSet[5]); + } + + public CubicObject(T aDOWN, T aUP, T aNORTH, T aSOUTH, T aWEST, T aEAST) { + DOWN = aDOWN; + UP = aUP; + NORTH = aNORTH; + SOUTH = aSOUTH; + WEST = aWEST; + EAST = aEAST; + } + + public T get(int aSide) { + return get(ForgeDirection.getOrientation(aSide)); + } + + public T get(ForgeDirection aSide) { + if (aSide == ForgeDirection.DOWN) { + return DOWN; + } + else if (aSide == ForgeDirection.UP) { + return UP; + } + else if (aSide == ForgeDirection.NORTH) { + return NORTH; + } + else if (aSide == ForgeDirection.SOUTH) { + return SOUTH; + } + else if (aSide == ForgeDirection.WEST) { + return WEST; + } + else if (aSide == ForgeDirection.EAST) { + return EAST; + } + else { + return null; + } + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java b/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java index d0c1f3f040..d5db8081dc 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java @@ -12,7 +12,7 @@ import net.minecraftforge.common.DimensionManager; public class FakeBlockPos extends BlockPos { private static final long serialVersionUID = -6442245826092414593L; - private Block aBlockAtPos; + private transient Block aBlockAtPos; private int aBlockMetaAtPos = 0; public static FakeBlockPos generateBlockPos(String sUUID) { diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java b/src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java new file mode 100644 index 0000000000..7c418b5a77 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/SafeTexture.java @@ -0,0 +1,64 @@ +package gtPlusPlus.api.objects.minecraft; + +import java.util.HashMap; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gtPlusPlus.core.util.Utils; +import net.minecraft.util.IIcon; + +/** + * A Server Side safe object that can hold {@link IIcon}s. + * @author Alkalus + * + */ +public class SafeTexture implements Runnable { + + @SideOnly(Side.CLIENT) + private static final HashMap<Integer, IIcon> mHashToIconCache = new HashMap<Integer, IIcon>(); + + @SideOnly(Side.CLIENT) + private static final HashMap<String, Integer> mPathToHashCash = new HashMap<String, Integer>(); + + private static final HashMap<String, SafeTexture> mTextureObjectCache = new HashMap<String, SafeTexture>(); + + private final int mHash; + + private final String mTextureName; + + private final static String getKey(String aTexPath) { + String aNameKey = Utils.sanitizeString(aTexPath); + aNameKey = aNameKey.replace('/', ' '); + aNameKey = aNameKey.toLowerCase(); + return aNameKey; + } + + public static SafeTexture register(String aTexturePath) { + String aNameKey = getKey(aTexturePath); + SafeTexture g = mTextureObjectCache.get(aNameKey); + if (g == null) { + g = new SafeTexture(aTexturePath); + mTextureObjectCache.put(aNameKey, g); + mPathToHashCash.put(aTexturePath, aTexturePath.hashCode()); + } + return g; + } + + private SafeTexture(String aTexturePath) { + mTextureName = aTexturePath; + mHash = getKey(aTexturePath).hashCode(); + GregTech_API.sGTBlockIconload.add(this); + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon() { + return mHashToIconCache.get(mHash); + } + + @Override + public void run() { + mHashToIconCache.put(getKey(mTextureName).hashCode(), GregTech_API.sBlockIcons.registerIcon(mTextureName)); + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java b/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java index 1073e63914..c0e9b20c54 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java @@ -3,11 +3,7 @@ package gtPlusPlus.api.objects.minecraft; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.everglades.dimension.Dimension_Everglades; -import gtPlusPlus.xmod.forestry.bees.items.FR_ItemRegistry; -import gtPlusPlus.xmod.ic2.item.IC2_Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.ShapedOreRecipe; @@ -36,13 +32,7 @@ public class ShapedRecipe { String[] aLoggingInfo = new String[9]; if (mBlackList == null) { - mBlackList = new ItemStack[] { - ItemUtils.getSimpleStack(ModBlocks.blockNet), - ItemUtils.getSimpleStack(ModBlocks.blockXpConverter), - ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard), - ItemUtils.getSimpleStack(ModBlocks.blockMiningExplosive), - ItemUtils.getSimpleStack(Dimension_Everglades.blockPortalFrame), - }; + mBlackList = new ItemStack[] {}; } //Just to be safe diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java index 393d3260b5..b7462250b1 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadFakeWorldGenerator.java @@ -21,7 +21,7 @@ public class ThreadFakeWorldGenerator extends Thread { public ThreadFakeWorldGenerator() { setName("gtpp.handler.fakeworldtrees"); - run(); + start(); } public static ThreadFakeWorldGenerator getInstance() { diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java index a5f466b19f..0ff6e112ac 100644 --- a/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java +++ b/src/Java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java @@ -33,7 +33,7 @@ public class ThreadPooCollector extends Thread { public ThreadPooCollector() { setName("gtpp.handler.poop"); - run(); + start(); } public static ThreadPooCollector getInstance() { diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java new file mode 100644 index 0000000000..4dc032d01f --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java @@ -0,0 +1,27 @@ +package gtPlusPlus.api.objects.minecraft.multi; + +import gtPlusPlus.core.recipe.common.CI; +import net.minecraft.item.ItemStack; + +public class NoOutputBonusMultiBehaviour extends SpecialMultiBehaviour { + + public NoOutputBonusMultiBehaviour() { + // Used by other mods which may wish to not obtain bonus outputs on their Sifting or Maceration recipes. + } + + @Override + public ItemStack getTriggerItem() { + return CI.getNumberedBioCircuit(22); + } + + @Override + public String getTriggerItemTooltip() { + return "Prevents bonus output % on GT++ multiblocks when used"; + } + + @Override + public int getOutputChanceRoll() { + return 10000; + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/multi/SpecialMultiBehaviour.java b/src/Java/gtPlusPlus/api/objects/minecraft/multi/SpecialMultiBehaviour.java new file mode 100644 index 0000000000..e562ccc40b --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/multi/SpecialMultiBehaviour.java @@ -0,0 +1,44 @@ +package gtPlusPlus.api.objects.minecraft.multi; + +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; + +/** + * Extend this class to implement custom behaviour for multiblocks. + * The Trigger item when in a special slot or input bus, will cause the multiblock to behave as specified. + * Not overriding a method here will cause the default values to be used. + * @author Alkalus + * + */ +public abstract class SpecialMultiBehaviour { + + private final int mMaxParallelRecipes = Short.MIN_VALUE; + private final int mEUPercent = Short.MIN_VALUE; + private final int mSpeedBonusPercent = Short.MIN_VALUE; + private final int mOutputChanceRoll = Short.MIN_VALUE; + + public abstract ItemStack getTriggerItem(); + + public abstract String getTriggerItemTooltip(); + + public int getMaxParallelRecipes() { + return this.mMaxParallelRecipes; + } + + public int getEUPercent() { + return this.mEUPercent; + } + + public int getSpeedBonusPercent() { + return this.mSpeedBonusPercent; + } + + public int getOutputChanceRoll() { + return this.mOutputChanceRoll; + } + + public final boolean isTriggerItem(ItemStack aToMatch) { + return GT_Utility.areStacksEqual(getTriggerItem(), aToMatch, false); + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/random/XSTR.java b/src/Java/gtPlusPlus/api/objects/random/XSTR.java index 4b5b1298b6..6ce1cbeb6c 100644 --- a/src/Java/gtPlusPlus/api/objects/random/XSTR.java +++ b/src/Java/gtPlusPlus/api/objects/random/XSTR.java @@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLong; * 03.06.2016 * version 0.0.4 */ -public class XSTR extends Random { +public class XSTR extends Random implements Cloneable { private static final long serialVersionUID = 6208727693524452904L; private long seed; @@ -115,6 +115,13 @@ public class XSTR extends Random { */ @Override public XSTR clone() { + try { + super.clone(); + } + catch (CloneNotSupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } return new XSTR(this.getSeed()); } diff --git a/src/Java/gtPlusPlus/api/plugin/Sample_Plugin.java b/src/Java/gtPlusPlus/api/plugin/Sample_Plugin.java index 82671acaea..543ec8e1fa 100644 --- a/src/Java/gtPlusPlus/api/plugin/Sample_Plugin.java +++ b/src/Java/gtPlusPlus/api/plugin/Sample_Plugin.java @@ -25,6 +25,16 @@ public final class Sample_Plugin implements IPlugin { } @Override + public boolean serverStart() { + return true; + } + + @Override + public boolean serverStop() { + return true; + } + + @Override public String getPluginName() { return "Sample Plugin"; } diff --git a/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java b/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java index 562f6acd15..77562f5691 100644 --- a/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java +++ b/src/Java/gtPlusPlus/australia/GTplusplus_Australia.java @@ -6,13 +6,13 @@ import java.io.File; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.event.*; +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 cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion; - import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.australia.biome.type.Biome_AustralianDesert; -import gtPlusPlus.australia.biome.type.Biome_AustralianDesert2; import gtPlusPlus.australia.biome.type.Biome_AustralianDesert_Ex; import gtPlusPlus.australia.biome.type.Biome_AustralianForest; import gtPlusPlus.australia.biome.type.Biome_AustralianOcean; diff --git a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java index 4ee24aaca5..c04f211fd3 100644 --- a/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java +++ b/src/Java/gtPlusPlus/australia/biome/type/Biome_AustralianPlains.java @@ -16,7 +16,6 @@ import net.minecraftforge.common.BiomeManager; public class Biome_AustralianPlains extends BiomeGenPlains { - protected boolean field_150628_aC; public Biome_AustralianPlains(int p_i1986_1_) { diff --git a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java index 82da02db45..07f5f969e2 100644 --- a/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java +++ b/src/Java/gtPlusPlus/australia/chunk/ChunkProviderAustralia.java @@ -9,26 +9,29 @@ import java.util.Map; import java.util.Random; import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.registry.VillagerRegistry; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.australia.gen.map.MapGenLargeRavine; import net.minecraft.block.Block; -import net.minecraft.block.BlockFalling; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.MathHelper; -import net.minecraft.world.*; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.SpawnerAnimals; +import net.minecraft.world.World; +import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.*; +import net.minecraft.world.gen.ChunkProviderGenerate; +import net.minecraft.world.gen.MapGenBase; +import net.minecraft.world.gen.MapGenCaves; +import net.minecraft.world.gen.NoiseGenerator; +import net.minecraft.world.gen.NoiseGeneratorOctaves; +import net.minecraft.world.gen.NoiseGeneratorPerlin; import net.minecraft.world.gen.feature.WorldGenDungeons; -import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.structure.MapGenMineshaft; import net.minecraft.world.gen.structure.MapGenScatteredFeature; -import net.minecraft.world.gen.structure.MapGenVillage; - import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.ChunkProviderEvent; import net.minecraftforge.event.terraingen.PopulateChunkEvent; @@ -40,16 +43,6 @@ public class ChunkProviderAustralia extends ChunkProviderGenerate implements ICh private NoiseGeneratorOctaves noiseGen2; private NoiseGeneratorOctaves noiseGen3; private NoiseGeneratorPerlin noiseGen4; - - /** - * A NoiseGeneratorOctaves used in generating terrain - */ - public NoiseGeneratorOctaves noiseGen5; - /** - * A NoiseGeneratorOctaves used in generating terrain - */ - public NoiseGeneratorOctaves noiseGen6; - public NoiseGeneratorOctaves mobSpawnerNoise; /** * Reference to the World object. */ diff --git a/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java b/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java index 4af5aa09ab..1f5dd59667 100644 --- a/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java +++ b/src/Java/gtPlusPlus/australia/gen/map/component/ComponentHut.java @@ -79,11 +79,11 @@ public class ComponentHut extends AustraliaComponent { placeDoorAtCurrentPosition( world, this.boundingBox, random, 0, 1, 3, getMetadataWithOffset(Blocks.wooden_door, 1)); } - else if (dir == 0) { + else if (dir == 1) { placeDoorAtCurrentPosition( world, this.boundingBox, random, 3, 1, 6, getMetadataWithOffset(Blocks.wooden_door, 1)); } - else if (dir == 0) { + else if (dir == 2) { placeDoorAtCurrentPosition( world, this.boundingBox, random, 6, 1, 3, getMetadataWithOffset(Blocks.wooden_door, 1)); } diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index b904b04556..a448e313ac 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -18,8 +18,10 @@ import gtPlusPlus.core.block.machine.DecayablesChest; import gtPlusPlus.core.block.machine.FishTrap; import gtPlusPlus.core.block.machine.HeliumGenerator; import gtPlusPlus.core.block.machine.Machine_ModularityTable; +import gtPlusPlus.core.block.machine.Machine_PestKiller; import gtPlusPlus.core.block.machine.Machine_PooCollector; import gtPlusPlus.core.block.machine.Machine_ProjectTable; +import gtPlusPlus.core.block.machine.Machine_RoundRobinator; import gtPlusPlus.core.block.machine.Machine_SuperJukebox; import gtPlusPlus.core.block.machine.Machine_TradeTable; import gtPlusPlus.core.block.machine.Machine_Workbench; @@ -33,6 +35,7 @@ import net.minecraftforge.fluids.Fluid; public final class ModBlocks { + public static Block blockRoundRobinator; public static Block blockCircuitProgrammer; public static Block blockFakeMiningPipe; public static Block blockFakeMiningHead; @@ -91,6 +94,8 @@ public final class ModBlocks { public static Block blockCustomJukebox; public static Block blockPooCollector; + + public static Block blockPestKiller; public static void init() { Logger.INFO("Initializing Blocks."); @@ -142,6 +147,10 @@ public final class ModBlocks { blockCustomJukebox = new Machine_SuperJukebox(); blockPooCollector = new Machine_PooCollector(); + + blockPestKiller = new Machine_PestKiller(); + + blockRoundRobinator = new Machine_RoundRobinator(); new BlockGenericRedstoneDetector(); new BlockGenericRedstoneTest(); diff --git a/src/Java/gtPlusPlus/core/block/base/BasicTileBlockWithTooltip.java b/src/Java/gtPlusPlus/core/block/base/BasicTileBlockWithTooltip.java new file mode 100644 index 0000000000..6166835f31 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/base/BasicTileBlockWithTooltip.java @@ -0,0 +1,315 @@ +package gtPlusPlus.core.block.base; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.interfaces.ITileTooltip; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.CubicObject; +import gtPlusPlus.api.objects.minecraft.SafeTexture; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.InventoryUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public abstract class BasicTileBlockWithTooltip extends BlockContainer implements ITileTooltip { + + /** + * Each mapped object holds the data for the six sides. + */ + @SideOnly(Side.CLIENT) + private AutoMap<CubicObject<SafeTexture>> mSidedTextureArray; + + /** + * Holds the data for the six sides, each side holds an array of data for each respective meta. + */ + @SideOnly(Side.CLIENT) + private AutoMap<CubicObject<String>> mSidedTexturePathArray; + + /** + * Does this block have any meta at all? + * @return + */ + public final boolean hasMeta() { + return getMetaCount() > 0; + } + + /** + * The amount of meta this block has. + * @return + */ + public abstract int getMetaCount(); + + /** + * Does this {@link Block} require special {@link ItemBlock} handling? + * @return The {@link Class} that will be used for this {@link Block}. + */ + public Class<? extends ItemBlock> getItemBlockClass() { + return ItemBlock.class; + } + + /** + * A lazy way to declare the unlocal name for the block, makes boilerplating easy. + * @return The internal name for this block. + */ + public abstract String getUnlocalBlockName(); + + /** + * Does this Block have {@link ITileTooltip} support? + * @return {@link boolean} that represents if this block supports {@link ITileTooltip} or not. + */ + public final boolean hasTooltip() { + return getTooltipID() >= -1; + } + + /** + * Lazy Boilerplating. + * @return Block Hardness. + */ + protected abstract float initBlockHardness(); + + /** + * Lazy Boilerplating. + * @return Block Resistance. + */ + protected abstract float initBlockResistance(); + + /** + * Lazy Boilerplating. + * @return The {@link CreativeTab} this Block is shown on. + */ + protected abstract CreativeTabs initCreativeTab(); + + /** + * The ID used by the {@link ITileTooltip} handler. Return -1 if you are not providing a custom {@link ItemBlock} in {@link #getItemBlockClass}(). + * @return + */ + @Override + public abstract int getTooltipID(); + + public BasicTileBlockWithTooltip(Material aBlockMat){ + super(aBlockMat); + //Use Abstract method values + this.setHardness(initBlockHardness()); + this.setResistance(initBlockResistance()); + this.setBlockName(getUnlocalBlockName()); + this.setCreativeTab(initCreativeTab()); + // Register the block last. + GameRegistry.registerBlock(this, getItemBlockClass(), getUnlocalBlockName()); + Logger.INFO("Registered "+getTileEntityName()+"."); + if (Utils.isClient()) { + // Handle Textures + handleTextures(); + } + } + + /** + * The name of the Tile Entity. + * @return + */ + protected abstract String getTileEntityName(); + + /** + * The String used for texture pathing. + * @return Sanitized {@link String}, containing no spaces or illegal characters. + */ + private final String getTileEntityNameForTexturePathing() { + return Utils.sanitizeString(getTileEntityName().replace(" ", "")); + } + + /** + * An array of CubicObjects, one for each meta, else just a single cell array. + * Expected to be null regularly, as the default texture handling should suffice. + * Handy if re-using textures or using a non-standard structure for them. FULL texture path must be used, + * inclusive of the MODID and a colon. + * @return + */ + public CubicObject<String>[] getCustomTextureDirectoryObject(){ + return null; + } + + @Override + @SideOnly(Side.CLIENT) + public final IIcon getIcon(final int aSide, final int aMeta) { + return mSidedTextureArray.get(aMeta).get(aSide).getIcon(); + } + + @Override + public IIcon getIcon(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) { + return super.getIcon(aWorld, aX, aY, aZ, aSide); + } + + @SideOnly(Side.CLIENT) + private final void handleTextures() { + + Logger.INFO("[TeTexture] Building Texture Maps for "+getTileEntityName()+"."); + + // Init on the Client side only, to prevent Field initialisers existing in the Server side bytecode. + mSidedTextureArray = new AutoMap<CubicObject<SafeTexture>>(); + mSidedTexturePathArray = new AutoMap<CubicObject<String>>(); + + + //Store them in forge order + //DOWN, UP, NORTH, SOUTH, WEST, EAST + + // Default Path Name, this will make us look inside 'miscutils\textures\blocks' + final String aPrefixTexPath = CORE.MODID + ":"; + // Default Path Name, this will make us look in the sub-directory for this Tile Entity. + final String aTexPathMid = "TileEntities"+CORE.SEPERATOR+getTileEntityNameForTexturePathing()+CORE.SEPERATOR; + // Construct a full path + String aTexPathBuilt = aPrefixTexPath + aTexPathMid; + // File Name Suffixes, without meta tags + String aStringBot; + String aStringTop; + String aStringBack; + String aStringFront; + String aStringLeft; + String aStringRight; + // Do we provide a matrix of custom data to be used for texture processing instead? + if (getCustomTextureDirectoryObject() != null) { + // Get custom provided texture data. + CubicObject<String>[] aDataMap = getCustomTextureDirectoryObject(); + Logger.INFO("[TeTexture] Found custom texture data, using this instead. Size: "+aDataMap.length); + // Map each meta string data to the main map. + for (int i=0;i<aDataMap.length;i++) { + mSidedTexturePathArray.put(aDataMap[i]); + Logger.INFO("Mapped value for meta "+i+"."); + } + } + else { + Logger.INFO("[TeTexture] Processing "+(1+getMetaCount())+" sets."); + // Iterate once for each meta + for (int i=0;i<(1+getMetaCount());i++) { + + // File Name Suffixes, without meta tags + aStringBot = "Bottom"; + aStringTop = "Top"; + aStringBack = "Back"; + aStringFront = "Front"; + aStringLeft = "Left"; + aStringRight = "Right"; + + // Add tails if we have meta + if (hasMeta()) { + aStringBot = aStringBot + "_"+i; + aStringTop = aStringTop + "_"+i; + aStringBack = aStringBack + "_"+i; + aStringFront = aStringFront + "_"+i; + aStringLeft = aStringLeft + "_"+i; + aStringRight = aStringRight + "_"+i; + } + // Append the full path + aStringBot = aTexPathBuilt + aStringBot; + aStringTop = aTexPathBuilt + aStringTop; + aStringBack = aTexPathBuilt + aStringBack; + aStringFront = aTexPathBuilt + aStringFront; + aStringLeft = aTexPathBuilt + aStringLeft; + aStringRight = aTexPathBuilt + aStringRight; + // Convenience Blob + CubicObject<String> aMetaBlob = new CubicObject<String>(aStringBot, aStringTop, aStringBack, aStringFront, aStringLeft, aStringRight); + mSidedTexturePathArray.put(aMetaBlob); + Logger.INFO("[TeTexture] Added Texture Path data to map for meta "+i); + } + } + Logger.INFO("[TeTexture] Map size for pathing: "+mSidedTexturePathArray.size()); + + // Iteration Index + int aIndex = 0; + + // Iterate each CubicObject, holding the six texture paths for each meta. + for (CubicObject<String> aMetaBlob : mSidedTexturePathArray) { + // Make a Safe Texture for each side + SafeTexture aBottom = SafeTexture.register(aMetaBlob.DOWN); + SafeTexture aTop = SafeTexture.register(aMetaBlob.UP); + SafeTexture aBack = SafeTexture.register(aMetaBlob.NORTH); + SafeTexture aFont = SafeTexture.register(aMetaBlob.SOUTH); + SafeTexture aWest = SafeTexture.register(aMetaBlob.WEST); + SafeTexture aEast = SafeTexture.register(aMetaBlob.EAST); + // Store them in an Array + SafeTexture[] aInjectBlob = new SafeTexture[] { + aBottom, + aTop, + aBack, + aFont, + aWest, + aEast + }; + // Convenience Blob + CubicObject<SafeTexture> aMetaBlob2 = new CubicObject<SafeTexture>(aInjectBlob); + // Store this Blob into + mSidedTextureArray.put(aMetaBlob2); + Logger.INFO("[TeTexture] Added SafeTexture data to map for meta "+(aIndex++)); + } + Logger.INFO("[TeTexture] Map size for registration: "+mSidedTextureArray.size()); + + + } + + @Override + @SideOnly(Side.CLIENT) + public final void registerBlockIcons(final IIconRegister aRegisterer){ + this.blockIcon = aRegisterer.registerIcon(CORE.MODID + ":" + "net"); + } + + @Override + public abstract TileEntity createNewTileEntity(final World world, final int p_149915_2_); + + /** + * Called when {@link #breakBlock}() is called, but before {@link InventoryUtils#dropInventoryItems} and the super call. + */ + public void onBlockBreak() { + + } + + @Override + public final void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) { + onBlockBreak(); + InventoryUtils.dropInventoryItems(world, x, y, z, block); + super.breakBlock(world, x, y, z, block, number); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + @Override + public final void getSubBlocks(Item aItem, CreativeTabs p_149666_2_, List aList) { + if (hasMeta()) { + for (int i=0;i<getMetaCount();i++) { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } + else { + aList.add(ItemUtils.getSimpleStack(aItem)); + } + } + + @Override + public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { + return false; + } + + + + /** + * Get the block's damage value (for use with pick block). + */ + @Override + public int getDamageValue(World aWorld, int aX, int aY, int aZ) { + int l = aWorld.getBlockMetadata(aX, aY, aZ); + return l; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java index 8310fa3c23..c0113e869b 100644 --- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java @@ -175,7 +175,7 @@ public class BlockBaseModular extends BasicBlock { } } metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType); - int tier = this.blockMaterial.vTier; + int tier = blockMaterial != null ? this.blockMaterial.vTier : 0; String aType = (this.thisBlock == BlockTypes.FRAME) ? "frameGt" : (tier <= 4 ? "block1" : "block5"); this.blockIcon = iIcon.registerIcon("gregtech" + ":" + "materialicons/"+ metType +"/" + aType); } diff --git a/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java b/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java index 45345ef176..8925962e4e 100644 --- a/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java +++ b/src/Java/gtPlusPlus/core/block/general/MiningExplosives.java @@ -165,8 +165,8 @@ public class MiningExplosives extends BlockTNT { /*this.blockIcon = iconRegister.registerIcon(this.getTextureName() + "_side"); this.textureTop = iconRegister.registerIcon(this.getTextureName() + "_top"); this.textureBottom = iconRegister.registerIcon(this.getTextureName() + "_bottom");*/ - this.blockIcon = iconRegister.registerIcon(CORE.MODID + ":" + "Chrono/" + "MetalSheet2"); - this.textureTop = iconRegister.registerIcon(CORE.MODID + ":" + "Chrono/" + "MetalFunnel"); - this.textureBottom = iconRegister.registerIcon(CORE.MODID + ":" + "Chrono/" + "MetalPanel"); + this.blockIcon = iconRegister.registerIcon(CORE.MODID + ":" + "chrono/" + "MetalSheet2"); + this.textureTop = iconRegister.registerIcon(CORE.MODID + ":" + "chrono/" + "MetalFunnel"); + this.textureBottom = iconRegister.registerIcon(CORE.MODID + ":" + "chrono/" + "MetalPanel"); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java index 6ae1a52aba..7d8b3eb708 100644 --- a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java +++ b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java @@ -1,42 +1,27 @@ package gtPlusPlus.core.block.machine; -import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gregtech.common.items.GT_MetaGenerated_Tool_01; -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; +import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.minecraft.CubicObject; +import gtPlusPlus.core.block.base.BasicTileBlockWithTooltip; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.handler.GuiHandler; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; +import gtPlusPlus.core.util.minecraft.PlayerUtils; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; -import gtPlusPlus.core.util.minecraft.InventoryUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; - -public class CircuitProgrammer extends BlockContainer implements ITileTooltip -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; +public class CircuitProgrammer extends BasicTileBlockWithTooltip { /** * Determines which tooltip is displayed within the itemblock. @@ -51,33 +36,7 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip @SuppressWarnings("deprecation") public CircuitProgrammer(){ super(Material.iron); - this.setHardness(5f); - this.setResistance(1f); - this.setBlockName("blockCircuitProgrammer"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockCircuitProgrammer"); LanguageRegistry.addName(this, "Circuit Programmer"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_B"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_B"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_G"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I"); } /** @@ -142,12 +101,6 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip } @Override - public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) { - InventoryUtils.dropInventoryItems(world, x, y, z, block); - super.breakBlock(world, x, y, z, block, number); - } - - @Override public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { if (stack.hasDisplayName()) { ((TileEntityCircuitProgrammer) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); @@ -159,4 +112,48 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip return false; } + @Override + public int getMetaCount() { + return 0; + } + + @Override + public String getUnlocalBlockName() { + return "blockCircuitProgrammer"; + } + + @Override + protected float initBlockHardness() { + return 5f; + } + + @Override + protected float initBlockResistance() { + return 1f; + } + + @Override + protected CreativeTabs initCreativeTab() { + return AddToCreativeTab.tabMachines; + } + + @Override + protected String getTileEntityName() { + return "Circuit Programmer"; + } + + @Override + public CubicObject<String>[] getCustomTextureDirectoryObject() { + String[] aTexData = new String[] { + CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_G", + CORE.MODID + ":" + "metro/" + "TEXTURE_TECH_PANEL_B", + CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I", + CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I", + CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I", + CORE.MODID + ":" + "metro/" + "TEXTURE_METAL_PANEL_I" + }; + CubicObject<String>[] aTextureData = new CubicObject[] {new CubicObject<String>(aTexData)}; + return aTextureData; + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java b/src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java new file mode 100644 index 0000000000..11fa80f439 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_PestKiller.java @@ -0,0 +1,137 @@ +package gtPlusPlus.core.block.machine; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.interfaces.ITileTooltip; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.handler.GuiHandler; +import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; +import gtPlusPlus.core.util.minecraft.InventoryUtils; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class Machine_PestKiller extends BlockContainer implements ITileTooltip +{ + @SideOnly(Side.CLIENT) + private IIcon textureTop; + @SideOnly(Side.CLIENT) + private IIcon textureBottom; + @SideOnly(Side.CLIENT) + private IIcon textureFront; + + /** + * Determines which tooltip is displayed within the itemblock. + */ + private final int mTooltipID = 6; + + @Override + public int getTooltipID() { + return this.mTooltipID; + } + + @SuppressWarnings("deprecation") + public Machine_PestKiller() + { + super(Material.wood); + this.setBlockName("blockPestKiller"); + this.setHardness(5f); + this.setResistance(1f); + this.setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockPestKiller"); + LanguageRegistry.addName(this, "Pest Killer"); + + } + + /** + * Gets the block's texture. Args: side, meta + */ + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(final int aSide, final int p_149691_2_) + { + return aSide == 1 ? this.textureTop : (aSide == 0 ? this.textureBottom : this.textureFront); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister p_149651_1_) + { + this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "MACHINE_CASING_FARM_MANAGER_STRUCTURAL"); + this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "MACHINE_PESTKILLER_TOP"); + this.textureBottom = p_149651_1_.registerIcon("planks_acacia"); + this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "MACHINE_CASING_FARM_MANAGER_STRUCTURAL"); + } + + /** + * Called upon block activation (right click on the block.) + */ + @Override + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) + { + if (world.isRemote) { + return true; + } + + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileEntityPestKiller)){ + player.openGui(GTplusplus.instance, GuiHandler.GUI15, world, x, y, z); + return true; + } + return false; + } + + @Override + public int getRenderBlockPass() { + return 0; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { + return new TileEntityPestKiller(); + } + + @Override + public void onBlockAdded(final World world, final int x, final int y, final int z) { + super.onBlockAdded(world, x, y, z); + } + + @Override + public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) { + InventoryUtils.dropInventoryItems(world, x, y, z, block); + super.breakBlock(world, x, y, z, block, number); + } + + @Override + public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) { + if (stack.hasDisplayName()) { + ((TileEntityPestKiller) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName()); + } + } + + @Override + public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { + return false; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java new file mode 100644 index 0000000000..dc87b885b9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_RoundRobinator.java @@ -0,0 +1,131 @@ +package gtPlusPlus.core.block.machine; + +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.CubicObject; +import gtPlusPlus.core.block.base.BasicTileBlockWithTooltip; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.itemblock.ItemBlockRoundRobinator; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class Machine_RoundRobinator extends BasicTileBlockWithTooltip { + + + public Machine_RoundRobinator(){ + super(Material.iron); + } + + /** + * Called upon block activation (right click on the block.) + */ + @Override + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) + { + if (world.isRemote) { + return true; + } + else { + + boolean mDidScrewDriver = false; + // Check For Screwdriver + try { + final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); + if (ItemUtils.isToolScrewdriver(mHandStack)) { + final TileEntityRoundRobinator tile = (TileEntityRoundRobinator) world.getTileEntity(x, y, z); + if (tile != null) { + mDidScrewDriver = tile.onScrewdriverRightClick((byte) side, player, x, y, z); + } + } + } + catch (final Throwable t) {} + + if (!mDidScrewDriver) { + final TileEntity te = world.getTileEntity(x, y, z); + if ((te != null) && (te instanceof TileEntityRoundRobinator)){ + return ((TileEntityRoundRobinator) te).onRightClick((byte) side, player, x, y, z); + } + return false; + } + else { + return true; + } + } + } + + @Override + public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { + return new TileEntityRoundRobinator(); + } + + @Override + public int getMetaCount() { + return 5; + } + + @Override + public String getUnlocalBlockName() { + return "blockRoundRobinator"; + } + + @Override + protected float initBlockHardness() { + return 1; + } + + @Override + protected float initBlockResistance() { + return 1; + } + + @Override + protected CreativeTabs initCreativeTab() { + return AddToCreativeTab.tabMachines; + } + + @Override + public int getTooltipID() { + return -1; + } + + @Override + protected String getTileEntityName() { + return "Round Robinator"; + } + + @Override + public Class<? extends ItemBlock> getItemBlockClass() { + return ItemBlockRoundRobinator.class; + } + + @Override + public CubicObject<String>[] getCustomTextureDirectoryObject() { + AutoMap<String[]> aTemp = new AutoMap<String[]>(); + for (int i=0;i<5;i++) { + String[] aTexData = new String[] { + CORE.MODID + ":" + "TileEntities/RoundRobinator/Top_"+i, + CORE.MODID + ":" + "TileEntities/RoundRobinator/Top_"+i, + CORE.MODID + ":" + "TileEntities/RoundRobinator/Side_"+i, + CORE.MODID + ":" + "TileEntities/RoundRobinator/Side_"+i, + CORE.MODID + ":" + "TileEntities/RoundRobinator/Side_"+i, + CORE.MODID + ":" + "TileEntities/RoundRobinator/Side_"+i, + }; + aTemp.put(aTexData); + } + AutoMap<CubicObject<String>> aTemp2 = new AutoMap<CubicObject<String>>(); + for (String[] y : aTemp) { + aTemp2.put(new CubicObject<String>(y)); + } + CubicObject<String>[] aTextureData = new CubicObject[] {aTemp2.get(0), aTemp2.get(1), aTemp2.get(2), aTemp2.get(3), aTemp2.get(4)}; + return aTextureData; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/model/ModelBatKing.java b/src/Java/gtPlusPlus/core/client/model/ModelBatKing.java new file mode 100644 index 0000000000..ac64dee26a --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/model/ModelBatKing.java @@ -0,0 +1,120 @@ +package gtPlusPlus.core.client.model; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.entity.monster.EntityBatKing; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.util.MathHelper; + +@SideOnly(Side.CLIENT) +public class ModelBatKing extends ModelBase +{ + private ModelRenderer batHead; + /** The body box of the bat model. */ + private ModelRenderer batBody; + /** The inner right wing box of the bat model. */ + private ModelRenderer batRightWing; + /** The inner left wing box of the bat model. */ + private ModelRenderer batLeftWing; + /** The outer right wing box of the bat model. */ + private ModelRenderer batOuterRightWing; + /** The outer left wing box of the bat model. */ + private ModelRenderer batOuterLeftWing; + + public ModelBatKing() + { + this.textureWidth = 64; + this.textureHeight = 64; + + this.batHead = new ModelRenderer(this, 0, 0); + this.batHead.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6); + ModelRenderer modelrenderer = new ModelRenderer(this, 24, 0); + modelrenderer.addBox(-4.0F, -6.0F, -2.0F, 3, 4, 1); + this.batHead.addChild(modelrenderer); + ModelRenderer modelrenderer1 = new ModelRenderer(this, 24, 0); + modelrenderer1.mirror = true; + modelrenderer1.addBox(1.0F, -6.0F, -2.0F, 3, 4, 1); + this.batHead.addChild(modelrenderer1); + this.batBody = new ModelRenderer(this, 0, 16); + this.batBody.addBox(-3.0F, 4.0F, -3.0F, 6, 12, 6); + this.batBody.setTextureOffset(0, 34).addBox(-5.0F, 16.0F, 0.0F, 10, 6, 1); + this.batRightWing = new ModelRenderer(this, 42, 0); + this.batRightWing.addBox(-12.0F, 1.0F, 1.5F, 10, 16, 1); + this.batOuterRightWing = new ModelRenderer(this, 24, 16); + this.batOuterRightWing.setRotationPoint(-12.0F, 1.0F, 1.5F); + this.batOuterRightWing.addBox(-8.0F, 1.0F, 0.0F, 8, 12, 1); + this.batLeftWing = new ModelRenderer(this, 42, 0); + this.batLeftWing.mirror = true; + this.batLeftWing.addBox(2.0F, 1.0F, 1.5F, 10, 16, 1); + this.batOuterLeftWing = new ModelRenderer(this, 24, 16); + this.batOuterLeftWing.mirror = true; + this.batOuterLeftWing.setRotationPoint(12.0F, 1.0F, 1.5F); + this.batOuterLeftWing.addBox(0.0F, 1.0F, 0.0F, 8, 12, 1); + this.batBody.addChild(this.batRightWing); + this.batBody.addChild(this.batLeftWing); + this.batRightWing.addChild(this.batOuterRightWing); + this.batLeftWing.addChild(this.batOuterLeftWing); + } + + /** + * not actually sure this is size, is not used as of now, but the model would be recreated if the value changed and + * it seems a good match for a bats size + */ + public int getBatSize() + { + return 72; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) + { + EntityBatKing entitybat = (EntityBatKing)p_78088_1_; + float f6; + + if (entitybat.getIsBatHanging()) + { + f6 = (180F / (float)Math.PI); + this.batHead.rotateAngleX = p_78088_6_ / (180F / (float)Math.PI); + this.batHead.rotateAngleY = (float)Math.PI - p_78088_5_ / (180F / (float)Math.PI); + this.batHead.rotateAngleZ = (float)Math.PI; + this.batHead.setRotationPoint(0.0F, -2.0F, 0.0F); + this.batRightWing.setRotationPoint(-3.0F, 0.0F, 3.0F); + this.batLeftWing.setRotationPoint(3.0F, 0.0F, 3.0F); + this.batBody.rotateAngleX = (float)Math.PI; + this.batRightWing.rotateAngleX = -0.15707964F; + this.batRightWing.rotateAngleY = -((float)Math.PI * 2F / 5F); + this.batOuterRightWing.rotateAngleY = -1.7278761F; + this.batLeftWing.rotateAngleX = this.batRightWing.rotateAngleX; + this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; + this.batOuterLeftWing.rotateAngleY = -this.batOuterRightWing.rotateAngleY; + } + else + { + f6 = (180F / (float)Math.PI); + this.batHead.rotateAngleX = p_78088_6_ / (180F / (float)Math.PI); + this.batHead.rotateAngleY = p_78088_5_ / (180F / (float)Math.PI); + this.batHead.rotateAngleZ = 0.0F; + this.batHead.setRotationPoint(0.0F, 0.0F, 0.0F); + this.batRightWing.setRotationPoint(0.0F, 0.0F, 0.0F); + this.batLeftWing.setRotationPoint(0.0F, 0.0F, 0.0F); + this.batBody.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(p_78088_4_ * 0.1F) * 0.15F; + this.batBody.rotateAngleY = 0.0F; + this.batRightWing.rotateAngleY = MathHelper.cos(p_78088_4_ * 1.3F) * (float)Math.PI * 0.25F; + this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; + this.batOuterRightWing.rotateAngleY = this.batRightWing.rotateAngleY * 0.5F; + this.batOuterLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY * 0.5F; + } + + + GL11.glScalef(4, 4, 4); + this.batHead.render(p_78088_7_); + this.batBody.render(p_78088_7_); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java b/src/Java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java new file mode 100644 index 0000000000..f40357495a --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/renderer/CustomItemBlockRenderer.java @@ -0,0 +1,85 @@ +package gtPlusPlus.core.client.renderer; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + + +/** + * Easy way of rendering an item which should look like a block. + * Borrowed. + * + * @author King Lemming + * + */ +public class CustomItemBlockRenderer implements IItemRenderer { + + public static CustomItemBlockRenderer instance = new CustomItemBlockRenderer(); + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + + double offset = -0.5; + if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + offset = 0; + } else if (type == ItemRenderType.ENTITY) { + GL11.glScalef(0.5F, 0.5F, 0.5F); + } + renderItemAsBlock((RenderBlocks) data[0], item, offset, offset, offset); + } + + public static void renderItemAsBlock(RenderBlocks renderer, ItemStack item, double translateX, double translateY, double translateZ) { + + renderTextureAsBlock(renderer, item.getIconIndex(), translateX, translateY, translateZ); + } + + public static void renderTextureAsBlock(RenderBlocks renderer, IIcon texture, double translateX, double translateY, double translateZ) { + + Tessellator tessellator = Tessellator.instance; + Block block = Blocks.stone; + + if (texture == null) { + return; + } + renderer.setRenderBoundsFromBlock(block); + GL11.glTranslated(translateX, translateY, translateZ); + tessellator.startDrawingQuads(); + + tessellator.setNormal(0.0F, -1.0F, 0.0F); + renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(0.0F, 1.0F, 0.0F); + renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(0.0F, 0.0F, -1.0F); + renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(0.0F, 0.0F, 1.0F); + renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(-1.0F, 0.0F, 0.0F); + renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.setNormal(1.0F, 0.0F, 0.0F); + renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, texture); + + tessellator.draw(); + } + +} diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java b/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java index fb260eedeb..000badb80f 100644 --- a/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderBatKing.java @@ -1,21 +1,23 @@ package gtPlusPlus.core.client.renderer; +import org.lwjgl.opengl.GL11; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.model.ModelBat; +import gtPlusPlus.core.client.model.ModelBatKing; +import gtPlusPlus.core.entity.monster.EntityBatKing; +import gtPlusPlus.core.lib.CORE; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.passive.EntityBat; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class RenderBatKing extends RenderLiving { - private static final ResourceLocation batTextures = new ResourceLocation("textures/entity/bat.png"); + private static final ResourceLocation batTextures = new ResourceLocation(CORE.MODID+":"+"textures/entity/batKing.png"); /** * not actually sure this is size, is not used as of now, but the model would be @@ -24,8 +26,8 @@ public class RenderBatKing extends RenderLiving { private int renderedBatSize; public RenderBatKing() { - super(new ModelBat(), 1F); - this.renderedBatSize = ((ModelBat) this.mainModel).getBatSize(); + super(new ModelBatKing(), 0.7F); + this.renderedBatSize = (((ModelBatKing) this.mainModel).getBatSize()); } /** @@ -36,13 +38,13 @@ public class RenderBatKing extends RenderLiving { * func_76986_a(T entity, double d, double d1, double d2, float f, float f1). * But JAD is pre 1.5 so doesn't do that. */ - public void doRender(EntityBat p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, + public void doRender(EntityBatKing p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { - int i = ((ModelBat) this.mainModel).getBatSize(); + int i = ((ModelBatKing) this.mainModel).getBatSize(); if (i != this.renderedBatSize) { this.renderedBatSize = i; - this.mainModel = new ModelBat(); + this.mainModel = new ModelBatKing(); } super.doRender((EntityLiving) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); @@ -52,7 +54,7 @@ public class RenderBatKing extends RenderLiving { * Returns the location of an entity's texture. Doesn't seem to be called unless * you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(EntityBat p_110775_1_) { + protected ResourceLocation getEntityTexture(EntityBatKing p_110775_1_) { return batTextures; } @@ -60,18 +62,18 @@ public class RenderBatKing extends RenderLiving { * Allows the render to do any OpenGL state modifications necessary before the * model is rendered. Args: entityLiving, partialTickTime */ - protected void preRenderCallback(EntityBat p_77041_1_, float p_77041_2_) { + protected void preRenderCallback(EntityBatKing p_77041_1_, float p_77041_2_) { GL11.glScalef(0.35F, 0.35F, 0.35F); } /** * Sets a simple glTranslate on a LivingEntity. */ - protected void renderLivingAt(EntityBat p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) { + protected void renderLivingAt(EntityBatKing p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) { super.renderLivingAt(p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_); } - protected void rotateCorpse(EntityBat p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { + protected void rotateCorpse(EntityBatKing p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { if (!p_77043_1_.getIsBatHanging()) { GL11.glTranslatef(0.0F, MathHelper.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F); } else { @@ -91,7 +93,7 @@ public class RenderBatKing extends RenderLiving { */ public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { - this.doRender((EntityBat) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + this.doRender((EntityBatKing) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } /** @@ -99,11 +101,11 @@ public class RenderBatKing extends RenderLiving { * model is rendered. Args: entityLiving, partialTickTime */ protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_) { - this.preRenderCallback((EntityBat) p_77041_1_, p_77041_2_); + this.preRenderCallback((EntityBatKing) p_77041_1_, p_77041_2_); } protected void rotateCorpse(EntityLivingBase p_77043_1_, float p_77043_2_, float p_77043_3_, float p_77043_4_) { - this.rotateCorpse((EntityBat) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); + this.rotateCorpse((EntityBatKing) p_77043_1_, p_77043_2_, p_77043_3_, p_77043_4_); } /** @@ -111,7 +113,7 @@ public class RenderBatKing extends RenderLiving { */ protected void renderLivingAt(EntityLivingBase p_77039_1_, double p_77039_2_, double p_77039_4_, double p_77039_6_) { - this.renderLivingAt((EntityBat) p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_); + this.renderLivingAt((EntityBatKing) p_77039_1_, p_77039_2_, p_77039_4_, p_77039_6_); } /** @@ -124,7 +126,7 @@ public class RenderBatKing extends RenderLiving { */ public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { - this.doRender((EntityBat) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + this.doRender((EntityBatKing) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } /** @@ -132,7 +134,7 @@ public class RenderBatKing extends RenderLiving { * you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(Entity p_110775_1_) { - return this.getEntityTexture((EntityBat) p_110775_1_); + return this.getEntityTexture((EntityBatKing) p_110775_1_); } /** @@ -145,6 +147,6 @@ public class RenderBatKing extends RenderLiving { */ public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { - this.doRender((EntityBat) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + this.doRender((EntityBatKing) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index 3a7d4461f4..5b9c17bacf 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -7,6 +7,7 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.preloader.asm.AsmConfig; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; @@ -33,6 +34,9 @@ public class CommandEnableDebugWhileRunning implements ICommand } + + // Use '/debugmodegtpp' along with 'logging' or 'debug' to toggle Debug mode and Logging. + // Using nothing after the command toggles both to their opposite states respectively. @Override public String getCommandUsage(final ICommandSender var1){ return "/debugmodegtpp"; @@ -47,16 +51,44 @@ public class CommandEnableDebugWhileRunning implements ICommand @Override public void processCommand(final ICommandSender S, final String[] argString){ - Logger.INFO("Toggling Debug Mode"); - final World W = S.getEntityWorld(); - final EntityPlayer P = CommandUtils.getPlayer(S); - - if (PlayerUtils.isPlayerOP(P)) { - CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); - PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); + if (argString == null || argString.length == 0 || argString.length > 1) { + Logger.INFO("Toggling Debug Mode & Logging."); + final EntityPlayer P = CommandUtils.getPlayer(S); + if (PlayerUtils.isPlayerOP(P)) { + CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); + PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); + AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); + PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); + } + } + else { + if (argString[0].toLowerCase().equals("debug")) { + Logger.INFO("Toggling Debug Mode."); + final EntityPlayer P = CommandUtils.getPlayer(S); + if (PlayerUtils.isPlayerOP(P)) { + CORE.DEBUG = Utils.invertBoolean(CORE.DEBUG); + PlayerUtils.messagePlayer(P, "Toggled GT++ Debug Mode - Enabled: "+CORE.DEBUG); + } + } + else if (argString[0].toLowerCase().equals("logging")) { + Logger.INFO("Toggling Logging."); + final EntityPlayer P = CommandUtils.getPlayer(S); + if (PlayerUtils.isPlayerOP(P)) { + AsmConfig.disableAllLogging = Utils.invertBoolean(AsmConfig.disableAllLogging); + PlayerUtils.messagePlayer(P, "Toggled GT++ Logging - Enabled: "+(!AsmConfig.disableAllLogging)); + } + } + else { + final EntityPlayer P = CommandUtils.getPlayer(S); + if (PlayerUtils.isPlayerOP(P)) { + PlayerUtils.messagePlayer(P, "Invalid command, use 'debug' or 'logging'"); + } + } } + + } @Override diff --git a/src/Java/gtPlusPlus/core/common/BasePlayer.java b/src/Java/gtPlusPlus/core/common/BasePlayer.java index 1b3f67b8d6..4686f34207 100644 --- a/src/Java/gtPlusPlus/core/common/BasePlayer.java +++ b/src/Java/gtPlusPlus/core/common/BasePlayer.java @@ -1,19 +1,14 @@ package gtPlusPlus.core.common; -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.entity.EntityClientPlayerMP; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.network.play.client.C0BPacketEntityAction; -import net.minecraft.potion.Potion; -import net.minecraft.util.MovementInputFromOptions; -import net.minecraft.util.ResourceLocation; - import api.player.client.ClientPlayerAPI; import api.player.client.ClientPlayerBase; import gtPlusPlus.core.handler.events.CustomMovementHandler; import gtPlusPlus.core.handler.events.SneakManager; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.util.MovementInputFromOptions; public class BasePlayer extends ClientPlayerBase { @@ -30,8 +25,17 @@ public class BasePlayer extends ClientPlayerBase * EntityPlayerSP.onLivingUpdate() - Adapted to PlayerAPI */ @Override - public void onLivingUpdate() - { + public void onLivingUpdate() { + + super.onLivingUpdate(); + EntityPlayer aPlayer = this.player; + if (aPlayer != null) { + SneakManager aSneak = SneakManager.get(aPlayer); + if (!aSneak.isWearingRing()) { + return; + } + } + if(this.player.sprintingTicksLeft > 0) { --this.player.sprintingTicksLeft; @@ -57,54 +61,9 @@ public class BasePlayer extends ClientPlayerBase } else { - this.player.prevTimeInPortal = this.player.timeInPortal; - if(this.playerAPI.getInPortalField()) - { - if(this.mc.currentScreen != null) - { - this.mc.displayGuiScreen((GuiScreen)null); - } - if(this.player.timeInPortal == 0.0F) - { - this.mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("portal.trigger"), (this.player.getRNG().nextFloat() * 0.4F) + 0.8F)); - } - this.player.timeInPortal += 0.0125F; - - if(this.player.timeInPortal >= 1.0F) - { - this.player.timeInPortal = 1.0F; - } - - this.playerAPI.setInPortalField(false); - } - else if(this.player.isPotionActive(Potion.confusion) && (this.player.getActivePotionEffect(Potion.confusion).getDuration() > 60)) - { - this.player.timeInPortal += 0.006666667F; - if(this.player.timeInPortal > 1.0F) - { - this.player.timeInPortal = 1.0F; - } - } - else - { - if(this.player.timeInPortal > 0.0F) - { - this.player.timeInPortal -= 0.05F; - } - - if(this.player.timeInPortal < 0.0F) - { - this.player.timeInPortal = 0.0F; - } - } - - - if(this.player.timeUntilPortal > 0) - { - --this.player.timeUntilPortal; - } + final boolean isJumping = this.player.movementInput.jump; @@ -112,44 +71,29 @@ public class BasePlayer extends ClientPlayerBase final boolean isMovingForward = this.player.movementInput.moveForward >= minSpeed; this.customMovementInput.update(this.mc, (MovementInputFromOptions)this.player.movementInput, this.player); - if(this.player.isUsingItem() && !this.player.isRiding()) - { - this.player.movementInput.moveStrafe *= 0.2F; - this.player.movementInput.moveForward *= 0.2F; - this.playerAPI.setSprintToggleTimerField(0); - } - - if(this.player.movementInput.sneak && (this.player.ySize < 0.2F)) - { - this.player.ySize = 0.2F; - } - - this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D)); - this.playerAPI.localPushOutOfBlocks(this.player.posX - (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D)); - this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ - (this.player.width * 0.35D)); - this.playerAPI.localPushOutOfBlocks(this.player.posX + (this.player.width * 0.35D), this.player.boundingBox.minY + 0.5D, this.player.posZ + (this.player.width * 0.35D)); - final boolean enoughHunger = (this.player.getFoodStats().getFoodLevel() > 6.0F) || this.player.capabilities.isFlying; /* * Begin ToggleSneak Changes - ToggleSprint */ + SneakManager aSneak = SneakManager.get(this.player); final boolean isSprintDisabled = false; - final boolean canDoubleTap = SneakManager.optionDoubleTap; + final boolean canDoubleTap = aSneak.optionDoubleTap; + // Detect when ToggleSprint was disabled in the in-game options menu - if(SneakManager.wasSprintDisabled) + if(aSneak.wasSprintDisabled) { this.player.setSprinting(false); - this.customMovementInput.UpdateSprint(false, false); - SneakManager.wasSprintDisabled = false; + this.customMovementInput.UpdateSprint(false, false, aSneak); + aSneak.wasSprintDisabled = false; } // Default Sprint routine converted to PlayerAPI, use if ToggleSprint is disabled - TODO - Disable sprinting as a whole if(isSprintDisabled) { //Utils.LOG_INFO("Sprint pressed"); - if(SneakManager.optionDoubleTap && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) + if(aSneak.optionDoubleTap && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) { if((this.playerAPI.getSprintToggleTimerField() <= 0) && !this.settings.keyBindSprint.getIsKeyPressed()) { @@ -157,26 +101,26 @@ public class BasePlayer extends ClientPlayerBase } else { - if (SneakManager.Sprinting()){ + if (aSneak.Sprinting()){ this.player.setSprinting(true); - this.customMovementInput.UpdateSprint(true, false); + this.customMovementInput.UpdateSprint(true, false, aSneak); } else { this.player.setSprinting(false); - this.customMovementInput.UpdateSprint(false, false); + this.customMovementInput.UpdateSprint(false, false, aSneak); } } } - if(!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed()) + if(!this.player.isSprinting() && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && this.settings.keyBindSprint.getIsKeyPressed()) { - if (SneakManager.Sprinting()){ + if (aSneak.Sprinting()){ this.player.setSprinting(true); - this.customMovementInput.UpdateSprint(true, false); + this.customMovementInput.UpdateSprint(true, false, aSneak); } else { this.player.setSprinting(false); - this.customMovementInput.UpdateSprint(false, false); + this.customMovementInput.UpdateSprint(false, false, aSneak); } } } @@ -190,11 +134,11 @@ public class BasePlayer extends ClientPlayerBase // 5/6/14 - onGround check removed to match vanilla's 'start sprint while jumping' behavior. //if(this.player.onGround && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) - if(enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) + if(!this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness) && !this.customMovementInput.sprintHeldAndReleased) { if((canDoubleTap && !this.player.isSprinting()) || !canDoubleTap) { - if (SneakManager.Sprinting()){ + if (aSneak.Sprinting()){ this.player.setSprinting(state); } else { this.player.setSprinting(false); @@ -202,7 +146,7 @@ public class BasePlayer extends ClientPlayerBase } } - if(canDoubleTap && !state && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && enoughHunger && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) + if(canDoubleTap && !state && this.player.onGround && !isMovingForward && (this.player.movementInput.moveForward >= minSpeed) && !this.player.isSprinting() && !this.player.isUsingItem() && !this.player.isPotionActive(Potion.blindness)) { if(this.playerAPI.getSprintToggleTimerField() == 0) { @@ -210,9 +154,9 @@ public class BasePlayer extends ClientPlayerBase } else { - if (SneakManager.Sprinting()){ + if (aSneak.Sprinting()){ this.player.setSprinting(true); - this.customMovementInput.UpdateSprint(true, true); + this.customMovementInput.UpdateSprint(true, true, aSneak); this.playerAPI.setSprintToggleTimerField(0); } } @@ -221,14 +165,14 @@ public class BasePlayer extends ClientPlayerBase // If sprinting, break the sprint in appropriate circumstances: // Player stops moving forward, runs into something, or gets too hungry - if(this.player.isSprinting() && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally || !enoughHunger)) + if(this.player.isSprinting() && ((this.player.movementInput.moveForward < minSpeed) || this.player.isCollidedHorizontally)) { this.player.setSprinting(false); // Undo toggle if we resumed vanilla operation due to Hold&Release, DoubleTap, Fly, Ride if ((this.customMovementInput.sprintHeldAndReleased == true) || isSprintDisabled || this.customMovementInput.sprintDoubleTapped || this.player.capabilities.isFlying || this.player.isRiding()) { - this.customMovementInput.UpdateSprint(false, false); + this.customMovementInput.UpdateSprint(false, false, aSneak); } } @@ -263,87 +207,6 @@ public class BasePlayer extends ClientPlayerBase // this.handledDebugPress = false; // } - // - // Fly Speed Boosting - Added 5/7/2014 - // - if(this.player.capabilities.getFlySpeed() != 0.05F) - { - this.player.capabilities.setFlySpeed(0.05F); - } - - - if(this.player.capabilities.allowFlying && !isJumping && this.player.movementInput.jump) - { - if(this.playerAPI.getFlyToggleTimerField() == 0) - { - this.playerAPI.setFlyToggleTimerField(7); - } - else - { - this.player.capabilities.isFlying = !this.player.capabilities.isFlying; - this.player.sendPlayerAbilities(); - this.playerAPI.setFlyToggleTimerField(0); - } - } - - if(this.player.capabilities.isFlying) - { - if(this.player.movementInput.sneak) - { - this.player.motionY -= 0.15D; - } - if(this.player.movementInput.jump) - { - this.player.motionY += 0.15D; - } - } - - if(this.player.isRidingHorse()) - { - if(this.playerAPI.getHorseJumpPowerCounterField() < 0) - { - this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() + 1); - if(this.playerAPI.getHorseJumpPowerCounterField() == 0) - { - this.playerAPI.setHorseJumpPowerField(0.0F); - } - } - - if(isJumping && !this.player.movementInput.jump) - { - this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() - 10); - this.playerAPI.setHorseJumpPowerCounterField(-10); - ((EntityClientPlayerMP)this.player).sendQueue.addToSendQueue(new C0BPacketEntityAction(this.player, 6, (int)(this.player.getHorseJumpPower() * 100.0F))); - } - else if(!isJumping && this.player.movementInput.jump) - { - this.playerAPI.setHorseJumpPowerCounterField(0); - this.playerAPI.setHorseJumpPowerField(0.0F); - } - else if(isJumping) - { - this.playerAPI.setHorseJumpPowerCounterField(this.playerAPI.getHorseJumpPowerCounterField() + 1); - if(this.playerAPI.getHorseJumpPowerCounterField() < 10) - { - this.playerAPI.setHorseJumpPowerField(this.playerAPI.getHorseJumpPowerCounterField() * 0.1F); - } - else - { - this.playerAPI.setHorseJumpPowerField(0.8F + ((2.0F / (this.playerAPI.getHorseJumpPowerCounterField() - 9)) * 0.1F)); - } - } - } - else - { - this.playerAPI.setHorseJumpPowerField(0.0F); - } - - this.playerAPI.superOnLivingUpdate(); - if(this.player.onGround && this.player.capabilities.isFlying) - { - this.player.capabilities.isFlying = false; - this.player.sendPlayerAbilities(); - } } } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 03b0f944b7..1ce16bf4de 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -12,6 +12,8 @@ import gregtech.api.enums.ItemList; import gregtech.api.enums.OrePrefixes; import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.api.objects.minecraft.ChunkManager; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.creative.AddToCreativeTab; @@ -51,12 +53,14 @@ import gtPlusPlus.plugin.villagers.block.BlockGenericSpawner; import gtPlusPlus.xmod.eio.handler.HandlerTooltip_EIO; import gtPlusPlus.xmod.galacticraft.handler.HandlerTooltip_GC; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.thermalfoundation.item.TF_Items; +import gtPlusPlus.xmod.gregtech.api.util.SpecialBehaviourTooltipHandler; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.common.ForgeChunkManager; public class CommonProxy { @@ -144,6 +148,8 @@ public class CommonProxy { // Block Handler for all events. Utils.registerEvent(new BlockEventHandler()); Utils.registerEvent(new GeneralTooltipEventHandler()); + // Handles Tooltips for items giving custom multiblock behaviour + Utils.registerEvent(new SpecialBehaviourTooltipHandler()); // Handles Custom tooltips for EIO. Utils.registerEvent(new HandlerTooltip_EIO()); // Handles Custom Tooltips for GC @@ -187,12 +193,22 @@ public class CommonProxy { } // Compat Handling + Logger.INFO("Removing recipes from other mods."); COMPAT_HANDLER.RemoveRecipesFromOtherMods(); + Logger.INFO("Initialising Handler, Then Adding Recipes"); COMPAT_HANDLER.InitialiseHandlerThenAddRecipes(); - COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); + Logger.INFO("Loading Intermod staging."); COMPAT_IntermodStaging.postInit(e); + Logger.INFO("Loading queued recipes."); COMPAT_HANDLER.runQueuedRecipes(); + Logger.INFO("Registering custom mob drops."); registerCustomMobDrops(); + + // Moved last in postInit(). + // 12/12/19 - Alkalus + // Moved last, to prevent recipes being generated post initialisation. + Logger.INFO("Loading Gregtech API recipes."); + COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); } public void serverStarting(final FMLServerStartingEvent e) { @@ -258,7 +274,7 @@ public class CommonProxy { //Special mobs Support if (ReflectionUtils.doesClassExist("toast.specialMobs.entity.zombie.EntityBrutishZombie")) { - Class aBrutishZombie = ReflectionUtils.getClass("toast.specialMobs.entity.zombie.EntityBrutishZombie"); + Class<?> aBrutishZombie = ReflectionUtils.getClass("toast.specialMobs.entity.zombie.EntityBrutishZombie"); ItemStack aFortune1 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); ItemStack aFortune2 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); ItemStack aFortune3 = ItemUtils.getEnchantedBook(Enchantment.fortune, 1); @@ -268,8 +284,45 @@ public class CommonProxy { EntityUtils.registerDropsForMob(aBrutishZombie, ItemUtils.getItemStackOfAmountFromOreDict("ingotRedAlloy", 1), 3, 200); } + //GalaxySpace Support + if (ReflectionUtils.doesClassExist("galaxyspace.SolarSystem.moons.europa.entities.EntityEvolvedColdBlaze")) { + Class<?> aColdBlaze = ReflectionUtils.getClass("galaxyspace.SolarSystem.moons.europa.entities.EntityEvolvedColdBlaze"); + ItemStack aSmallBlizz, aTinyBlizz, aSmallCryo, aTinyCryo; + aSmallBlizz = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallBlizz", 1); + aTinyBlizz = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyBlizz", 1); + aSmallCryo = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallCryotheum", 1); + aTinyCryo = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyCryotheum", 1); + EntityUtils.registerDropsForMob(aColdBlaze, ItemUtils.getItemStackOfAmountFromOreDict("stickBlizz", 1), 2, 500); + if (aSmallBlizz != null) { + EntityUtils.registerDropsForMob(aColdBlaze, aSmallBlizz, 2, 750); + } + if (aTinyBlizz != null) { + EntityUtils.registerDropsForMob(aColdBlaze, aTinyBlizz, 4, 1500); + } + if (aSmallCryo != null) { + EntityUtils.registerDropsForMob(aColdBlaze, aSmallCryo, 1, 50); + } + if (aTinyCryo != null) { + EntityUtils.registerDropsForMob(aColdBlaze, aTinyCryo, 2, 100); + } + } - + } + + protected final AutoMap<Pair<Item, IItemRenderer>> mItemRenderMappings = new AutoMap<Pair<Item, IItemRenderer>>(); + + + public static void registerItemRendererGlobal(Item aItem, IItemRenderer aRenderer) { + GTplusplus.proxy.registerItemRenderer(aItem, aRenderer); + } + + public void registerItemRenderer(Item aItem, IItemRenderer aRenderer) { + if (Utils.isServer()) { + return; + } + else { + mItemRenderMappings.add(new Pair<Item, IItemRenderer>(aItem, aRenderer)); + } } } diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java index 06467503d8..12b3a94083 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_PlayerAPI.java @@ -23,7 +23,7 @@ public class COMPAT_PlayerAPI { public static class clientProxy{ public static void initPre(){ - Utils.registerEvent(SneakManager.instance); + //Utils.registerEvent(SneakManager.instance); } public static void Init(){ diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java index 89c1324a54..ecaf031030 100644 --- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java @@ -176,6 +176,7 @@ public class ConfigHandler { "Enables Custom GT++ Cape."); disableZombieReinforcement = config.getBoolean("disableZombieReinforcement", "features", false, "Disables Zombie Reinforcement on hard difficutly."); + enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s."); //Biomes EVERGLADES_ID = config.getInt("darkworld_ID", "worldgen", 227, 1, 254, "The ID of the Dark Dimension."); diff --git a/src/Java/gtPlusPlus/core/container/Container_PestKiller.java b/src/Java/gtPlusPlus/core/container/Container_PestKiller.java new file mode 100644 index 0000000000..2f25c5aace --- /dev/null +++ b/src/Java/gtPlusPlus/core/container/Container_PestKiller.java @@ -0,0 +1,154 @@ +package gtPlusPlus.core.container; + +import gregtech.api.gui.GT_Slot_Render; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.InventoryPestKiller; +import gtPlusPlus.core.slots.SlotGeneric; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidStack; + +public class Container_PestKiller extends Container { + + public TileEntityPestKiller tile_entity; + public final InventoryPestKiller inventoryChest; + + private final World worldObj; + private final int posX; + private final int posY; + private final int posZ; + + public static int StorageSlotNumber = 3; // Number of slots in storage area + public static int InventorySlotNumber = 36; // Inventory Slots (Inventory + // and Hotbar) + public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All + // slots + + public Container_PestKiller(final InventoryPlayer inventory, final TileEntityPestKiller te) { + this.tile_entity = te; + this.inventoryChest = te.getInventory(); + te.openInventory(); + int var6; + int var7; + this.worldObj = te.getWorldObj(); + this.posX = te.xCoord; + this.posY = te.yCoord; + this.posZ = te.zCoord; + int o = 0; + + int aSlotX = 134; + + this.addSlotToContainer(new SlotGeneric(this.inventoryChest, o++, aSlotX, 10)); + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, aSlotX, 60)); + addSlotToContainer(new GT_Slot_Render(tile_entity, o++, aSlotX, 35)); + + // Player Inventory + for (var6 = 0; var6 < 3; ++var6) { + for (var7 = 0; var7 < 9; ++var7) { + this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); + } + } + + // Player Hotbar + for (var6 = 0; var6 < 9; ++var6) { + this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); + } + + } + + public FluidStack getFluidOfStoredTank() { + if (tile_entity != null) { + if (tile_entity.getTank() != null) { + return tile_entity.getTank().getFluid(); + } + } + return null; + } + + public int getFluidStoredAmount() { + FluidStack f = getFluidOfStoredTank(); + return f == null ? 0 : f.amount; + } + + @Override + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + boolean fluid = false; + if (aSlotIndex == 2) { + fluid = true; + } + if (!fluid) { + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + else { + return null; + } + } + + @Override + public void onContainerClosed(final EntityPlayer par1EntityPlayer) { + super.onContainerClosed(par1EntityPlayer); + tile_entity.closeInventory(); + } + + @Override + public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { + if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockPestKiller) { + return false; + } + return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; + } + + @Override + public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) { + ItemStack var3 = null; + final Slot var4 = (Slot) this.inventorySlots.get(par2); + + if ((var4 != null) && var4.getHasStack()) { + final ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + /* + * if (par2 == 0) { if (!this.mergeItemStack(var5, + * InOutputSlotNumber, FullSlotNumber, true)) { return null; } + * + * var4.onSlotChange(var5, var3); } else if (par2 >= + * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if + * (!this.mergeItemStack(var5, InventoryOutSlotNumber, + * FullSlotNumber, false)) { return null; } } else if (par2 >= + * InventoryOutSlotNumber && par2 < FullSlotNumber) { if + * (!this.mergeItemStack(var5, InOutputSlotNumber, + * InventoryOutSlotNumber, false)) { return null; } } else if + * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, + * false)) { return null; } + */ + + if (var5.stackSize == 0) { + var4.putStack((ItemStack) null); + } else { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } + + // Can merge Slot + @Override + public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { + return super.func_94530_a(p_94530_1_, p_94530_2_); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java b/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java new file mode 100644 index 0000000000..cbd08c2cca --- /dev/null +++ b/src/Java/gtPlusPlus/core/container/Container_RoundRobinator.java @@ -0,0 +1,246 @@ +package gtPlusPlus.core.container; + +import java.util.Iterator; + +import org.apache.commons.lang3.ArrayUtils; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.inventories.Inventory_RoundRobinator; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class Container_RoundRobinator extends Container { + + public TileEntityRoundRobinator tile_entity; + public final Inventory_RoundRobinator inventoryChest; + + private final World worldObj; + private final int posX; + private final int posY; + private final int posZ; + + private final boolean[] mActiveData = new boolean[] {false, false, false, false}; + + public static int mStorageSlotNumber = 4; // Number of slots in storage area + public static int mInventorySlotNumber = 36; // Inventory Slots (Inventory + // and Hotbar) + public static int mFullSlotNumber = mInventorySlotNumber + mStorageSlotNumber; // All + // slots + + public Container_RoundRobinator(final InventoryPlayer inventory, final TileEntityRoundRobinator te) { + this.tile_entity = te; + this.inventoryChest = te.getInventory(); + boolean [] aTemp = te.getActiveSides(); + if (aTemp != null && aTemp.length == 4) { + for (int i=0;i<4;i++) { + mActiveData[i] = aTemp[i]; + } + } + + int var6; + int var7; + this.worldObj = te.getWorldObj(); + this.posX = te.xCoord; + this.posY = te.yCoord; + this.posZ = te.zCoord; + + int o = 0; + int xStart = 134; + int yStart = 32; + + try { + //0 + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart, yStart)); + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart+18, yStart)); + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart, yStart+17)); + this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, xStart+18, yStart+17)); + + // Player Inventory + for (var6 = 0; var6 < 3; ++var6) { + for (var7 = 0; var7 < 9; ++var7) { + this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); + } + } + // Player Hotbar + for (var6 = 0; var6 < 9; ++var6) { + this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); + } + } + catch (Throwable t) { + t.printStackTrace(); + } + this.detectAndSendChanges(); + + } + + @Override + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, + final EntityPlayer aPlayer) { + + if (!aPlayer.worldObj.isRemote) { + if (aSlotIndex < 4) { + this.tile_entity.toggleSide(aSlotIndex+2); + //Logger.INFO("Toggling side: "+(aSlotIndex+2)+" | Active: "+this.tile_entity.getSideActive(aSlotIndex+2)+" | Data:"+this.tile_entity.getDataString()); + } + } + return GT_Values.NI; + //return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + @Override + public void onContainerClosed(final EntityPlayer par1EntityPlayer) { + super.onContainerClosed(par1EntityPlayer); + } + + @Override + public boolean canInteractWith(final EntityPlayer par1EntityPlayer) { + if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockRoundRobinator) { + return false; + } + + return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; + } + + + + public final void addCraftingToCrafters(ICrafting par1ICrafting) { + try { + super.addCraftingToCrafters(par1ICrafting); + } catch (Throwable var3) { + var3.printStackTrace(); + } + } + + public final void removeCraftingFromCrafters(ICrafting par1ICrafting) { + try { + super.removeCraftingFromCrafters(par1ICrafting); + } catch (Throwable var3) { + var3.printStackTrace(); + } + } + + public final void detectAndSendChanges() { + try { + super.detectAndSendChanges(); + detectAndSendChangesEx(); + } catch (Throwable var2) { + var2.printStackTrace(); + } + } + + public final void updateProgressBar(int par1, int par2) { + try { + super.updateProgressBar(par1, par2); + updateProgressBarEx(par1, par2); + } catch (Throwable var4) { + var4.printStackTrace(); + } + } + + + public int mSide_1 = 0; + public int mSide_2 = 0; + public int mSide_3 = 0; + public int mSide_4 = 0; + public int mTier = 1; + public int mTickRate = 50; + + private int oSide_1 = 0; + private int oSide_2 = 0; + private int oSide_3 = 0; + private int oSide_4 = 0; + private int oTier = 1; + private int oTickRate = 50; + + private int mTimer = 0; + + + + public void detectAndSendChangesEx() { + super.detectAndSendChanges(); + if (!this.tile_entity.getWorldObj().isRemote) { + boolean [] aTemp = tile_entity.getActiveSides(); + for (int i=0;i<4;i++) { + mActiveData[i] = aTemp[i]; + } + this.mSide_1 = aTemp[0] ? 1 : 0; + this.mSide_2 = aTemp[1] ? 1 : 0; + this.mSide_3 = aTemp[2] ? 1 : 0; + this.mSide_4 = aTemp[3] ? 1 : 0; + this.mTier = this.tile_entity.getTier(); + this.mTickRate = this.tile_entity.getTickRate(); + ++this.mTimer; + Iterator var2 = this.crafters.iterator(); + + while (true) { + ICrafting var1; + do { + if (!var2.hasNext()) { + this.oSide_1 = this.mSide_1; + this.oSide_2 = this.mSide_2; + this.oSide_3 = this.mSide_3; + this.oSide_4 = this.mSide_4; + this.oTier = this.mTier; + this.oTickRate = this.mTickRate; + return; + } + var1 = (ICrafting) var2.next(); + if (this.mTimer % 500 == 10 || this.oSide_1 != this.mSide_1) { + var1.sendProgressBarUpdate(this, 2, this.mSide_1); + } + if (this.mTimer % 500 == 10 || this.oSide_2 != this.mSide_2) { + var1.sendProgressBarUpdate(this, 4, this.mSide_2); + } + if (this.mTimer % 500 == 10 || this.oSide_3 != this.mSide_3) { + var1.sendProgressBarUpdate(this, 6, this.mSide_3); + } + if (this.mTimer % 500 == 10 || this.oSide_4 != this.mSide_4) { + var1.sendProgressBarUpdate(this, 8, this.mSide_4); + } + if (this.mTimer % 500 == 10 || this.oTier != this.mTier) { + var1.sendProgressBarUpdate(this, 10, this.mTier); + } + if (this.mTimer % 500 == 10 || this.oTickRate != this.mTickRate) { + var1.sendProgressBarUpdate(this, 12, this.mTickRate); + } + } while (this.mTimer % 500 != 10); + + } + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBarEx(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 2 : + this.mSide_1 = par2; + break; + case 4 : + this.mSide_2 = par2; + break; + case 6 : + this.mSide_3 = par2; + case 8 : + this.mSide_4 = par2; + case 10 : + this.mTier = par2; + case 12 : + this.mTickRate = par2; + break; + } + + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java b/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java index 34a4e9fa97..f9bf617e1b 100644 --- a/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java +++ b/src/Java/gtPlusPlus/core/container/Container_SuperJukebox.java @@ -191,7 +191,7 @@ public class Container_SuperJukebox extends Container { @Override public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (tile_entity.getWorldObj().isRemote || tile_entity == null) return null; + if (tile_entity == null || tile_entity.getWorldObj().isRemote) return null; switch (aSlotIndex) { case SLOT_HOLO_PLAY: if (tile_entity == null) return null; @@ -217,7 +217,7 @@ public class Container_SuperJukebox extends Container { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if (tile_entity.getWorldObj().isRemote || tile_entity == null) return; + if (tile_entity == null || tile_entity.getWorldObj().isRemote) return; isPlaying = tile_entity.mIsPlaying; isLooping = tile_entity.mIsLooping; diff --git a/src/Java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java b/src/Java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java new file mode 100644 index 0000000000..52d1d6100c --- /dev/null +++ b/src/Java/gtPlusPlus/core/entity/ai/batking/EntityAIBatKingAttack.java @@ -0,0 +1,406 @@ +package gtPlusPlus.core.entity.ai.batking; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.entity.monster.EntityBatKing; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.EntityUtils; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IRangedAttackMob; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.pathfinding.PathEntity; +import net.minecraft.pathfinding.PathPoint; +import net.minecraft.util.MathHelper; + +public class EntityAIBatKingAttack extends EntityAIBase { + + private final Ranged mRangedAI; + private final Melee mMeleeAI; + private boolean mIsMelee = false; + + /** The Bat King in control of this AI. */ + private final EntityBatKing mAttackingEntity; + + /** The PathEntity of our entity. */ + private PathEntity mEntityPathEntity; + + /** The current target of Bat King in control of this AI. */ + private EntityLivingBase mEntityTarget; + + private final Class mClassTarget; + + public EntityAIBatKingAttack(EntityBatKing aAttacker, Class aClassTarget, + double aMovementSpeed, int someInt, int aMaxRangedAttackTime, float someFloat, boolean aLongMemory) { + mRangedAI = new Ranged(this, aMovementSpeed, someInt, 5, someFloat); + mMeleeAI = new Melee(this, aClassTarget, aMovementSpeed, aLongMemory); + mAttackingEntity = aAttacker; + mClassTarget = aClassTarget; + } + + @Override + public boolean shouldExecute() { + determineCombatStyle(); + EntityLivingBase entitylivingbase = this.mAttackingEntity.getAttackTarget(); + if (entitylivingbase == null) { + this.mEntityTarget = null; + return false; + } else if (!entitylivingbase.isEntityAlive()) { + return false; + } else if (this.mClassTarget != null && !this.mClassTarget.isAssignableFrom(entitylivingbase.getClass())) { + return false; + } else { + if (this.mIsMelee) { + return this.mMeleeAI.shouldExecute(); + } + else { + this.mEntityTarget = entitylivingbase; + this.mEntityPathEntity = this.mAttackingEntity.getNavigator().getPathToEntityLiving(entitylivingbase); + return mRangedAI != null && mMeleeAI != null && hasValidTarget(); + } + } + } + + public EntityBatKing getBatKing() { + return this.mAttackingEntity; + } + + public IRangedAttackMob getBatKingAsIRangedAttackMob() { + return this.mAttackingEntity; + } + + public boolean hasValidTarget() { + return this.mEntityTarget != null; + } + + public EntityLivingBase getTarget() { + return mEntityTarget; + } + + @Override + public boolean continueExecuting() { + determineCombatStyle(); + if (mIsMelee) { + return mMeleeAI.continueExecuting(); + } else { + return mRangedAI.continueExecuting(); + } + } + + @Override + public boolean isInterruptible() { + if (mIsMelee) { + + } else { + + } + return super.isInterruptible(); + } + + @Override + public void startExecuting() { + determineCombatStyle(); + if (mIsMelee) { + mMeleeAI.startExecuting(); + } else { + mRangedAI.startExecuting(); + } + } + + @Override + public void resetTask() { + determineCombatStyle(); + if (mIsMelee) { + mMeleeAI.resetTask(); + } else { + mRangedAI.resetTask(); + } + } + + @Override + public void updateTask() { + determineCombatStyle(); + if (mIsMelee) { + mMeleeAI.updateTask(); + } else { + mRangedAI.updateTask(); + } + } + + + private final void determineCombatStyle() { + boolean aisMeleeNow = this.mIsMelee; + if (this.mEntityTarget != null && EntityUtils.getDistance(getBatKing(), mEntityTarget) < 4) { + this.mIsMelee = true; + } + else { + this.mIsMelee = false; + } + if (aisMeleeNow != this.mIsMelee) { + Logger.INFO("Bat King changed combat style from "+(aisMeleeNow ? "Melee" : "Ranged")+" to "+(this.mIsMelee ? "Melee" : "Ranged")); + } + } + + private class Ranged { + + private final EntityAIBatKingAttack parentAI; + + /** + * A decrementing tick that spawns a ranged attack once this value reaches 0. It + * is then set back to the maxRangedAttackTime. + */ + private int rangedAttackTime; + private double entityMoveSpeed; + private int mCooldownTime; + private int field_96561_g; + /** + * The maximum time the AI has to wait before performing another ranged attack. + */ + private int maxRangedAttackTime; + private float field_96562_i; + private float field_82642_h; //Max range + + public Ranged(EntityAIBatKingAttack aParent, double aMovementSpeed, int someInt, + int aMaxRangedAttackTime, float someFloat) { + this.rangedAttackTime = -1; + this.parentAI = aParent; + this.entityMoveSpeed = aMovementSpeed; + this.field_96561_g = someInt; + this.maxRangedAttackTime = aMaxRangedAttackTime; + this.field_96562_i = someFloat; + this.field_82642_h = someFloat * someFloat * 8; + parentAI.setMutexBits(3); + + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() { + parentAI.getBatKing().getNavigator().setPath(parentAI.mEntityPathEntity, this.entityMoveSpeed); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() { + return parentAI.shouldExecute() || !parentAI.getBatKing().getNavigator().noPath(); + } + + /** + * Resets the task + */ + public void resetTask() { + parentAI.mEntityTarget = null; + this.mCooldownTime = 0; + this.rangedAttackTime = -1; + } + + /** + * Updates the task + */ + public void updateTask() { + + if (MathUtils.randInt(0, 100) == 0) { + maxRangedAttackTime = MathUtils.balance(maxRangedAttackTime, 20, 40); + } + + double d0 = parentAI.getBatKing().getDistanceSq(parentAI.mEntityTarget.posX, parentAI.mEntityTarget.boundingBox.minY, + parentAI.mEntityTarget.posZ); + boolean flag = parentAI.getBatKing().getEntitySenses().canSee(parentAI.mEntityTarget); + + if (flag) { + ++this.mCooldownTime; + } else { + this.mCooldownTime = 0; + } + + if (d0 <= (double) this.field_82642_h && this.mCooldownTime >= 20) { + parentAI.getBatKing().getNavigator().clearPathEntity(); + } else { + if (parentAI.getBatKing().getNavigator().tryMoveToEntityLiving(parentAI.mEntityTarget, this.entityMoveSpeed)) { + Logger.INFO("Doing Ranged Ai Task."); + } + else { + Logger.INFO("Not Doing Ranged Ai Task."); + } + } + + parentAI.getBatKing().getLookHelper().setLookPositionWithEntity(parentAI.mEntityTarget, 30.0F, 30.0F); + float f; + Logger.INFO("Ranged AI - "+rangedAttackTime); + + if (--this.rangedAttackTime == 0) { + if (d0 > (double) this.field_82642_h || !flag) { + Logger.INFO("Stopping ranged attack. "+flag+"|"+(d0 > (double) this.field_82642_h)+"|"+d0+"|"+(double) this.field_82642_h); + return; + } + + f = MathHelper.sqrt_double(d0) / this.field_96562_i; + float f1 = f; + + if (f < 0.1F) { + f1 = 0.1F; + } + + if (f1 > 1.0F) { + f1 = 1.0F; + } + Logger.INFO("Trying to do a ranged attack."); + parentAI.getBatKingAsIRangedAttackMob().attackEntityWithRangedAttack(parentAI.mEntityTarget, f1); + this.rangedAttackTime = MathHelper.floor_float( + f * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); + } else if (this.rangedAttackTime < 0) { + f = MathHelper.sqrt_double(d0) / this.field_96562_i; + this.rangedAttackTime = MathHelper.floor_float( + f * (float) (this.maxRangedAttackTime - this.field_96561_g) + (float) this.field_96561_g); + } + } + + } + + private class Melee { + + private final EntityAIBatKingAttack parentAI; + + /** + * An amount of decrementing ticks that allows the entity to attack once the + * tick reaches 0. + */ + int attackTick; + /** The speed with which the mob will approach the target */ + double speedTowardsTarget; + /** + * When true, the mob will continue chasing its target, even if it can't find a + * path to them right now. + */ + boolean longMemory; + Class classTarget; + private int field_75445_i; + private double field_151497_i; + private double field_151495_j; + private double field_151496_k; + + private int failedPathFindingPenalty; + + public Melee(EntityAIBatKingAttack aParent, Class aClassTarget, + double aMoveToTargetSpeed, boolean aLongMemory) { + this.parentAI = aParent; + this.classTarget = aClassTarget; + this.speedTowardsTarget = aMoveToTargetSpeed; + this.longMemory = aLongMemory; + parentAI.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() { + if (!parentAI.hasValidTarget()) { + return false; + } + EntityLivingBase entitylivingbase = parentAI.getTarget(); + + if (entitylivingbase == null) { + return false; + } else if (!entitylivingbase.isEntityAlive()) { + return false; + } else if (this.classTarget != null && !this.classTarget.isAssignableFrom(entitylivingbase.getClass())) { + return false; + } else { + if (--this.field_75445_i <= 0) { + parentAI.mEntityPathEntity = parentAI.mAttackingEntity.getNavigator().getPathToEntityLiving(entitylivingbase); + this.field_75445_i = 4 + parentAI.mAttackingEntity.getRNG().nextInt(7); + return parentAI.mEntityPathEntity != null; + } else { + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() { + EntityLivingBase entitylivingbase = parentAI.mAttackingEntity.getAttackTarget(); + return entitylivingbase == null ? false + : (!entitylivingbase.isEntityAlive() ? false + : (!this.longMemory ? !parentAI.mAttackingEntity.getNavigator().noPath() + : parentAI.mAttackingEntity.isWithinHomeDistance(MathHelper.floor_double(entitylivingbase.posX), + MathHelper.floor_double(entitylivingbase.posY), + MathHelper.floor_double(entitylivingbase.posZ)))); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() { + parentAI.mAttackingEntity.getNavigator().setPath(parentAI.mEntityPathEntity, this.speedTowardsTarget); + this.field_75445_i = 0; + } + + /** + * Resets the task + */ + public void resetTask() { + parentAI.mAttackingEntity.getNavigator().clearPathEntity(); + } + + /** + * Updates the task + */ + public void updateTask() { + EntityLivingBase entitylivingbase = parentAI.mAttackingEntity.getAttackTarget(); + parentAI.mAttackingEntity.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F); + double d0 = parentAI.mAttackingEntity.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, + entitylivingbase.posZ); + double d1 = (double) (parentAI.mAttackingEntity.width * 2.0F * parentAI.mAttackingEntity.width * 2.0F + entitylivingbase.width); + --this.field_75445_i; + + if ((this.longMemory || parentAI.mAttackingEntity.getEntitySenses().canSee(entitylivingbase)) && this.field_75445_i <= 0 + && (this.field_151497_i == 0.0D && this.field_151495_j == 0.0D && this.field_151496_k == 0.0D + || entitylivingbase.getDistanceSq(this.field_151497_i, this.field_151495_j, + this.field_151496_k) >= 1.0D + || parentAI.mAttackingEntity.getRNG().nextFloat() < 0.05F)) { + this.field_151497_i = entitylivingbase.posX; + this.field_151495_j = entitylivingbase.boundingBox.minY; + this.field_151496_k = entitylivingbase.posZ; + this.field_75445_i = failedPathFindingPenalty + 4 + parentAI.mAttackingEntity.getRNG().nextInt(7); + + if (parentAI.mAttackingEntity.getNavigator().getPath() != null) { + PathPoint finalPathPoint = parentAI.mAttackingEntity.getNavigator().getPath().getFinalPathPoint(); + if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, + finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) { + failedPathFindingPenalty = 0; + } else { + failedPathFindingPenalty += 10; + } + } else { + failedPathFindingPenalty += 10; + } + + if (d0 > 1024.0D) { + this.field_75445_i += 10; + } else if (d0 > 256.0D) { + this.field_75445_i += 5; + } + + if (!parentAI.mAttackingEntity.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) { + this.field_75445_i += 15; + } + } + + this.attackTick = Math.max(this.attackTick - 1, 0); + + if (d0 <= d1 && this.attackTick <= 20) { + this.attackTick = 20; + + if (parentAI.mAttackingEntity.getHeldItem() != null) { + parentAI.mAttackingEntity.swingItem(); + } + + parentAI.mAttackingEntity.attackEntityAsMob(entitylivingbase); + } + } + + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java b/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java index 114ca50b4b..55e0f4c571 100644 --- a/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java +++ b/src/Java/gtPlusPlus/core/entity/monster/EntityBatKing.java @@ -1,228 +1,712 @@ package gtPlusPlus.core.entity.monster; -import java.util.Calendar; +import java.lang.reflect.Field; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.entity.ai.batking.EntityAIBatKingAttack; +import gtPlusPlus.core.entity.projectile.EntityThrowableBomb; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.RandomPositionGenerator; +import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.passive.EntityBat; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityLargeFireball; +import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; +import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; -public class EntityBatKing extends EntityBat -{ - /** Coordinates of where the bat spawned. */ - private ChunkCoordinates spawnPosition; - - public EntityBatKing(World p_i1680_1_) - { - super(p_i1680_1_); - this.setSize(2F, 3.6F); - this.setIsBatHanging(false); - } - - protected void entityInit() - { - super.entityInit(); - } - - /** - * Returns the volume for the sounds this mob makes. - */ - protected float getSoundVolume() - { - return 0.3F; - } - - /** - * Gets the pitch of living sounds in living entities. - */ - protected float getSoundPitch() - { - return super.getSoundPitch() * 0.35F; - } - - /** - * Returns the sound this mob makes while it's alive. - */ - protected String getLivingSound() - { - return this.getIsBatHanging() && this.rand.nextInt(4) != 0 ? null : "mob.bat.idle"; - } - - /** - * Returns the sound this mob makes when it is hurt. - */ - protected String getHurtSound() - { - return "mob.bat.hurt"; - } - - /** - * Returns the sound this mob makes on death. - */ - protected String getDeathSound() - { - return "mob.bat.death"; - } - - /** - * Returns true if this entity should push and be pushed by other entities when colliding. - */ - public boolean canBePushed() - { - return false; - } - - protected void collideWithEntity(Entity p_82167_1_) {} - - protected void collideWithNearbyEntities() {} - - protected void applyEntityAttributes() - { - super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(60.0D); - } - - public boolean getIsBatHanging() - { - return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; - } - - public void setIsBatHanging(boolean p_82236_1_) - { - byte b0 = this.dataWatcher.getWatchableObjectByte(16); - - if (p_82236_1_) - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1))); - } - else - { - this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2))); - } - } - - /** - * Returns true if the newer Entity AI code should be run - */ - protected boolean isAIEnabled() - { - return true; - } - - /** - * Called to update the entity's position/logic. - */ - public void onUpdate() - { - super.onUpdate(); - } - - protected void updateAITasks() - { - super.updateAITasks(); - - } - - /** - * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to - * prevent them from trampling crops - */ - protected boolean canTriggerWalking() - { - return false; - } - - /** - * Called when the mob is falling. Calculates and applies fall damage. - */ - protected void fall(float p_70069_1_) {} - - /** - * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance - * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround - */ - protected void updateFallState(double p_70064_1_, boolean p_70064_3_) {} - - /** - * Return whether this entity should NOT trigger a pressure plate or a tripwire. - */ - public boolean doesEntityNotTriggerPressurePlate() - { - return true; - } - - /** - * Called when the entity is attacked. - */ - public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) - { - if (this.isEntityInvulnerable()) - { - return false; - } - else - { - if (!this.worldObj.isRemote && this.getIsBatHanging()) - { - this.setIsBatHanging(false); - } - - return super.attackEntityFrom(p_70097_1_, p_70097_2_); - } - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - public void readEntityFromNBT(NBTTagCompound p_70037_1_) - { - super.readEntityFromNBT(p_70037_1_); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - public void writeEntityToNBT(NBTTagCompound p_70014_1_) - { - super.writeEntityToNBT(p_70014_1_); - } - - /** - * Checks if the entity's current position is a valid location to spawn this entity. - */ - public boolean getCanSpawnHere() - { - int i = MathHelper.floor_double(this.boundingBox.minY); - - if (i >= 63) - { - return false; - } - else - { - int j = MathHelper.floor_double(this.posX); - int k = MathHelper.floor_double(this.posZ); - int l = this.worldObj.getBlockLightValue(j, i, k); - byte b0 = 4; - Calendar calendar = this.worldObj.getCurrentDate(); - - if ((calendar.get(2) + 1 != 10 || calendar.get(5) < 20) && (calendar.get(2) + 1 != 11 || calendar.get(5) > 3)) - { - if (this.rand.nextBoolean()) - { - return false; - } - } - else - { - b0 = 7; - } - - return l > this.rand.nextInt(b0) ? false : super.getCanSpawnHere(); - } - } +public class EntityBatKing extends EntityMob implements IRangedAttackMob { + + public int courseChangeCooldown; + public double waypointX; + public double waypointY; + public double waypointZ; + private Entity targetedEntity; + private int aggroCooldown; + public int prevAttackCounter; + public int attackCounter; + private int explosionStrength = 1; + + private EntityAIBatKingAttack aiAttack = new EntityAIBatKingAttack(this, null, 1.0D, 20, 60, 15.0F, true); + private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, + false); + + public EntityBatKing(World p_i1680_1_) { + super(p_i1680_1_); + this.setSize(2.5F, 1.5F); + + this.setIsBatHanging(false); + this.isImmuneToFire = true; + this.experienceValue = 1000; + + this.tasks.addTask(3, this.aiAttack); + //this.tasks.addTask(4, this.aiAttackOnCollide); + //this.tasks.addTask(4, new EntityAIRestrictSun(this)); + //this.tasks.addTask(5, new EntityAIFleeSun(this, 1.0D)); + this.tasks.addTask(4, new EntityAIWander(this, 1.0D)); + //this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + //this.tasks.addTask(6, new EntityAILookIdle(this)); + + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); + //this.targetTasks.addTask(2, this.aiAttack); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); + this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityBat.class, 0, false)); + + } + + protected void entityInit() { + super.entityInit(); + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() { + return EnumCreatureAttribute.UNDEAD; + } + + /** + * Gets the pitch of living sounds in living entities. + */ + protected float getSoundPitch() { + return super.getSoundPitch() * 0.15F; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() { + int aRand = MathUtils.randInt(0, 10); + if (aRand < 6) { + return null; + } else if (aRand <= 8) { + return "mob.bat.idle"; + } else { + return "mob.blaze.breathe"; + } + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() { + return "mob.blaze.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() { + return "mob.bat.death"; + } + + /** + * Returns true if this entity should push and be pushed by other entities when + * colliding. + */ + public boolean canBePushed() { + return true; + } + + protected void collideWithEntity(Entity aEntity) { + if (aEntity != null) { + if (aEntity instanceof EntityPlayer) { + EntityUtils.doDamage(aEntity, DamageSource.magic, (int) (((EntityPlayer) aEntity).getHealth() / 20)); + } + } + } + + protected void collideWithNearbyEntities() { + } + + protected void applyEntityAttributes() { + + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed); + this.getAttributeMap().registerAttribute(SharedMonsterAttributes.followRange); + + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250.0D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(120.0D); + } + + public boolean getIsBatHanging() { + return false; + } + + public void setIsBatHanging(boolean p_82236_1_) { + generateParticles(this); + generateParticles(this); + generateParticles(this); + for (int i = 0; i < 32; ++i) { + // + String particleName = "lava"; + if (MathUtils.randInt(0, 3) <= 2) { + particleName = "crit"; + } + this.worldObj.spawnParticle(particleName, + this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width, + this.posY + this.rand.nextDouble() * (double) this.height, + this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D); + } + + } + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() { + return true; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() { + super.onUpdate(); + generateParticles(this); + + if (!this.worldObj.isRemote && (this.targetedEntity == null || this.aggroCooldown-- <= 0)) { + this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D); + + if (this.targetedEntity != null) { + this.aggroCooldown = 30; + if (aiAttack.hasValidTarget()) { + this.setAttackTarget(aiAttack.getTarget()); + } + else { + Logger.INFO("No valid target."); + if (ReflectionUtils.doesFieldExist(aiAttack.getClass(), "mEntityTarget")) { + Logger.INFO("Found field."); + } + else { + Logger.INFO("Did not find field."); + } + Field target = ReflectionUtils.getField(EntityAIBatKingAttack.class, "mEntityTarget"); + if (target != null) { + ReflectionUtils.setField(aiAttack, target, this.targetedEntity); + Logger.INFO("Set target."); + } + else { + Logger.INFO("Could not set via reflection."); + } + + + } + } + else { + Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this, 32, 20); + if (vec3 != null) { + double xPosition = vec3.xCoord; + double yPosition = vec3.yCoord; + double zPosition = vec3.zCoord; + this.getNavigator().tryMoveToXYZ(xPosition, yPosition, zPosition, 3); + } + } + } + + } + + private static void generateParticles(EntityBatKing aKing) { + for (int i = 0; i < 20; ++i) { + // + if (MathUtils.randInt(0, 50) <= 1) { + String particleName = "smoke"; + if (MathUtils.randInt(0, 3) <= 2) { + particleName = "largesmoke"; + } + aKing.worldObj.spawnParticle(particleName, + aKing.posX + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, + aKing.posY + aKing.rand.nextDouble() * (double) aKing.height, + aKing.posZ + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, 0.0D, 0.0D, 0.0D); + } + if (MathUtils.randInt(0, 100) <= 1) { + String particleName = "smoke"; + int test2 = MathUtils.randInt(0, 3); + if (test2 == 2) { + particleName = "dripLava"; + } else if (test2 == 3) { + particleName = "portal"; + } + aKing.worldObj.spawnParticle(particleName, + aKing.posX + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, + aKing.posY + aKing.rand.nextDouble() * (double) aKing.height, + aKing.posZ + (aKing.rand.nextDouble() - 0.5D) * (double) aKing.width, 0.0D, 0.0D, 0.0D); + } + } + } + + protected void updateAITasks() { + super.updateAITasks(); + } + + private boolean isFlying() { + if (this.onGround) { + return false; + } + return true; + } + + private boolean hasAir() { + BlockPos p = EntityUtils.findBlockPosUnderEntity(this); + int y = p.yPos; + int yOriginal = p.yPos; + + for (int u = 0; u<5;u++) { + if (u > 50 || y <= 0) { + break; + } + if (!this.worldObj.isAirBlock(p.xPos, y, p.zPos)) { + break; + } + y--; + } + if (yOriginal != y) { + for (int i = 0; i < y; y++) { + this.jump(); + } + return true; + } + return false; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk + * on. used for spiders and wolves to prevent them from trampling crops + */ + protected boolean canTriggerWalking() { + return false; + } + + /** + * Return whether this entity should NOT trigger a pressure plate or a tripwire. + */ + public boolean doesEntityNotTriggerPressurePlate() { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) { + if (this.isEntityInvulnerable()) { + return false; + } else { + if (!this.worldObj.isRemote && this.getIsBatHanging()) { + this.setIsBatHanging(false); + } + + return super.attackEntityFrom(p_70097_1_, p_70097_2_); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound p_70037_1_) { + super.readEntityFromNBT(p_70037_1_); + if (p_70037_1_.hasKey("ExplosionPower", 99)) { + this.explosionStrength = p_70037_1_.getInteger("ExplosionPower"); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound p_70014_1_) { + super.writeEntityToNBT(p_70014_1_); + p_70014_1_.setInteger("ExplosionPower", this.explosionStrength); + } + + /** + * Attack the specified entity using a ranged attack. + */ + @Override + public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_) { + Logger.INFO("Trying to do ranged attack 1 |"+(this.targetedEntity != null)+"|"); + + if (!this.isFlying() || !this.isAirBorne) { + //this.hasAir(); + /* + * for (int i=0;i<3;i++) { this.jump(); } + */ + } + + + double d4 = 64.0D; + if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4 * 8) { + Logger.INFO("Trying to do ranged attack 2"); + double d5 = this.targetedEntity.posX - this.posX; + double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) + - (this.posY + (double) (this.height / 2.0F)); + double d7 = this.targetedEntity.posZ - this.posZ; + this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI; + + ++this.attackCounter; + + if (this.canEntityBeSeen(this.targetedEntity)) { + Logger.INFO("Trying to do ranged attack 3a | "+attackCounter); + + + if (this.attackCounter >= 2) { + Logger.INFO("Trying to do ranged attack 3a1"); + + this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1008, (int) this.posX, (int) this.posY, + (int) this.posZ, 0); + setIsBatHanging(true); + + EntityThrowableBomb entitylargefireball = new EntityThrowableBomb(this.worldObj, this/*d5, d6, d7*/); + //entitylargefireball.field_92057_e = this.explosionStrength; + //entitylargefireball.accelerationX *= 2; + //entitylargefireball.accelerationY *= 2; + //entitylargefireball.accelerationZ *= 2; + double d8 = 4.0D; + Vec3 vec3 = this.getLook(1.0F); + entitylargefireball.posX = this.posX + vec3.xCoord * d8; + entitylargefireball.posY = this.posY + (double) (this.height / 2.0F) + 0.5D; + entitylargefireball.posZ = this.posZ + vec3.zCoord * d8; + this.worldObj.spawnEntityInWorld(entitylargefireball); + + for (int u=0; u<MathUtils.randInt(2, 10);u++) { + if (this.attackCounter > 0) { + Logger.INFO("Trying to do ranged attack 5a"); + --this.attackCounter; + EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, MathUtils.randFloat(1f, 3f), + (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); + int i = MathUtils.randInt(0, 4); + int j = MathUtils.randInt(0, 3); + int k = MathUtils.randInt(0, 3); + entityarrow.setDamage((double) (p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() * 0.11F)); + + boolean boostAttack = MathUtils.randInt(0, 100) <= 21; + if (boostAttack) { + if (i > 0) { + entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); + } + + if (j > 0) { + entityarrow.setKnockbackStrength(j); + } + if (k > 0) { + entityarrow.setFire(50 * k); + } + } + + this.playSound("mob.skeleton.say", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(entityarrow); + Logger.INFO("Trying to do ranged attack 5a done"); + } + } + + + + + this.attackCounter = 0; + } + } else if (this.attackCounter > 0) { + Logger.INFO("Trying to do ranged attack 3b"); + --this.attackCounter; + } + } else { + Logger.INFO("Trying to do ranged attack 4a"); + this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F + / (float) Math.PI; + + if (this.attackCounter > 0) { + Logger.INFO("Trying to do ranged attack 5a"); + --this.attackCounter; + EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, 1.6F, + (float) (14 - this.worldObj.difficultySetting.getDifficultyId() * 4)); + int i = MathUtils.randInt(0, 4); + int j = MathUtils.randInt(0, 3); + int k = MathUtils.randInt(0, 3); + entityarrow.setDamage((double) (p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + + (double) ((float) this.worldObj.difficultySetting.getDifficultyId() * 0.11F)); + + boolean boostAttack = MathUtils.randInt(0, 100) <= 21; + if (boostAttack) { + if (i > 0) { + entityarrow.setDamage(entityarrow.getDamage() + (double) i * 0.5D + 0.5D); + } + + if (j > 0) { + entityarrow.setKnockbackStrength(j); + } + if (k > 0) { + entityarrow.setFire(50 * k); + } + } + + this.playSound("mob.skeleton.say", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(entityarrow); + Logger.INFO("Trying to do ranged attack 5a done"); + } + + } + + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() { + return 10.0F; + } + + /** + * Checks if the entity's current position is a valid location to spawn this + * entity. + */ + public boolean getCanSpawnHere() { + return super.getCanSpawnHere() && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL; + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + public int getMaxSpawnedInChunk() { + return 1; + } + + protected Item getDropItem() { + return Items.gunpowder; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has + * recently been hit by a player. @param par2 - Level of Looting used to kill + * this mob. + */ + protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) { + int j = this.rand.nextInt(2) + this.rand.nextInt(1 + p_70628_2_); + int k; + + for (k = 0; k < j; ++k) { + this.dropItem(Items.ghast_tear, 1); + } + + j = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_); + + for (k = 0; k < j; ++k) { + this.dropItem(Items.gunpowder, 1); + } + } + + @Override + protected void updateEntityActionState() { + if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL) { + this.setDead(); + } + + this.despawnEntity(); + this.prevAttackCounter = this.attackCounter; + double d0 = this.waypointX - this.posX; + double d1 = this.waypointY - this.posY; + double d2 = this.waypointZ - this.posZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + + if (d3 < 1.0D || d3 > 3600.0D) { + this.waypointX = this.posX + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + this.waypointY = this.posY + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + this.waypointZ = this.posZ + (double) ((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + } + + if (this.courseChangeCooldown-- <= 0) { + this.courseChangeCooldown += this.rand.nextInt(5) + 2; + d3 = (double) MathHelper.sqrt_double(d3); + + if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, d3)) { + this.motionX += d0 / d3 * 0.1D; + this.motionY += d1 / d3 * 0.1D; + this.motionZ += d2 / d3 * 0.1D; + } else { + this.waypointX = this.posX; + this.waypointY = this.posY; + this.waypointZ = this.posZ; + } + } + + if (this.targetedEntity != null && this.targetedEntity.isDead) { + this.targetedEntity = null; + } + + if (this.targetedEntity == null || this.aggroCooldown-- <= 0) { + this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D); + + if (this.targetedEntity != null) { + this.aggroCooldown = 20; + } + } + + double d4 = 64.0D; + + if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < d4 * d4) { + double d5 = this.targetedEntity.posX - this.posX; + double d6 = this.targetedEntity.boundingBox.minY + (double) (this.targetedEntity.height / 2.0F) + - (this.posY + (double) (this.height / 2.0F)); + double d7 = this.targetedEntity.posZ - this.posZ; + this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(d5, d7)) * 180.0F / (float) Math.PI; + + if (this.canEntityBeSeen(this.targetedEntity)) { + if (this.attackCounter == 10) { + this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1007, (int) this.posX, (int) this.posY, + (int) this.posZ, 0); + } + + ++this.attackCounter; + + if (this.attackCounter == 20) { + this.worldObj.playAuxSFXAtEntity((EntityPlayer) null, 1008, (int) this.posX, (int) this.posY, + (int) this.posZ, 0); + EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.worldObj, this, d5, d6, d7); + entitylargefireball.field_92057_e = this.explosionStrength; + double d8 = 4.0D; + Vec3 vec3 = this.getLook(1.0F); + entitylargefireball.posX = this.posX + vec3.xCoord * d8; + entitylargefireball.posY = this.posY + (double) (this.height / 2.0F) + 0.5D; + entitylargefireball.posZ = this.posZ + vec3.zCoord * d8; + this.worldObj.spawnEntityInWorld(entitylargefireball); + this.attackCounter = -40; + } + } else if (this.attackCounter > 0) { + --this.attackCounter; + } + } else { + this.renderYawOffset = this.rotationYaw = -((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F + / (float) Math.PI; + + if (this.attackCounter > 0) { + --this.attackCounter; + } + } + + if (!this.worldObj.isRemote) { + byte b1 = this.dataWatcher.getWatchableObjectByte(16); + byte b0 = (byte) (this.attackCounter > 10 ? 1 : 0); + + if (b1 != b0) { + this.dataWatcher.updateObject(16, Byte.valueOf(b0)); + } + } + } + + /** + * True if the ghast has an unobstructed line of travel to the waypoint. + */ + private boolean isCourseTraversable(double p_70790_1_, double p_70790_3_, double p_70790_5_, double p_70790_7_) { + double d4 = (this.waypointX - this.posX) / p_70790_7_; + double d5 = (this.waypointY - this.posY) / p_70790_7_; + double d6 = (this.waypointZ - this.posZ) / p_70790_7_; + AxisAlignedBB axisalignedbb = this.boundingBox.copy(); + + for (int i = 1; (double) i < p_70790_7_; ++i) { + axisalignedbb.offset(d4, d5, d6); + + /* + * if (!this.worldObj.getCollidingBoundingBoxes(this, axisalignedbb).isEmpty()) + * { return false; } + */ + } + + return true; + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float p_70069_1_) { + } + + /** + * Takes in the distance the entity has fallen this tick and whether its on the + * ground to update the fall distance and deal fall damage if landing on the + * ground. Args: distanceFallenThisTick, onGround + */ + protected void updateFallState(double p_70064_1_, boolean p_70064_3_) { + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_) { + if (this.isInWater()) { + this.moveFlying(p_70612_1_, p_70612_2_, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.800000011920929D; + this.motionY *= 0.800000011920929D; + this.motionZ *= 0.800000011920929D; + } else if (this.handleLavaMovement()) { + this.moveFlying(p_70612_1_, p_70612_2_, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } else { + float f2 = 0.91F; + + if (this.onGround) { + f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; + } + + float f3 = 0.16277136F / (f2 * f2 * f2); + this.moveFlying(p_70612_1_, p_70612_2_, this.onGround ? 0.1F * f3 : 0.02F); + f2 = 0.91F; + + if (this.onGround) { + f2 = this.worldObj.getBlock(MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.boundingBox.minY) - 1, + MathHelper.floor_double(this.posZ)).slipperiness * 0.91F; + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double) f2; + this.motionY *= (double) f2; + this.motionZ *= (double) f2; + } + + this.prevLimbSwingAmount = this.limbSwingAmount; + double d1 = this.posX - this.prevPosX; + double d0 = this.posZ - this.prevPosZ; + float f4 = MathHelper.sqrt_double(d1 * d1 + d0 * d0) * 4.0F; + + if (f4 > 1.0F) { + f4 = 1.0F; + } + + this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + } + + /** + * returns true if this entity is by a ladder, false otherwise + */ + public boolean isOnLadder() { + return false; + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/fluids/FactoryFluid.java b/src/Java/gtPlusPlus/core/fluids/FactoryFluid.java index 3359f18f7d..e3383aee91 100644 --- a/src/Java/gtPlusPlus/core/fluids/FactoryFluid.java +++ b/src/Java/gtPlusPlus/core/fluids/FactoryFluid.java @@ -43,7 +43,7 @@ public class FactoryFluid extends Fluid implements Runnable { @Override public void run() { - this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + this.mTextureName)); + this.setIcons(GregTech_API.sBlockIcons.registerIcon(this.mTextureName)); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java new file mode 100644 index 0000000000..881c6c82a1 --- /dev/null +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_PestKiller.java @@ -0,0 +1,159 @@ +package gtPlusPlus.core.gui.machine; + +import java.awt.Color; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.container.Container_PestKiller; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.MISC_MATERIALS; +import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidTank; +import net.minecraftforge.fluids.IFluidTank; + +@SideOnly(Side.CLIENT) +public class GUI_PestKiller extends GuiContainer { + + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/PestKiller.png"); + private final TileEntityPestKiller mTileKiller; + + public GUI_PestKiller(final InventoryPlayer player_inventory, final TileEntityPestKiller te) { + super(new Container_PestKiller(player_inventory, te)); + mTileKiller = te; + } + + @Override + protected void drawGuiContainerForegroundLayer(final int i, final int j) { + if (mTileKiller != null) { + this.fontRendererObj.drawString(I18n.format(mTileKiller.getInventoryName(), new Object[0]), 4, 6, 4210752); + drawFluidTank(mTileKiller.getTank(), 134, 35); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j) { + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(craftingTableGuiTextures); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } + + // This method is called when the Gui is first called! + @Override + public void initGui() { + super.initGui(); + } + + private void drawFluidTank(IFluidTank tank, int x, int y) { + Color startGrad = new Color(50, 50, 50); + Color endGrad = new Color(20, 20, 20); + Container_PestKiller aCont = (Container_PestKiller) this.inventorySlots; + + double aPercentage = 0; + double aDivisor = (100/16); + int aFrameHeight = 16; + + boolean didRender = false; + if (aCont != null) { + TileEntityPestKiller aTile = mTileKiller; + if (aTile != null) { + FluidTank aTank = aTile.getTank(); + int aTier = aTile.getTier(); + drawGradientRect(x, y, x+16, y+16, startGrad.getRGB(), endGrad.getRGB()); + if (aTier <= 0 || aTier > 2) { + if (aTank != null && aTank.getFluidAmount() > 0) { + aPercentage = MathUtils.findPercentage(aTank.getFluidAmount(), aTank.getCapacity()); + //Logger.INFO("Percent = "+aPercentage); + aFrameHeight = (int) (aPercentage / aDivisor); + //Logger.INFO("Frame Height = "+aFrameHeight); + } + this.fontRendererObj.drawString("Tier: 0", 4, 18, 4210752); + this.fontRendererObj.drawString("Range: 1x1", 4, 30, 4210752); + this.fontRendererObj.drawString("Poison: None", 4, 42, 4210752); + this.fontRendererObj.drawString("Amount: 0", 4, 64, 4210752); + didRender = true; + } + else if (aTier == 1) { + if (aTank != null && aTank.getFluidAmount() > 0) { + aPercentage = MathUtils.findPercentage(aTank.getFluidAmount(), aTank.getCapacity()); + //Logger.INFO("Percent = "+aPercentage); + aFrameHeight = (int) (aPercentage / aDivisor); + //Logger.INFO("Frame Height = "+aFrameHeight); + } + startGrad = new Color(240, 50, 240); + endGrad = new Color(130, 30, 130); + drawGradientRect(x, y+(16-aFrameHeight), x+16, y+16, startGrad.getRGB(), endGrad.getRGB()); + this.fontRendererObj.drawString("Tier: 1", 4, 18, 4210752); + this.fontRendererObj.drawString("Range: 5x5", 4, 30, 4210752); + this.fontRendererObj.drawString("Poison: ", 4, 42, 4210752); + this.fontRendererObj.drawString(""+aTile.getTank().getFluid().getLocalizedName(), 4, 54, 4210752); + this.fontRendererObj.drawString("Amount: "+aTile.getTank().getFluidAmount(), 4, 64, 4210752); + didRender = true; + } + else if (aTier == 2) { + if (aTank != null && aTank.getFluidAmount() > 0) { + aPercentage = MathUtils.findPercentage(aTank.getFluidAmount(), aTank.getCapacity()); + //Logger.INFO("Percent = "+aPercentage); + aFrameHeight = (int) (aPercentage / aDivisor); + //Logger.INFO("Frame Height = "+aFrameHeight); + } + short[] aRGB = MISC_MATERIALS.HYDROGEN_CYANIDE.getRGB(); + startGrad = new Color(aRGB[0], aRGB[1], aRGB[2]); + endGrad = new Color(Math.max(aRGB[0], 0), Math.max(aRGB[1], 0), Math.max(aRGB[2], 0)); + drawGradientRect(x, y+(16-aFrameHeight), x+16, y+16, startGrad.getRGB(), endGrad.getRGB()); + this.fontRendererObj.drawString("Tier: 2", 4, 18, 4210752); + this.fontRendererObj.drawString("Range: 9x9", 4, 30, 4210752); + this.fontRendererObj.drawString("Poison: ", 4, 42, 4210752); + this.fontRendererObj.drawString(""+aTile.getTank().getFluid().getLocalizedName(), 4, 54, 4210752); + this.fontRendererObj.drawString("Amount: "+aTile.getTank().getFluidAmount(), 4, 64, 4210752); + didRender = true; + } + } + } + if (!didRender) { + startGrad = new Color(255, 30, 120); + endGrad = new Color(255, 0, 50); + drawGradientRect(x, y, x+16, y+16, startGrad.getRGB(), endGrad.getRGB()); + this.fontRendererObj.drawString("Tier: 0", 4, 18, 4210752); + } + + + + + + + /* + * FluidStack fluid = tank.getFluid(); TextureManager manager = + * mc.getTextureManager(); if (fluid != null) { + * manager.bindTexture(manager.getResourceLocation(0)); float amount = + * fluid.amount; float capacity = tank.getCapacity(); float scale = amount / + * capacity; int fluidTankHeight = 60; int fluidAmount = (int) (scale * + * fluidTankHeight); drawFluid(x, y + fluidTankHeight - fluidAmount, + * fluid.getFluid().getIcon(fluid), 16, fluidAmount); } + */ + } + + private void drawFluid(int x, int y, IIcon icon, int width, int height) { + int i = 0; + int j = 0; + int drawHeight = 0; + int drawWidth = 0; + for (i = 0; i < width; i += 16) { + for (j = 0; j < height; j += 16) { + drawWidth = Math.min(width - i, 16); + drawHeight = Math.min(height - j, 16); + drawTexturedModelRectFromIcon(x + i, y + j, icon, drawWidth, drawHeight); + } + } + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java new file mode 100644 index 0000000000..edb53e8ec0 --- /dev/null +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_RoundRobinator.java @@ -0,0 +1,120 @@ +package gtPlusPlus.core.gui.machine; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.container.Container_RoundRobinator; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +@SideOnly(Side.CLIENT) +public class GUI_RoundRobinator extends GuiContainer { + + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/RoundRobinator.png"); + private TileEntityRoundRobinator mTile; + private Container_RoundRobinator mContainer; + private static final Method mDrawItemStack; + + static { + mDrawItemStack = ReflectionUtils.getMethod(GuiContainer.class, "drawItemStack", new Class[] {ItemStack.class, int.class, int.class, String.class}); + } + + public GUI_RoundRobinator(final InventoryPlayer player_inventory, final TileEntityRoundRobinator te){ + this(new Container_RoundRobinator(player_inventory, te)); + mTile = te; + } + + private GUI_RoundRobinator(final Container_RoundRobinator aContainer){ + super(aContainer); + mContainer = aContainer; + } + + @Override + protected void drawGuiContainerForegroundLayer(final int i, final int j){ + super.drawGuiContainerForegroundLayer(i, j); + + int xStart = 134; + int yStart = 31; + mTile = this.mContainer.tile_entity; + + int tier = mContainer.mTier; + int aTickRate = mContainer.mTickRate; + + fontRendererObj.drawString("Round Robinator", 85, 4, Utils.rgbtoHexValue(50, 150, 50)); + fontRendererObj.drawString("Tier: "+tier, 85, 12, Utils.rgbtoHexValue(50, 150, 50)); + fontRendererObj.drawString("Rate: 1 Item/"+aTickRate+"t", 85, 20, Utils.rgbtoHexValue(50, 150, 50)); + + boolean[] aStates = new boolean[] {mContainer.mSide_1 == 0 ? false : true, mContainer.mSide_2 == 0 ? false : true, mContainer.mSide_3 == 0 ? false : true,mContainer.mSide_4 == 0 ? false : true}; + + fontRendererObj.drawString("West: "+(aStates[0] ? "Active" : "Disabled"), 5, 5, Utils.rgbtoHexValue(50, 50, 50)); + fontRendererObj.drawString("North: "+(aStates[1] ? "Active" : "Disabled"), 5, 15, Utils.rgbtoHexValue(50, 50, 50)); + fontRendererObj.drawString("South: "+(aStates[2] ? "Active" : "Disabled"), 5, 25, Utils.rgbtoHexValue(50, 50, 50)); + fontRendererObj.drawString("East: "+(aStates[3] ? "Active" : "Disabled"), 5, 35, Utils.rgbtoHexValue(50, 50, 50)); + fontRendererObj.drawString("Toggling South will visually", 5, 65, Utils.rgbtoHexValue(150, 50, 50)); + fontRendererObj.drawString("toggle East, This is a visual bug.", 5, 74, Utils.rgbtoHexValue(150, 50, 50)); + drawStatus(aStates[0], xStart, yStart); + drawStatus(aStates[1], xStart+18, yStart); + drawStatus(aStates[2], xStart, yStart+18); + drawStatus(aStates[3], xStart+18, yStart+18); + + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(craftingTableGuiTextures); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + + + + } + + private static ItemStack aGreenGlass; + private static ItemStack aRedGlass; + + private void drawStatus(boolean aStateActive, int x, int y) { + if (aGreenGlass == null) { + Item pane = ItemUtils.getSimpleStack(Blocks.stained_glass_pane).getItem(); + aGreenGlass = ItemUtils.simpleMetaStack(pane, 5, 1); + } + if (aRedGlass == null) { + Item pane = ItemUtils.getSimpleStack(Blocks.stained_glass_pane).getItem(); + aRedGlass = ItemUtils.simpleMetaStack(pane, 14, 1); + } + if (mDrawItemStack != null) { + try { + if (aStateActive) { + mDrawItemStack.invoke(this, new Object[]{aGreenGlass, x, y, ""}); + } + else { + mDrawItemStack.invoke(this, new Object[]{aRedGlass, x, y, ""}); + } + } + catch (Throwable t) { + t.printStackTrace(); + } + } + } + + //This method is called when the Gui is first called! + @Override + public void initGui(){ + super.initGui(); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/AchievementHandler.java b/src/Java/gtPlusPlus/core/handler/AchievementHandler.java index 9053875058..fa10f4def3 100644 --- a/src/Java/gtPlusPlus/core/handler/AchievementHandler.java +++ b/src/Java/gtPlusPlus/core/handler/AchievementHandler.java @@ -17,6 +17,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; @@ -74,7 +75,9 @@ public class AchievementHandler { this.registerAchievement("semifluid", -14, -10, GregtechItemList.Generator_SemiFluid_HV.get(1), aBaseAchievementName, false); this.registerAchievement("earlywasher", -13, -10, GregtechItemList.SimpleDustWasher_ULV.get(1), aBaseAchievementName, false); this.registerAchievement("advancedsteam", -12, -10, GregtechItemList.Boiler_Advanced_MV.get(1), aBaseAchievementName, false); - this.registerAchievement("pollutionremoval", -11, -10, GregtechItemList.Pollution_Cleaner_IV.get(1), aBaseAchievementName, false); + if (PollutionUtils.isPollutionEnabled()) { + this.registerAchievement("pollutionremoval", -11, -10, GregtechItemList.Pollution_Cleaner_IV.get(1), aBaseAchievementName, false); + } this.registerAchievement("hiampxform", -10, -10, GregtechItemList.Transformer_HA_HV_MV.get(1), aBaseAchievementName, false); diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index fd30457b46..be02e352c7 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -2,7 +2,9 @@ package gtPlusPlus.core.handler; import static gtPlusPlus.core.lib.LoadedMods.Gregtech; -import java.util.*; +import java.util.LinkedList; +import java.util.Queue; +import java.util.Set; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import gregtech.api.enums.GT_Values; @@ -11,22 +13,99 @@ import gtPlusPlus.api.interfaces.RunnableWithInfo; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ItemPackage; -import gtPlusPlus.core.common.compat.*; +import gtPlusPlus.core.common.compat.COMPAT_BigReactors; +import gtPlusPlus.core.common.compat.COMPAT_CompactWindmills; +import gtPlusPlus.core.common.compat.COMPAT_EnderIO; +import gtPlusPlus.core.common.compat.COMPAT_ExtraUtils; +import gtPlusPlus.core.common.compat.COMPAT_HarvestCraft; +import gtPlusPlus.core.common.compat.COMPAT_IC2; +import gtPlusPlus.core.common.compat.COMPAT_MorePlanets; +import gtPlusPlus.core.common.compat.COMPAT_OpenBlocks; +import gtPlusPlus.core.common.compat.COMPAT_PneumaticCraft; +import gtPlusPlus.core.common.compat.COMPAT_RFTools; +import gtPlusPlus.core.common.compat.COMPAT_Railcraft; +import gtPlusPlus.core.common.compat.COMPAT_SimplyJetpacks; +import gtPlusPlus.core.common.compat.COMPAT_Thaumcraft; +import gtPlusPlus.core.common.compat.COMPAT_Witchery; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; -import gtPlusPlus.core.recipe.*; +import gtPlusPlus.core.recipe.RECIPES_Extruder; +import gtPlusPlus.core.recipe.RECIPES_GREGTECH; +import gtPlusPlus.core.recipe.RECIPES_LaserEngraver; +import gtPlusPlus.core.recipe.ShapedRecipeObject; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; -import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaGarbageCollector; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaPollutionCreator; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_FluidCanning; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling; -import gtPlusPlus.xmod.gregtech.registration.gregtech.*; +import gtPlusPlus.xmod.gregtech.registration.gregtech.Gregtech4Content; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechAdvancedBoilers; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechAdvancedMixer; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechAlgaeContent; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechAmazonWarehouse; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechBedrockPlatforms; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechBufferDynamos; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechComponentAssembler; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechCustomHatches; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechCyclotron; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechDehydrator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechEnergyBuffer; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechFactoryGradeReplacementMultis; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechFluidReactor; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechGeneratorsULV; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechGeothermalThermalGenerator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechHiAmpTransformer; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialArcFurnace; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialBlastSmelter; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCentrifuge; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCokeOven; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCuttingFactory; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialElectrolyzer; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialExtruder; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialFishPond; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialFuelRefinery; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialGeneratorArray; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialMacerator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialMassFabricator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialMixer; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialMultiMachine; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialMultiTank; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialPlatePress; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialSifter; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialThermalCentrifuge; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialTreeFarm; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialWashPlant; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialWiremill; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIronBlastFurnace; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechLFTR; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechLargeTurbinesAndHeatExchanger; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMiniRaFusion; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechNaqReactor; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechPollutionDevices; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechPowerBreakers; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechPowerSubStation; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechRTG; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechRocketFuelGenerator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSafeBlock; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSemiFluidgenerators; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSimpleWasher; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSolarGenerators; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSolarTower; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSteamCondenser; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSuperChests; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechTeslaTower; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechThaumcraftDevices; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechThreadedBuffers; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechTieredChunkloaders; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechTieredFluidTanks; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechTreeFarmerTE; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechWirelessChargers; +import gtPlusPlus.xmod.gregtech.registration.gregtech.NewHorizonsAccelerator; import net.minecraft.item.ItemStack; public class COMPAT_HANDLER { @@ -135,6 +214,8 @@ public class COMPAT_HANDLER { GregtechSolarTower.run(); GregtechLargeTurbinesAndHeatExchanger.run(); GregtechPowerBreakers.run(); + GregtechFluidReactor.run(); + GregtechAlgaeContent.run(); //New Horizons Content NewHorizonsAccelerator.run(); @@ -211,6 +292,7 @@ public class COMPAT_HANDLER { for (RunnableWithInfo<Material> r : m) { try { r.run(); + Logger.INFO("[FIND] "+r.getInfoData().getLocalizedName()+" recipes generated."); } catch (Throwable t) { t.printStackTrace(); @@ -220,6 +302,9 @@ public class COMPAT_HANDLER { } RecipeGen_Recycling.executeGenerators(); runQueuedMisc(); + + // Do Fluid Canning Last, because they're not executed on demand, but rather queued. + RecipeGen_FluidCanning.init(); } diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java index 0f689325a3..b7efcf08ea 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -12,6 +12,8 @@ import gtPlusPlus.xmod.galacticraft.HANDLER_GalactiCraft; import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.growthcraft.HANDLER_GC; import gtPlusPlus.xmod.ic2.HANDLER_IC2; +import gtPlusPlus.xmod.railcraft.HANDLER_Railcraft; +import gtPlusPlus.xmod.reliquary.HANDLER_Reliquary; import gtPlusPlus.xmod.sc2.HANDLER_SC2; import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF; @@ -33,6 +35,8 @@ public class COMPAT_IntermodStaging { HANDLER_SC2.preInit(); HANDLER_GalactiCraft.preInit(); HANDLER_CropsPlusPlus.preInit(preinit); + HANDLER_Railcraft.preInit(); + HANDLER_Reliquary.preInit(); } public static void init(FMLInitializationEvent init){ @@ -49,6 +53,8 @@ public class COMPAT_IntermodStaging { HANDLER_SC2.init(); HANDLER_GalactiCraft.init(); HANDLER_CropsPlusPlus.init(init); + HANDLER_Railcraft.init(); + HANDLER_Reliquary.init(); } public static void postInit(FMLPostInitializationEvent postinit){ @@ -65,6 +71,8 @@ public class COMPAT_IntermodStaging { HANDLER_SC2.postInit(); HANDLER_GalactiCraft.postInit(); HANDLER_CropsPlusPlus.postInit(postinit); + HANDLER_Railcraft.postInit(); + HANDLER_Reliquary.postInit(); } public static void onLoadComplete(FMLLoadCompleteEvent event) { diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java index 8448b738a2..e44c9a8f20 100644 --- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java +++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java @@ -2,16 +2,22 @@ package gtPlusPlus.core.handler; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; - import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; -import gtPlusPlus.core.container.*; +import gtPlusPlus.core.container.Container_BackpackBase; +import gtPlusPlus.core.container.Container_CircuitProgrammer; +import gtPlusPlus.core.container.Container_DecayablesChest; +import gtPlusPlus.core.container.Container_FishTrap; +import gtPlusPlus.core.container.Container_Grindle; +import gtPlusPlus.core.container.Container_ModularityTable; +import gtPlusPlus.core.container.Container_PestKiller; +import gtPlusPlus.core.container.Container_ProjectTable; +import gtPlusPlus.core.container.Container_RoundRobinator; +import gtPlusPlus.core.container.Container_SuperJukebox; +import gtPlusPlus.core.container.Container_TradeTable; +import gtPlusPlus.core.container.Container_Workbench; +import gtPlusPlus.core.container.Container_WorkbenchAdvanced; import gtPlusPlus.core.container.box.LunchBoxContainer; import gtPlusPlus.core.container.box.MagicBagContainer; import gtPlusPlus.core.container.box.ToolBoxContainer; @@ -22,20 +28,38 @@ import gtPlusPlus.core.gui.item.GuiBaseGrindle; import gtPlusPlus.core.gui.item.box.LunchBoxGui; import gtPlusPlus.core.gui.item.box.MagicBagGui; import gtPlusPlus.core.gui.item.box.ToolBoxGui; -import gtPlusPlus.core.gui.machine.*; +import gtPlusPlus.core.gui.machine.GUI_CircuitProgrammer; +import gtPlusPlus.core.gui.machine.GUI_DecayablesChest; +import gtPlusPlus.core.gui.machine.GUI_FishTrap; +import gtPlusPlus.core.gui.machine.GUI_ModularityTable; +import gtPlusPlus.core.gui.machine.GUI_PestKiller; +import gtPlusPlus.core.gui.machine.GUI_ProjectTable; +import gtPlusPlus.core.gui.machine.GUI_RoundRobinator; +import gtPlusPlus.core.gui.machine.GUI_SuperJukebox; +import gtPlusPlus.core.gui.machine.GUI_TradeTable; +import gtPlusPlus.core.gui.machine.GUI_Workbench; +import gtPlusPlus.core.gui.machine.GUI_WorkbenchAdvanced; import gtPlusPlus.core.interfaces.IGuiManager; import gtPlusPlus.core.inventories.BaseInventoryBackpack; import gtPlusPlus.core.inventories.BaseInventoryGrindle; import gtPlusPlus.core.inventories.box.LunchBoxInventory; import gtPlusPlus.core.inventories.box.MagicBagInventory; import gtPlusPlus.core.inventories.box.ToolBoxInventory; -import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase; -import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory; import gtPlusPlus.core.tileentities.base.TileEntityBase; import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; -import gtPlusPlus.core.tileentities.machines.*; +import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; +import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; +import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.world.World; public class GuiHandler implements IGuiHandler { @@ -53,6 +77,8 @@ public class GuiHandler implements IGuiHandler { public static final int GUI12 = 11; // Bag for Magic Tools public static final int GUI13 = 12; // Decayables Chest public static final int GUI14 = 13; // Super Jukebox + public static final int GUI15 = 14; // Pest Killer + public static final int GUI16 = 15; // Round-Robinator public static void init() { @@ -97,9 +123,13 @@ public class GuiHandler implements IGuiHandler { return new Container_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te); } else if (ID == GUI13) { return new Container_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te); - }else if (ID == GUI14) { + } else if (ID == GUI14) { return new Container_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te); - } + } else if (ID == GUI15) { + return new Container_PestKiller(player.inventory, (TileEntityPestKiller) te); + } else if (ID == GUI16) { + return new Container_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te); + } } if (ID == GUI9) { @@ -157,7 +187,11 @@ public class GuiHandler implements IGuiHandler { return new GUI_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te); } else if (ID == GUI14) { return new GUI_SuperJukebox(player.inventory, (TileEntitySuperJukebox) te); - } + } else if (ID == GUI15) { + return new GUI_PestKiller(player.inventory, (TileEntityPestKiller) te); + } else if (ID == GUI16) { + return new GUI_RoundRobinator(player.inventory, (TileEntityRoundRobinator) te); + } } if (ID == GUI9) { diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java b/src/Java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java new file mode 100644 index 0000000000..360b0440a2 --- /dev/null +++ b/src/Java/gtPlusPlus/core/handler/Recipes/DecayableRecipe.java @@ -0,0 +1,39 @@ +package gtPlusPlus.core.handler.Recipes; + +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.item.ItemStack; + +public class DecayableRecipe { + + public static final AutoMap<DecayableRecipe> mRecipes = new AutoMap<DecayableRecipe>(); + + + public final int mTime; + public final ItemStack mInput; + public final ItemStack mOutput; + + public DecayableRecipe(int time, ItemStack input, ItemStack output) { + mTime = time; + mInput = input; + mOutput = output; + mRecipes.put(this); + } + + @Override + public boolean equals(Object o) { + if (o instanceof DecayableRecipe) { + DecayableRecipe i = (DecayableRecipe) o; + if (i.mTime == this.mTime && GT_Utility.areStacksEqual(mInput, i.mInput) && GT_Utility.areStacksEqual(mOutput, i.mOutput)) { + return true; + } + } + return false; + } + + public boolean isValid() { + return (mTime > 0 && ItemUtils.checkForInvalidItems(mInput) && ItemUtils.checkForInvalidItems(mOutput)); + } + +} diff --git a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java index b10e67aeaf..8853acd4b7 100644 --- a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java +++ b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java @@ -1,8 +1,8 @@ package gtPlusPlus.core.handler; +import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; +import net.minecraft.client.Minecraft; import net.minecraft.stats.AchievementList; import net.minecraftforge.event.entity.player.AchievementEvent; @@ -12,12 +12,15 @@ public class StopAnnoyingFuckingAchievements { * Stops me getting fireworks every fucking time I open my inventory upon first loading a dev client. * @param event */ - @SubscribeEvent + @SubscribeEvent(priority=EventPriority.HIGHEST) public void FUCK_OFF(AchievementEvent event) { if (event.achievement.equals(AchievementList.openInventory)) { - if (MathUtils.randInt(0, 10) >= 9) - PlayerUtils.messagePlayer(event.entityPlayer, "Bang! Nah, Just joking, there's no fireworks. :)"); event.setCanceled(true); + if (Minecraft.getMinecraft() != null) { + if (Minecraft.getMinecraft().gameSettings != null) { + Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false; + } + } } } diff --git a/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java b/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java index f1587fa82a..b70e58d009 100644 --- a/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/CustomMovementHandler.java @@ -61,7 +61,7 @@ public class CustomMovementHandler { // // Check to see if Enabled - Added 6/17/14 to provide option to disable Sneak Toggle - final boolean isSneaking = SneakManager.Sneaking(); + final boolean isSneaking = SneakManager.get(thisPlayer).Sneaking(); //Utils.LOG_INFO("Can sneak: "+isSneaking); //Utils.LOG_INFO("Can sprint: "+SneakManager.Sprinting()); if (isSneaking) @@ -107,7 +107,7 @@ public class CustomMovementHandler { options.sneak = settings.keyBindSneak.getIsKeyPressed(); } - if(options.sneak || SneakManager.Sneaking()) + if(options.sneak || SneakManager.get(thisPlayer).Sneaking()) { options.moveStrafe = (float)(options.moveStrafe * 0.3D); options.moveForward = (float)(options.moveForward * 0.3D); @@ -121,8 +121,8 @@ public class CustomMovementHandler { final boolean enoughHunger = (thisPlayer.getFoodStats().getFoodLevel() > 6.0F) || thisPlayer.capabilities.isFlying; final boolean canSprint = !options.sneak && !thisPlayer.isRiding() && !thisPlayer.capabilities.isFlying && enoughHunger; - this.isDisabled = !SneakManager.Sprinting(); - this.canDoubleTap = SneakManager.optionDoubleTap; + this.isDisabled = !SneakManager.get(thisPlayer).Sprinting(); + this.canDoubleTap = SneakManager.get(thisPlayer).optionDoubleTap; // Key Pressed if((canSprint || this.isDisabled) && settings.keyBindSprint.getIsKeyPressed() && !this.handledSprintPress) @@ -149,8 +149,8 @@ public class CustomMovementHandler { } - public void UpdateSprint(final boolean newValue, final boolean doubleTapped){ - if (!SneakManager.Sprinting()){ + public void UpdateSprint(final boolean newValue, final boolean doubleTapped, SneakManager aSneak){ + if (!aSneak.Sprinting()){ this.sprint = false; this.sprintDoubleTapped = doubleTapped; } diff --git a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java index e9c8c72934..3e51c6488a 100644 --- a/src/Java/gtPlusPlus/core/handler/events/SneakManager.java +++ b/src/Java/gtPlusPlus/core/handler/events/SneakManager.java @@ -1,47 +1,77 @@ package gtPlusPlus.core.handler.events; -import net.minecraft.client.Minecraft; +import java.util.concurrent.ConcurrentHashMap; import gtPlusPlus.api.objects.Logger; +import net.minecraft.entity.player.EntityPlayer; public class SneakManager { //We make this a singleton for clientside data storage. - public static SneakManager instance = new SneakManager(); - protected static final Minecraft mc = Minecraft.getMinecraft(); - public static boolean canSprint = true; - public static boolean isSneaking = true; - public static boolean optionDoubleTap = true; - public static boolean wasSprintDisabled = false; - private static State Sprinting = State.ON; - private static State Crouching = State.OFF; + public static ConcurrentHashMap<String, SneakManager> mPlayerCache = new ConcurrentHashMap<String, SneakManager>(); + + private static void addPlayer(EntityPlayer aPlayer) { + String aKey = getKey(aPlayer); + if (!mPlayerCache.containsKey(aKey)) { + mPlayerCache.put(aKey, new SneakManager(aPlayer)); + } + } + + public static SneakManager get(EntityPlayer aPlayer) { + + String aKey = getKey(aPlayer); + if (!mPlayerCache.containsKey(aKey)) { + addPlayer(aPlayer); + } + return mPlayerCache.get(aKey); + } + + private static String getKey(EntityPlayer aPlayer) { + return ""+aPlayer.getGameProfile().getId().toString(); + } + + + public SneakManager instance; + public EntityPlayer owner; + public boolean canSprint = true; + public boolean isSneaking = true; + public boolean optionDoubleTap = true; + public boolean wasSprintDisabled = false; + public boolean mIsWearingRing = false; + + private State Sprinting = State.ON; + private State Crouching = State.OFF; + + public SneakManager(EntityPlayer aPlayer) { + owner = aPlayer; + } - public static boolean Sneaking(){ + public boolean Sneaking(){ return Crouching.getState(); } - public static boolean Sprinting(){ + public boolean Sprinting(){ return Sprinting.getState(); } - public static State getSneakingState(){ + public State getSneakingState(){ return Crouching; } - public static State getSprintingDisabledState(){ + public State getSprintingDisabledState(){ return Sprinting; } - public static void toggleSneaking(){ + public void toggleSneaking(){ toggleState(Crouching); } - public static void toggleSprinting(){ + public void toggleSprinting(){ toggleState(Sprinting); } - private static State toggleState(final State state){ + private State toggleState(final State state){ Logger.INFO("State Toggle"); if (state == State.ON) { return State.OFF; @@ -49,22 +79,38 @@ public class SneakManager { return State.ON; } - public static State setCrouchingStateON(){ + private State setCrouchingStateON(){ return Crouching = State.ON; } - public static State setCrouchingStateOFF(){ + private State setCrouchingStateOFF(){ return Crouching = State.OFF; } - public static State setSprintingStateON(){ + private State setSprintingStateON(){ return Sprinting = State.ON; } - public static State setSprintingStateOFF(){ + private State setSprintingStateOFF(){ return Sprinting = State.OFF; } - + + public void putRingOn() { + mIsWearingRing = true; + setSprintingStateOFF(); + setCrouchingStateON(); + } + + public void takeRingOff() { + mIsWearingRing = false; + setSprintingStateON(); + setCrouchingStateOFF(); + } + + public boolean isWearingRing() { + return mIsWearingRing; + } + public static enum State { ON(true), OFF(false); diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java b/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java index 4cdbb72c6e..da45b5a988 100644 --- a/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java +++ b/src/Java/gtPlusPlus/core/inventories/InventoryCircuitProgrammer.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.inventories; -import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.slots.SlotIntegratedCircuit; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -167,7 +167,7 @@ public class InventoryCircuitProgrammer implements IInventory{ */ @Override public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - return (itemstack.getItem() == CI.getNumberedCircuit(0).getItem()); + return SlotIntegratedCircuit.isItemValidForSlot(itemstack); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java b/src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java new file mode 100644 index 0000000000..1c5d98f7d2 --- /dev/null +++ b/src/Java/gtPlusPlus/core/inventories/InventoryPestKiller.java @@ -0,0 +1,176 @@ +package gtPlusPlus.core.inventories; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class InventoryPestKiller implements IInventory{ + + private final String name = "Pest Killer"; + + /** Defining your inventory size this way is handy */ + public static final int INV_SIZE = 3; + + /** Inventory's size must be same as number of slots you add to the Container class */ + private ItemStack[] inventory = new ItemStack[INV_SIZE]; + + public void readFromNBT(final NBTTagCompound nbt){ + final NBTTagList list = nbt.getTagList("Items", 10); + this.inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++){ + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)){ + //Utils.LOG_INFO("Trying to read NBT data from inventory."); + this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } + } + + public void writeToNBT(final NBTTagCompound nbt){ + final NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++){ + final ItemStack stack = this.inventory[i]; + if(stack != null){ + //Utils.LOG_INFO("Trying to write NBT data to inventory."); + final NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + } + + @Override + public int getSizeInventory() + { + return this.inventory.length; + } + + public ItemStack[] getInventory(){ + return this.inventory; + } + + @Override + public ItemStack getStackInSlot(final int slot) + { + return this.inventory[slot]; + } + + @Override + public ItemStack decrStackSize(final int slot, final int amount) + { + ItemStack stack = this.getStackInSlot(slot); + if(stack != null) + { + if(stack.stackSize > amount) + { + stack = stack.splitStack(amount); + // Don't forget this line or your inventory will not be saved! + this.markDirty(); + } + else + { + // this method also calls markDirty, so we don't need to call it again + this.setInventorySlotContents(slot, null); + } + } + return stack; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int slot) + { + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); + return stack; + } + + @Override + public void setInventorySlotContents(final int slot, final ItemStack stack) + { + this.inventory[slot] = stack; + + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) + { + stack.stackSize = this.getInventoryStackLimit(); + } + + // Don't forget this line or your inventory will not be saved! + this.markDirty(); + } + + // 1.7.2+ renamed to getInventoryName + @Override + public String getInventoryName() + { + return this.name; + } + + // 1.7.2+ renamed to hasCustomInventoryName + @Override + public boolean hasCustomInventoryName() + { + return this.name.length() > 0; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + /** + * This is the method that will handle saving the inventory contents, as it is called (or should be called!) + * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also + * let you change things in your inventory without ever opening a Gui, if you want. + */ + // 1.7.2+ renamed to markDirty + @Override + public void markDirty() + { + for (int i = 0; i < this.getSizeInventory(); ++i) + { + final ItemStack temp = this.getStackInSlot(i); + if (temp != null){ + //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); + } + + if ((temp != null) && (temp.stackSize == 0)) { + this.inventory[i] = null; + } + } + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer entityplayer) + { + return true; + } + + // 1.7.2+ renamed to openInventory(EntityPlayer player) + @Override + public void openInventory() {} + + // 1.7.2+ renamed to closeInventory(EntityPlayer player) + @Override + public void closeInventory() {} + + /** + * This method doesn't seem to do what it claims to do, as + * items can still be left-clicked and placed in the inventory + * even when this returns false + */ + @Override + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) + { + // Don't want to be able to store the inventory item within itself + // Bad things will happen, like losing your inventory + // Actually, this needs a custom Slot to work + return true; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java b/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java new file mode 100644 index 0000000000..a47f250c39 --- /dev/null +++ b/src/Java/gtPlusPlus/core/inventories/Inventory_RoundRobinator.java @@ -0,0 +1,172 @@ +package gtPlusPlus.core.inventories; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class Inventory_RoundRobinator implements IInventory{ + + private final String name = "Round Robinator"; + + /** Defining your inventory size this way is handy */ + public static final int INV_SIZE = 4; + + /** Inventory's size must be same as number of slots you add to the Container class */ + private ItemStack[] inventory = new ItemStack[INV_SIZE]; + + public void readFromNBT(final NBTTagCompound nbt){ + final NBTTagList list = nbt.getTagList("Items", 10); + this.inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++){ + final NBTTagCompound data = list.getCompoundTagAt(i); + final int slot = data.getInteger("Slot"); + if((slot >= 0) && (slot < INV_SIZE)){ + //Utils.LOG_INFO("Trying to read NBT data from inventory."); + this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } + } + + public void writeToNBT(final NBTTagCompound nbt){ + final NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++){ + final ItemStack stack = this.inventory[i]; + if(stack != null){ + //Utils.LOG_INFO("Trying to write NBT data to inventory."); + final NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + } + + @Override + public int getSizeInventory() + { + return this.inventory.length; + } + + public ItemStack[] getInventory(){ + return this.inventory; + } + + @Override + public ItemStack getStackInSlot(final int slot) + { + return this.inventory[slot]; + } + + @Override + public ItemStack decrStackSize(final int slot, final int amount) + { + ItemStack stack = this.getStackInSlot(slot); + if(stack != null) + { + if(stack.stackSize > amount) + { + stack = stack.splitStack(amount); + // Don't forget this line or your inventory will not be saved! + this.markDirty(); + } + else + { + // this method also calls markDirty, so we don't need to call it again + this.setInventorySlotContents(slot, null); + } + } + return stack; + } + + @Override + public ItemStack getStackInSlotOnClosing(final int slot) + { + final ItemStack stack = this.getStackInSlot(slot); + this.setInventorySlotContents(slot, null); + return stack; + } + + @Override + public void setInventorySlotContents(final int slot, final ItemStack stack) + { + this.inventory[slot] = stack; + + if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) + { + stack.stackSize = this.getInventoryStackLimit(); + } + + // Don't forget this line or your inventory will not be saved! + this.markDirty(); + } + + // 1.7.2+ renamed to getInventoryName + @Override + public String getInventoryName() + { + return this.name; + } + + // 1.7.2+ renamed to hasCustomInventoryName + @Override + public boolean hasCustomInventoryName() + { + return this.name.length() > 0; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + /** + * This is the method that will handle saving the inventory contents, as it is called (or should be called!) + * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also + * let you change things in your inventory without ever opening a Gui, if you want. + */ + // 1.7.2+ renamed to markDirty + @Override + public void markDirty() + { + for (int i = 0; i < this.getSizeInventory(); ++i) + { + final ItemStack temp = this.getStackInSlot(i); + if (temp != null){ + //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); + } + + if ((temp != null) && (temp.stackSize == 0)) { + this.inventory[i] = null; + } + } + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer entityplayer) + { + return true; + } + + // 1.7.2+ renamed to openInventory(EntityPlayer player) + @Override + public void openInventory() {} + + // 1.7.2+ renamed to closeInventory(EntityPlayer player) + @Override + public void closeInventory() {} + + /** + * This method doesn't seem to do what it claims to do, as + * items can still be left-clicked and placed in the inventory + * even when this returns false + */ + @Override + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { + return true; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index de22821127..8bfcfe2d70 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -288,6 +288,10 @@ public final class ModItems { public static Item itemAirFilter; public static Item itemCoalCoke; + public static Item itemCactusCharcoal; + public static Item itemSugarCharcoal; + public static Item itemCactusCoke; + public static Item itemSugarCoke; public static Item itemCircuitLFTR; @@ -394,11 +398,8 @@ public final class ModItems { //Some Simple forms of materials itemStickyRubber = new Item().setUnlocalizedName("itemStickyRubber").setCreativeTab(tabMachines).setTextureName(CORE.MODID + ":itemStickyRubber"); GameRegistry.registerItem(itemStickyRubber, "itemStickyRubber"); - GT_OreDictUnificator.registerOre("ingotRubber", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemStickyRubber", 1)); - - - itemCoalCoke = new BaseItemBurnable("itemCoalCoke", "Coking Coal", tabMisc, 64, 0, "Used for metallurgy.", "fuelCoke", 3200, 0).setTextureName(CORE.MODID + ":itemCoalCoke"); - + GT_OreDictUnificator.registerOre("ingotRubber", ItemUtils.getItemStackFromFQRN(CORE.MODID+":itemStickyRubber", 1)); + //Register Hydrogen Blobs first, so we can replace old helium blobs. itemHydrogenBlob = new CoreItem("itemHydrogenBlob", "Mysterious Hydrogen Blob", tabMisc).setTextureName(CORE.MODID + ":itemHeliumBlob"); //Register Old Helium Blob, this will be replaced when held by a player. @@ -564,9 +565,9 @@ public final class ModItems { MaterialGenerator.generate(ALLOY.TUNGSTEN_TITANIUM_CARBIDE); //LFTR Fuel components - MaterialGenerator.generate(FLUORIDES.HYDROXIDE); //LFTR fuel component - MaterialGenerator.generate(FLUORIDES.AMMONIA); //LFTR fuel component - MaterialGenerator.generate(FLUORIDES.AMMONIUM); //LFTR fuel component + MaterialGenerator.generate(MISC_MATERIALS.HYDROXIDE); //LFTR fuel component + MaterialGenerator.generate(MISC_MATERIALS.AMMONIA); //LFTR fuel component + MaterialGenerator.generate(MISC_MATERIALS.AMMONIUM); //LFTR fuel component MaterialGenerator.generate(FLUORIDES.AMMONIUM_BIFLUORIDE); //LFTR fuel component MaterialGenerator.generate(FLUORIDES.BERYLLIUM_HYDROXIDE); //LFTR fuel component MaterialGenerator.generate(FLUORIDES.AMMONIUM_TETRAFLUOROBERYLLATE); //LFTR fuel component @@ -1054,10 +1055,10 @@ public final class ModItems { GT_OreDictUnificator.registerOre("platePhasedIron", ItemUtils.getSimpleStack(itemPlatePulsatingIron)); GT_OreDictUnificator.registerOre("blockVibrantAlloy", ItemUtils.getItemStackOfAmountFromOreDict("blockPhasedGold", 1)); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getPlate(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 10000, 16, 4*9); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getIngot(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(144), 10000, 16, 4*9); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getNugget(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(16), 10000, 16, 4); - CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getBlock(1), null, MaterialEIO.REDSTONE_ALLOY.getFluid(1294), 10000, 16, 4*9*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getPlate(1), MaterialEIO.REDSTONE_ALLOY.getFluid(144), 16, 4*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getIngot(1), MaterialEIO.REDSTONE_ALLOY.getFluid(144), 16, 4*9); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getNugget(1), MaterialEIO.REDSTONE_ALLOY.getFluid(16), 16, 4); + CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getBlock(1), MaterialEIO.REDSTONE_ALLOY.getFluid(1294), 16, 4*9*9); } else { diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index 90e831cbb4..9b732e38e1 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -96,7 +96,7 @@ public class BaseItemComponent extends Item{ this.extraData = RGBA; this.setTextureName(CORE.MODID + ":" + "item"+ComponentTypes.CELL.COMPONENT_NAME); GameRegistry.registerItem(this, aFormattedNameForFluids); - GT_OreDictUnificator.registerOre(ComponentTypes.CELL.getOreDictName()+aFormattedNameForFluids, ItemUtils.getSimpleStack(this)); + GT_OreDictUnificator.registerOre(ComponentTypes.CELL.getOreDictName()+Utils.sanitizeStringKeepBrackets(localName), ItemUtils.getSimpleStack(this)); registerComponent(); } @@ -165,13 +165,32 @@ public class BaseItemComponent extends Item{ public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { try { + + + if (this.componentMaterial == null){ + if (this.materialName != null){ + //list.add(Utils.sanitizeStringKeepBrackets(materialName)); + } + } + if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("") && (this.componentMaterial != null)){ if (this.componentMaterial != null){ - if ((!this.componentMaterial.vChemicalFormula.equals("??")) && (!this.componentMaterial.vChemicalFormula.equals("?")) && (this.componentMaterial.getState() != MaterialState.PURE_LIQUID)) { + if (!this.componentMaterial.vChemicalFormula.contains("?") && this.componentMaterial.getState() != MaterialState.PURE_LIQUID) { list.add(Utils.sanitizeStringKeepBrackets(this.componentMaterial.vChemicalFormula)); } + else if (this.componentMaterial.vChemicalFormula.contains("?") && this.componentMaterial.getState() != MaterialState.PURE_LIQUID) { + String temp = componentMaterial.vChemicalFormula; + temp = temp.replace(" ", ""); + temp = temp.replace("-", ""); + temp = temp.replace("_", ""); + temp = temp.replace("!", ""); + temp = temp.replace("@", ""); + temp = temp.replace("#", ""); + temp = temp.replace(" ", ""); + list.add(temp); + } if (this.componentMaterial.isRadioactive){ list.add(CORE.GT_Tooltip_Radioactive); diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index afc4b17354..9022f864cb 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -1,14 +1,10 @@ package gtPlusPlus.core.item.base.dusts; import gtPlusPlus.core.item.base.BaseItemComponent; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; public class BaseItemDust extends BaseItemComponent { - - - private Material dustInfo; private BaseItemComponent[] mSizedDusts = new BaseItemComponent[2]; public BaseItemDust(Material aMat) { @@ -33,127 +29,10 @@ public class BaseItemDust extends BaseItemComponent { } } - private BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, final int colour, final String pileSize, final int tier){ - this(unlocalizedName, materialName, matInfo, colour, pileSize, tier, true); - } - private BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, boolean addRecipes) { super(matInfo, ComponentTypes.DUST); - - try {/* - this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); - - this.setCreativeTab(tabMisc); - this.colour = colour; - this.mTier = tier; - this.materialName = materialName; - this.dustInfo = matInfo; - this.setTextureName(this.getCorrectTexture(pileSize)); - GameRegistry.registerItem(this, unlocalizedName); - - String temp = ""; - Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); - if (this.getUnlocalizedName().contains("item.")){ - temp = this.getUnlocalizedName().replace("item.", ""); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else { - temp = this.getUnlocalizedName(); - } - if (temp.contains("DustTiny")){ - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else if (temp.contains("DustSmall")){ - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - else { - temp = temp.replace("itemD", "d"); - Logger.WARNING("Generating OreDict Name: "+temp); - } - if ((temp != null) && !temp.equals("")){ - GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); - } - if (addRecipes){ - this.addFurnaceRecipe(); - this.addMacerationRecipe(); - } - */} - catch (Throwable t) { - t.printStackTrace(); - } } - private String getCorrectTexture(final String pileSize){ - - if (!CORE.ConfigSwitches.useGregtechTextures || this.dustInfo.getTextureSet() == null){ - if ((pileSize == "dust") || (pileSize == "Dust")){ - this.setTextureName(CORE.MODID + ":" + "dust");} - else{ - this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); - } - } - - - if (pileSize.toLowerCase().contains("small")){ - return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dustSmall"; - } - else if (pileSize.toLowerCase().contains("tiny")){ - return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dustTiny"; - } - return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dust"; - } - - /* @Override - public String getItemStackDisplayName(final ItemStack iStack) { - - String unlocal = super.getItemStackDisplayName(iStack); - if (!unlocal.toLowerCase().contains(".name")) { - return unlocal; - } - else { - return unlocal; - } - - }*/ - - /* @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - try { - if (this.dustInfo != null){ - if (entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.dustInfo.vRadiationLevel, world, entityHolding); - } - } - } - } - catch (Throwable t) { - t.printStackTrace(); - } - }*/ - - /*@SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - - if (stack.getDisplayName().toLowerCase().contains("fluorite")){ - list.add("Mined from Sandstone and Limestone."); - } - if (this.dustInfo != null){ - list.add(this.dustInfo.vChemicalFormula); - } - if (this.dustInfo.vRadiationLevel > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - - - //} - super.addInformation(stack, aPlayer, list, bool); - }*/ - public static class DustState { static final int NORMAL = (1); static final int SMALL = (10); @@ -208,8 +87,7 @@ public class BaseItemDust extends BaseItemComponent { else if (amount == 10) { doesThings[0] = false; doesThings[1] = true; - doesThings[2] = false; - + doesThings[2] = false; } else if (amount == 100) { doesThings[0] = false; diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java index e1c3e179ee..e4fa06c58e 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java @@ -118,7 +118,7 @@ public class BaseItemDustUnique extends Item{ private String getCorrectTexture(final String pileSize){ if (!CORE.ConfigSwitches.useGregtechTextures){ - if ((pileSize == "dust") || (pileSize == "Dust")){ + if ((pileSize.equals("dust")) || (pileSize.equals("Dust"))){ this.setTextureName(CORE.MODID + ":" + "dust");} else{ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java index 51b133241b..251230932c 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java @@ -9,10 +9,10 @@ import net.minecraft.item.ItemStack; import gtPlusPlus.api.interfaces.ITileTooltip; -public class ItemBlockBasicTile extends ItemBlock{ +public class ItemBlockBasicTile extends ItemBlock { private final int mID; - + public ItemBlockBasicTile(final Block block) { super(block); this.mID = ((ITileTooltip) block).getTooltipID(); @@ -21,37 +21,50 @@ public class ItemBlockBasicTile extends ItemBlock{ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.mID == 0){ //Fish trap - list.add("This trap catches fish faster if surrounded by more water blocks"); - list.add("Can also be placed beside upto 4 other fish traps"); - list.add("Requires at least two faces touching water"); - list.add("1/1000 chance to produce triple loot."); - } - else if (this.mID == 1){ //Modularity - list.add("Used to construct modular armour & bauble upgrades.."); - } - else if (this.mID == 2){ //Trade - list.add("Allows for SMP trade-o-mat type trading."); - } - else if (this.mID == 3){ //Project - list.add("Scan any crafting recipe in this to mass fabricate them in the Autocrafter.."); - } - else if (this.mID == 4){ //Circuit Table + if (this.mID == 0) { // Fish trap + list.add("This trap catches fish faster if surrounded by more water blocks"); + list.add("Can also be placed beside upto 4 other fish traps"); + list.add("Requires at least two faces touching water"); + list.add("1/1000 chance to produce triple loot."); + } + else if (this.mID == 1) { // Modularity + list.add("Used to construct modular armour & bauble upgrades.."); + } + else if (this.mID == 2) { // Trade + list.add("Allows for SMP trade-o-mat type trading."); + } + else if (this.mID == 3) { // Project + list.add("Scan any crafting recipe in this to mass fabricate them in the Autocrafter.."); + } + else if (this.mID == 4) { // Circuit Table list.add("Easy Circuit Configuration"); list.add("Change default setting with a Screwdriver"); - list.add("Default is used to select slot for auto-insertion"); + list.add("Default is used to select slot for auto-insertion"); + } + else if (this.mID == 5) { // Decayables Chest + list.add("Chest which holds radioactive materials"); + list.add("Items which decay will tick while inside"); + list.add("Place with right click"); + } + else if (this.mID == 6) { // Butterfly Killer + list.add("Kills Forestry Butterflies, Bats and other pests"); + list.add("Use either Formaldehyde or Hydrogen cyanide"); + list.add("Be weary of your neighbours"); + } + else if (this.mID == 7) { + + } + else if (this.mID == 8){ + } - else if (this.mID == 5){ //Decayables Chest - list.add("Chest which holds radioactive materials"); - list.add("Items which decay will tick while inside"); - list.add("Place with right click"); + else if (this.mID == 9){ + } + else { - list.add("Bad Tooltip ID - "+mID); - + list.add("Bad Tooltip ID - " + mID); } super.addInformation(stack, aPlayer, list, bool); } - } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java deleted file mode 100644 index 9badd384d8..0000000000 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java +++ /dev/null @@ -1,34 +0,0 @@ -package gtPlusPlus.core.item.base.itemblock; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.interfaces.ITileTooltip; - -public class ItemBlockBasicTooltip extends ItemBlock{ - - protected final int mID; - - public ItemBlockBasicTooltip(final Block block) { - super(block); - this.mID = ((ITileTooltip) block).getTooltipID(); - } - - - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - if (this.mID == 0){ //blockDarkWorldPortalFrame - list.add("Assembled in the same shape as the Nether Portal."); - } - else if (this.mID == 1){ //Modularity - list.add("Used to construct modular armour & bauble upgrades.."); - } - } - - -} diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java new file mode 100644 index 0000000000..2d0fd00dd9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java @@ -0,0 +1,110 @@ +package gtPlusPlus.core.item.base.itemblock; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlockWithMetadata; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class ItemBlockRoundRobinator extends ItemBlockWithMetadata +{ + private final Block mBlock; + + public ItemBlockRoundRobinator(final Block aBlock){ + super(aBlock, aBlock); + this.mBlock = aBlock; + } + + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add("Attempts to output items evenly on all four horizontal planes"); + if (stack.getItemDamage() == 0) { + list.add("1 Item per enabled side every 400 ticks"); + } + else if (stack.getItemDamage() == 1) { + list.add("1 Item per enabled side every 100 ticks"); + } + else if (stack.getItemDamage() == 2) { + list.add("1 Item per enabled side every 20 ticks"); + } + else if (stack.getItemDamage() == 3) { + list.add("1 Item per enabled side every 10 ticks"); + } + else if (stack.getItemDamage() == 4) { + list.add("1 Item per enabled side every tick"); + } + list.add("Top and bottom do not pull, so you must push items in"); + list.add("Sides can also be disabled with a screwdriver"); + list.add("Shift+RMB with empty hand to view inventory contents"); + super.addInformation(stack, aPlayer, list, bool); + } + + /** + * Gets an icon index based on an item's damage value + */ + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(final int p_77617_1_) + { + return this.mBlock.getIcon(0, p_77617_1_); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + @Override + public int getMetadata(final int p_77647_1_) + { + return p_77647_1_; + } + + @Override + public String getUnlocalizedName(final ItemStack stack) { + return this.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return 0; + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java index 277114a6ae..c5b7191ddd 100644 --- a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java @@ -128,10 +128,20 @@ public class BaseOreComponent extends Item{ public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { if (this.materialName != null && !this.materialName.equals("")){ if (this.componentMaterial != null){ - if (!this.componentMaterial.vChemicalFormula.equals("??") && !this.componentMaterial.vChemicalFormula.equals("?") && this.componentMaterial.getState() != MaterialState.PURE_LIQUID) { + if (!this.componentMaterial.vChemicalFormula.contains("?") && this.componentMaterial.getState() != MaterialState.PURE_LIQUID) { list.add(Utils.sanitizeStringKeepBrackets(this.componentMaterial.vChemicalFormula)); } - + else if (this.componentMaterial.vChemicalFormula.contains("?") && this.componentMaterial.getState() != MaterialState.PURE_LIQUID) { + String temp = componentMaterial.vChemicalFormula; + temp = temp.replace(" ", ""); + temp = temp.replace("-", ""); + temp = temp.replace("_", ""); + temp = temp.replace("!", ""); + temp = temp.replace("@", ""); + temp = temp.replace("#", ""); + temp = temp.replace(" ", ""); + list.add(temp); + } if (this.componentMaterial.isRadioactive){ list.add(CORE.GT_Tooltip_Radioactive+" | Level: "+this.componentMaterial.vRadiationLevel); } diff --git a/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java index 2e40d86473..70de4603e7 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java @@ -90,7 +90,7 @@ public class BatteryPackBaseBauble extends ElectricBaseBauble { String aString2 = StatCollector.translateToLocal("GTPP.battpack.tooltip.2"); String aString3 = StatCollector.translateToLocal("GTPP.battpack.tooltip.3"); String aString4 = StatCollector.translateToLocal("GTPP.battpack.tooltip.4"); - + String aEU = StatCollector.translateToLocal("GTPP.info.eu"); String aEUT = aEU+"/t"; @@ -128,31 +128,34 @@ public class BatteryPackBaseBauble extends ElectricBaseBauble { @Override // TODO public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayer) { if (!aPlayer.worldObj.isRemote) { - if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) { - // Try Iterate Armour Slots of Player - if (aPlayer instanceof EntityPlayer) { - - // amour - for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.armorInventory) { - if (aInvStack != null) { - if (aInvStack == aBaubleStack) { - continue; - } - if (ChargingHelper.isItemValid(aInvStack)) { - double aTransferRate = 0; - final IElectricItem electricItem = (IElectricItem) aInvStack.getItem(); - if (electricItem != null) { - aTransferRate = electricItem.getTransferLimit(aInvStack); - double aItemCharge = ElectricItem.manager.getCharge(aInvStack); - if (aItemCharge >= 0 && aItemCharge != electricItem.getMaxCharge(aInvStack)) { - if (aItemCharge <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { + + try { + + if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) { + // Try Iterate Armour Slots of Player + if (aPlayer instanceof EntityPlayer) { + + // amour + for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.armorInventory) { + if (aInvStack != null) { + if (aInvStack == aBaubleStack) { + continue; + } + if (ChargingHelper.isItemValid(aInvStack)) { + double aTransferRate = 0; + final IElectricItem electricItem = (IElectricItem) aInvStack.getItem(); + if (electricItem != null) { + aTransferRate = electricItem.getTransferLimit(aInvStack); + double aItemCharge = ElectricItem.manager.getCharge(aInvStack); + if (aItemCharge >= 0 && aItemCharge != electricItem.getMaxCharge(aInvStack)) { + if (aItemCharge <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { if (ElectricItem.manager.getCharge(aBaubleStack) >= aTransferRate) { if (ElectricItem.manager.getCharge(aInvStack) <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { double d = ElectricItem.manager.charge(aInvStack, aTransferRate * 16, mTier, false, true); if (d > 0) { - d = ElectricItem.manager.charge(aInvStack, aTransferRate * 16, mTier, false, false); - ElectricItem.manager.discharge(aBaubleStack, d, mTier, false, true, false); - //Logger.INFO("Charging " + aInvStack.getDisplayName() + " | " + d + " | "+electricItem.getMaxCharge(aInvStack)); + d = ElectricItem.manager.charge(aInvStack, aTransferRate * 16, mTier, false, false); + ElectricItem.manager.discharge(aBaubleStack, d, mTier, false, true, false); + //Logger.INFO("Charging " + aInvStack.getDisplayName() + " | " + d + " | "+electricItem.getMaxCharge(aInvStack)); } } else { @@ -167,29 +170,29 @@ public class BatteryPackBaseBauble extends ElectricBaseBauble { //Logger.INFO("3"); } + } + else { + //Logger.INFO("1"); + } } - else { - //Logger.INFO("1"); - } - } + } + } + if (this.getCharge(aBaubleStack) > 0) { + continue; + } else { + break; } } - if (this.getCharge(aBaubleStack) > 0) { - continue; - } else { - break; - } - } - // Hotbar Slots - int aSlotCounter = 0; - for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.mainInventory) { - if (aSlotCounter > (InventoryPlayer.getHotbarSize() - 1)) { - break; - } - aSlotCounter++; - if (aInvStack != null) { + // Hotbar Slots + int aSlotCounter = 0; + for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.mainInventory) { + if (aSlotCounter > (InventoryPlayer.getHotbarSize() - 1)) { + break; + } + aSlotCounter++; + if (aInvStack != null) { if (aInvStack == aBaubleStack) { continue; } @@ -201,26 +204,26 @@ public class BatteryPackBaseBauble extends ElectricBaseBauble { double aItemCharge = ElectricItem.manager.getCharge(aInvStack); if (aItemCharge >= 0 && aItemCharge != electricItem.getMaxCharge(aInvStack)) { if (aItemCharge <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { - if (ElectricItem.manager.getCharge(aBaubleStack) >= aTransferRate) { - if (ElectricItem.manager.getCharge(aInvStack) <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { - double d = ElectricItem.manager.charge(aInvStack, aTransferRate, mTier, false, true); - if (d > 0) { + if (ElectricItem.manager.getCharge(aBaubleStack) >= aTransferRate) { + if (ElectricItem.manager.getCharge(aInvStack) <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) { + double d = ElectricItem.manager.charge(aInvStack, aTransferRate, mTier, false, true); + if (d > 0) { d = ElectricItem.manager.charge(aInvStack, aTransferRate, mTier, false, false); ElectricItem.manager.discharge(aBaubleStack, d, mTier, false, true, false); //Logger.INFO("Charging " + aInvStack.getDisplayName() + " | " + d + " | "+electricItem.getMaxCharge(aInvStack)); - } - } - else { - //Logger.INFO("5"); } } else { - //Logger.INFO("4"); + //Logger.INFO("5"); } } else { - //Logger.INFO("3"); + //Logger.INFO("4"); } + } + else { + //Logger.INFO("3"); + } } else { @@ -228,16 +231,24 @@ public class BatteryPackBaseBauble extends ElectricBaseBauble { } } } - } - if (this.getCharge(aBaubleStack) > 0) { - continue; - } else { - break; + } + if (this.getCharge(aBaubleStack) > 0) { + continue; + } else { + break; + } } } - } + } } + catch (Throwable t) { + + } } + + + + } @Override diff --git a/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java b/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java index 04467091c0..6a8751b682 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java @@ -11,6 +11,7 @@ import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.DevHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -28,7 +29,7 @@ public class FireProtectionBauble extends BaseBauble { private static Field isImmuneToFire; static { - isImmuneToFire = ReflectionUtils.getField(Entity.class, "isImmuneToFire"); + isImmuneToFire = ReflectionUtils.getField(Entity.class, DevHelper.isObfuscatedEnvironment() ? "func_70045_F" : "isImmuneToFire"); } public static boolean fireImmune(Entity aEntity) { @@ -36,7 +37,11 @@ public class FireProtectionBauble extends BaseBauble { } public static boolean setEntityImmuneToFire(Entity aEntity, boolean aImmune) { - return ReflectionUtils.setField(aEntity, isImmuneToFire, aImmune); + try { + return ReflectionUtils.setField(aEntity, isImmuneToFire, aImmune); + } + catch (Throwable t) {} + return false; } public FireProtectionBauble() { diff --git a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java index 0c2bdaa3ef..0e23e9a845 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java @@ -1,10 +1,12 @@ package gtPlusPlus.core.item.chemistry; +import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.List; -import forestry.plugins.PluginCore; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; +import gtPlusPlus.api.helpers.MaterialHelper; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ItemPackage; @@ -14,6 +16,12 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.plugin.agrichem.BioRecipes; +import gtPlusPlus.plugin.agrichem.item.algae.ItemAgrichemBase; +import gtPlusPlus.plugin.agrichem.item.algae.ItemAlgaeBase; +import gtPlusPlus.plugin.agrichem.item.algae.ItemBioChip; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -40,7 +48,8 @@ public class AgriculturalChem extends ItemPackage { public static Fluid FertileManureSlurry; // Blood public static Fluid CustomBlood; - + // Red Mud + public static Fluid RedMud; /** * Items */ @@ -70,6 +79,64 @@ public class AgriculturalChem extends ItemPackage { // Fertilizer + + public static Item mAlgae; + public static Item mBioCircuit; + public static Item mAgrichemItem1; + + /* + * 0 - Algae Biomass + * 1 - Green Algae Biomass + * 2 - Brown Algae Biomass + * 3 - Golden-Brown Algae Biomass + * 4 - Red Algae Biomass + * 5 - Cellulose Fiber + * 6 - Golden-Brown Cellulose Fiber + * 7 - Red Cellulose Fiber + * 8 - Compost + * 9 - Wood Pellet + * 10 - Wood Brick + * 11 - Cellulose Pulp + * 12 - Raw Bio Resin + * 13 - Catalyst Carrier + * 14 - Green Metal Catalyst + * 15 - Alginic Acid + * 16 - Alumina + * 17 - Aluminium Pellet + * 18 - Sodium Aluminate + * 19 - Sodium Hydroxide // Exists in Newer GT + * 20 - Sodium Carbonate + * 21 - Lithium Chloride + * 22 - Pellet Mold + * 23 - Clean Aluminium Mix + */ + + public static ItemStack mAlgaeBiosmass; + public static ItemStack mGreenAlgaeBiosmass; + public static ItemStack mBrownAlgaeBiosmass; + public static ItemStack mGoldenBrownAlgaeBiosmass; + public static ItemStack mRedAlgaeBiosmass; + public static ItemStack mCelluloseFiber; + public static ItemStack mGoldenBrownCelluloseFiber; + public static ItemStack mRedCelluloseFiber; + public static ItemStack mCompost; + public static ItemStack mWoodPellet; + public static ItemStack mWoodBrick; + public static ItemStack mCellulosePulp; + public static ItemStack mRawBioResin; + public static ItemStack mCatalystCarrier; + public static ItemStack mGreenCatalyst; + public static ItemStack mAlginicAcid; + public static ItemStack mAlumina; + public static ItemStack mAluminiumPellet; + public static ItemStack mSodiumAluminate; + public static ItemStack mSodiumHydroxide; + public static ItemStack mSodiumCarbonate; + public static ItemStack mLithiumChloride; + public static ItemStack mPelletMold; + public static ItemStack mCleanAluminiumMix; + + @Override public void items() { // Nitrogen, Ammonium Nitrate, Phosphates, Calcium, Copper, Carbon @@ -81,7 +148,100 @@ public class AgriculturalChem extends ItemPackage { "Ca5(PO4)3(OH)", Utils.rgbtoHexValue(240, 240, 240))[0]; // Dirt Dust :) - dustDirt = ItemUtils.generateSpecialUseDusts("Dirt", "Dried Earth", Utils.rgbtoHexValue(65, 50, 15))[0]; + dustDirt = ItemUtils.generateSpecialUseDusts("Dirt", "Dried Earth", Utils.rgbtoHexValue(65, 50, 15))[0]; + + mAlgae = new ItemAlgaeBase(); + mAgrichemItem1 = new ItemAgrichemBase(); + mBioCircuit = new ItemBioChip(); + GregtechItemList.Circuit_BioRecipeSelector.set(mBioCircuit); + + + + mAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 0, 1); + mGreenAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 1, 1); + mBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 2, 1); + mGoldenBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 3, 1); + mRedAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 4, 1); + mCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 5, 1); + mGoldenBrownCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 6, 1); + mRedCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 7, 1); + mCompost = ItemUtils.simpleMetaStack(mAgrichemItem1, 8, 1); + mWoodPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 9, 1); + mWoodBrick = ItemUtils.simpleMetaStack(mAgrichemItem1, 10, 1); + mCellulosePulp = ItemUtils.simpleMetaStack(mAgrichemItem1, 11, 1); + mRawBioResin = ItemUtils.simpleMetaStack(mAgrichemItem1, 12, 1); + mCatalystCarrier = ItemUtils.simpleMetaStack(mAgrichemItem1, 13, 1); + mGreenCatalyst = ItemUtils.simpleMetaStack(mAgrichemItem1, 14, 1); + mAlginicAcid = ItemUtils.simpleMetaStack(mAgrichemItem1, 15, 1); + mAlumina = ItemUtils.simpleMetaStack(mAgrichemItem1, 16, 1); + mAluminiumPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 17, 1); + mSodiumAluminate = ItemUtils.simpleMetaStack(mAgrichemItem1, 18, 1); + + /** + * If It exists, don't add a new one. + */ + if (OreDictionary.doesOreNameExist("dustSodiumHydroxide_GT5U") || OreDictionary.doesOreNameExist("dustSodiumHydroxide")) { + List<ItemStack> aTest = OreDictionary.getOres("dustSodiumHydroxide", false); + ItemStack aTestStack; + if (aTest.isEmpty()) { + aTest = OreDictionary.getOres("dustSodiumHydroxide_GT5U", false); + if (aTest.isEmpty()) { + aTestStack = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1); + } + else { + aTestStack = aTest.get(0); + } + } + else { + aTestStack = aTest.get(0); + } + mSodiumHydroxide = aTestStack; + } + else { + mSodiumHydroxide = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1); + } + mSodiumCarbonate = ItemUtils.simpleMetaStack(mAgrichemItem1, 20, 1); + mLithiumChloride = ItemUtils.simpleMetaStack(mAgrichemItem1, 21, 1); + mPelletMold = ItemUtils.simpleMetaStack(mAgrichemItem1, 22, 1); + mCleanAluminiumMix = ItemUtils.simpleMetaStack(mAgrichemItem1, 23, 1); + + ItemUtils.addItemToOreDictionary(mGreenAlgaeBiosmass, "biomassGreenAlgae"); + ItemUtils.addItemToOreDictionary(mBrownAlgaeBiosmass, "biomassBrownAlgae"); + ItemUtils.addItemToOreDictionary(mGoldenBrownAlgaeBiosmass, "biomassGoldenBrownAlgae"); + ItemUtils.addItemToOreDictionary(mRedAlgaeBiosmass, "biomassRedAlgae"); + + ItemUtils.addItemToOreDictionary(mCelluloseFiber, "fiberCellulose"); + ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberCellulose"); + ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberGoldenBrownCellulose"); + ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberCellulose"); + ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberRedCellulose"); + + ItemUtils.addItemToOreDictionary(mWoodPellet, "pelletWood"); + ItemUtils.addItemToOreDictionary(mWoodBrick, "brickWood"); + ItemUtils.addItemToOreDictionary(mCellulosePulp, "pulpCellulose"); + + ItemUtils.addItemToOreDictionary(mCatalystCarrier, "catalystEmpty"); + ItemUtils.addItemToOreDictionary(mGreenCatalyst, "catalystAluminiumSilver"); + ItemUtils.addItemToOreDictionary(mAlginicAcid, "dustAlginicAcid"); + ItemUtils.addItemToOreDictionary(mAlumina, "dustAlumina"); + ItemUtils.addItemToOreDictionary(mAluminiumPellet, "pelletAluminium"); + + ItemUtils.addItemToOreDictionary(mSodiumAluminate, "dustSodiumAluminate"); + ItemUtils.addItemToOreDictionary(mSodiumHydroxide, "dustSodiumHydroxide"); + ItemUtils.addItemToOreDictionary(mSodiumCarbonate, "dustSodiumCarbonate"); + ItemUtils.addItemToOreDictionary(mLithiumChloride, "dustLithiumChloride"); + + //Handle GT NaOH dusts + List<ItemStack> NaOHSmall = OreDictionary.getOres("dustSmallSodiumHydroxide_GT5U", false); + if (!NaOHSmall.isEmpty()) { + ItemUtils.addItemToOreDictionary(NaOHSmall.get(0), "dustSmallSodiumHydroxide"); + } + List<ItemStack> NaOHTiny = OreDictionary.getOres("dustTinySodiumHydroxide_GT5U", false); + if (!NaOHTiny.isEmpty()) { + ItemUtils.addItemToOreDictionary(NaOHTiny.get(0), "dustTinySodiumHydroxide"); + } + + } @Override @@ -101,7 +261,10 @@ public class AgriculturalChem extends ItemPackage { // Sewage FertileManureSlurry = FluidUtils.generateFluidNonMolten("fertile.manure.slurry", "Fertile Manure Slurry", - 45 + 175, new short[] { 65, 50, 15, 100 }, null, null, 0, true); + 45 + 175, new short[] { 65, 50, 15, 100 }, null, null, 0, true); + + RedMud = FluidUtils.generateFluidNoPrefix("mud.red.slurry", "Red Mud Slurry", 32 + 175, new short[] { 180, 35, 25, 100 }, true); + } @@ -155,20 +318,20 @@ public class AgriculturalChem extends ItemPackage { } - private static AutoMap<ItemStack> mMeats = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mFish = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mFruits = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mVege = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mNuts = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mSeeds = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mPeat = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mBones = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mBoneMeal = new AutoMap<ItemStack>(); - - private static AutoMap<ItemStack> mList_Master_Meats = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mList_Master_FruitVege = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mList_Master_Bones = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mList_Master_Seeds = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mMeats = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mFish = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mFruits = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mVege = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mNuts = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mSeeds = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mPeat = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mBones = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mBoneMeal = new AutoMap<ItemStack>(); + + private final static AutoMap<ItemStack> mList_Master_Meats = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mList_Master_FruitVege = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mList_Master_Seeds = new AutoMap<ItemStack>(); + private final static AutoMap<ItemStack> mList_Master_Bones = new AutoMap<ItemStack>(); private static void processAllOreDict() { processOreDict("listAllmeatraw", mMeats); @@ -322,6 +485,10 @@ public class AgriculturalChem extends ItemPackage { } } } + + public static ItemStack aFertForestry; + public static ItemStack aFertIC2; + private static void addMiscRecipes() { @@ -334,19 +501,32 @@ public class AgriculturalChem extends ItemPackage { * Forestry Support */ if (LoadedMods.Forestry) { - - Item aForestryFert = PluginCore.items.fertilizerCompound; - - CORE.RA.addDehydratorRecipe( - new ItemStack[] { CI.getNumberedCircuit(11), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null, - null, new ItemStack[] { ItemUtils.getSimpleStack(aForestryFert, 3), aManureByprod, aManureByprod }, - new int[] { 10000, 2000, 2000 }, 20 * 20, 240); + Field aItemField = ReflectionUtils.getField(ReflectionUtils.getClass("forestry.plugins.PluginCore"), "items"); + try { + Object aItemRegInstance = aItemField != null ? aItemField.get(aItemField) : null; + if (aItemRegInstance != null) { + Field aFertField = ReflectionUtils.getField(aItemRegInstance.getClass(), "fertilizerCompound"); + Object aItemInstance = aFertField.get(aItemRegInstance); + if (aItemInstance instanceof Item) { + aFertForestry = ItemUtils.getSimpleStack((Item) aItemInstance); + Item aForestryFert = (Item) aItemInstance; + CORE.RA.addDehydratorRecipe( + new ItemStack[] { CI.getNumberedCircuit(11), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null, + null, new ItemStack[] { ItemUtils.getSimpleStack(aForestryFert, 3), aManureByprod, aManureByprod }, + new int[] { 10000, 2000, 2000 }, 20 * 20, 240); + } + } + } + catch (IllegalArgumentException | IllegalAccessException e) { + + } } /** * IC2 Support */ if (LoadedMods.IndustrialCraft2) { + aFertIC2 = ItemUtils.getItemStackFromFQRN("IC2:itemFertilizer", 1); CORE.RA.addDehydratorRecipe( new ItemStack[] { CI.getNumberedCircuit(12), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null, null, new ItemStack[] { ItemUtils.getItemStackFromFQRN("IC2:itemFertilizer", 3), aManureByprod, @@ -364,8 +544,8 @@ public class AgriculturalChem extends ItemPackage { GT_Values.RA.addCentrifugeRecipe(CI.getNumberedCircuit(20), ItemUtils.getSimpleStack(aManureByprod, 4), FluidUtils.getFluidStack("sulfuricacid", 250), // In Fluid FluidUtils.getFluidStack("sulfuricapatite", 50), // Out Fluid - Materials.Phosphorus.getDustSmall(2), Materials.Calcium.getDustSmall(2), - Materials.Copper.getDustTiny(1), Materials.Carbon.getDust(1), ItemUtils.getSimpleStack(dustDirt, 1), + MaterialHelper.getDustSmall(Materials.Phosphorus, 2), MaterialHelper.getDustSmall(Materials.Calcium, 2), + MaterialHelper.getDustTiny(Materials.Copper, 1), MaterialHelper.getDust(Materials.Carbon, 1), ItemUtils.getSimpleStack(dustDirt, 1), ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAmmoniumNitrate", 1), new int[] { 2500, 2500, 750, 1000, 5000, 250 }, // Chances 20 * 20, // Time @@ -380,7 +560,6 @@ public class AgriculturalChem extends ItemPackage { @Override public String errorMessage() { - // TODO Auto-generated method stub return "Failed to generate recipes for AgroChem."; } @@ -403,6 +582,9 @@ public class AgriculturalChem extends ItemPackage { addAdvancedOrganiseFertRecipes(); addMiscRecipes(); + + BioRecipes.init(); + return true; } } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java index e060723afd..8428328f37 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java @@ -1,23 +1,18 @@ package gtPlusPlus.core.item.chemistry; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.api.objects.minecraft.ItemPackage; import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.AddGregtechRecipe; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -26,7 +21,6 @@ public class CoalTar extends ItemPackage { public static Fluid Coal_Gas; public static Fluid Coal_Oil; public static Fluid Ethylene; - public static Fluid Benzene; public static Fluid Ethylbenzene; public static Fluid Anthracene; public static Fluid Toluene; @@ -35,10 +29,6 @@ public class CoalTar extends ItemPackage { public static Fluid Sulfuric_Coal_Tar_Oil; public static Fluid Naphthalene; public static Fluid Phthalic_Acid; - public static Fluid Ethylanthraquinone2; - public static Fluid Ethylanthrahydroquinone2; - public static Fluid Hydrogen_Peroxide; - public static Fluid Lithium_Peroxide; private static void recipeEthylBenzineFuelsIntoHeavyFuel() { CORE.RA.addChemicalRecipe( @@ -264,85 +254,8 @@ public class CoalTar extends ItemPackage { } - private static void recipe2Ethylanthraquinone() { - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4), - ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2), - null, - FluidUtils.getFluidStack("fluid.2ethylanthraquinone", 2000+(144*4)), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2), - 20*16); - - } - - private static void recipe2Ethylanthrahydroquinone() { - GT_Values.RA.addChemicalRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("platePalladium", 0), - ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthraquinone", 1), - FluidUtils.getFluidStack("hydrogen", 500), - FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 1200), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1), - 20*40); - - } - - private static void recipeHydrogenPeroxide() { - GT_Values.RA.addElectrolyzerRecipe( - GT_ModHandler.getAirCell(15), - ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthrahydroquinone", 5), - FluidUtils.getFluidStack("fluid.anthracene", 50), - FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 4450), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 2), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 18), - null, - null, - null, - null, - new int[]{10000, 10000}, - 20*90, - 240); - } - - - private static void recipeLithiumHydroperoxide() { - GT_Values.RA.addElectrolyzerRecipe( - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1), - FluidUtils.getFluidStack("fluid.cellhydrogenperoxide", 50), - null, - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 14), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1), - null, - null, - null, - null, - new int[]{10000, 10000}, - 20*60, - 240); - } - - - private static void recipeLithiumPeroxide() { - CORE.RA.addDehydratorRecipe( - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 2), - ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 3) - }, - null, - null, - new ItemStack[]{ - ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumPeroxide", 1), - ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1), - ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2) - }, - new int[]{10000, 10000, 10000}, - 20*100, - 240); - } - @Override public String errorMessage() { - // TODO Auto-generated method stub return "Bad Coal Science!"; } @@ -357,11 +270,6 @@ public class CoalTar extends ItemPackage { recipeCoalTarOilToSulfuricOilToNaphthalene(); recipeNaphthaleneToPhthalicAcid(); recipePhthalicAcidToPhthalicAnhydride(); - recipe2Ethylanthraquinone(); - recipe2Ethylanthrahydroquinone(); - recipeHydrogenPeroxide(); - recipeLithiumHydroperoxide(); - recipeLithiumPeroxide(); recipeEthylBenzineFuelsIntoHeavyFuel(); @@ -390,7 +298,6 @@ public class CoalTar extends ItemPackage { @Override public void blocks() { - // TODO Auto-generated method stub } @@ -407,19 +314,11 @@ public class CoalTar extends ItemPackage { //Create Ethylene - if (!FluidUtils.doesFluidExist("Ethylene")){ - Ethylene = FluidUtils.generateFluidNonMolten("Ethylene", "Ethylene", -103, new short[]{255, 255, 255, 100}, null, null); - } - else { - Ethylene = FluidUtils.getWildcardFluidStack("Ethylene", 1).getFluid(); - } - - //Create Benzene - (Toluene + Hydrogen | 95% Benzene / 5% methane) - if (!FluidUtils.doesFluidExist("NitrousOxide")){ - Benzene = FluidUtils.generateFluidNonMolten("Benzene", "Benzene", 81, new short[]{150, 75, 0, 100}, null, null); + if (!FluidUtils.doesFluidExist("ethylene")){ + Ethylene = FluidUtils.generateFluidNonMolten("ethylene", "Ethylene", -103, new short[]{255, 255, 255, 100}, null, null); } else { - Benzene = FluidUtils.getWildcardFluidStack("Benzene", 1).getFluid(); + Ethylene = FluidUtils.getWildcardFluidStack("ethylene", 1).getFluid(); } //Create Ethylbenzene - Ethylbenzene is produced in on a large scale by combining benzene and ethylene in an acid-catalyzed chemical reaction @@ -428,13 +327,11 @@ public class CoalTar extends ItemPackage { //Create Anthracene Anthracene = FluidUtils.generateFluidNonMolten("Anthracene", "Anthracene", 340, new short[]{255, 255, 255, 100}, null, null); //Toluene - if (!FluidUtils.doesFluidExist("Toluene")){ - Toluene = FluidUtils.generateFluidNonMolten("Toluene", "Toluene", -95, new short[]{140, 70, 20, 100}, null, null); + if (!FluidUtils.doesFluidExist("liquid_toluene")){ + Toluene = FluidUtils.generateFluidNonMolten("liquid_toluene", "Toluene", -95, new short[]{140, 70, 20, 100}, null, null); } else { - Toluene = FluidUtils.getWildcardFluidStack("Toluene", 1).getFluid(); - Item itemCellToluene = new BaseItemComponent("Toluene", "Toluene", new short[]{140, 70, 20, 100}); - MaterialGenerator.addFluidCannerRecipe(ItemUtils.getEmptyCell(), ItemUtils.getSimpleStack(itemCellToluene), FluidUtils.getFluidStack(Toluene, 1000), null); + Toluene = FluidUtils.getWildcardFluidStack("liquid_toluene", 1).getFluid(); } //Create Coal Tar @@ -457,23 +354,6 @@ public class CoalTar extends ItemPackage { - //Create 2-Ethylanthraquinone - //2-Ethylanthraquinone is prepared from the reaction of phthalic anhydride and ethylbenzene - Ethylanthraquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthraquinone", "2-Ethylanthraquinone", 415, new short[]{227, 255, 159, 100}, null, null); - //Create 2-Ethylanthrahydroquinone - //Palladium plate + Hydrogen(250) + 2-Ethylanthraquinone(500) = 600 Ethylanthrahydroquinone - Ethylanthrahydroquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthrahydroquinone", "2-Ethylanthrahydroquinone", 415, new short[]{207, 225, 129, 100}, null, null); - //Create Hydrogen Peroxide - //Compressed Air(1500) + Ethylanthrahydroquinone(500) + Anthracene(5) = 450 Ethylanthraquinone && 200 Peroxide - Hydrogen_Peroxide = FluidUtils.generateFluidNonMolten("HydrogenPeroxide", "Hydrogen Peroxide", 150, new short[]{210, 255, 255, 100}, null, null); - - - - //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O - //ItemUtils.generateSpecialUseDusts("LithiumHydroperoxide", "Lithium Hydroperoxide", "HLiO2", Utils.rgbtoHexValue(125, 125, 125)); - // v - Dehydrate - //Lithium Peroxide - 2 LiOOH → Li2O2 + H2O2 + 2 H2O - Lithium_Peroxide = FluidUtils.generateFluidNonMolten("LithiumPeroxide", "Lithium Peroxide", 446, new short[]{135, 135, 135, 100}, null, null); } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java index c64ad07d2a..35d2066793 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java @@ -1,19 +1,29 @@ package gtPlusPlus.core.item.chemistry; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.TextureSet; +import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.minecraft.ItemPackage; +import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.NONMATERIAL; import gtPlusPlus.core.material.state.MaterialState; +import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.plugin.agrichem.item.algae.ItemAgrichemBase; +import net.minecraft.block.Block; +import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; public class GenericChem extends ItemPackage { @@ -66,12 +76,18 @@ public class GenericChem extends ItemPackage { public Fluid Putrescine; //https://en.wikipedia.org/wiki/Putrescine + public static Fluid Ethylanthraquinone2; + public static Fluid Ethylanthrahydroquinone2; + public static Fluid Hydrogen_Peroxide; + public static Fluid Lithium_Peroxide; + /** * Items */ // Phenol Byproducts public Item PhenolicResins; //https://en.wikipedia.org/wiki/Phenol_formaldehyde_resin + public ItemGenericChemBase mGenericChemItem1; @@ -80,7 +96,46 @@ public class GenericChem extends ItemPackage { PhenolicResins = ItemUtils.generateSpecialUseDusts("phenolicresins", "Phenolic Resin", "HOC6H4CH2OH", Utils.rgbtoHexValue(80, 40, 40))[0]; MaterialGenerator.generate(BAKELITE, false); MaterialGenerator.generate(NYLON, false); - MaterialGenerator.generate(TEFLON, false); + MaterialGenerator.generate(TEFLON, false); + + mGenericChemItem1 = new ItemGenericChemBase(); + + registerItemStacks(); + registerOreDict(); + } + + private ItemStack mCatalystCarrier; + + public ItemStack mRedCatalyst; + public ItemStack mYellowCatalyst; + public ItemStack mBlueCatalyst; + public ItemStack mOrangeCatalyst; + public ItemStack mPurpleCatalyst; + public ItemStack mBrownCatalyst; + + + public void registerItemStacks() { + + mCatalystCarrier = ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 13, 1); + + mRedCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 0, 1); + mYellowCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 1, 1); + mBlueCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 2, 1); + mOrangeCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 3, 1); + mPurpleCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 4, 1); + mBrownCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 5, 1); + + } + + public void registerOreDict() { + + ItemUtils.addItemToOreDictionary(mRedCatalyst, "catalystIronCopper"); + ItemUtils.addItemToOreDictionary(mYellowCatalyst, "catalystTungstenNickel"); + ItemUtils.addItemToOreDictionary(mBlueCatalyst, "catalystCobaltTitanium"); + ItemUtils.addItemToOreDictionary(mOrangeCatalyst, "catalystVanadiumPalladium"); + ItemUtils.addItemToOreDictionary(mPurpleCatalyst, "catalystIridiumRuthenium"); + ItemUtils.addItemToOreDictionary(mBrownCatalyst, "catalystNickelAluminium"); + } @Override @@ -115,18 +170,500 @@ public class GenericChem extends ItemPackage { Cadaverine = FluidUtils.generateFluidNoPrefix("cadaverine", "Cadaverine", 32 + 175, new short[] { 100, 70, 30, 100 }, true); Putrescine = FluidUtils.generateFluidNoPrefix("putrescine", "Putrescine", 32 + 175, new short[] { 100, 70, 30, 100 }, true); + //Create 2-Ethylanthraquinone + //2-Ethylanthraquinone is prepared from the reaction of phthalic anhydride and ethylbenzene + Ethylanthraquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthraquinone", "2-Ethylanthraquinone", 415, new short[]{227, 255, 159, 100}, null, null); + //Create 2-Ethylanthrahydroquinone + //Palladium plate + Hydrogen(250) + 2-Ethylanthraquinone(500) = 600 Ethylanthrahydroquinone + Ethylanthrahydroquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthrahydroquinone", "2-Ethylanthrahydroquinone", 415, new short[]{207, 225, 129, 100}, null, null); + //Create Hydrogen Peroxide + //Compressed Air(1500) + Ethylanthrahydroquinone(500) + Anthracene(5) = 450 Ethylanthraquinone && 200 Peroxide + Hydrogen_Peroxide = FluidUtils.generateFluidNonMolten("HydrogenPeroxide", "Hydrogen Peroxide", 150, new short[]{210, 255, 255, 100}, null, null); + + + + //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O + //ItemUtils.generateSpecialUseDusts("LithiumHydroperoxide", "Lithium Hydroperoxide", "HLiO2", Utils.rgbtoHexValue(125, 125, 125)); + // v - Dehydrate + //Lithium Peroxide - 2 LiOOH → Li2O2 + H2O2 + 2 H2O + Lithium_Peroxide = FluidUtils.generateFluidNonMolten("LithiumPeroxide", "Lithium Peroxide", 446, new short[]{135, 135, 135, 100}, null, null); + + + } @Override public String errorMessage() { - // TODO Auto-generated method stub - return "Failed to generate recipes for AgroChem."; + return "Failed to generate recipes for GenericChem."; } @Override - public boolean generateRecipes() { - + public boolean generateRecipes() { + + recipeCatalystRed(); + recipeCatalystYellow(); + recipeCatalystBlue(); + recipeCatalystOrange(); + recipeCatalystPurple(); + recipeCatalystBrown(); + + recipeNitroBenzene(); + recipeAniline(); + recipeCadaverineAndPutrescine(); + recipeCyclohexane(); + recipeCyclohexanone(); + + recipe2Ethylanthraquinone(); + recipe2Ethylanthrahydroquinone(); + recipeHydrogenPeroxide(); + recipeLithiumHydroperoxide(); + recipeLithiumPeroxide(); return true; } + + private void recipeCyclohexane() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getTierTwoChip(), + ItemUtils.getSimpleStack(mBrownCatalyst, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(Benzene, 2000), + FluidUtils.getFluidStack("hydrogen", 10000) + }, + new ItemStack[] { + ItemUtils.getSimpleStack(mCatalystCarrier, 1) + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Cyclohexane, 1000), + }, + 20 * 120, + 120, + 2); + + } + + private void recipeCyclohexanone() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getTierTwoChip(), + ItemUtils.getSimpleStack(mBlueCatalyst, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(Cyclohexane, 2000), + FluidUtils.getFluidStack("air", 10000) + }, + new ItemStack[] { + ItemUtils.getSimpleStack(mCatalystCarrier, 1) + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Cyclohexanone, 2000), + }, + 20 * 120, + 120, + 2); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getTierTwoChip(), + }, + new FluidStack[] { + FluidUtils.getFluidStack(Phenol, 2000), + FluidUtils.getFluidStack("oxygen", 5000) + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Cyclohexanone, 2000), + }, + 20 * 120, + 120, + 2); + + + + + } + + private void recipeCatalystRed() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getTierOneChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + ELEMENT.getInstance().IRON.getDust(2), + ELEMENT.getInstance().COPPER.getDust(2), + }, + GT_Values.NF, + ItemUtils.getSimpleStack(mRedCatalyst, 10), + 20 * 20, + 30); + + } + + private void recipeCatalystYellow() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getTierThreeChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + ELEMENT.getInstance().TUNGSTEN.getDust(4), + ELEMENT.getInstance().NICKEL.getDust(4), + }, + GT_Values.NF, + ItemUtils.getSimpleStack(mYellowCatalyst, 10), + 60 * 20, + 2000); + + } + + private void recipeCatalystBlue() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getTierTwoChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + ELEMENT.getInstance().COBALT.getDust(3), + ELEMENT.getInstance().TITANIUM.getDust(3), + }, + GT_Values.NF, + ItemUtils.getSimpleStack(mBlueCatalyst, 10), + 40 * 20, + 500); + + } + + private void recipeCatalystOrange() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getTierTwoChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + ELEMENT.getInstance().VANADIUM.getDust(5), + ELEMENT.getInstance().PALLADIUM.getDust(5), + }, + GT_Values.NF, + ItemUtils.getSimpleStack(mOrangeCatalyst, 10), + 40 * 20, + 500); + + } + + private void recipeCatalystPurple() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getTierFourChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + ELEMENT.getInstance().IRIDIUM.getDust(6), + ELEMENT.getInstance().RUTHENIUM.getDust(6), + }, + GT_Values.NF, + ItemUtils.getSimpleStack(mPurpleCatalyst, 10), + 120 * 20, + 8000); + + } + + private void recipeCatalystBrown() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getTierOneChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + ELEMENT.getInstance().NICKEL.getDust(4), + ELEMENT.getInstance().ALUMINIUM.getDust(4), + }, + GT_Values.NF, + ItemUtils.getSimpleStack(mBrownCatalyst, 10), + 15 * 20, + 30); + + } + + private void recipeCadaverineAndPutrescine() { + + // Basic Recipe + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getTierOneChip(), + ItemUtils.getSimpleStack(Items.rotten_flesh, 64) + }, + new FluidStack[] { + FluidUtils.getHotWater(2000) + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Cadaverine, 250), + FluidUtils.getFluidStack(Putrescine, 250), + }, + 20 * 120, + 120, + 1); + + // Advanced Recipe + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getTierTwoChip(), + ItemUtils.getSimpleStack(Items.rotten_flesh, 128), + ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 8, 32) + }, + new FluidStack[] { + FluidUtils.getHotWater(3000) + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Cadaverine, 750), + FluidUtils.getFluidStack(Putrescine, 750), + }, + 20 * 120, + 240, + 2); + + } + + private void recipeAniline() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getTierThreeChip(), + ItemUtils.getSimpleStack(mBlueCatalyst, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(NitroBenzene, 2000), + FluidUtils.getFluidStack("hydrogen", 10000) + }, + new ItemStack[] { + ItemUtils.getSimpleStack(mCatalystCarrier, 1) + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Aniline, 2000), + }, + 20 * 30, + 500, + 3); + + } + + private void recipeNitroBenzene() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getTierThreeChip(), + }, + new FluidStack[] { + FluidUtils.getFluidStack(Benzene, 5000), + FluidUtils.getFluidStack("sulfuricacid", 3000), + FluidUtils.getFluidStack("nitricacid", 3000), + FluidUtils.getDistilledWater(10000) + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack("dilutedsulfuricacid", 3000), + FluidUtils.getFluidStack(NitroBenzene, 5000), + }, + 20 * 30, + 500, + 3); + + } + + private void recipe2Ethylanthraquinone() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + CI.getNumberedCircuit(4), + ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4), + }, + new FluidStack[] { + FluidUtils.getFluidStack(CoalTar.Ethylbenzene, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Ethylanthraquinone2, 2000+(144*4)), + }, + 20 * 15, + 120, + 1); + + /*GT_Values.RA.addChemicalRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4), + ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2), + null, + FluidUtils.getFluidStack("fluid.2ethylanthraquinone", 2000+(144*4)), + ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2), + 20*16);*/ + + } + + private void recipe2Ethylanthrahydroquinone() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + CI.getNumberedCircuit(4), + ItemUtils.getSimpleStack(mOrangeCatalyst, 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(Ethylanthraquinone2, 4000), + FluidUtils.getFluidStack("hydrogen", 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(Ethylanthrahydroquinone2, 5000), + }, + 20 * 40, + 120, + 1); + + /*GT_Values.RA.addChemicalRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("platePalladium", 0), + ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthraquinone", 1), + FluidUtils.getFluidStack("hydrogen", 500), + FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 1200), + ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1), + 20*40);*/ + + } + + private void recipeLithiumPeroxide() { + CORE.RA.addDehydratorRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 2), + ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 3) + }, + null, + null, + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumPeroxide", 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2) + }, + new int[]{10000, 10000, 10000}, + 20*100, + 120); + } + + private void recipeLithiumHydroperoxide() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + CI.getNumberedCircuit(4), + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7), + }, + new FluidStack[] { + FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000), + }, + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 14), + }, + new FluidStack[] { + + }, + 20 * 30, + 240, + 1); + + + + /*CORE.RA.addChemicalRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1), + 20, + FluidUtils.getFluidStack("fluid.cellhydrogenperoxide", 50), + null, + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 14), + CI.emptyCells(1), + 20*30, + 240); */ + } + + private void recipeHydrogenPeroxide() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + CI.getNumberedCircuit(4), + }, + new FluidStack[] { + FluidUtils.getFluidStack("air", 15000), + FluidUtils.getFluidStack(Ethylanthrahydroquinone2, 5000), + FluidUtils.getFluidStack("fluid.anthracene", 50), + }, + new ItemStack[] { + }, + new FluidStack[] { + FluidUtils.getFluidStack(Ethylanthraquinone2, 4000), + FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000), + }, + 20 * 30, + 240, + 1); + + /* CORE.RA.addChemicalRecipe( + GT_ModHandler.getAirCell(15), + ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthrahydroquinone", 5), + 20, + FluidUtils.getFluidStack("fluid.anthracene", 50), + FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 4450), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 2), + CI.emptyCells(18), + 20*30, + 240);*/ + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + private static final ItemStack getTierOneChip() { + return CI.getNumberedBioCircuit(4); + } + private static final ItemStack getTierTwoChip() { + return CI.getNumberedBioCircuit(8); + } + private static final ItemStack getTierThreeChip() { + return CI.getNumberedBioCircuit(12); + } + private static final ItemStack getTierFourChip() { + return CI.getNumberedBioCircuit(16); + } + + + } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/OilChem.java b/src/Java/gtPlusPlus/core/item/chemistry/OilChem.java index cb7e32eaf0..4406995d27 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/OilChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/OilChem.java @@ -1,16 +1,6 @@ package gtPlusPlus.core.item.chemistry; -import java.util.ArrayList; - -import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ItemPackage; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.oredict.OreDictionary; public class OilChem extends ItemPackage { @@ -18,54 +8,16 @@ public class OilChem extends ItemPackage { * Fluids */ - // Poop Juice - public static Fluid PoopJuice; - // Manure Slurry - public static Fluid ManureSlurry; - // Fertile Manure Slurry - public static Fluid FertileManureSlurry; /** * Items */ - // Manure Byproducts - public static Item dustManureByproducts; - // Organic Fertilizer - public static Item dustOrganicFertilizer; - // Dirt - public static Item dustDirt; - - // Poop Juice - // vv - Centrifuge - // Manure Slurry && Manure Byproducts -> (Elements) Centrifuge to several tiny - // piles - // vv - Chem Reactor - Add Peat, Meat - // Organic Fertilizer - // vv - Dehydrate - // Fertilizer - - // Poop Juice - // vv - Mixer - Add Blood, Bone, Meat (1000L Poo, 200L Blood, x2 Bone, x3 Meat) - // Fertile Manure Slurry - // vv - Chem Reactor - Add Peat x1.5 - // Organic Fertilizer x3 - // vv - Dehydrate - // Fertilizer @Override public void items() { - // Nitrogen, Ammonium Nitrate, Phosphates, Calcium, Copper, Carbon - dustManureByproducts = ItemUtils.generateSpecialUseDusts("ManureByproducts", "Manure Byproduct", - "(N2H4O3)N2P2Ca3CuC8", Utils.rgbtoHexValue(110, 75, 25))[0]; - - // Basically Guano - dustOrganicFertilizer = ItemUtils.generateSpecialUseDusts("OrganicFertilizer", "Organic Fertilizer", - "Ca5(PO4)3(OH)", Utils.rgbtoHexValue(240, 240, 240))[0]; - - // Dirt Dust :) - dustDirt = ItemUtils.generateSpecialUseDusts("Dirt", "Dried Earth", Utils.rgbtoHexValue(65, 50, 15))[0]; + } @Override @@ -75,127 +27,19 @@ public class OilChem extends ItemPackage { @Override public void fluids() { - // Sewage - PoopJuice = FluidUtils.generateFluidNonMolten("raw.waste", "Raw Animal Waste", 32 + 175, - new short[] { 100, 70, 30, 100 }, null, null, 0, true); - - // Sewage - ManureSlurry = FluidUtils.generateFluidNonMolten("manure.slurry", "Manure Slurry", 39 + 175, - new short[] { 75, 45, 15, 100 }, null, null, 0, true); - - // Sewage - FertileManureSlurry = FluidUtils.generateFluidNonMolten("fertile.manure.slurry", "Fertile Manure Slurry", - 45 + 175, new short[] { 65, 50, 15, 100 }, null, null, 0, true); - } - - private static AutoMap<ItemStack> mMeats = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mFish = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mFruits = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mVege = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mNuts = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mSeeds = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mPeat = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mBones = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mBoneMeal = new AutoMap<ItemStack>(); - - private static AutoMap<ItemStack> mList_Master_Meats = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mList_Master_FruitVege = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mList_Master_Bones = new AutoMap<ItemStack>(); - private static AutoMap<ItemStack> mList_Master_Seeds = new AutoMap<ItemStack>(); - - private static void processAllOreDict() { - processOreDict("listAllmeatraw", mMeats); - processOreDict("listAllfishraw", mFish); - processOreDict("listAllfruit", mFruits); - processOreDict("listAllVeggie", mVege); - processOreDict("listAllnut", mNuts); - processOreDict("listAllSeed", mSeeds); - processOreDict("brickPeat", mPeat); - processOreDict("bone", mBones); - processOreDict("dustBone", mBoneMeal); - // Just make a mega list, makes life easier. - if (!mMeats.isEmpty()) { - for (ItemStack g : mMeats) { - mList_Master_Meats.put(g); - } - } - if (!mFish.isEmpty()) { - for (ItemStack g : mFish) { - mList_Master_Meats.put(g); - } - } - if (!mFruits.isEmpty()) { - for (ItemStack g : mFruits) { - mList_Master_FruitVege.put(g); - } - } - if (!mVege.isEmpty()) { - for (ItemStack g : mVege) { - mList_Master_FruitVege.put(g); - } - } - if (!mNuts.isEmpty()) { - for (ItemStack g : mNuts) { - mList_Master_FruitVege.put(g); - } - } - if (!mSeeds.isEmpty()) { - for (ItemStack g : mSeeds) { - mList_Master_Seeds.put(g); - } - } - if (!mBoneMeal.isEmpty()) { - for (ItemStack g : mBoneMeal) { - mList_Master_Bones.put(g); - } - } - if (!mBones.isEmpty()) { - for (ItemStack g : mBones) { - mList_Master_Bones.put(g); - } - } - } - - private static void processOreDict(String aOreName, AutoMap<ItemStack> aMap) { - ArrayList<ItemStack> aTemp = OreDictionary.getOres(aOreName); - if (!aTemp.isEmpty()) { - for (ItemStack stack : aTemp) { - aMap.put(stack); - } - } + } - private static void addBasicSlurryRecipes() {} - - private static void addAdvancedSlurryRecipes() {} - - private static void addBasicOrganiseFertRecipes() {} - - private static void addAdvancedOrganiseFertRecipes() {} - - private static void addMiscRecipes() {} + @Override public String errorMessage() { - // TODO Auto-generated method stub - return "Failed to generate recipes for AgroChem."; + return "Failed to generate recipes for OilChem."; } @Override public boolean generateRecipes() { - // Organise OreDict - processAllOreDict(); - - // Slurry Production - addBasicSlurryRecipes(); - addAdvancedSlurryRecipes(); - - // Organic Fert. Production - addBasicOrganiseFertRecipes(); - addAdvancedOrganiseFertRecipes(); - - addMiscRecipes(); return true; } } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java index f2b5d0683c..bbdf322817 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java @@ -9,6 +9,7 @@ import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.util.GT_Recipe; import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.helpers.MaterialHelper; import gtPlusPlus.api.objects.minecraft.ItemPackage; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.lib.CORE; @@ -25,7 +26,7 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; public class RocketFuels extends ItemPackage { - + public static HashSet<String> mValidRocketFuelNames = new HashSet<String>(); public static HashMap<Integer, Fluid> mValidRocketFuels = new HashMap<Integer, Fluid>(); @@ -40,6 +41,7 @@ public class RocketFuels extends ItemPackage { public static Fluid Nitrous_Oxide; public static Fluid Hydrated_Ammonium_Nitrate_Slurry; public static Fluid Liquid_Oxygen; + public static Fluid Liquid_Hydrogen; public static Fluid Formaldehyde; @@ -51,16 +53,16 @@ public class RocketFuels extends ItemPackage { public static Item Ammonium_Nitrate_Dust; public static Item Formaldehyde_Catalyst; - + public static void createKerosene(){ - - - + + + FluidStack fuelA = FluidUtils.getFluidStack("diesel", 300); FluidStack fuelB = FluidUtils.getFluidStack("fuel", 300); - - - + + + if (fuelA != null){ //GT_Values.RA.addDistilleryRecipe(23, fuelA, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false); GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(Kerosene, 100), 200, 64, false); @@ -134,7 +136,11 @@ public class RocketFuels extends ItemPackage { private static void createLOX() { GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidOxygen", 1), 20*16); CORE.RA.addAdvancedFreezerRecipe(new ItemStack[] {}, new FluidStack[] {FluidUtils.getFluidStack("oxygen", 3000)}, new FluidStack[] {FluidUtils.getFluidStack(Liquid_Oxygen, 3000)}, new ItemStack[] {}, new int[] {}, 20*16, 240, 0); + } + private static void createLOH() { + GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidhydrogen", 1), 20*16); + CORE.RA.addAdvancedFreezerRecipe(new ItemStack[] {}, new FluidStack[] {FluidUtils.getFluidStack("hydrogen", 300)}, new FluidStack[] {FluidUtils.getFluidStack(Liquid_Hydrogen, 300)}, new ItemStack[] {}, new int[] {}, 20*4, 540, 0); } private static void createHydratedAmmoniumNitrateSlurry() { @@ -213,7 +219,7 @@ public class RocketFuels extends ItemPackage { 0, 0, 256)); //Fuel Value - + mRocketFuels.put(1, new Recipe_GT( true, new ItemStack[] {}, @@ -225,7 +231,7 @@ public class RocketFuels extends ItemPackage { 0, 0, 512)); //Fuel Value - + mRocketFuels.put(2, new Recipe_GT( true, new ItemStack[] {}, @@ -237,7 +243,7 @@ public class RocketFuels extends ItemPackage { 0, 0, 768)); //Fuel Value - + mRocketFuels.put(3, new Recipe_GT( true, new ItemStack[] {}, @@ -249,8 +255,8 @@ public class RocketFuels extends ItemPackage { 0, 0, 1024)); //Fuel Value - - + + //Add in default Diesel for the Buggy mValidRocketFuels.put(-1, Diesel); @@ -287,7 +293,7 @@ public class RocketFuels extends ItemPackage { GT_Values.RA.addCentrifugeRecipe( CI.getNumberedCircuit(23), - ItemUtils.getItemStackOfAmountFromOreDict("cellRP1Fuel", 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellRP1", 1), FluidUtils.getFluidStack(Liquid_Oxygen, 4000), FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 200), CI.emptyCells(1), @@ -348,7 +354,7 @@ public class RocketFuels extends ItemPackage { 20*48, 480); } - + GT_Values.RA.addCentrifugeRecipe( CI.getNumberedCircuit(23), @@ -429,6 +435,7 @@ public class RocketFuels extends ItemPackage { if (!CORE.GTNH) { createLOX(); } + createLOH(); createHydratedAmmoniumNitrateSlurry(); @@ -439,18 +446,18 @@ public class RocketFuels extends ItemPackage { createRocketFuels(); addRocketFuelsToMap(); - + return true; } @Override public boolean onLoadComplete(FMLLoadCompleteEvent event) { - + if (MathUtils.randInt(1, 2) > 0) { return false; } - + Materials aMaterial_Chloramine = MaterialUtils.getMaterial("Chloramine"); Materials aMaterial_Dimethylamine = MaterialUtils.getMaterial("Dimethylamine"); @@ -458,33 +465,35 @@ public class RocketFuels extends ItemPackage { Materials aMaterial_NitrogenDioxide = MaterialUtils.getMaterial("NitrogenDioxide"); Materials aMaterial_DinitrogenTetroxide = MaterialUtils.getMaterial("DinitrogenTetroxide"); Materials aMaterial_Dimethylhydrazine = MaterialUtils.getMaterial("Dimethylhydrazine"); - + Materials aMaterial_Oxygen = Materials.Oxygen; Materials aMaterial_Water = Materials.Water; Materials aMaterial_HypochlorousAcid = MaterialUtils.getMaterial("HypochlorousAcid"); Materials aMaterial_Ammonia = MaterialUtils.getMaterial("Ammonia"); Materials aMaterial_Methanol = MaterialUtils.getMaterial("Methanol"); - + if (aMaterial_Chloramine == null || aMaterial_Dimethylamine == null || aMaterial_DilutedHydrochloricAcid == null || aMaterial_Dimethylhydrazine == null || aMaterial_NitrogenDioxide == null || aMaterial_DinitrogenTetroxide == null || aMaterial_HypochlorousAcid == null || aMaterial_Ammonia == null || aMaterial_Methanol == null) { return false; } - - ItemStack aCellEmpty = CI.emptyCells(1); - ItemStack aCellWater = aMaterial_Water.getCells(1); - ItemStack aCellOxygen = aMaterial_Oxygen.getCells(1); - ItemStack aCellChloramine = aMaterial_Chloramine.getCells(1); - ItemStack aCellDimethylamine = aMaterial_Dimethylamine.getCells(1); - ItemStack aCellDilutedHydrochloricAcid = aMaterial_DilutedHydrochloricAcid.getCells(1); - ItemStack aCellNitrogenDioxide = aMaterial_NitrogenDioxide.getCells(1); - ItemStack aCellDinitrogenTetroxide = aMaterial_DinitrogenTetroxide.getCells(1); - ItemStack aCellDimethylhydrazine = aMaterial_Dimethylhydrazine.getCells(1); - - - + + MaterialHelper.getCells(aMaterial_Water, 1); + ItemStack aCellEmpty = CI.emptyCells(1); + ItemStack aCellWater = MaterialHelper.getCells(aMaterial_Water, 1); + ItemStack aCellOxygen = MaterialHelper.getCells(aMaterial_Oxygen, 1); + ItemStack aCellChloramine = MaterialHelper.getCells(aMaterial_Chloramine, 1); + ItemStack aCellDimethylamine = MaterialHelper.getCells(aMaterial_Dimethylamine, 1); + ItemStack aCellDilutedHydrochloricAcid = MaterialHelper.getCells(aMaterial_DilutedHydrochloricAcid, 1); + ItemStack aCellNitrogenDioxide = MaterialHelper.getCells(aMaterial_NitrogenDioxide, 1); + ItemStack aCellDinitrogenTetroxide = MaterialHelper.getCells(aMaterial_DinitrogenTetroxide, 1); + ItemStack aCellDimethylhydrazine = MaterialHelper.getCells(aMaterial_Dimethylhydrazine, 1); + + + + GT_Recipe aChemReactor_1 = new Recipe_GT( @@ -510,10 +519,10 @@ public class RocketFuels extends ItemPackage { 0, //Dura 0, //Eu 0); //Special - - - - + + + + GT_Recipe aChemReactor_Basic_1 = new Recipe_GT( true, //Optimise new ItemStack[] {}, //I @@ -561,18 +570,18 @@ public class RocketFuels extends ItemPackage { 0, //Dura 0, //Eu 0); //Special - - - - - - - - - - - - + + + + + + + + + + + + GT_Recipe aChemReactor_Adv_1 = new Recipe_GT( true, //Optimise @@ -598,26 +607,26 @@ public class RocketFuels extends ItemPackage { 0, //Eu 0); //Special - - + + //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes); //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes); //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes); //RecipeUtils.removeGtRecipe(aChemReactor_Basic_1, GT_Recipe.GT_Recipe_Map.sChemicalRecipes); - - - - - - /* GT_Values.RA.addChemicalRecipe( Materials.Chloramine.getCells(2), GT_Utility.getIntegratedCircuit(1), Materials.Dimethylamine.getGas(5000), Materials.Dimethylhydrazine.getFluid(6000), Materials.DilutedHydrochloricAcid.getCells(1), Materials.Empty.getCells(1), 960, 480); + + + + + + /* GT_Values.RA.addChemicalRecipe( Materials.Chloramine.getCells(2), GT_Utility.getIntegratedCircuit(1), Materials.Dimethylamine.getGas(5000), Materials.Dimethylhydrazine.getFluid(6000), Materials.DilutedHydrochloricAcid.getCells(1), Materials.Empty.getCells(1), 960, 480); GT_Values.RA.addChemicalRecipe( Materials.Dimethylamine.getCells(5), GT_Utility.getIntegratedCircuit(1), Materials.Chloramine.getFluid(2000), Materials.Dimethylhydrazine.getFluid(6000), Materials.DilutedHydrochloricAcid.getCells(1), Materials.Empty.getCells(4), 960, 480); GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Chloramine.getCells(2), Materials.Empty.getCells(4), Materials.Dimethylamine.getGas(5000), Materials.DilutedHydrochloricAcid.getFluid(1000), Materials.Dimethylhydrazine.getCells(6), GT_Values.NI, 960, 480); GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Dimethylamine.getCells(5), Materials.Empty.getCells(1), Materials.Chloramine.getFluid(2000), Materials.DilutedHydrochloricAcid.getFluid(1000), Materials.Dimethylhydrazine.getCells(6), GT_Values.NI, 960, 480); GT_Values.RA.addChemicalRecipeForBasicMachineOnly(Materials.Dimethylamine.getCells(5), Materials.Chloramine.getCells(2), Materials.Chloramine.getFluid(2000), Materials.DilutedHydrochloricAcid.getFluid(1000), Materials.Dimethylhydrazine.getCells(6), Materials.DilutedHydrochloricAcid.getCells(1), 960, 480); GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(24)}, new FluidStack[]{Materials.HypochlorousAcid.getFluid(3000), Materials.Ammonia.getGas(8000), Materials.Methanol.getFluid(12000)}, new FluidStack[]{Materials.Dimethylhydrazine.getFluid(12000), Materials.DilutedHydrochloricAcid.getFluid(2000), Materials.Water.getFluid(9000)}, null, 1040, 480); - + GT_Values.RA.addChemicalRecipe(GT_Utility.getIntegratedCircuit(2), GT_Values.NI, Materials.NitrogenDioxide.getGas(1000), Materials.DinitrogenTetroxide.getGas(1000), GT_Values.NI, 640); GT_Values.RA.addChemicalRecipe(Materials.NitrogenDioxide.getCells(1), GT_Utility.getIntegratedCircuit(2), GT_Values.NF, Materials.DinitrogenTetroxide.getGas(1000), Materials.Empty.getCells(1), 640); GT_Values.RA.addChemicalRecipe(Materials.NitrogenDioxide.getCells(1), GT_Utility.getIntegratedCircuit(12), GT_Values.NF, GT_Values.NF, Materials.DinitrogenTetroxide.getCells(1), 640); @@ -629,25 +638,25 @@ public class RocketFuels extends ItemPackage { GT_Values.RA.addMixerRecipe(Materials.Dimethylhydrazine.getCells(2), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Oxygen.getGas(1000), new FluidStack(ItemList.sRocketFuel, 3000), Materials.Empty.getCells(2), 60, 16); GT_Values.RA.addMixerRecipe(Materials.Oxygen.getCells(1), GT_Values.NI, GT_Values.NI, GT_Values.NI, Materials.Dimethylhydrazine.getFluid(2000), new FluidStack(ItemList.sRocketFuel, 3000), Materials.Empty.getCells(1), 60, 16); - - */ - - - - - - - - - + + */ + + + + + + + + + //Get Rocket Fuel - + //Find recipes using default values - + //Remove - + //Rebake map - + return true; }; @@ -662,18 +671,28 @@ public class RocketFuels extends ItemPackage { @Override public void fluids() { - + //Register default fluids Diesel = MaterialUtils.getMaterial("Fuel", "Diesel").getFluid(1).getFluid(); - Oil_Heavy = MaterialUtils.getMaterial("OilHeavy", "Oil").getFluid(1).getFluid(); - + // 5.08 Compat + if (!FluidUtils.doesFluidExist("liquid_heavy_oil")){ + Oil_Heavy = FluidUtils.generateFluidNoPrefix("liquid_heavy_oil", "Heavy Oil", 200, new short[]{10, 10, 10, 100}); + } + else { + Oil_Heavy = MaterialUtils.getMaterial("OilHeavy", "Oil").getFluid(1).getFluid(); + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellOilHeavy", 1) == null){ + new BaseItemComponent("OilHeavy", "Heavy Oil", new short[] {10, 10, 10}); + } + } + + //Create Kerosene Kerosene = FluidUtils.generateFluidNonMolten("Kerosene", "Kerosene", 500, new short[]{150, 40, 150, 100}, null, null); CoalTar.Coal_Oil = Kerosene; - + //RP! Focket Fuel - RP1 = FluidUtils.generateFluidNonMolten("RP1Fuel", "RP-1 Rocket Fuel", 500, new short[]{210, 50, 50, 100}, null, null); + RP1 = FluidUtils.generateFluidNonMolten("RP1Fuel", "RP-1", 500, new short[]{210, 50, 50, 100}, null, null); //Create Nitrogen Tetroxide Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("NitrogenTetroxide", "Nitrogen Tetroxide", -11, new short[]{170, 170, 0, 100}, null, null); @@ -697,7 +716,7 @@ public class RocketFuels extends ItemPackage { new BaseItemComponent("NitrousOxide", "Nitrous Oxide", new short[] {10, 10, 175}); } } - + //Unsymmetrical_Dimethylhydrazine if (FluidUtils.getFluidStack("1,1dimethylhydrazine", 1) == null){ Unsymmetrical_Dimethylhydrazine = FluidUtils.generateFluidNonMolten("UnsymmetricalDimethylhydrazine", "Unsymmetrical Dimethylhydrazine", -57, new short[]{70, 210, 20, 100}, null, null); @@ -727,16 +746,31 @@ public class RocketFuels extends ItemPackage { new BaseItemComponent("LiquidOxygen", "Liquid Oxygen", new short[] {10, 10, 175}); } } - + + //Create Liquid_Hydrogen + if (FluidUtils.getFluidStack("LiquidHydrogen", 1) == null && FluidUtils.getFluidStack("liquidhydrogen", 1) == null){ + Liquid_Hydrogen = FluidUtils.generateFluidNonMolten("LiquidHydrogen", "Liquid Hydrogen", -240, new short[]{75, 75, 220, 100}, null, null); + } + else { + if (FluidUtils.getFluidStack("LiquidHydrogen", 1) != null ) { + Liquid_Hydrogen = FluidUtils.getFluidStack("LiquidHydrogen", 1).getFluid(); + } + else { + Liquid_Hydrogen = FluidUtils.getFluidStack("liquidhydrogen", 1).getFluid(); + } + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellLiquidHydrogen", 1) == null){ + new BaseItemComponent("LiquidHydrogen", "Liquid Hydrogen", new short[] {10, 10, 175}); + } + } Formaldehyde = FluidUtils.generateFluidNonMolten("Formaldehyde", "Formaldehyde", -92, new short[]{150, 75, 150, 100}, null, null); - + Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("RocketFuelMixA", "H8N4C2O4 Rocket Fuel", -185, new short[]{50, 220, 50, 100}, null, null); - RP1_Plus_Liquid_Oxygen = FluidUtils.generateFluidNonMolten("RocketFuelMixB", "Rp-1 Fuel Mixture", -250, new short[]{250, 50, 50, 100}, null, null); + RP1_Plus_Liquid_Oxygen = FluidUtils.generateFluidNonMolten("RocketFuelMixB", "Rp-1 Rocket Fuel", -250, new short[]{250, 50, 50, 100}, null, null); Monomethylhydrazine_Plus_Nitric_Acid = FluidUtils.generateFluidNonMolten("RocketFuelMixC", "CN3H7O3 Rocket Fuel", -300, new short[]{125, 75, 180, 100}, null, null); Dense_Hydrazine_Mix = FluidUtils.generateFluidNonMolten("RocketFuelMixD", "Dense Hydrazine Fuel Mixture", -250, new short[]{175, 80, 120, 100}, null, null); - + } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java b/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java index 1e833a7b00..10eaaf0da9 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java @@ -149,7 +149,7 @@ public class StandardBaseParticles extends BaseItemParticle { @Override public void registerIcons(IIconRegister reg) { for (int i = 0; i < this.icons.length; i++) { - this.icons[i] = reg.registerIcon(CORE.MODID + ":" + "particle/"+i); + this.icons[i] = reg.registerIcon(CORE.MODID + ":" + "particle/new/"+i); } } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java new file mode 100644 index 0000000000..8a003ec7aa --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java @@ -0,0 +1,162 @@ +package gtPlusPlus.core.item.chemistry.general; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class ItemGenericChemBase extends Item { + + final protected IIcon base[]; + + final private int aMetaSize = 6; + + /* + * 0 - Red Metal Catalyst //FeCu + * 1 - Yellow Metal Catalyst //WNi + * 2 - Blue Metal Catalyst //CoTi + * 3 - Orange Metal Catalyst //Vanadium Pd + * 4 - Purple Metal Catalyst //IrIdium Ruthenium + * 5 - Brown Metal Catalyst //NiAl + * + */ + + public ItemGenericChemBase() { + this.setHasSubtypes(true); + this.setNoRepair(); + this.setMaxStackSize(64); + this.setMaxDamage(0); + base = new IIcon[aMetaSize]; + this.setUnlocalizedName("BasicGenericChemItem"); + GameRegistry.registerItem(this, this.getUnlocalizedName()); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean shouldRotateAroundWhenRendering() { + return super.shouldRotateAroundWhenRendering(); + } + + @Override + public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + return super.getItemStackDisplayName(aStack); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + try { + + } + catch (Throwable t) { + t.printStackTrace(); + } + super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); + } + + @Override + public EnumRarity getRarity(ItemStack p_77613_1_) { + return EnumRarity.common; + } + + @Override + public boolean requiresMultipleRenderPasses() { + return false; + } + + @Override + public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { + for (int i=0;i<aMetaSize;i++) { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return stack.getItemDamage(); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } + + @Override + public void registerIcons(final IIconRegister u) { + for (int i=0;i<this.aMetaSize;i++) { + String aPath = CORE.MODID + ":" + "science/general/MetaItem1/"+i; + this.base[i] = u.registerIcon(aPath); + } + } + + + @Override + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { + return this.base[damage]; + } + + @Override + public IIcon getIconFromDamage(int damage) { + return this.base[damage]; + } + + @Override + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + return this.base[stack.getItemDamage()]; + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return this.base[stack.getItemDamage()]; + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + +} diff --git a/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java b/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java index 1c28f99ff8..3f8e31d8d2 100644 --- a/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java +++ b/src/Java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java @@ -26,7 +26,9 @@ public class ItemDummyResearch extends ItemGenericToken { RESEARCH_4_BASIC_PHYSICS("Basic Physics", "Fundamental laws of motion"), RESEARCH_5_ADV_PHYSICS("Advanced Physics", "Advanced knowledge!"), RESEARCH_6_BASIC_METALLURGY("Basic Metallurgy", "Information about material smelting"), - RESEARCH_7_ADV_METALLURGY("Advanced Metallurgy", "Advanced Material Sciences!"); + RESEARCH_7_ADV_METALLURGY("Advanced Metallurgy", "Advanced Material Sciences!"), + RESEARCH_8_TURBINE_AUTOMATION("Turbine Automation", "You really don't want to share this with anyone!"), + RESEARCH_9_CLOAKING("Cloaking Technologies", "Sneaking around like a mouse"); diff --git a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java b/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java index 5ef72b6f17..b74b7972be 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java @@ -71,6 +71,9 @@ public class ItemControlCore extends Item { @Override public String getItemStackDisplayName(final ItemStack tItem) { + if (tItem == null) { + return "Control Core"; + } String aReturnValue = super.getItemStackDisplayName(tItem); if (tItem != null) { try { diff --git a/src/Java/gtPlusPlus/core/item/general/ItemGenericToken.java b/src/Java/gtPlusPlus/core/item/general/ItemGenericToken.java index c076bf5c95..21d2c6e120 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemGenericToken.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemGenericToken.java @@ -148,8 +148,19 @@ public class ItemGenericToken extends CoreItem { } @Override - public int getItemStackLimit(ItemStack stack) { - return mMaxStackSizes.get(stack.getItemDamage()); + public int getItemStackLimit(ItemStack aStack) { + if (aStack == null) { + return getItemStackLimit(); + } + else { + Integer aSize = mMaxStackSizes.get(aStack.getItemDamage()); + if (aSize != null) { + return aSize; + } + else { + return getItemStackLimit(); + } + } } @Override diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java index c8acdc2152..82bb29b5bf 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java @@ -2,23 +2,10 @@ package gtPlusPlus.core.item.general; import java.util.List; -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - import baubles.api.BaubleType; import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; @@ -31,6 +18,16 @@ import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItemManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemHealingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ @@ -232,7 +229,7 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI @Override //TODO public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase arg1) { - if (!arg1.worldObj.isRemote){ + if (arg1 != null && arg1.worldObj != null && !arg1.worldObj.isRemote){ //Try Charge First diff --git a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java index 7134df4a44..fa008bf1a3 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java @@ -2,10 +2,15 @@ package gtPlusPlus.core.item.general; import java.util.List; +import baubles.api.BaubleType; +import baubles.api.IBauble; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.client.Minecraft; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.handler.events.CustomMovementHandler; +import gtPlusPlus.core.handler.events.SneakManager; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -14,14 +19,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import baubles.api.BaubleType; -import baubles.api.IBauble; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.events.CustomMovementHandler; -import gtPlusPlus.core.handler.events.SneakManager; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; - @Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemSlowBuildingRing extends Item implements IBauble{ @@ -42,23 +39,11 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ if (worldObj.isRemote) { return; } - if (player instanceof EntityPlayer){ - for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) { - if (is == itemStack) { - continue; - } - if (is != null) { - - - } - } - } super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); } @Override public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return (EnumChatFormatting.YELLOW+"Slow Building Ring"+EnumChatFormatting.GRAY); } @@ -68,6 +53,7 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ return false; } + @SuppressWarnings("unchecked") @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(""); @@ -95,13 +81,32 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ @Override //TODO public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { - doEffect(arg1); + try { + EntityPlayer aPlayer; + if (arg1 instanceof EntityPlayer) { + aPlayer = (EntityPlayer) arg1; + SneakManager s = SneakManager.get(aPlayer); + s.putRingOn(); + } + } + catch (Throwable t) { + t.printStackTrace(); + } } @Override //TODO public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { - SneakManager.setSprintingStateON(); - SneakManager.setCrouchingStateOFF(); + try { + EntityPlayer aPlayer; + if (arg1 instanceof EntityPlayer) { + aPlayer = (EntityPlayer) arg1; + SneakManager s = SneakManager.get(aPlayer); + s.takeRingOff(); + } + } + catch (Throwable t) { + t.printStackTrace(); + } } @Override //TODO @@ -110,20 +115,26 @@ public class ItemSlowBuildingRing extends Item implements IBauble{ } private static void doEffect(final EntityLivingBase arg1){ - if (arg1.worldObj.isRemote){ - if (!arg1.isSneaking()){ - arg1.setSneaking(true); - Minecraft.getMinecraft().thePlayer.setSneaking(true); - SneakManager.setSprintingStateOFF(); - SneakManager.setCrouchingStateON(); - } - else if (arg1.isSneaking()){ - arg1.setSprinting(false); - Minecraft.getMinecraft().thePlayer.setSprinting(true); - SneakManager.setSprintingStateOFF(); - SneakManager.setCrouchingStateON(); + try { + // Get World + World aWorld = arg1.worldObj; + if (aWorld != null && !aWorld.isRemote) { + EntityPlayer aPlayer; + if (arg1 instanceof EntityPlayer) { + aPlayer = (EntityPlayer) arg1; + SneakManager s = SneakManager.get(aPlayer); + if (!aPlayer.isSneaking()){ + aPlayer.setSneaking(true); + } + if (aPlayer.isSprinting()) { + aPlayer.setSprinting(false); + } + } } } + catch (Throwable t) { + t.printStackTrace(); + } } } diff --git a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java index aa6fdabacc..9994c7d362 100644 --- a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java +++ b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.item.materials; +import static gtPlusPlus.core.util.minecraft.ItemUtils.getSimpleStack; + import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; @@ -10,6 +12,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.handler.Recipes.DecayableRecipe; import gtPlusPlus.core.item.base.BaseItemTickable; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.EntityUtils; @@ -25,6 +28,7 @@ public class DustDecayable extends BaseItemTickable { this.turnsIntoItem = turnsInto; this.radLevel = radLevel; GT_OreDictUnificator.registerOre(unlocal, ItemUtils.getSimpleStack(this)); + new DecayableRecipe(maxTicks, getSimpleStack(this), getSimpleStack(turnsInto)); } @Override diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java b/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java index d0f3005d00..0170df0dc7 100644 --- a/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java +++ b/src/Java/gtPlusPlus/core/item/tool/misc/DebugScanner.java @@ -7,6 +7,7 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -62,19 +63,22 @@ public class DebugScanner extends CoreItem { PlayerUtils.messagePlayer(player, "Invisible? "+entity.isInvisible()); PlayerUtils.messagePlayer(player, "Age: "+entity.ticksExisted); - if (entity instanceof EntityLiving) { - EntityLiving g = (EntityLiving) entity; + if (entity instanceof EntityLivingBase) { + EntityLivingBase g = (EntityLivingBase) entity; PlayerUtils.messagePlayer(player, "Health: "+g.getHealth()+"/"+g.getMaxHealth()); PlayerUtils.messagePlayer(player, "On ground? "+g.onGround); - PlayerUtils.messagePlayer(player, "Can Loot? "+g.canPickUpLoot()); - PlayerUtils.messagePlayer(player, "Child? "+g.isChild()); - if (entity instanceof EntityPlayer) { - EntityPlayer y = (EntityPlayer) entity; - PlayerUtils.messagePlayer(player, "Experience: "+y.experience); - PlayerUtils.messagePlayer(player, "Name: "+y.getCommandSenderName()); - } + PlayerUtils.messagePlayer(player, "Child? "+g.isChild()); + } + if (entity instanceof EntityLiving) { + EntityLiving g = (EntityLiving) entity; + PlayerUtils.messagePlayer(player, "Can Loot? "+g.canPickUpLoot()); } + if (entity instanceof EntityPlayer) { + EntityPlayer y = (EntityPlayer) entity; + PlayerUtils.messagePlayer(player, "Experience: "+y.experience); + PlayerUtils.messagePlayer(player, "Name: "+y.getCommandSenderName()); + } } return true; diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java index 0c31b999cd..a48573888e 100644 --- a/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java +++ b/src/Java/gtPlusPlus/core/item/tool/misc/GregtechPump.java @@ -1127,7 +1127,7 @@ public class GregtechPump extends Item implements ISpecialElectricItem, IElectri else if ((aTileEntity instanceof IFluidTank || aTileEntity instanceof IFluidHandler)) { if (aTileEntity instanceof IFluidTank) { Logger.INFO("Tile Was instanceof IFluidTank."); - FluidStack f = ((IFluidTank) aTileEntity).getFluid(); + FluidStack f = ((IFluidTank) aTileEntity).getFluid(); if (aSetFluid == null) { aSetFluid = f; aSetFluid.amount = f.amount; diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 38be7d8593..2a267dc16d 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -5,12 +5,16 @@ import java.util.concurrent.ConcurrentHashMap; import com.mojang.authlib.GameProfile; +import cpw.mods.fml.common.FMLCommonHandler; import gregtech.api.GregTech_API; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.core.util.sys.GeoUtils; import gtPlusPlus.core.util.sys.NetworkUtils; +import gtPlusPlus.preloader.CORE_Preloader; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; @@ -51,7 +55,7 @@ public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.7.03.01"; + public static final String VERSION = "1.7.03.45"; public static String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static String USER_COUNTRY = GeoUtils.determineUsersCountry(); public static boolean isModUpToDate = Utils.isModUpToDate(); @@ -75,7 +79,7 @@ public class CORE { public static int turbineCutoffBase = 75000; //GT++ Fake Player Profile - public static GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("gtplusplus.core".getBytes()), "[GT++]"); + public static final GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("gtplusplus.core".getBytes()), "[GT++]"); public static final WeakHashMap<World, EntityPlayerMP> fakePlayerCache = new WeakHashMap<World, EntityPlayerMP>(); //Tooltips; public static final String GT_Tooltip = "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus "+EnumChatFormatting.GRAY+"- "+EnumChatFormatting.RED+"[GT++]"; @@ -87,6 +91,7 @@ public class CORE { //Because I want to be lazy. Beyond Reality Classic Var. public static boolean BRC = false; + public static final String SEPERATOR = "/"; /** @@ -209,6 +214,7 @@ public class CORE { public static boolean enableCustomCircuits = true; public static boolean enableOldGTcircuits = false; public static boolean disableZombieReinforcement = false; + public static int enableWatchdogBGM = CORE_Preloader.enableWatchdogBGM; //GT Fixes public static boolean enableNitroFix = false; @@ -284,7 +290,20 @@ public class CORE { } public static final void crash() { - System.exit(0); + Logger.INFO("=========================================================="); + Logger.INFO("[GT++ CRASH]"); + Logger.INFO("=========================================================="); + Logger.INFO("Oooops..."); + Logger.INFO("This should only happy in a development environment or when something really bad happens."); + Logger.INFO("=========================================================="); + Logger.INFO("Called from: "+ReflectionUtils.getMethodName(0)); + Logger.INFO(ReflectionUtils.getMethodName(1)); + Logger.INFO(ReflectionUtils.getMethodName(2)); + Logger.INFO(ReflectionUtils.getMethodName(3)); + Logger.INFO(ReflectionUtils.getMethodName(4)); + Logger.INFO(ReflectionUtils.getMethodName(5)); + Logger.INFO(ReflectionUtils.getMethodName(6)); + FMLCommonHandler.instance().exitJava(0, true); } public static final void gc() { diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index 5a2b75337b..d96875b811 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -55,6 +55,7 @@ public class LoadedMods { public static boolean Witchery = false; public static boolean Waila = false; public static boolean CropsPlusPlus = false; //Barts Crop Mod + public static boolean Reliquary = false; @@ -102,6 +103,11 @@ public class LoadedMods { Logger.INFO("Components enabled for: Crops++"); totalMods++; } + if (Loader.isModLoaded("xreliquary")) { + Reliquary = true; + Logger.INFO("Components enabled for: Reliquary"); + totalMods++; + } if (Loader.isModLoaded("TConstruct")){ TiCon = true; Logger.INFO("Components enabled for: Tinkers Construct"); diff --git a/src/Java/gtPlusPlus/core/lib/VanillaColours.java b/src/Java/gtPlusPlus/core/lib/VanillaColours.java new file mode 100644 index 0000000000..9a7a82cb1f --- /dev/null +++ b/src/Java/gtPlusPlus/core/lib/VanillaColours.java @@ -0,0 +1,28 @@ +package gtPlusPlus.core.lib; + +import gtPlusPlus.core.util.Utils; + +public enum VanillaColours { + + BONE_MEAL(249, 255, 254), INK_BLACK(29, 29, 33), COCOA_BEANS(131, 84, 50), LAPIS_LAZULI(60, 68, 170), + DYE_WHITE(249, 255, 254), DYE_BLACK(29, 29, 33), DYE_RED(176, 46, 38), DYE_GREEN(94, 124, 22), + DYE_CYAN(22, 156, 156), DYE_PINK(243, 139, 170), DYE_LIME(128, 199, 31), DYE_YELLOW(254, 216, 61), + DYE_ORANGE(249, 128, 29), DYE_BROWN(131, 84, 50), DYE_LIGHT_BLUE(58, 179, 218), DYE_LIGHT_PURPLE(199, 78, 189), + DYE_LIGHT_GRAY(157, 157, 151), DYE_DARK_BLUE(60, 68, 170), DYE_DARK_PURPLE(137, 50, 184), DYE_DARK_GRAY(71, 79, 82); + + private final int r, g, b; + + private VanillaColours(int aR, int aG, int aB) { + r = aR; + g = aG; + b = aB; + } + + public short[] getAsShort() { + return new short[] { (short) r, (short) g, (short) b }; + } + + public int getAsInt() { + return Utils.rgbtoHexValue(r, g, b); + } +} diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 99586b37fe..ba2579aa97 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -217,9 +217,32 @@ public final class ELEMENT { //Runescape materials - public static final Material BLACK_METAL = new Material("Black Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {5, 5, 5}, 2350, 4650, 24, 17, false, "҈", 0, new MaterialStack[]{new MaterialStack(getInstance().LEAD, 15), new MaterialStack(getInstance().TUNGSTEN, 25), new MaterialStack(getInstance().CARBON, 60)});//Not a GT Inherited Material + public static final Material BLACK_METAL = new Material("Black Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {5, 5, 5}, 2350, 4650, 24, 17, false, "҈", 0, new MaterialStack[]{new MaterialStack(getInstance().LEAD, 15), new MaterialStack(getInstance().MANGANESE, 25), new MaterialStack(getInstance().CARBON, 60)});//Not a GT Inherited Material public static final Material WHITE_METAL = new Material("White Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {255, 255, 255}, 4560, 7580, 35, 41, false, "҉", 0, new MaterialStack[]{new MaterialStack(getInstance().COPPER, 5), new MaterialStack(getInstance().ANTIMONY, 10), new MaterialStack(getInstance().PLATINUM, 10), new MaterialStack(getInstance().TIN, 75)});//Not a GT Inherited Material - public static final Material GRANITE = new Material("Ancient Granite", MaterialState.SOLID, TextureSet.SET_SAND, new short[] {107, 107, 107}, 500, 2000, 16, 12, false, "«»", 0, false);//Not a GT Inherited Material + + public static final Material GRANITE = new Material( + "Ancient Granite", + MaterialState.SOLID, + TextureSet.SET_SAND, + new short[] {107, 107, 107}, + 500, + 2000, + 16, + 12, + false, + "«»", + 0, + false, + new MaterialStack[]{ + new MaterialStack(getInstance().OXYGEN, 30), + new MaterialStack(getInstance().IRON, 20), + new MaterialStack(getInstance().SILICON, 20), + new MaterialStack(getInstance().ALUMINIUM, 10), + new MaterialStack(getInstance().POTASSIUM, 10), + new MaterialStack(getInstance().CALCIUM, 5), + new MaterialStack(getInstance().SODIUM, 5) + });//Not a GT Inherited Material + public static final Material RUNITE = new Material("Runite", MaterialState.SOLID, TextureSet.SET_FINE, new short[] {60, 200, 190}, 6750, 11550, 73, 87, true, "§", 0);//Not a GT Inherited Material public static final Material DRAGON_METAL = new Material("Dragonblood", MaterialState.SOLID, TextureSet.SET_SHINY, new short[] {220, 40, 20, 2}, 10160, 17850, 96, 105, true, "۞", 0);//Not a GT Inherited Material diff --git a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java index c7032ab7c7..8dad69f70a 100644 --- a/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java +++ b/src/Java/gtPlusPlus/core/material/MISC_MATERIALS.java @@ -1,22 +1,25 @@ package gtPlusPlus.core.material; +import gregtech.api.enums.Materials; import gregtech.api.enums.TextureSet; -import gtPlusPlus.core.material.nuclear.FLUORIDES; +import gtPlusPlus.core.client.CustomTextureSet.TextureSets; import gtPlusPlus.core.material.state.MaterialState; +import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; public final class MISC_MATERIALS { - + /* * Some of these materials purely exist as data objects, items will most likely be assigned seperately. * Most are just compositions which will have dusts assigned to them. */ - + public static void run() { MaterialUtils.generateSpecialDustAndAssignToAMaterial(STRONTIUM_OXIDE, false); MaterialUtils.generateSpecialDustAndAssignToAMaterial(STRONTIUM_HYDROXIDE, false); + WATER.registerComponentForMaterial(FluidUtils.getWater(1000)); } - + public static final Material STRONTIUM_OXIDE = new Material( "Strontium Oxide", MaterialState.SOLID, @@ -33,8 +36,255 @@ public final class MISC_MATERIALS { new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().STRONTIUM, 1), new MaterialStack(ELEMENT.getInstance().OXYGEN, 1) - }); - + }); + + public static final Material SELENIUM_DIOXIDE = new Material( + "Selenium Dioxide", + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().SELENIUM, 1), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 2) + }); + + public static final Material SELENIOUS_ACID = new Material( + "Selenious Acid", + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(SELENIUM_DIOXIDE, 1), + new MaterialStack(ELEMENT.getInstance().HYDROGEN, 8), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 4) + }); + + public static final Material HYDROGEN_CYANIDE = new Material( + "Hydrogen Cyanide", + MaterialState.PURE_LIQUID, //State + null, //Material Colour + 4, //Melting Point in C + 26, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1), + new MaterialStack(ELEMENT.getInstance().CARBON, 1), + new MaterialStack(ELEMENT.getInstance().NITROGEN, 1) + }); + + public static final Material CARBON_MONOXIDE = new Material( + "Carbon Monoxide", + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().CARBON, 1), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 1) + }); + + public static final Material CARBON_DIOXIDE = new Material( + "Carbon Dioxide", + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().CARBON, 1), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 2) + }); + + + /* + * Rare Earth Materials + */ + + public static final Material RARE_EARTH_LOW = new Material( + "Rare Earth (I)", //Material Name + MaterialState.ORE, //State + TextureSets.GEM_A.get(), //Texture Set + null, //Material Colour + 1200, + 2500, + -1, + -1, + -1, //Radiation + new MaterialStack[]{ + new MaterialStack(ORES.GREENOCKITE, 1), + new MaterialStack(ORES.LANTHANITE_CE, 1), + new MaterialStack(ORES.AGARDITE_CD, 1), + new MaterialStack(ORES.XENOTIME, 1), + new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.NetherQuartz), 1), + new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Galena), 1), + new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Chalcopyrite), 1), + new MaterialStack(MaterialUtils.generateMaterialFromGtENUM(Materials.Cobaltite), 1), + new MaterialStack(ELEMENT.STANDALONE.GRANITE, 1) + }); + + public static final Material RARE_EARTH_MID = new Material( + "Rare Earth (II)", //Material Name + MaterialState.ORE, //State + TextureSets.ENRICHED.get(), //Texture Set + null, //Material Colour + 3500, + 5000, + -1, + -1, + -1, //Radiation + new MaterialStack[]{ + new MaterialStack(ORES.LANTHANITE_ND, 1), + new MaterialStack(ORES.AGARDITE_ND, 1), + new MaterialStack(ORES.YTTRIAITE, 1), + new MaterialStack(ORES.CROCROITE, 1), + new MaterialStack(ORES.NICHROMITE, 1), + new MaterialStack(ORES.ZIRCON, 1), + new MaterialStack(ELEMENT.STANDALONE.GRANITE, 1), + new MaterialStack(ELEMENT.STANDALONE.BLACK_METAL, 1), + new MaterialStack(ELEMENT.STANDALONE.RUNITE, 1) + }); + + public static final Material RARE_EARTH_HIGH = new Material( + "Rare Earth (III)", //Material Name + MaterialState.ORE, //State + TextureSets.REFINED.get(), //Texture Set + null, //Material Colour + 5200, + 7500, + -1, + -1, + -1, //Radiation + new MaterialStack[]{ + new MaterialStack(ORES.GADOLINITE_Y, 1), + new MaterialStack(ORES.LEPERSONNITE, 1), + new MaterialStack(ORES.FLORENCITE, 1), + new MaterialStack(ORES.FLUORCAPHITE, 1), + new MaterialStack(ORES.LAUTARITE, 1), + new MaterialStack(ORES.DEMICHELEITE_BR, 1), + new MaterialStack(ORES.ALBURNITE, 1), + new MaterialStack(ORES.KASHINITE, 1), + new MaterialStack(ORES.AGARDITE_LA, 1), + }); + + public static final Material WATER = new Material( + "Water", + MaterialState.PURE_LIQUID, + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().HYDROGEN, 2), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 1) + }); + + //OH + public static final Material HYDROXIDE = new Material( + "Hydroxide", //Material Name + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().OXYGEN, 1), + new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1) + }); + + //NH3 + public static final Material AMMONIA = new Material( + "Ammonia", //Material Name + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -77, //Melting Point in C + -33, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().NITROGEN, 1), + new MaterialStack(ELEMENT.getInstance().HYDROGEN, 3) + }); + + //NH4 + public static final Material AMMONIUM = new Material( + "Ammonium", //Material Name + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().NITROGEN, 1), + new MaterialStack(ELEMENT.getInstance().HYDROGEN, 4) + }); + + + public static final Material HYDROGEN_CHLORIDE = new Material( + "Hydrogen Chloride", + MaterialState.PURE_LIQUID, + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1), + new MaterialStack(ELEMENT.getInstance().CHLORINE, 1), + }); + + + public static final Material SODIUM_CHLORIDE = new Material( + "Sodium Chloride", + MaterialState.PURE_LIQUID, + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().SODIUM, 1), + new MaterialStack(ELEMENT.getInstance().CHLORINE, 1), + }); + + + public static final Material SODIUM_HYDROXIDE = new Material( + "Sodium Hydroxide", + MaterialState.PURE_LIQUID, + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().SODIUM, 1), + new MaterialStack(HYDROXIDE, 1), + }); + + public static final Material SALT_WATER = new Material( + "Salt Water", + MaterialState.PURE_LIQUID, + new MaterialStack[]{ + new MaterialStack(WATER, 3), + new MaterialStack(SODIUM_CHLORIDE, 1), + }); + + public static final Material BRINE = new Material( + "Brine", + MaterialState.PURE_LIQUID, + new MaterialStack[]{ + new MaterialStack(SALT_WATER, 1), + new MaterialStack(SODIUM_CHLORIDE, 2), + }); + public static final Material STRONTIUM_HYDROXIDE = new Material( "Strontium Hydroxide", MaterialState.SOLID, @@ -50,40 +300,9 @@ public final class MISC_MATERIALS { false, new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().STRONTIUM, 1), - new MaterialStack(FLUORIDES.HYDROXIDE, 2) - }); - - public static final Material SELENIUM_DIOXIDE = new Material( - "Selenium Dioxide", - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SELENIUM, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 2) - }); - - public static final Material SELENIOUS_ACID = new Material( - "Selenious Acid", - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(SELENIUM_DIOXIDE, 1), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 8), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 4) - }); - - - + new MaterialStack(MISC_MATERIALS.HYDROXIDE, 2) + }); + + + } diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 6b6be32107..b5922dde53 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -85,8 +85,17 @@ public class Material { public static AutoMap<Materials> invalidMaterials = new AutoMap<Materials>(); + + + public Material(final String materialName, final MaterialState defaultState, final MaterialStack... inputs){ + this(materialName, defaultState, null, inputs); + } + + public Material(final String materialName, final MaterialState defaultState, final short[] rgba, final MaterialStack... inputs){ + this(materialName, defaultState, null, 0, rgba, -1, -1, -1, -1, false, "", 0, false, false, inputs); + } - public Material(String materialName, MaterialState defaultState, short[] rgba, int radiationLevel, MaterialStack[] materialStacks) { + public Material(final String materialName, final MaterialState defaultState, final short[] rgba, int radiationLevel, MaterialStack... materialStacks) { this(materialName, defaultState, null, 0, rgba, -1, -1, -1, -1, false, "", radiationLevel, false, materialStacks); } @@ -94,8 +103,8 @@ public class Material { this(materialName, defaultState, null, 0, rgba, j, k, l, m, false, "", radiationLevel, false, materialStacks); } - public Material(String materialName, MaterialState defaultState, final TextureSet set, short[] rgba, int j, int k, int l, int m, int radiationLevel, MaterialStack[] materialStacks){ - this(materialName, defaultState, set, 0, rgba, j, k, l, m, false, "", radiationLevel, false, materialStacks); + public Material(String materialName, MaterialState defaultState, final TextureSet set, short[] rgba, int meltingPoint, int boilingPoint, int protons, int neutrons, int radiationLevel, MaterialStack[] materialStacks){ + this(materialName, defaultState, set, 0, rgba, meltingPoint, boilingPoint, protons, neutrons, false, "", radiationLevel, false, materialStacks); } public Material(final String materialName, final MaterialState defaultState,final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final MaterialStack... inputs){ @@ -228,7 +237,7 @@ public class Material { int hashSize = MathUtils.howManyPlaces(aValueForGen); String a = String.valueOf(aValueForGen); - String b = null; + String b = ""; if (hashSize < 9) { int aSecondHash = this.materialState.hashCode(); @@ -370,9 +379,6 @@ public class Material { aDataSet.put(m.getStackMaterial().vRadiationLevel); } byte aAverage = MathUtils.getByteAverage(aDataSet); - if (aAverage > Byte.MAX_VALUE || aAverage < Byte.MIN_VALUE) { - aAverage = 0; - } if (aAverage > 0) { Logger.MATERIALS(this.getLocalizedName()+" is radioactive due to trace elements. Level: "+aAverage+"."); this.isRadioactive = true; @@ -463,32 +469,31 @@ public class Material { } if (generateFluid){ - final Materials isValid = Materials.get(this.getLocalizedName()); - if (FluidUtils.getFluidStack(localizedName, 1) != null){ - this.vMoltenFluid = FluidUtils.getFluidStack(localizedName, 1).getFluid(); - } - else if (isValid == null || isValid == Materials._NULL){ - queueFluidGeneration(); + final Materials isValid = Materials.get(this.getLocalizedName()); + FluidStack aTest = FluidUtils.getWildcardFluidStack(localizedName, 1); + if (aTest != null){ + this.vMoltenFluid = aTest.getFluid(); } else { - if (isValid.mFluid != null){ - this.vMoltenFluid = isValid.mFluid; - } - else if (isValid.mGas != null){ - this.vMoltenFluid = isValid.mGas; - } - else { + if (isValid == null || isValid == Materials._NULL){ queueFluidGeneration(); } + else { + FluidStack aTest2 = FluidUtils.getWildcardFluidStack(localizedName, 1); + if (aTest2 != null){ + this.vMoltenFluid = aTest2.getFluid(); + } + else { + queueFluidGeneration(); + } + } } - this.vPlasma = this.generatePlasma(); } else { this.vMoltenFluid = null; this.vPlasma = null; } - String ratio = ""; if (this.vSmallestRatio != null) { for (int hu=0;hu<this.vSmallestRatio.length;hu++){ @@ -523,11 +528,6 @@ public class Material { } } - public Material(String string, MaterialState solid, TextureSet setShiny, int i, short[] s, int j, int k, int l, - int m, boolean b, String string2, int n) { - // TODO Auto-generated constructor stub - } - public final TextureSet getTextureSet() { synchronized(this) { return textureSet; @@ -860,10 +860,9 @@ public class Material { ItemStack a1 = getOre(1); Item a2 = a1.getItem(); Block a3 = Block.getBlockFromItem(a2); - - //Logger.DEBUG_MATERIALS("[Invalid Ore] Is a1 valid? "+(a1 != null)); - //Logger.DEBUG_MATERIALS("[Invalid Ore] Is a2 valid? "+(a2 != null)); - //Logger.DEBUG_MATERIALS("[Invalid Ore] Is a3 valid? "+(a3 != null)); + if (a3 != null) { + return a3; + } Block x = Block.getBlockFromItem(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ore"+Utils.sanitizeString(this.unlocalizedName), stacksize).getItem()); if (x != null){ @@ -1095,96 +1094,41 @@ public class Material { if (this.materialState == MaterialState.ORE){ return null; } + + Fluid aGTBaseFluid = null; - final Materials isValid = Materials.get(this.getLocalizedName()); - //Logger.MATERIALS("Is "+this.getLocalizedName()+" a Gregtech material? "+(isValid != null && isValid != Materials._NULL)+" | Found "+isValid.mDefaultLocalName); - if (isValid != Materials._NULL){ - for (Materials m : invalidMaterials.values()){ - if (isValid == m){ - Logger.MATERIALS("Trying to generate a fluid for blacklisted material: "+m.mDefaultLocalName); - FluidStack a1 = m.getFluid(1); - FluidStack a2 = m.getGas(1); - FluidStack a3 = m.getMolten(1); - FluidStack a4 = m.getSolid(1); - FluidStack a5 = m.getPlasma(1); - if (a1 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Fluid."); - return a1.getFluid(); - } - if (a2 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Gas."); - return a2.getFluid(); - } - if (a3 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Molten."); - return a3.getFluid(); - } - if (a4 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Solid."); - return a4.getFluid(); - } - if (a5 != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. Plasma."); - return a5.getFluid(); - } - Logger.MATERIALS("Using null."); - return null; - } - } - } - - if (this.materialState == MaterialState.SOLID){ - if (isValid.mFluid != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mFluid."); - return isValid.mFluid; - } - else if (isValid.mStandardMoltenFluid != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); - return isValid.mStandardMoltenFluid; - } - } - else if (this.materialState == MaterialState.GAS){ - if (isValid.mGas != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mGas."); - return isValid.mGas; - } - } - else if (this.materialState == MaterialState.LIQUID || this.materialState == MaterialState.PURE_LIQUID){ - if (isValid.mFluid != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mFluid."); - return isValid.mFluid; - } - else if (isValid.mGas != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mGas."); - return isValid.mGas; - } - else if (isValid.mStandardMoltenFluid != null){ - Logger.MATERIALS("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); - return isValid.mStandardMoltenFluid; - } - } + // Clean up Internal Fluid Generation + final Materials n1 = MaterialUtils.getMaterial(this.getLocalizedName(), Utils.sanitizeString(this.getLocalizedName())); + final Materials n2 = MaterialUtils.getMaterial(this.getUnlocalizedName(), Utils.sanitizeString(this.getUnlocalizedName())); - FluidStack aTest1 = FluidUtils.getFluidStack("molten."+Utils.sanitizeString(this.getLocalizedName()), 1); - FluidStack aTest2 = FluidUtils.getFluidStack("fluid."+Utils.sanitizeString(this.getLocalizedName()), 1); - FluidStack aTest3 = FluidUtils.getFluidStack(Utils.sanitizeString(this.getLocalizedName()), 1); + FluidStack f1 = FluidUtils.getWildcardFluidStack(n1, 1); + FluidStack f2 = FluidUtils.getWildcardFluidStack(n2, 1); + FluidStack f3 = FluidUtils.getWildcardFluidStack(Utils.sanitizeString(this.getUnlocalizedName(), new char[] {'-', '_'}), 1); + FluidStack f4 = FluidUtils.getWildcardFluidStack(Utils.sanitizeString(this.getLocalizedName(), new char[] {'-', '_'}), 1); - if (aTest1 != null) { - Logger.MATERIALS("Found FluidRegistry entry for "+"molten."+Utils.sanitizeString(this.getLocalizedName())); - return aTest1.getFluid(); + if (f1 != null) { + aGTBaseFluid = f1.getFluid(); + } + else if (f2 != null) { + aGTBaseFluid = f2.getFluid(); } - if (aTest2 != null) { - Logger.MATERIALS("Found FluidRegistry entry for "+"fluid."+Utils.sanitizeString(this.getLocalizedName())); - return aTest2.getFluid(); + else if (f3 != null) { + aGTBaseFluid = f3.getFluid(); } - if (aTest3 != null) { - Logger.MATERIALS("Found FluidRegistry entry for "+Utils.sanitizeString(this.getLocalizedName())); - return aTest3.getFluid(); + else if (f4 != null) { + aGTBaseFluid = f4.getFluid(); } + ItemStack aFullCell = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1); + ItemStack aFullCell2 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getLocalizedName(), 1); + ItemStack aFullCell3 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+Utils.sanitizeString(this.getUnlocalizedName(), new char[] {'-', '_'}), 1); + ItemStack aFullCell4 = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+Utils.sanitizeString(this.getLocalizedName(), new char[] {'-', '_'}), 1); + Logger.MATERIALS("Generating our own fluid."); - //Generate a Cell if we need to - if (aFullCell == null){ + //Generate a Cell if we need to, but first validate all four searches are invalid + + if (!ItemUtils.checkForInvalidItems(new ItemStack[] {aFullCell, aFullCell2, aFullCell3, aFullCell4})){ if (this.vGenerateCells){ Item g = new BaseItemCell(this); aFullCell = ItemUtils.getSimpleStack(g); @@ -1194,7 +1138,29 @@ public class Material { Logger.MATERIALS("Did not generate a cell for "+this.getUnlocalizedName()); } } + else { + // One cell we searched for was valid, let's register it. + if (aFullCell != null) { + this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell); + } + else if (aFullCell2 != null) { + this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell2); + } + else if (aFullCell3 != null) { + this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell3); + } + else if (aFullCell4 != null) { + this.registerComponentForMaterial(ComponentTypes.CELL, aFullCell4); + } + } + // We found a GT fluid, let's use it. + // Good chance we registered the cell from this material too. + if (aGTBaseFluid != null) { + return aGTBaseFluid; + } + + // This fluid does not exist at all, time to generate it. if (this.materialState == MaterialState.SOLID){ return FluidUtils.addGTFluid( this.getUnlocalizedName(), @@ -1334,7 +1300,17 @@ public class Material { } + public boolean registerComponentForMaterial(FluidStack aStack) { + return registerComponentForMaterial(this, aStack); + } + private static boolean registerComponentForMaterial(Material componentMaterial, FluidStack aStack) { + if (componentMaterial != null && aStack != null && componentMaterial.vMoltenFluid == null) { + componentMaterial.vMoltenFluid = aStack.getFluid(); + return true; + } + return false; + } public boolean registerComponentForMaterial(ComponentTypes aPrefix, ItemStack aStack) { return registerComponentForMaterial(this, aPrefix.getGtOrePrefix(), aStack); diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java index 44c02bc70d..20fdfd3c8c 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -2,13 +2,6 @@ package gtPlusPlus.core.material; import java.util.Set; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.Recipe_GT; - import gtPlusPlus.api.interfaces.RunnableWithInfo; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; @@ -24,7 +17,11 @@ import gtPlusPlus.core.item.base.gears.BaseItemGear; import gtPlusPlus.core.item.base.ingots.BaseItemIngot; import gtPlusPlus.core.item.base.ingots.BaseItemIngotHot; import gtPlusPlus.core.item.base.nugget.BaseItemNugget; -import gtPlusPlus.core.item.base.ore.*; +import gtPlusPlus.core.item.base.ore.BaseItemCentrifugedCrushedOre; +import gtPlusPlus.core.item.base.ore.BaseItemCrushedOre; +import gtPlusPlus.core.item.base.ore.BaseItemImpureDust; +import gtPlusPlus.core.item.base.ore.BaseItemPurifiedCrushedOre; +import gtPlusPlus.core.item.base.ore.BaseItemPurifiedDust; import gtPlusPlus.core.item.base.plates.BaseItemPlate; import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; import gtPlusPlus.core.item.base.rings.BaseItemRing; @@ -36,7 +33,21 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.gregtech.loaders.*; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_AlloySmelter; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Assembler; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_BlastSmelter; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Extruder; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_FluidCanning; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Fluids; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_MaterialProcessing; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Ore; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Plates; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_ShapedCrafting; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public class MaterialGenerator { @@ -48,21 +59,36 @@ public class MaterialGenerator { @SuppressWarnings("unused") private static volatile Block tempBlock; - public static void addFluidExtractionRecipe(ItemStack a, Object b, FluidStack c, int a1, int a2, int a3) { - GT_Recipe r = new Recipe_GT( - true, - new ItemStack[] {a, b != null ? (ItemStack) b : null}, - new ItemStack[] {}, - null, - new int[] {}, - new FluidStack[] {}, - new FluidStack[] {c}, - a2, a3, a1); - new RecipeGen_FluidCanning(r, true); + + public static boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid) { + return addFluidExtractionRecipe(aEmpty, aRemains, aFluid, null, null); } - public static void addFluidCannerRecipe(ItemStack aFullContainer, ItemStack aEmpty, FluidStack rFluidIn, FluidStack rFluidOut) { - GT_Recipe r = new Recipe_GT( + /** + * Called Reflectively from CORE.RA.addFluidExtractionRecipe + * @param aSpecial + * @return + */ + public static boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid, Integer aDuration, Integer aEU) { + RecipeGen_FluidCanning g = new RecipeGen_FluidCanning(true, aEmpty, aRemains, aFluid, aDuration, aEU); + if (g != null && g.valid()) { + //Logger.INFO("[FIND] Adding Extraction recipe for "+ItemUtils.getItemName(aEmpty)+", "+ItemUtils.getItemName(aRemains)+", "+ItemUtils.getFluidName(aFluid)); + return true; + } + Logger.INFO("[ERROR] FAILED adding Extraction recipe for "+ItemUtils.getItemName(aEmpty)+", "+ItemUtils.getItemName(aRemains)+", "+ItemUtils.getFluidName(aFluid)); + return false; + } + + + public static boolean addFluidCannerRecipe(ItemStack aEmpty, ItemStack aFullContainer, FluidStack aFluidIn, FluidStack rFluidOut) { + return addFluidCannerRecipe(aEmpty, aFullContainer, aFluidIn, rFluidOut, null, null); + } + /** + * Called Reflectively from CORE.RA.addFluidCannerRecipe + * @return + */ + public static boolean addFluidCannerRecipe(ItemStack aEmpty, ItemStack aFullContainer, FluidStack aFluidIn, FluidStack rFluidOut, Integer aTime, Integer aEu) { + /*GT_Recipe r = new Recipe_GT( true, new ItemStack[] {aEmpty}, new ItemStack[] {aFullContainer}, @@ -70,12 +96,13 @@ public class MaterialGenerator { new int[] {}, new FluidStack[] {rFluidIn}, new FluidStack[] {rFluidOut}, - 0, 0, 0); - new RecipeGen_FluidCanning(r, false); - } - - public static void generateFluidExtractorRecipe(GT_Recipe recipe, boolean extracting) { - new RecipeGen_FluidCanning(recipe, extracting); + 0, 0, 0);*/ + //new RecipeGen_FluidCanning(r, false); + RecipeGen_FluidCanning g = new RecipeGen_FluidCanning(false, aEmpty, aFullContainer, aFluidIn, null, null, 0); + if (g != null && g.valid()) { + return true; + } + return false; } public static void generate(final Material matInfo){ diff --git a/src/Java/gtPlusPlus/core/material/ORES.java b/src/Java/gtPlusPlus/core/material/ORES.java index 0e1691a557..c2556b60f1 100644 --- a/src/Java/gtPlusPlus/core/material/ORES.java +++ b/src/Java/gtPlusPlus/core/material/ORES.java @@ -90,9 +90,10 @@ public final class ORES { -1, -1, //Radiation new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().LEAD, 1), - new MaterialStack(ELEMENT.getInstance().CHROMIUM, 1), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 4) + new MaterialStack(ELEMENT.getInstance().LEAD, 2), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 2), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), + new MaterialStack(ELEMENT.getInstance().CAESIUM, 1), }); public static final Material NICHROMITE = new Material( @@ -126,7 +127,10 @@ public final class ORES { -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), //Y not YT/YB - new MaterialStack(ELEMENT.getInstance().OXYGEN, 3) + new MaterialStack(ELEMENT.getInstance().OXYGEN, 3), + new MaterialStack(ELEMENT.getInstance().IRON, 4), + new MaterialStack(ELEMENT.getInstance().TIN, 1), + new MaterialStack(ELEMENT.getInstance().NITROGEN, 2) }); //Samarskite_Y @@ -260,6 +264,7 @@ public final class ORES { -1, //Radiation new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().YTTRIUM, 1), + new MaterialStack(ELEMENT.getInstance().YTTERBIUM, 1), new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 1), new MaterialStack(ELEMENT.getInstance().OXYGEN, 4) }); @@ -794,6 +799,21 @@ public final class ORES { new MaterialStack(ELEMENT.getInstance().SULFUR, 16), new MaterialStack(ELEMENT.getInstance().OXYGEN, 15) }); + + public static final Material GREENOCKITE = new Material( + "Greenockite", //Material Name + MaterialState.ORE, //State + TextureSets.GEM_A.get(), //Texture Set + new short[]{110, 193, 25, 0}, //Material Colour + -1, + -1, + -1, + -1, + -1, //Radiation + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().CADMIUM, 2), + new MaterialStack(ELEMENT.getInstance().SULFUR, 2), + }); public static final Material DEEP_EARTH_REACTOR_FUEL_DEPOSIT = new Material( diff --git a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java index b7a5f6074d..bfa08d3c29 100644 --- a/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java +++ b/src/Java/gtPlusPlus/core/material/nuclear/FLUORIDES.java @@ -3,6 +3,7 @@ package gtPlusPlus.core.material.nuclear; import gregtech.api.enums.Materials; import gregtech.api.enums.TextureSet; import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.state.MaterialState; @@ -166,54 +167,6 @@ public class FLUORIDES { //LFTR sub components - //OH - public static final Material HYDROXIDE = new Material( - "Hydroxide", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().OXYGEN, 1), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1) - }); - - //NH3 - public static final Material AMMONIA = new Material( - "Ammonia", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -77, //Melting Point in C - -33, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NITROGEN, 1), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 3) - }); - - //NH4 - public static final Material AMMONIUM = new Material( - "Ammonium", //Material Name - MaterialState.PURE_LIQUID, //State - null, //Material Colour - -1, //Melting Point in C - -1, //Boiling Point in C - -1, //Protons - -1, - false, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NITROGEN, 1), - new MaterialStack(ELEMENT.getInstance().HYDROGEN, 4) - }); - //(NH4)HF2 public static final Material AMMONIUM_BIFLUORIDE = new Material( "Ammonium Bifluoride", //Material Name @@ -226,7 +179,7 @@ public class FLUORIDES { false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(FLUORIDES.AMMONIUM, 1), + new MaterialStack(MISC_MATERIALS.AMMONIUM, 1), new MaterialStack(ELEMENT.getInstance().HYDROGEN, 1), new MaterialStack(ELEMENT.getInstance().FLUORINE, 2) }); @@ -244,7 +197,7 @@ public class FLUORIDES { //Material Stacks with Percentage of required elements. new MaterialStack[]{ new MaterialStack(ELEMENT.getInstance().BERYLLIUM, 1), - new MaterialStack(FLUORIDES.HYDROXIDE, 2) + new MaterialStack(MISC_MATERIALS.HYDROXIDE, 2) }); // (NH4)2Be(OH)2 / (NH4)2BeF4 @@ -259,7 +212,7 @@ public class FLUORIDES { false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(FLUORIDES.AMMONIUM, 2), + new MaterialStack(MISC_MATERIALS.AMMONIUM, 2), new MaterialStack(FLUORIDES.BERYLLIUM_HYDROXIDE, 1) }); diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index 71befe0a37..2372762e0d 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -1,9 +1,5 @@ package gtPlusPlus.core.proxy; -import java.net.URL; -import java.util.HashSet; -import java.util.Scanner; - import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Optional; @@ -17,6 +13,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.australia.entity.model.ModelBoar; import gtPlusPlus.australia.entity.model.ModelDingo; import gtPlusPlus.australia.entity.model.ModelOctopus; @@ -29,6 +26,7 @@ import gtPlusPlus.australia.entity.type.EntityBoar; import gtPlusPlus.australia.entity.type.EntityDingo; import gtPlusPlus.australia.entity.type.EntityOctopus; import gtPlusPlus.core.client.model.ModelGiantChicken; +import gtPlusPlus.core.client.renderer.CustomItemBlockRenderer; import gtPlusPlus.core.client.renderer.CustomOreBlockRenderer; import gtPlusPlus.core.client.renderer.RenderBatKing; import gtPlusPlus.core.client.renderer.RenderDecayChest; @@ -61,11 +59,13 @@ import gtPlusPlus.core.util.minecraft.particles.EntityParticleFXMysterious; import gtPlusPlus.xmod.gregtech.common.render.GTPP_CapeRenderer; import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; import net.minecraft.client.Minecraft; -import net.minecraft.client.model.ModelBat; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.entity.RenderFireball; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.entity.Entity; +import net.minecraft.item.Item; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.MinecraftForgeClient; public class ClientProxy extends CommonProxy implements Runnable{ @@ -113,6 +113,7 @@ public class ClientProxy extends CommonProxy implements Runnable{ * Custom Block Renderers */ new CustomOreBlockRenderer(); + new CustomItemBlockRenderer(); new GTPP_Render_MachineBlock(); super.init(e); @@ -164,6 +165,20 @@ public class ClientProxy extends CommonProxy implements Runnable{ RenderingRegistry.registerEntityRenderingHandler(EntityBoar.class, new RenderBoar(new ModelBoar(), new ModelBoar(0.5F), 0.7F)); RenderingRegistry.registerEntityRenderingHandler(EntityDingo.class, new RenderDingo(new ModelDingo(), new ModelDingo(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityOctopus.class, new RenderOctopus(new ModelOctopus(), 0.7F)); + + + + + + + + /** + * Items + */ + for (Pair<Item, IItemRenderer> sItemRenderMappings : mItemRenderMappings) { + MinecraftForgeClient.registerItemRenderer(sItemRenderMappings.getKey(), sItemRenderMappings.getValue()); + } + } @Override diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index b6d41443ef..14858b15aa 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -2,9 +2,9 @@ package gtPlusPlus.core.recipe; import static gtPlusPlus.core.lib.CORE.GTNH; +import java.util.ArrayList; + import cpw.mods.fml.common.Loader; -import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -27,8 +27,6 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.MISC_MATERIALS; -import gtPlusPlus.core.material.MaterialStack; -import gtPlusPlus.core.material.NONMATERIAL; import gtPlusPlus.core.material.ORES; import gtPlusPlus.core.material.Particle; import gtPlusPlus.core.material.nuclear.FLUORIDES; @@ -46,6 +44,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; public class RECIPES_GREGTECH { @@ -92,24 +91,25 @@ public class RECIPES_GREGTECH { latheRecipes(); vacuumFreezerRecipes(); fluidheaterRecipes(); - - + + /** * Special Recipe handlers */ RECIPES_SeleniumProcessing.init(); - - - - - + RECIPES_RareEarthProcessing.init(); + + + + + addFuels(); } private static void fluidheaterRecipes() { GT_Values.RA.addFluidHeaterRecipe(CI.getNumberedCircuit(20), FluidUtils.getWater(1000), FluidUtils.getHotWater(1000), 30, 30); - + } private static void vacuumFreezerRecipes() { @@ -274,6 +274,35 @@ public class RECIPES_GREGTECH { 20 * 60 * 1 * (GTNH ? 2 : 1), (int) GT_Values.V[5]); + // Turbine Automation Port + CORE.RA.addAssemblylineRecipe( + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_8_TURBINE_AUTOMATION, 1), + 20 * 60 * 60 * 24, + new ItemStack[] { + CI.getTieredMachineHull(8, 4), + CI.getConveyor(8, GTNH ? 24 : 12), + CI.getElectricMotor(7, GTNH ? 32 : 16), + CI.getElectricPiston(7, GTNH ? 16 : 4), + CI.getEnergyCore(6, GTNH ? 8 : 2), + CI.getPlate(8, GTNH ? 24 : 12), + CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 48 : 24), + CI.getTieredComponent(OrePrefixes.bolt, 7, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.rod, 6, GTNH ? 12 : 6), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 20 : 10), + CI.getTieredComponent(OrePrefixes.rotor, 6, GTNH ? 16 : 8), + }, + new FluidStack[] { + CI.getTieredFluid(8, 144 * 32), + CI.getAlternativeTieredFluid(7, 144 * 16), + CI.getTertiaryTieredFluid(7, 144 * 16), + ALLOY.BABBIT_ALLOY.getFluid(128 * 144), + ALLOY.ZERON_100.getFluid(144 * 64) + + }, + GregtechItemList.Hatch_Input_TurbineHousing.get(4), + 20 * 60 * 60 * (GTNH ? 2 : 1), + (int) GT_Values.V[8]); + /* * Contianment casings @@ -358,88 +387,116 @@ public class RECIPES_GREGTECH { } - //Nano Healer - CORE.RA.addAssemblylineRecipe( - ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), - 20 * 60 * 10, - new ItemStack[] { - ItemUtils.getSimpleStack(aGemCasings[2], GTNH ? 4 : 2), - CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), - CI.getTieredComponent(OrePrefixes.cableGt02, 7, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.gearGt, 6, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.screw, 7, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.bolt, 5, GTNH ? 24 : 12), - CI.getTieredComponent(OrePrefixes.frameGt, 4, GTNH ? 12 : 6), - aCoilWire[3] - }, - new FluidStack[] { - CI.getTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - CI.getTertiaryTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(6, 144 * 18 * (GTNH ? 16 : 8)), - CI.getAlternativeTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - - }, - ItemUtils.getItemStackFromFQRN("miscutils:personalHealingDevice", 1), - 20 * 60 * 30 * (GTNH ? 2 : 1), - (int) GT_Values.V[7]); - - - - //Charge Pack LuV-UV - - ItemStack[] aChargeResearch = new ItemStack[] { - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 1), - }; - - ItemStack[] aChargeOutputs = new ItemStack[] { - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 1), - ItemUtils.getSimpleStack(ModItems.itemChargePack_High_4, 1), - }; + if (LoadedMods.Baubles) { + //Nano Healer + CORE.RA.addAssemblylineRecipe( + ItemUtils.simpleMetaStack(Items.golden_apple, 1, 1), + 20 * 60 * 10, + new ItemStack[] { + ItemUtils.getSimpleStack(aGemCasings[2], GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), + CI.getTieredComponent(OrePrefixes.cableGt02, 7, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.gearGt, 6, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.screw, 7, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.bolt, 5, GTNH ? 24 : 12), + CI.getTieredComponent(OrePrefixes.frameGt, 4, GTNH ? 12 : 6), + aCoilWire[3] + }, + new FluidStack[] { + CI.getTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), + CI.getTertiaryTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(6, 144 * 18 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), - ItemStack[] aBufferCoreInputs = new ItemStack[] { - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", GTNH ? 8 : 4), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore8", GTNH ? 8 : 4), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore9", GTNH ? 8 : 4), - ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore10", GTNH ? 8 : 4), - }; + }, + ItemUtils.getItemStackFromFQRN("miscutils:personalHealingDevice", 1), + 20 * 60 * 30 * (GTNH ? 2 : 1), + (int) GT_Values.V[7]); + + + + //Charge Pack LuV-UV + + ItemStack[] aChargeResearch = new ItemStack[] { + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 1), + }; + + ItemStack[] aChargeOutputs = new ItemStack[] { + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_1, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_2, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_3, 1), + ItemUtils.getSimpleStack(ModItems.itemChargePack_High_4, 1), + }; + + ItemStack[] aBufferCoreInputs = new ItemStack[] { + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore7", GTNH ? 8 : 4), + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore8", GTNH ? 8 : 4), + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore9", GTNH ? 8 : 4), + ItemUtils.getItemStackFromFQRN("miscutils:item.itemBufferCore10", GTNH ? 8 : 4), + }; + + int aCurrSlot = 0; + for (int h = 6; h < 10; h++) { + CORE.RA.addAssemblylineRecipe( + aChargeResearch[aCurrSlot], + 20 * 60 * 10 * (aCurrSlot + 1), + new ItemStack[] { + ItemUtils.getSimpleStack( + aGemBatteries[aCurrSlot], GTNH ? 4 : 2), + aBufferCoreInputs[aCurrSlot], + aCoilWire[aCurrSlot], + CI.getTieredComponent(OrePrefixes.plate, h, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.plate, h-1, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, h, GTNH ? 16 : 4), + CI.getTieredComponent(OrePrefixes.circuit, h-1, GTNH ? 32 : 8), + CI.getTieredComponent(OrePrefixes.cableGt12, h-1, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.screw, h, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.bolt, h-2, GTNH ? 32 : 16), + CI.getElectricMotor(h, GTNH ? 8 : 4), + CI.getFieldGenerator(h-1, 2), + CI.getRobotArm(h-2, GTNH ? 4 : 2), + }, + new FluidStack[] { + CI.getTieredFluid(h, 144 * 18 * (GTNH ? 8 : 4)), + CI.getTertiaryTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), + CI.getAlternativeTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), + CI.getAlternativeTieredFluid(h-2, 144 * 18 * (GTNH ? 8 : 4)), + }, + aChargeOutputs[aCurrSlot], + 20 * 60 * 30 * (GTNH ? 2 : 1) * (aCurrSlot+1), + (int) GT_Values.V[h]); + aCurrSlot++; + } - int aCurrSlot = 0; - for (int h = 6; h < 10; h++) { + //Cloaking device CORE.RA.addAssemblylineRecipe( - aChargeResearch[aCurrSlot], - 20 * 60 * 10 * (aCurrSlot + 1), + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_9_CLOAKING, 1), + 20 * 60 * 10, new ItemStack[] { - ItemUtils.getSimpleStack( - aGemBatteries[aCurrSlot], GTNH ? 4 : 2), - aBufferCoreInputs[aCurrSlot], - aCoilWire[aCurrSlot], - CI.getTieredComponent(OrePrefixes.plate, h, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.plate, h-1, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.circuit, h, GTNH ? 16 : 4), - CI.getTieredComponent(OrePrefixes.circuit, h-1, GTNH ? 32 : 8), - CI.getTieredComponent(OrePrefixes.cableGt12, h-1, GTNH ? 32 : 16), - CI.getTieredComponent(OrePrefixes.screw, h, GTNH ? 16 : 8), - CI.getTieredComponent(OrePrefixes.bolt, h-2, GTNH ? 32 : 16), - CI.getElectricMotor(h, GTNH ? 8 : 4), - CI.getFieldGenerator(h-1, 2), - CI.getRobotArm(h-2, GTNH ? 4 : 2), + ItemUtils.getSimpleStack(aGemCasings[3], GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.plate, 8, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, 7, GTNH ? 16 : 4), + CI.getTieredComponent(OrePrefixes.cableGt04, 8, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.gearGt, 7, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.bolt, 7, GTNH ? 24 : 12), + CI.getTieredComponent(OrePrefixes.frameGt, 5, GTNH ? 12 : 6), + aCoilWire[3] }, new FluidStack[] { - CI.getTieredFluid(h, 144 * 18 * (GTNH ? 8 : 4)), - CI.getTertiaryTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), - CI.getAlternativeTieredFluid(h-1, 144 * 18 * (GTNH ? 8 : 4)), - CI.getAlternativeTieredFluid(h-2, 144 * 18 * (GTNH ? 8 : 4)), + CI.getTieredFluid(8, 144 * 18 * (GTNH ? 16 : 8)), + CI.getTertiaryTieredFluid(8, 144 * 18 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(7, 144 * 18 * (GTNH ? 16 : 8)), + CI.getAlternativeTieredFluid(8, 144 * 18 * (GTNH ? 16 : 8)), + }, - aChargeOutputs[aCurrSlot], - 20 * 60 * 30 * (GTNH ? 2 : 1) * (aCurrSlot+1), - (int) GT_Values.V[h]); - aCurrSlot++; + ItemUtils.getItemStackFromFQRN("miscutils:personalCloakingDevice", 1), + 20 * 60 * 30 * (GTNH ? 2 : 1), + (int) GT_Values.V[8]); } @@ -722,16 +779,36 @@ public class RECIPES_GREGTECH { 480*4); + //Wood's Glass Laser Lens + CORE.RA.addBlastSmelterRecipe( + new ItemStack[] { + ItemUtils.getGregtechCircuit(5), + ItemList.Shape_Mold_Ball.get(0), + ELEMENT.getInstance().BARIUM.getDust(1), + ELEMENT.getInstance().SODIUM.getDust(1), + ELEMENT.getInstance().SILICON.getDust(2), + ELEMENT.getInstance().NICKEL.getDust(1), + ItemUtils.getItemStackOfAmountFromOreDict("dustGlass", 5) + }, + FluidUtils.getUUM(1000), + null, + new ItemStack[] { + GregtechItemList.Laser_Lens_WoodsGlass.get(1) + }, + new int[] {10000}, + 20 * 300, + (int) GT_Values.V[3]); + } private static void fluidcannerRecipes() { // Sulfuric Acid - GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), + CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), ItemUtils.getSimpleStack(ModItems.itemSulfuricPotion), FluidUtils.getFluidStack("sulfuricacid", 250), null); - GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemSulfuricPotion), + CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemSulfuricPotion), ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("sulfuricacid", 250)); @@ -741,31 +818,49 @@ public class RECIPES_GREGTECH { // Try use Internal GT Fluid first if (Utils.getGregtechVersionAsInt() >= 50929) { // Hydrofluoric Acid - GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), + CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 250), null); - addedGtExtraction = GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), + addedGtExtraction = CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 250)); } //Add a Fill recipe for GT++ Acid - GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), + CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(Items.glass_bottle), ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), FluidUtils.getFluidStack("hydrofluoricacid", 125), null); //Add an empty recipe, but only if we didn't for the standard GT HF. Prevents Fluid transformation exploits. - if (!addedGtExtraction) - GT_Values.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), - ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("hydrofluoricacid", 125)); + if (!addedGtExtraction) { + CORE.RA.addFluidCannerRecipe(ItemUtils.getSimpleStack(ModItems.itemHydrofluoricPotion), ItemUtils.getSimpleStack(Items.glass_bottle), null, FluidUtils.getFluidStack("hydrofluoricacid", 125)); + } + //Gelid Cryotheum + CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustCryotheum", 1), FluidUtils.getFluidStack("cryotheum", 250), 200, 240); + + //Ender Fluid + CORE.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), FluidUtils.getFluidStack("ender", 250), 100, 30); + + //Blazing Pyrotheum + CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustPyrotheum", 1), FluidUtils.getFluidStack("pyrotheum", 250), 200, 240); + } private static void cokeOvenRecipes() { Logger.INFO("Loading Recipes for Industrial Coking Oven."); - - // Wood to Charcoal - AddGregtechRecipe.addCokeAndPyrolyseRecipes(GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 20L), 20, - GT_ModHandler.getSteam(1000), GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 24L), - FluidUtils.getFluidStack("fluid.coalgas", 1440), 60, 30); + // Wood to Charcoal + //Try use all woods found + ArrayList<ItemStack> aLogData = OreDictionary.getOres("logWood"); + if (aLogData.isEmpty()) { + AddGregtechRecipe.addCokeAndPyrolyseRecipes(GT_OreDictUnificator.get(OrePrefixes.log, Materials.Wood, 20L), 20, + GT_ModHandler.getSteam(1000), GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 24L), + FluidUtils.getFluidStack("fluid.coalgas", 1440), 60, 30); } + else { + for (ItemStack stack : aLogData) { + AddGregtechRecipe.addCokeAndPyrolyseRecipes(ItemUtils.getSimpleStack(stack, 20), 20, + GT_ModHandler.getSteam(1000), GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 24L), + FluidUtils.getFluidStack("fluid.coalgas", 1440), 60, 30); + } + } // Coal to Coke AddGregtechRecipe.addCokeAndPyrolyseRecipes(GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 16L), 22, @@ -1334,41 +1429,50 @@ public class RECIPES_GREGTECH { CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {ItemUtils.getSimpleStack(Items.nether_star), ItemUtils.getItemStackOfAmountFromOreDict("plateTungstenSteel", 8), ItemUtils.getItemStackOfAmountFromOreDict("stickBlackSteel", 8)}, null, ItemUtils.getSimpleStack(ModBlocks.blockWitherGuard, 32), 30*20, 500); + ItemStack aFluidReg1 = Utils.getValueOfItemList("FluidRegulator_LV", ItemList.Pump_LV).get(1); + ItemStack aFluidReg2 = Utils.getValueOfItemList("FluidRegulator_MV", ItemList.Pump_MV).get(1); + ItemStack aFluidReg3 = Utils.getValueOfItemList("FluidRegulator_HV", ItemList.Pump_HV).get(1); + ItemStack aFluidReg4 = Utils.getValueOfItemList("FluidRegulator_EV", ItemList.Pump_EV).get(1); CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.electricPump_LV, + aFluidReg1, CI.electricMotor_LV, - ItemUtils.getItemStackOfAmountFromOreDict("circuitBasic", 2), + CI.getTieredComponent(OrePrefixes.bolt, 1, GTNH ? 8 : 4), ItemUtils.getItemStackOfAmountFromOreDict("ringBrass", 1), ItemUtils.getItemStackOfAmountFromOreDict("stickBrass", 1), ItemUtils.getItemStackOfAmountFromOreDict("plateSteel", 2) }, null, ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 1, 1), 10*20, 30); CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.electricPump_MV, + aFluidReg2, CI.electricMotor_MV, - ItemUtils.getItemStackOfAmountFromOreDict("circuitAdvanced", 2), + CI.getTieredComponent(OrePrefixes.bolt, 2, GTNH ? 8 : 4), ItemUtils.getItemStackOfAmountFromOreDict("ringInvar", 1), ItemUtils.getItemStackOfAmountFromOreDict("stickInvar", 1), ItemUtils.getItemStackOfAmountFromOreDict("plateAluminium", 2) }, null, ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 2, 1), 10*20*2, 120); CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.electricPump_HV, + aFluidReg3, CI.electricMotor_HV, - ItemUtils.getItemStackOfAmountFromOreDict("circuitData", 2), + CI.getTieredComponent(OrePrefixes.bolt, 3, GTNH ? 8 : 4), ItemUtils.getItemStackOfAmountFromOreDict("ringChrome", 1), ItemUtils.getItemStackOfAmountFromOreDict("stickChrome", 1), ItemUtils.getItemStackOfAmountFromOreDict("plateStainlessSteel", 2) }, null, ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 3, 1), 10*20*3, 480); CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.electricPump_EV, + aFluidReg4, CI.electricMotor_EV, - ItemUtils.getItemStackOfAmountFromOreDict("circuitElite", 2), + CI.getTieredComponent(OrePrefixes.bolt, 4, GTNH ? 8 : 4), ItemUtils.getItemStackOfAmountFromOreDict("ringTitanium", 1), ItemUtils.getItemStackOfAmountFromOreDict("stickTitanium", 1), ItemUtils.getItemStackOfAmountFromOreDict("plateTungstenSteel", 2) }, null, ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 4, 1), 10*20*4, 1960); + GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 1, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1000, 1), 30, 30); + GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 2, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1001, 1), 120, 120); + GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 3, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1002, 1), 480, 480); + GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 4, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1003, 1), 1820, 1820); + @@ -1417,11 +1521,11 @@ public class RECIPES_GREGTECH { ItemUtils.getSimpleStack(ModItems.itemChargePack_Low_4), ItemUtils.getSimpleStack(ModItems.itemChargePack_Low_5) }; - + for (int i = 1; i < 6; i++) { - + int aAS = i-1; - + CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { aPackPlates[aAS], @@ -1430,27 +1534,74 @@ public class RECIPES_GREGTECH { aPackCircuit[aAS], aPackBatteries[aAS], CI.getSensor(i, GTNH ? 4 : 2), - }, + }, CI.getTieredFluid(i, (144 * (GTNH ? 4 : 2))), aPackOutput[aAS], 30 * 20 * i, (int) GT_Values.V[i]); } - + if (!GTNH) { - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.WroughtIron, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 2L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Bronze, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 2L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Brass, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 2L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Invar, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 2L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); - - } else { - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.WroughtIron, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 4L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bronze, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 4L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Brass, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 4L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); - GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Invar, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 4L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); - } + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.WroughtIron, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 2L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Bronze, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 2L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Brass, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 2L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plateDouble, Materials.Invar, 1L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 2L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); + + } else { + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.WroughtIron, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.WroughtIron, 4L), GregtechItemList.Fluid_Cell_1L.get(1L, new Object[0]), 50, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Bronze, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Bronze, 4L), GregtechItemList.Fluid_Cell_16L.get(1L, new Object[0]), 50, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Brass, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Brass, 4L), GregtechItemList.Fluid_Cell_36L.get(1L, new Object[0]), 75, 32); + GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Invar, 8L), GT_OreDictUnificator.get(OrePrefixes.ring, Materials.Invar, 4L), GregtechItemList.Fluid_Cell_144L.get(1L, new Object[0]), 75, 32); + } + } + + + if (LoadedMods.Baubles) { + + + + // Turbine Housing Research Page + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + ItemUtils.getGregtechCircuit(17), + ItemUtils.getItemStackOfAmountFromOreDict("plateRefinedTrinium", GTNH ? 64 : 32), + CI.getSensor(6, GTNH ? 6 : 3), + CI.getBolt(7, GTNH ? 64 : 32), + ItemUtils.getItemStackOfAmountFromOreDict("wireFinePlatinum", GTNH ? 64 : 32), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(7), GTNH ? 12 : 6) + }, + CI.getAlternativeTieredFluid(7, 144 * 32), + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_8_TURBINE_AUTOMATION, 1), + 20 * 60 * 5, + (int) GT_Values.V[6]); + + // Cloaking Device Research Page + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + ItemUtils.getGregtechCircuit(17), + ItemUtils.getSimpleStack(ModItems.itemCircuitLFTR, 4), + CI.getFieldGenerator(6, GTNH ? 16 : 8), + ItemUtils.getItemStackOfAmountFromOreDict("wireFinePalladium", GTNH ? 32 : 16), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(6), GTNH ? 12 : 6) + }, + CI.getAlternativeTieredFluid(7, 144 * 32), + ItemDummyResearch.getResearchStack(ASSEMBLY_LINE_RESEARCH.RESEARCH_9_CLOAKING, 1), + 20 * 60 * 10, + (int) GT_Values.V[7]); + + + // Supreme Pizza Gloves + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + ItemUtils.getGregtechCircuit(19), + ItemUtils.getSimpleStack(ModItems.itemRope, GTNH ? 32 : 16), + ItemUtils.getItemStackOfAmountFromOreDict("gearGtSmallWroughtIron", GTNH ? 8 : 4), + ItemUtils.getItemStackOfAmountFromOreDict("wireFineCopper", GTNH ? 32 : 16), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(1), GTNH ? 2 : 1) + }, + FluidUtils.getFluidStack("molten.rubber", 2000), + ItemUtils.getSimpleStack(ModItems.itemPersonalFireProofDevice), + 20 * 60 * 5, + 30); } @@ -1517,8 +1668,10 @@ public class RECIPES_GREGTECH { new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("nuggetBronze", 1), ItemUtils.getItemStackOfAmountFromOreDict("nuggetElectrum", 1), + ItemUtils.getItemStackOfAmountFromOreDict("nuggetTantalum", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallTungstate", 1), ItemUtils.getSimpleStack(Blocks.obsidian) }, - new int[] { 750, 250, 1850 }, 0); + new int[] { 750, 250, 250, 250, 1850 }, 0); /* * HotFuel.addNewHotFuel( FluidUtils.getFluidStack("ic2hotcoolant", @@ -1547,19 +1700,19 @@ public class RECIPES_GREGTECH { private static void fluidExtractorRecipes() { //FLiBe fuel - GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLi2BeF4", 1), null, - FluidUtils.getFluidStack("li2bef4", 144), 10000, 100, 500); + CORE.RA.addFluidExtractionRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustLi2BeF4", 1), + FluidUtils.getFluidStack("li2bef4", 144), 100, 500); //LFTR Fuel 1 - GT_Values.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4U235.getDust(1), null, - NUCLIDE.LiFBeF2ZrF4U235.getFluid(144), 10000, 250, 1000); - GT_Values.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4UF4.getDust(1), null, - NUCLIDE.LiFBeF2ZrF4UF4.getFluid(144), 10000, 150, 2000); - GT_Values.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ThF4UF4.getDust(1), null, - NUCLIDE.LiFBeF2ThF4UF4.getFluid(144), 10000, 200, 1500); + CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4U235.getDust(1), + NUCLIDE.LiFBeF2ZrF4U235.getFluid(144), 250, 1000); + CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ZrF4UF4.getDust(1), + NUCLIDE.LiFBeF2ZrF4UF4.getFluid(144), 150, 2000); + CORE.RA.addFluidExtractionRecipe(NUCLIDE.LiFBeF2ThF4UF4.getDust(1), + NUCLIDE.LiFBeF2ThF4UF4.getFluid(144), 200, 1500); //ZIRCONIUM_TETRAFLUORIDE - GT_Values.RA.addFluidExtractionRecipe(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(1), null, - FluidUtils.getFluidStack(ModItems.fluidZrF4, 144), 10000, 200, 512+256); + CORE.RA.addFluidExtractionRecipe(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(1), + FluidUtils.getFluidStack(ModItems.fluidZrF4, 144), 200, 512+256); @@ -1600,6 +1753,27 @@ public class RECIPES_GREGTECH { } private static void centrifugeRecipes() { + + //Try use all woods found, fix/add methane extraction. + ArrayList<ItemStack> aLogData = OreDictionary.getOres("logWood"); + ArrayList<ItemStack> aRubberLogs = OreDictionary.getOres("logRubber"); + if (!aLogData.isEmpty() && !aRubberLogs.isEmpty()) { + Logger.INFO("Fixing Methane output of centrifuged logs."); + //First Check to see if it's a rubber log + for (ItemStack stack : aLogData) { + if (aRubberLogs.contains(stack)) { + if (GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, stack), null, null, Materials.Methane.getGas(60L), ItemList.IC2_Resin.get(1L, new Object[0]), GT_ModHandler.getIC2Item("plantBall", 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Carbon, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), null, null, new int[] { 5000, 3750, 2500, 2500 }, 200, 20)) { + Logger.INFO("Added rubber plant based methane extraction for "+ItemUtils.getItemName(stack)); + } + } + else { + if (GT_Values.RA.addCentrifugeRecipe(GT_Utility.copyAmount(1L, stack), null, null, Materials.Methane.getGas(60L), GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, GT_Values.NI, null, 200, 20)) { + Logger.INFO("Added methane extraction for "+ItemUtils.getItemName(stack)); + } + } + } + } + GT_Values.RA.addCentrifugeRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustThorium", 8), GT_Values.NI, GT_Values.NF, GT_Values.NF, ELEMENT.getInstance().THORIUM232.getDust(2), ItemUtils.getItemStackOfAmountFromOreDict("dustSmallThorium", 20), @@ -1850,7 +2024,6 @@ public class RECIPES_GREGTECH { Materials.Titanium.mBlastFurnaceTemp); } - } private static void autoclaveRecipes() { @@ -1895,25 +2068,6 @@ public class RECIPES_GREGTECH { } - public static boolean addPulverisationRecipe(final ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, - final ItemStack aOutput3) { - aOutput1 = GT_OreDictUnificator.get(true, aOutput1); - aOutput2 = GT_OreDictUnificator.get(true, aOutput2); - if ((GT_Utility.isStackInvalid(aInput)) || (GT_Utility.isStackInvalid(aOutput1))) { - return false; - } - if (GT_Utility.getContainerItem(aInput, false) == null) { - - if (GregTech_API.sRecipeFile.get(ConfigCategories.Machines.maceration, aInput, true)) { - GT_Utility.addSimpleIC2MachineRecipe(aInput, GT_ModHandler.getMaceratorRecipeList(), null, - new Object[] { aOutput1 }); - } - GT_Values.RA.addPulveriserRecipe(aInput, new ItemStack[] { aOutput1, aOutput2, aOutput3 }, - new int[] { 10000, 10000, 10000 }, 400, 2); - } - return true; - } - private static void cyclotronRecipes() { // Polonium @@ -2241,24 +2395,6 @@ public class RECIPES_GREGTECH { private static void sifterRecipes() { - // Rare Earth Processing - GT_Values.RA.addSifterRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustRareEarth", 1), - new ItemStack[] { - ELEMENT.getInstance().YTTRIUM.getSmallDust(1), - ELEMENT.getInstance().NEODYMIUM.getSmallDust(1), - ELEMENT.getInstance().LANTHANUM.getSmallDust(1), - ELEMENT.getInstance().CERIUM.getSmallDust(1), - ELEMENT.getInstance().CADMIUM.getSmallDust(1), - ELEMENT.getInstance().CAESIUM.getSmallDust(1), - ORES.SAMARSKITE_YB.getSmallDust(1), - ORES.FLORENCITE.getSmallDust(1), - ORES.FLUORCAPHITE.getSmallDust(1), - //ELEMENT.getInstance().YTTERBIUM.getTinyDust(1), - //ELEMENT.getInstance().SAMARIUM.getTinyDust(1), - //ELEMENT.getInstance().GADOLINIUM.getTinyDust(1) - }, - new int[] { 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000 }, 20 * 30, 500); - // Zirconium GT_Values.RA.addSifterRecipe(ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedIlmenite", 1), new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustIron", 1), diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java index 6ed5c71bcc..5048c5f2a5 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java @@ -1,11 +1,14 @@ package gtPlusPlus.core.recipe; +import static gtPlusPlus.core.lib.CORE.GTNH; import static gtPlusPlus.core.recipe.common.CI.bitsd; import static gtPlusPlus.core.util.minecraft.ItemUtils.getSimpleStack; import static gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits.generatePipeRecipes; import static gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits.generateWireRecipes; -import gregtech.api.enums.*; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; @@ -14,15 +17,14 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -55,7 +57,6 @@ public class RECIPES_General { OUTPUT_Blueprint = ItemUtils.getSimpleStack(ModItems.itemBlueprintBase); run(); addCompressedObsidian(); - addHandPumpRecipes(); migratedRecipes(); } } @@ -118,12 +119,6 @@ public class RECIPES_General { Logger.INFO("Added a recipe for Rainforest oak Saplings."); } - - // Try fix this ore - if (ModBlocks.blockOreFluorite != null){ - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[]{ItemUtils.getSimpleStack(ModBlocks.blockOreFluorite)}, FLUORIDES.FLUORITE.getOre(1)); - } - //Iron bars final ItemStack ironBars; if (CORE.GTNH) { @@ -162,13 +157,13 @@ public class RECIPES_General { //Shaped Crafting for ULV Material Dusts - + //Potin if (RecipeUtils.addShapelessGregtechRecipe(new Object[] {"dustLead", "dustBronze", "dustTin", "dustLead", "dustBronze"}, ALLOY.POTIN.getDust(5))){ Logger.INFO("Added shapeless recipe for Potin Dust."); } - + //Tumbaga if (RecipeUtils.addShapelessGregtechRecipe(new Object[] { "dustGold", "dustGold", "dustCopper"}, ItemUtils.getSimpleStack(ModItems.dustTumbagaMix))){ @@ -179,7 +174,7 @@ public class RECIPES_General { ItemUtils.getSimpleStack(ModItems.dustTumbagaMix), ItemUtils.getSimpleStack(ModItems.dustTumbagaMix), "dustGold" - }, + }, ALLOY.TUMBAGA.getDust(10))){ Logger.INFO("Added shapeless recipe for Tumbaga Dust."); } @@ -291,6 +286,19 @@ public class RECIPES_General { 20 * 30, // Dur 16); // Eu + // Pest Killer + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedCircuit(16), + CI.getTieredMachineCasing(1), + CI.getElectricPump(2, 1), + CI.getPlate(2, GTNH ? 4 : 2), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(0), GTNH ? 2 : 1), + }, + FluidUtils.getHotWater(500), // Fluid + ItemUtils.getSimpleStack(ModBlocks.blockPestKiller), // Output + 20 * 60, // Dur + 16); // Eu @@ -335,42 +343,6 @@ public class RECIPES_General { return true; } - private static void addHandPumpRecipes() { - if (RecipeUtils.recipeBuilder( - CI.electricPump_LV, "circuitBasic", null, - "ringBrass", CI.electricMotor_LV, "circuitBasic", - "plateSteel", "plateSteel", "rodBrass", - ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 1, 1))) - Logger.INFO("Added recipe for Hand Pump I - true"); - if (RecipeUtils.recipeBuilder( - CI.electricPump_MV, "circuitAdvanced", null, - "ringMagnalium", CI.electricMotor_MV, "circuitAdvanced", - "plateAluminium", "plateAluminium", "rodMagnalium", - ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 2, 1))) - Logger.INFO("Added recipe for Hand Pump II - true"); - if (RecipeUtils.recipeBuilder( - CI.electricPump_HV, "circuitData", null, - "ringChrome", CI.electricMotor_HV, "circuitData", - "plateStainlessSteel", "plateStainlessSteel", "rodChrome", - ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 3, 1))) - Logger.INFO("Added recipe for Hand Pump III - true"); - if (RecipeUtils.recipeBuilder( - CI.electricPump_EV, "circuitElite", null, - "ringTitanium", CI.electricMotor_EV, "circuitElite", - "plateTungstenSteel", "plateTungstenSteel", "rodTitanium", - ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 4, 1))) - Logger.INFO("Added recipe for Hand Pump IV - true"); - - - - GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 1, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1000, 1), 30, 30); - GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 2, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1001, 1), 120, 120); - GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 3, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1002, 1), 480, 480); - GT_Values.RA.addAssemblerRecipe(ItemUtils.simpleMetaStack(ModItems.itemGenericToken, 4, 1), CI.getNumberedCircuit(20), ItemUtils.simpleMetaStack(ModItems.toolGregtechPump, 1003, 1), 1820, 1820); - - - } - private static void migratedRecipes() { RecipeUtils.generateMortarRecipe(ItemUtils.getSimpleStack(ModItems.itemPlateRawMeat), ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 1)); @@ -423,12 +395,11 @@ public class RECIPES_General { generatePipeRecipes(e.mDefaultLocalName, e.getMass(), tVoltageMultiplier); } - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) - RecipeUtils.addShapedGregtechRecipe( - CI.component_Plate[4], "rotorGtStainlessSteel", CI.component_Plate[4], - CI.getTieredCircuitOreDictName(3), CI.machineHull_HV, CI.getTieredCircuitOreDictName(3), - CI.component_Plate[4], CI.electricPump_HV, CI.component_Plate[4], - GregtechItemList.Hatch_Air_Intake.get(1L, new Object[0])); + RecipeUtils.addShapedGregtechRecipe( + CI.component_Plate[4], "rotorGtStainlessSteel", CI.component_Plate[4], + CI.getTieredCircuitOreDictName(3), CI.machineHull_HV, CI.getTieredCircuitOreDictName(3), + CI.component_Plate[4], CI.electricPump_HV, CI.component_Plate[4], + GregtechItemList.Hatch_Air_Intake.get(1L, new Object[0])); RecipeUtils.addShapedGregtechRecipe(CI.component_Plate[6], ALLOY.MARAGING250.getGear(1), CI.component_Plate[6], CI.getTieredCircuitOreDictName(4), GregtechItemList.Casing_AdvancedVacuum.get(1), @@ -446,7 +417,7 @@ public class RECIPES_General { CI.component_Plate[8], GregtechItemList.Hatch_Input_Naquadah.get(1L, new Object[0])); - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + if (PollutionUtils.isPollutionEnabled()) { GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_LV.get(1L, new Object[0]), bitsd, new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_LV.get(1), Character.valueOf('P'), GregtechItemList.Pollution_Cleaner_LV.get(1) }); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 6979bb4f39..578ef8f89c 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.recipe; import static gtPlusPlus.core.lib.CORE.GTNH; +import cpw.mods.fml.common.Loader; import gregtech.api.enums.*; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; @@ -15,8 +16,13 @@ import gtPlusPlus.core.material.Material; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.*; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.everglades.dimension.Dimension_Everglades; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; +import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; +import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -207,7 +213,7 @@ public class RECIPES_Machines { } private static void run(){ - + //Determines Casing Recipe Output if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !GTNH){ Casing_Amount=2; @@ -215,7 +221,7 @@ public class RECIPES_Machines { else { Casing_Amount=1; } - + initModItems(); controlCores(); energyCores(); @@ -223,7 +229,9 @@ public class RECIPES_Machines { largeArcFurnace(); industrialVacuumFurnace(); fakeMachineCasingCovers(); + ztonesCoverRecipes(); superBuses(); + roundRobinators(); } private static void initModItems(){ @@ -289,7 +297,7 @@ public class RECIPES_Machines { private static void runModRecipes(){ if (LoadedMods.Gregtech){ - + //Computer Cube CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -357,7 +365,7 @@ public class RECIPES_Machines { ItemUtils.getSimpleStack(ModBlocks.blockCustomJukebox), 20 * 30, 30); - + //Poo Collector CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -443,7 +451,7 @@ public class RECIPES_Machines { //Add recycle recipes for the Iron Plated Bricks //GT_ModHandler.addPulverisationRecipe(RECIPE_IronPlatedBricks, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustIron", 6), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustClay", 2), true); - RECIPES_GREGTECH.addPulverisationRecipe( + CORE.RA.addPulverisationRecipe( RECIPE_IronPlatedBricks, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustIron", 6), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustClay", 2), @@ -708,7 +716,7 @@ public class RECIPES_Machines { //Semi-Fluid Generators ItemStack mSemiFluidgen = ItemUtils.getItemStackFromFQRN("IC2:blockGenerator:7", 1); mSemiFluidgen.setItemDamage(7); - //ItemUtils.simpleMetaStack("IC2:blockGenerator:7", 7, 1); + //ItemUtils.simpleMetaStack("IC2:blockGenerator:7", 7, 1); ItemStack[] aSemifluids = new ItemStack[] {mSemiFluidgen, GregtechItemList.Generator_SemiFluid_LV.get(1), GregtechItemList.Generator_SemiFluid_MV.get(1), GregtechItemList.Generator_SemiFluid_HV.get(1)}; for (int o=1;o<4;o++) { CORE.RA.addSixSlotAssemblingRecipe( @@ -829,7 +837,7 @@ public class RECIPES_Machines { "plankWood", "frameGtTumbaga", "plankWood", "plankWood", "plankWood", "plankWood", RECIPE_TreeFarmFrame); - } + } if (CORE.ConfigSwitches.enableMachine_Tesseracts){ //Tesseracts @@ -852,8 +860,8 @@ public class RECIPES_Machines { if (CORE.ConfigSwitches.enableMachine_SimpleWasher){ ItemStack plateWrought = ItemUtils.getItemStackOfAmountFromOreDict("plateWroughtIron", 1); ItemStack washerPipe; - - + + if (CORE.ConfigSwitches.enableCustom_Pipes){ washerPipe = ItemUtils.getItemStackOfAmountFromOreDict("pipeLargeClay", 1); RecipeUtils.addShapedGregtechRecipe( @@ -869,7 +877,7 @@ public class RECIPES_Machines { plateWrought, washerPipe, plateWrought, plateWrought, CI.machineCasing_ULV, plateWrought, GregtechItemList.SimpleDustWasher_ULV.get(1)); - + int aSimpleWasherTier = 2; int aSlot = 0; ItemStack[][] aInputsForSimpleWashers = new ItemStack[4][6]; @@ -880,7 +888,7 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, 1, GTNH ? 8 : 4), CI.getTieredComponent(OrePrefixes.rod, 2, GTNH ? 4 : 2), CI.getTieredComponent(OrePrefixes.circuit, 2, GTNH ? 3 : 1), - + }; aInputsForSimpleWashers[1] = new ItemStack[] { CI.getTieredMachineHull(4), @@ -888,7 +896,7 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, 3, GTNH ? 12 : 6), CI.getTieredComponent(OrePrefixes.rod, 4, GTNH ? 6 : 3), CI.getTieredComponent(OrePrefixes.circuit, 4, GTNH ? 4 : 2), - + }; aInputsForSimpleWashers[2] = new ItemStack[] { CI.getTieredMachineHull(6), @@ -896,7 +904,7 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, 5, GTNH ? 16 : 8), CI.getTieredComponent(OrePrefixes.rod, 6, GTNH ? 8 : 4), CI.getTieredComponent(OrePrefixes.circuit, 6, GTNH ? 6 : 3), - + }; aInputsForSimpleWashers[3] = new ItemStack[] { CI.getTieredMachineHull(8), @@ -904,37 +912,37 @@ public class RECIPES_Machines { CI.getTieredComponent(OrePrefixes.plate, 7, GTNH ? 32 : 16), CI.getTieredComponent(OrePrefixes.rod, 8, GTNH ? 10 : 5), CI.getTieredComponent(OrePrefixes.circuit, 8, GTNH ? 8 : 4), - + }; - - - - - - + + + + + + ItemStack[] aSimpleWashers = new ItemStack[] {GregtechItemList.SimpleDustWasher_MV.get(1), GregtechItemList.SimpleDustWasher_EV.get(1), GregtechItemList.SimpleDustWasher_LuV.get(1), GregtechItemList.SimpleDustWasher_UV.get(1)}; for (int i=0;i<4;i++) { - + CORE.RA.addSixSlotAssemblingRecipe( aInputsForSimpleWashers[aSlot], CI.getTieredFluid(aSimpleWasherTier, 144 * aSimpleWasherTier), aSimpleWashers[aSlot], 20 * 15 * aSimpleWasherTier, (int) GT_Values.V[aSimpleWasherTier]); - + aSimpleWasherTier += 2; aSlot++; } - - - - - - + + + + + + } - if (CORE.ConfigSwitches.enableMachine_Pollution && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - + if (CORE.ConfigSwitches.enableMachine_Pollution && PollutionUtils.isPollutionEnabled()){ + RecipeUtils.addShapedGregtechRecipe( "plateCarbon", "plateCarbon", "plateCarbon", "dustCarbon", "dustCarbon", "dustCarbon", @@ -1056,7 +1064,20 @@ public class RECIPES_Machines { RECIPE_ThermalBoilerCasing); //Lava Filter Recipe - GT_Values.RA.addAssemblerRecipe(ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 16), CI.getNumberedCircuit(18), ItemUtils.getSimpleStack(ModItems.itemLavaFilter), 80*20, 16); + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + CI.getNumberedCircuit(18), + ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", GTNH ? 64 : 32), + ItemUtils.getItemStackOfAmountFromOreDict("wireFineSteel", GTNH ? 64 : 32), + ItemUtils.getItemStackOfAmountFromOreDict("ringTumbaga", GTNH ? 32 : 16), + ItemUtils.getItemStackOfAmountFromOreDict("foilCopper", GTNH ? 8 : 4), + ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 64), + + }, + CI.getTieredFluid(3, 144), + ItemUtils.getSimpleStack(ModItems.itemLavaFilter, GTNH ? 8 : 16), + 1600, + 240 + ); } if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor){ @@ -1164,7 +1185,7 @@ public class RECIPES_Machines { RECIPE_CyclotronController = GregtechItemList.COMET_Cyclotron.get(1); RECIPE_CyclotronOuterCasing = GregtechItemList.Casing_Cyclotron_External.get(Casing_Amount); RECIPE_CyclotronInnerCoil = GregtechItemList.Casing_Cyclotron_Coil.get(1); - + //Outer Casing CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -1179,8 +1200,8 @@ public class RECIPES_Machines { RECIPE_CyclotronOuterCasing, 30 * 20 * 2, MaterialUtils.getVoltageForTier(4)); - - + + //Inner Coil CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { @@ -1995,7 +2016,7 @@ public class RECIPES_Machines { } } - + private static void largeArcFurnace() { int aCostMultiplier = GTNH ? 2 : 1; CORE.RA.addSixSlotAssemblingRecipe( @@ -2025,10 +2046,10 @@ public class RECIPES_Machines { 60 * 20 * 8, MaterialUtils.getVoltageForTier(6)); } - + private static void industrialVacuumFurnace() { int aCostMultiplier = GTNH ? 2 : 1; - + CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { CI.getTieredMachineHull(-1, 1 * aCostMultiplier), @@ -2041,9 +2062,9 @@ public class RECIPES_Machines { GregtechItemList.Casing_Vacuum_Furnace.get(Casing_Amount), 20 * 10 * 6, MaterialUtils.getVoltageForTier(6)); - + ; - + CORE.RA.addSixSlotAssemblingRecipe( new ItemStack[] { GregtechItemList.Casing_Vacuum_Furnace.get(Casing_Amount), @@ -2058,113 +2079,290 @@ public class RECIPES_Machines { 60 * 20 * 12, MaterialUtils.getVoltageForTier(7)); } - + private static void fakeMachineCasingCovers() { - GregtechItemList[] mMachineCasingCovers = new GregtechItemList[] { - GregtechItemList.FakeMachineCasingPlate_ULV, - GregtechItemList.FakeMachineCasingPlate_LV, - GregtechItemList.FakeMachineCasingPlate_MV, - GregtechItemList.FakeMachineCasingPlate_HV, - GregtechItemList.FakeMachineCasingPlate_EV, - GregtechItemList.FakeMachineCasingPlate_IV, - GregtechItemList.FakeMachineCasingPlate_LuV, - GregtechItemList.FakeMachineCasingPlate_ZPM, - GregtechItemList.FakeMachineCasingPlate_UV, - GregtechItemList.FakeMachineCasingPlate_MAX, - }; - for (int i = 0;i<10;i++) { - GT_Values.RA.addCutterRecipe( - CI.getTieredMachineCasing(i), - mMachineCasingCovers[i].get(5), - null, - 20 * 5 * i, - (int) GT_Values.V[i]); - } + GregtechItemList[] mMachineCasingCovers = new GregtechItemList[] { + GregtechItemList.FakeMachineCasingPlate_ULV, + GregtechItemList.FakeMachineCasingPlate_LV, + GregtechItemList.FakeMachineCasingPlate_MV, + GregtechItemList.FakeMachineCasingPlate_HV, + GregtechItemList.FakeMachineCasingPlate_EV, + GregtechItemList.FakeMachineCasingPlate_IV, + GregtechItemList.FakeMachineCasingPlate_LuV, + GregtechItemList.FakeMachineCasingPlate_ZPM, + GregtechItemList.FakeMachineCasingPlate_UV, + GregtechItemList.FakeMachineCasingPlate_MAX, + }; + int aMaxTier = GT_Values.VOLTAGE_NAMES.length; + if (!GTNH) { + aMaxTier = 10; + } + ItemStack aTier[] = new ItemStack[aMaxTier]; + for (int i=0;i<aMaxTier;i++) { + aTier[i] = ItemUtils.simpleMetaStack(CoverManager.Cover_Gt_Machine_Casing, i, 7); + } + // Deprecate old recipes + for (int i=0;i<10;i++) { + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {mMachineCasingCovers[i].get(1)}, ItemUtils.getSimpleStack(aTier[i], 1)); + } + // Add recipes for new ones + for (int i = 0;i<aMaxTier;i++) { + GT_Values.RA.addCutterRecipe( + CI.getTieredMachineCasing(i), + aTier[i], + null, + 20 * 5 * i, + (int) GT_Values.V[i]); + } } - + + private static void ztonesCoverRecipes() { + + if (!Loader.isModLoaded("Ztones")) { + return; + } + Class ModBlocksClass = ReflectionUtils.getClass("com.riciJak.Ztones.init.ModBlocks"); + Block agon = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "agonBlock")); + Block korp = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "korpBlock")); + Block jelt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "jeltBlock")); + Block bitt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "bittBlock")); + Block iszm = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "iszmBlock")); + + // "agon", "iszm", "korp", "jelt", "bitt" + + ItemStack[] aBlocks = new ItemStack[] { + ItemUtils.getSimpleStack(agon), + ItemUtils.getSimpleStack(iszm), + ItemUtils.getSimpleStack(korp), + ItemUtils.getSimpleStack(jelt), + ItemUtils.getSimpleStack(bitt) + }; + MetaCustomCoverItem[] aCovers = new MetaCustomCoverItem[] { + CoverManager.Cover_Agon, + CoverManager.Cover_Iszm, + CoverManager.Cover_Korp, + CoverManager.Cover_Jelt, + CoverManager.Cover_Bitt + }; + + ItemStack aInputs[][] = new ItemStack[5][16]; + ItemStack aOutputs[][] = new ItemStack[5][16]; + for (int a=0;a<5;a++) { + for (int i=0;i<16;i++) { + aInputs[a][i] = ItemUtils.simpleMetaStack(aBlocks[a].getItem(), i, 1); + aOutputs[a][i] = ItemUtils.simpleMetaStack(aCovers[a], i, 9); + } + } + for (int a=0;a<5;a++) { + for (int i = 0;i<16;i++) { + ItemStack aInput = aInputs[a][i]; + ItemStack aOutput = aOutputs[a][i]; + if (GT_Values.RA.addCutterRecipe( + aInput, + aOutput, + null, + 20 * 5, + 16)) { + Logger.INFO("Added Cutting recipe for "+aInput.getDisplayName()); + } + + if (CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedCircuit((i/4)+4), + aOutput + }, + FluidUtils.getWildcardFluidStack("glue", 250), + aInput, + 20 * 10, + 16)) { + Logger.INFO("Added Assembly recipe for "+aInput.getDisplayName()); + } + } + } + } + private static void superBuses() { - GregtechItemList[] mSuperBusesInput = new GregtechItemList[] { - GregtechItemList.Hatch_SuperBus_Input_ULV, - GregtechItemList.Hatch_SuperBus_Input_LV, - GregtechItemList.Hatch_SuperBus_Input_MV, - GregtechItemList.Hatch_SuperBus_Input_HV, - GregtechItemList.Hatch_SuperBus_Input_EV, - GregtechItemList.Hatch_SuperBus_Input_IV, - GregtechItemList.Hatch_SuperBus_Input_LuV, - GregtechItemList.Hatch_SuperBus_Input_ZPM, - GregtechItemList.Hatch_SuperBus_Input_UV, - GregtechItemList.Hatch_SuperBus_Input_MAX, - }; - - GregtechItemList[] mSuperBusesOutput = new GregtechItemList[] { - GregtechItemList.Hatch_SuperBus_Output_ULV, - GregtechItemList.Hatch_SuperBus_Output_LV, - GregtechItemList.Hatch_SuperBus_Output_MV, - GregtechItemList.Hatch_SuperBus_Output_HV, - GregtechItemList.Hatch_SuperBus_Output_EV, - GregtechItemList.Hatch_SuperBus_Output_IV, - GregtechItemList.Hatch_SuperBus_Output_LuV, - GregtechItemList.Hatch_SuperBus_Output_ZPM, - GregtechItemList.Hatch_SuperBus_Output_UV, - GregtechItemList.Hatch_SuperBus_Output_MAX, - }; - - ItemStack[] mInputHatch = new ItemStack[] { - ItemList.Hatch_Input_Bus_EV.get(1), - ItemList.Hatch_Input_Bus_IV.get(1), - ItemList.Hatch_Input_Bus_LuV.get(1), - ItemList.Hatch_Input_Bus_ZPM.get(1), - ItemList.Hatch_Input_Bus_UV.get(1), - ItemList.Hatch_Input_Bus_MAX.get(1), - GregtechItemList.Hatch_SuperBus_Input_ULV.get(1), - GregtechItemList.Hatch_SuperBus_Input_LV.get(1), - GregtechItemList.Hatch_SuperBus_Input_MV.get(1), - GregtechItemList.Hatch_SuperBus_Input_HV.get(1), - }; - - ItemStack[] mOutputHatch = new ItemStack[] { - ItemList.Hatch_Output_Bus_EV.get(1), - ItemList.Hatch_Output_Bus_IV.get(1), - ItemList.Hatch_Output_Bus_LuV.get(1), - ItemList.Hatch_Output_Bus_ZPM.get(1), - ItemList.Hatch_Output_Bus_UV.get(1), - ItemList.Hatch_Output_Bus_MAX.get(1), - GregtechItemList.Hatch_SuperBus_Output_ULV.get(1), - GregtechItemList.Hatch_SuperBus_Output_LV.get(1), - GregtechItemList.Hatch_SuperBus_Output_MV.get(1), - GregtechItemList.Hatch_SuperBus_Output_HV.get(1), - }; - - //Input Buses - for (int i = 0; i < 10; i++) { - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(16), - mInputHatch[i], - CI.getElectricMotor(i, GTNH ? 8 : 2), - CI.getConveyor(i, GTNH ? 10 : 5), - CI.getGear(i, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) - }, - CI.getAlternativeTieredFluid(i, 144 * 8), - mSuperBusesInput[i].get(1), 20 * 30 * 2 * i, - (int) GT_Values.V[i]); - } - //Output Buses - for (int i = 0; i < 10; i++) { - CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { - CI.getNumberedCircuit(18), - mOutputHatch[i], - CI.getElectricPiston(i, GTNH ? 8 : 2), - CI.getConveyor(i, GTNH ? 10 : 5), - CI.getGear(i, GTNH ? 6 : 3), - CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) - }, - CI.getTertiaryTieredFluid(i, 144 * 8), - mSuperBusesOutput[i].get(1), 20 * 30 * 2 * i, - (int) GT_Values.V[i]); - } - + GregtechItemList[] mSuperBusesInput = new GregtechItemList[] { + GregtechItemList.Hatch_SuperBus_Input_ULV, + GregtechItemList.Hatch_SuperBus_Input_LV, + GregtechItemList.Hatch_SuperBus_Input_MV, + GregtechItemList.Hatch_SuperBus_Input_HV, + GregtechItemList.Hatch_SuperBus_Input_EV, + GregtechItemList.Hatch_SuperBus_Input_IV, + GregtechItemList.Hatch_SuperBus_Input_LuV, + GregtechItemList.Hatch_SuperBus_Input_ZPM, + GregtechItemList.Hatch_SuperBus_Input_UV, + GregtechItemList.Hatch_SuperBus_Input_MAX, + }; + + GregtechItemList[] mSuperBusesOutput = new GregtechItemList[] { + GregtechItemList.Hatch_SuperBus_Output_ULV, + GregtechItemList.Hatch_SuperBus_Output_LV, + GregtechItemList.Hatch_SuperBus_Output_MV, + GregtechItemList.Hatch_SuperBus_Output_HV, + GregtechItemList.Hatch_SuperBus_Output_EV, + GregtechItemList.Hatch_SuperBus_Output_IV, + GregtechItemList.Hatch_SuperBus_Output_LuV, + GregtechItemList.Hatch_SuperBus_Output_ZPM, + GregtechItemList.Hatch_SuperBus_Output_UV, + GregtechItemList.Hatch_SuperBus_Output_MAX, + }; + + ItemStack[] mInputHatch = new ItemStack[] { + ItemList.Hatch_Input_Bus_EV.get(1), + ItemList.Hatch_Input_Bus_IV.get(1), + ItemList.Hatch_Input_Bus_LuV.get(1), + ItemList.Hatch_Input_Bus_ZPM.get(1), + ItemList.Hatch_Input_Bus_UV.get(1), + ItemList.Hatch_Input_Bus_MAX.get(1), + GregtechItemList.Hatch_SuperBus_Input_LV.get(1), + GregtechItemList.Hatch_SuperBus_Input_MV.get(1), + GregtechItemList.Hatch_SuperBus_Input_HV.get(1), + GregtechItemList.Hatch_SuperBus_Input_EV.get(1), + }; + + ItemStack[] mOutputHatch = new ItemStack[] { + ItemList.Hatch_Output_Bus_EV.get(1), + ItemList.Hatch_Output_Bus_IV.get(1), + ItemList.Hatch_Output_Bus_LuV.get(1), + ItemList.Hatch_Output_Bus_ZPM.get(1), + ItemList.Hatch_Output_Bus_UV.get(1), + ItemList.Hatch_Output_Bus_MAX.get(1), + GregtechItemList.Hatch_SuperBus_Output_LV.get(1), + GregtechItemList.Hatch_SuperBus_Output_MV.get(1), + GregtechItemList.Hatch_SuperBus_Output_HV.get(1), + GregtechItemList.Hatch_SuperBus_Output_EV.get(1), + }; + + // Special Case recipes for ULV buses + { + + int i = 0; + ItemStack[] aInputs1 = new ItemStack[] { + CI.getNumberedCircuit(17), + mInputHatch[i], + CI.getElectricMotor(i, GTNH ? 8 : 2), + CI.getConveyor(i, GTNH ? 10 : 5), + CI.getBolt(i, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) + }; + Logger.INFO("[FIND] "+ItemUtils.getArrayStackNames(aInputs1)); + ItemStack[] aOutputs1 = new ItemStack[] { + CI.getNumberedCircuit(18), + mOutputHatch[i], + CI.getElectricPiston(i, GTNH ? 8 : 2), + CI.getConveyor(i, GTNH ? 10 : 5), + CI.getGear(i, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) + }; + Logger.INFO("[FIND] "+ItemUtils.getArrayStackNames(aOutputs1)); + + FluidStack a1 = CI.getAlternativeTieredFluid(i, 144 * 8); + FluidStack a2 = CI.getTertiaryTieredFluid(i, 144 * 8); + + + Logger.INFO("[FIND] Input Bus Fluid: "+ItemUtils.getFluidName(a1)); + Logger.INFO("[FIND] Output Bus Fluid: "+ItemUtils.getFluidName(a2)); + + + CORE.RA.addSixSlotAssemblingRecipe(aInputs1, + a1, + mSuperBusesInput[i].get(1), + 20 * 30 * 2 * i, + (int) GT_Values.V[i]); + + CORE.RA.addSixSlotAssemblingRecipe(aOutputs1, + a2, + mSuperBusesOutput[i].get(1), + 20 * 30 * 2 * i, + (int) GT_Values.V[i]); + + + } + + //Input Buses + for (int i = 1; i < 10; i++) { + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + CI.getNumberedCircuit(17), + mInputHatch[i], + CI.getElectricMotor(i, GTNH ? 8 : 2), + CI.getConveyor(i, GTNH ? 10 : 5), + CI.getBolt(i, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) + }, + CI.getAlternativeTieredFluid(i, 144 * 8), + mSuperBusesInput[i].get(1), 20 * 30 * 2 * i, + (int) GT_Values.V[i]); + } + //Output Buses + for (int i = 1; i < 10; i++) { + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + CI.getNumberedCircuit(18), + mOutputHatch[i], + CI.getElectricPiston(i, GTNH ? 8 : 2), + CI.getConveyor(i, GTNH ? 10 : 5), + CI.getGear(i, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2) + }, + CI.getTertiaryTieredFluid(i, 144 * 8), + mSuperBusesOutput[i].get(1), 20 * 30 * 2 * i, + (int) GT_Values.V[i]); + } + } - + + private static void roundRobinators() { + + RecipeUtils.addShapedGregtechRecipe( + ItemUtils.getSimpleStack(Blocks.hopper), "circuitPrimitive", ItemUtils.getSimpleStack(Blocks.hopper), + CI.craftingToolWrench, CI.machineCasing_ULV, CI.craftingToolScrewdriver, + ItemUtils.getSimpleStack(Blocks.hopper), "circuitPrimitive", ItemUtils.getSimpleStack(Blocks.hopper), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1)); + + ItemStack[] aRobinators = new ItemStack[] { + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 1, 1), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 2, 1), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 3, 1), + ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 4, 1), + }; + + int aCostMultiplier = GTNH ? 2 : 1; + + for (int i = 0; i < 5; i++) { + if (i == 0) { + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedCircuit(17), + CI.getTieredMachineCasing(0), + ItemUtils.getSimpleStack(Blocks.hopper, 4), + CI.getTieredComponent(OrePrefixes.circuit, 0, 2) + }, + GT_Values.NF, //Input Fluid + aRobinators[i], + 45 * 10 * 1, + 8); + continue; + } + int aTier = i+1; + ItemStack[] aInputs = new ItemStack[] { + aRobinators[i-1], + CI.getTieredMachineHull(aTier, 1 * aCostMultiplier), + CI.getConveyor(aTier, 2 * aCostMultiplier), + CI.getElectricMotor(aTier, 2 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier), + CI.getTieredComponent(OrePrefixes.circuit, i, 2 * aCostMultiplier), + }; + + CORE.RA.addSixSlotAssemblingRecipe( + aInputs, + GT_Values.NF, //Input Fluid + aRobinators[i], + 45 * 10 * 1 * (i+1), + MaterialUtils.getVoltageForTier(i)); + + } + } + } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java new file mode 100644 index 0000000000..d3c0b4c093 --- /dev/null +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_RareEarthProcessing.java @@ -0,0 +1,226 @@ +package gtPlusPlus.core.recipe; + +import static gtPlusPlus.core.material.MISC_MATERIALS.BRINE; +import static gtPlusPlus.core.material.MISC_MATERIALS.HYDROGEN_CHLORIDE; +import static gtPlusPlus.core.material.MISC_MATERIALS.RARE_EARTH_HIGH; +import static gtPlusPlus.core.material.MISC_MATERIALS.RARE_EARTH_LOW; +import static gtPlusPlus.core.material.MISC_MATERIALS.RARE_EARTH_MID; +import static gtPlusPlus.core.material.MISC_MATERIALS.SALT_WATER; +import static gtPlusPlus.core.material.MISC_MATERIALS.SODIUM_CHLORIDE; +import static gtPlusPlus.core.material.MISC_MATERIALS.SODIUM_HYDROXIDE; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.material.MISC_MATERIALS; +import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.material.ORES; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +public class RECIPES_RareEarthProcessing { + + private static ItemStack mDustSodiumHydroxide; + private static ItemStack mDustSalt; + private static FluidStack mSaltWater; + private static FluidStack mBrine; + private static FluidStack mHydrogenChloride; + + public static void init() { + + // Salt Check and Assignment + mDustSalt = ItemUtils.getItemStackOfAmountFromOreDict("dustSalt", 1); + if (mDustSalt == null) { + MaterialUtils.generateSpecialDustAndAssignToAMaterial(SODIUM_CHLORIDE, false); + mDustSalt = SODIUM_CHLORIDE.getDust(1); + } + else { + SODIUM_CHLORIDE.registerComponentForMaterial(OrePrefixes.dust, mDustSalt); + } + + // Salt water Check and Assignment + mSaltWater = FluidUtils.getFluidStack("saltwater", 1000); + if (mSaltWater == null) { + Fluid f = SALT_WATER.generateFluid(); + SALT_WATER.registerComponentForMaterial(FluidUtils.getFluidStack(f, 1000)); + mSaltWater = SALT_WATER.getFluid(1000); + } + else { + SALT_WATER.registerComponentForMaterial(FluidUtils.getFluidStack(mSaltWater, 1000)); + } + + // Brine Check and assignment + mBrine = FluidUtils.getFluidStack("brine", 1000); + if (mBrine == null) { + Fluid f = BRINE.generateFluid(); + BRINE.registerComponentForMaterial(FluidUtils.getFluidStack(f, 1000)); + mBrine = BRINE.getFluid(1000); + } + else { + BRINE.registerComponentForMaterial(FluidUtils.getFluidStack(mBrine, 1000)); + } + + // Check Sodium Hydroxide Exists, generate if not. + mDustSodiumHydroxide = ItemUtils.getItemStackOfAmountFromOreDict("dustSodiumHydroxide", 1); + if (mDustSodiumHydroxide == null) { + mDustSodiumHydroxide = ItemUtils.getItemStackOfAmountFromOreDict("dustSodiumHydroxide_GT5U", 1); + if (mDustSodiumHydroxide == null) { + MaterialUtils.generateSpecialDustAndAssignToAMaterial(SODIUM_HYDROXIDE, false); + mDustSodiumHydroxide = SODIUM_HYDROXIDE.getDust(1); + } + else { + SODIUM_HYDROXIDE.registerComponentForMaterial(OrePrefixes.dust, mDustSodiumHydroxide); + } + } + else { + SODIUM_HYDROXIDE.registerComponentForMaterial(OrePrefixes.dust, mDustSodiumHydroxide); + } + + // Hydrogen Chloride Check and assignment + mHydrogenChloride = FluidUtils.getFluidStack("hydrogenchloride", 1000); + if (mHydrogenChloride == null) { + HYDROGEN_CHLORIDE.generateFluid(); + mHydrogenChloride = BRINE.getFluid(1000); + } + else { + HYDROGEN_CHLORIDE.registerComponentForMaterial(FluidUtils.getFluidStack(mHydrogenChloride, 1000)); + } + + + // Add Process for creating Brine + CORE.RA.addBrewingRecipe( + ItemUtils.getSimpleStack(mDustSalt, 16), + MISC_MATERIALS.SALT_WATER.getFluid(2000), + FluidUtils.getFluidStack(mBrine, 4000), + 20 * 20, + 120, + false); + + // Chloralkali process + GT_Values.RA.addElectrolyzerRecipe( + CI.getNumberedCircuit(16), + CI.emptyCells(4), + FluidUtils.getFluidStack(mBrine, 4000), + null, // Out + ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 2), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 2), + ItemUtils.getSimpleStack(mDustSodiumHydroxide, 2), + null, + null, + null, + new int[] {10000, 10000, 10000}, + 20 * 30, + (int) GT_Values.V[2]); + + // Generate Special Laser Recipe + CORE.RA.addUvLaserRecipe( + ELEMENT.getInstance().CHLORINE.getCell(2), + ELEMENT.getInstance().HYDROGEN.getCell(2), + ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 4), + 20 * 30, + 480); + + + // Set Material Tiers correctly + ORES.GREENOCKITE.vTier = 1; + RARE_EARTH_LOW.vTier = 1; + RARE_EARTH_MID.vTier = 3; + RARE_EARTH_HIGH.vTier = 5; + + // Set Material Voltages correctly + ORES.GREENOCKITE.vVoltageMultiplier = 30; + RARE_EARTH_LOW.vVoltageMultiplier = 30; + RARE_EARTH_MID.vVoltageMultiplier = 480; + RARE_EARTH_HIGH.vVoltageMultiplier = 7680; + + // Set Material Tooltips to be shorter + RARE_EARTH_LOW.vChemicalFormula = "??????"; + RARE_EARTH_MID.vChemicalFormula = "??????"; + RARE_EARTH_HIGH.vChemicalFormula = "??????"; + + // Set Material Tooltips to be shorter + RARE_EARTH_LOW.vChemicalSymbol = "??"; + RARE_EARTH_MID.vChemicalSymbol = "??"; + RARE_EARTH_HIGH.vChemicalSymbol = "??"; + + // Generate Ore Materials + MaterialGenerator.generateOreMaterial(RARE_EARTH_LOW); + MaterialGenerator.generateOreMaterial(RARE_EARTH_MID); + MaterialGenerator.generateOreMaterial(RARE_EARTH_HIGH); + + ItemStack aRareEarth = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.RareEarth, 1L); + + Fluid aSulfuric = FluidUtils.getFluidStack("sulfuricacid", 1).getFluid(); + Fluid aHydrocholric = FluidUtils.getFluidStack("hydrogenchloride", 1).getFluid(); + Fluid aNitric = FluidUtils.getFluidStack("hydrofluoricacid", 1).getFluid(); + + + + // LV Rare Earth + GT_Values.RA.addChemicalBathRecipe( + ItemUtils.getSimpleStack(aRareEarth, 3), + FluidUtils.getFluidStack(aSulfuric, 1000), + RARE_EARTH_LOW.getCrushed(1), + RARE_EARTH_LOW.getCrushed(1), + RARE_EARTH_LOW.getCrushed(1), + new int[] {10000, 10000, 9000}, + 20 * 30, + (int) GT_Values.V[1]); + + // HV Rare Earth + GT_Values.RA.addChemicalBathRecipe( + ItemUtils.getSimpleStack(aRareEarth, 6), + FluidUtils.getFluidStack(aHydrocholric, 3000), + RARE_EARTH_MID.getCrushed(2), + RARE_EARTH_MID.getCrushed(2), + RARE_EARTH_MID.getCrushed(2), + new int[] {10000, 9000, 8000}, + 20 * 60, + (int) GT_Values.V[3]); + + // IV Rare Earth + GT_Values.RA.addChemicalBathRecipe( + ItemUtils.getSimpleStack(aRareEarth, 9), + FluidUtils.getFluidStack(aNitric, 6000), + RARE_EARTH_HIGH.getCrushed(3), + RARE_EARTH_HIGH.getCrushed(3), + RARE_EARTH_HIGH.getCrushed(3), + new int[] {9000, 8000, 7000}, + 20 * 90, + (int) GT_Values.V[5]); + + + } + + + public static void processCopperRecipes() { + + // Rare Earth Processing + /*GT_Values.RA.addSifterRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustRareEarth", 1), + new ItemStack[] { + ELEMENT.getInstance().YTTRIUM.getSmallDust(1), + ELEMENT.getInstance().NEODYMIUM.getSmallDust(1), + ELEMENT.getInstance().LANTHANUM.getSmallDust(1), + ELEMENT.getInstance().CERIUM.getSmallDust(1), + ELEMENT.getInstance().CADMIUM.getSmallDust(1), + ELEMENT.getInstance().CAESIUM.getSmallDust(1), + ORES.SAMARSKITE_YB.getSmallDust(1), + ORES.FLORENCITE.getSmallDust(1), + ORES.FLUORCAPHITE.getSmallDust(1), + //ELEMENT.getInstance().YTTERBIUM.getTinyDust(1), + //ELEMENT.getInstance().SAMARIUM.getTinyDust(1), + //ELEMENT.getInstance().GADOLINIUM.getTinyDust(1) + }, + new int[] { 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2000 }, 20 * 30, 500);*/ + + } + +} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java index 471a3cc33e..902806e026 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_SeleniumProcessing.java @@ -17,7 +17,7 @@ public class RECIPES_SeleniumProcessing { public static void init() { //We need this - MaterialUtils.generateSpecialDustAndAssignToAMaterial(MISC_MATERIALS.SELENIUM_DIOXIDE); + MaterialUtils.generateSpecialDustAndAssignToAMaterial(MISC_MATERIALS.SELENIUM_DIOXIDE, false); // Makes Selenium Dioxide processCopperRecipes(); @@ -86,15 +86,15 @@ public class RECIPES_SeleniumProcessing { public static void processCopperRecipes() { - //Copper + //Copper CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Copper, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Copper, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(20), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Copper, 1), + ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Copper, 1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), @@ -116,18 +116,17 @@ public class RECIPES_SeleniumProcessing { 1000 }, 40 * 20, // Time in ticks - 1024); // EU - + 1024); // EU //Tetra CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Tetrahedrite, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Tetrahedrite, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(10), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Tetrahedrite, 1), + ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Tetrahedrite, 1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), @@ -150,15 +149,16 @@ public class RECIPES_SeleniumProcessing { }, 40 * 20, // Time in ticks 1024); // EU + //Chalco CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Chalcopyrite, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Chalcopyrite, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(10), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Chalcopyrite, 1), + ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Chalcopyrite, 1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), @@ -181,15 +181,16 @@ public class RECIPES_SeleniumProcessing { }, 40 * 20, // Time in ticks 1024); // EU + //Malachite CORE.RA.addDehydratorRecipe( new ItemStack[]{ - ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Malachite, 1), // Item Input + ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Malachite, 1), // Item Input }, FluidUtils.getHotWater(1000), // Fluid MISC_MATERIALS.SELENIUM_DIOXIDE.getFluid(10), // Fluid new ItemStack[] { - ItemUtils.getOrePrefixStack(OrePrefixes.crushedPurified, Materials.Malachite, 1), + ItemUtils.getOrePrefixStack(OrePrefixes.crushedCentrifuged, Materials.Malachite, 1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getDust(1), MISC_MATERIALS.SELENIUM_DIOXIDE.getSmallDust(1), diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java index 10cefdf0c4..2cc6d7b41a 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java @@ -154,16 +154,7 @@ public class RECIPES_Tools { CobbleStone, sandHammer, CobbleStone, CobbleStone, CobbleStone, CobbleStone, RECIPE_Sand); - - if (LoadedMods.Baubles){ - //Cloaking Device - RecipeUtils.recipeBuilder( - plateDoubleNiChrome, plateIridiumAlloy, plateDoubleNiChrome, - plateIridiumAlloy, batteryUltimate, plateIridiumAlloy, - plateDoubleNiChrome, plateIridiumAlloy, plateDoubleNiChrome, - personalCloakingDevice); - - } + //Sand to Sandstone RecipeUtils.recipeBuilder( Sand, Sand, Sand, diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index a9f336d19c..be1089a72a 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -6,6 +6,7 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; @@ -447,7 +448,10 @@ public class CI { } public static final ItemStack getTieredMachineCasing(int tier){ - if (tier == 0){ + if (tier == 0){ + if (machineCasing_ULV == null) { + machineCasing_ULV = ItemList.Casing_ULV.get(1); + } return machineCasing_ULV; } else if (tier == 1){ @@ -544,7 +548,7 @@ public class CI { private static final Material[] aMaterial_Main = new Material[] { ALLOY.POTIN, - ALLOY.ZIRCONIUM_CARBIDE, + ALLOY.TUMBAGA, ALLOY.EGLIN_STEEL, ALLOY.INCONEL_792, ALLOY.TUNGSTEN_TITANIUM_CARBIDE, @@ -558,7 +562,7 @@ public class CI { }; private static final Material[] aMaterial_Secondary = new Material[] { - ALLOY.TUMBAGA, + ALLOY.STEEL, ALLOY.SILICON_CARBIDE, ALLOY.TUNGSTEN_CARBIDE, ALLOY.INCONEL_690, @@ -573,7 +577,7 @@ public class CI { }; private static final Material[] aMaterial_Tertiary = new Material[] { - ALLOY.STEEL, + ELEMENT.getInstance().LEAD, ELEMENT.getInstance().ALUMINIUM, ALLOY.STAINLESS_STEEL, ELEMENT.getInstance().TUNGSTEN, @@ -631,12 +635,22 @@ public class CI { } public static FluidStack getTieredFluid(int aTier, int aAmount, int aType) { - ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); + // Weird Legacy handling + /*ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); FluidStack a = GT_Utility.getFluidForFilledItem(aCell, true); if (a == null) { a = aMaster[aType][aTier].getFluid(aAmount); - } - a.amount = aAmount; + }*/ + + // Modern Handling + FluidStack a = aMaster[aType][aTier].getFluid(aAmount); + if (a == null) { + ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1); + if (aCell != null) { + a = GT_Utility.getFluidForFilledItem(aCell, true); + a.amount = aAmount; + } + } return a; } @@ -1226,4 +1240,8 @@ public class CI { } + public static ItemStack getNumberedBioCircuit(int i) { + return ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, i, 0); + } + } diff --git a/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java b/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java new file mode 100644 index 0000000000..6cd13dc209 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotChemicalPlantInput.java @@ -0,0 +1,45 @@ +package gtPlusPlus.core.slots; + +import gregtech.api.util.Recipe_GT; +import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class SlotChemicalPlantInput extends Slot { + + public SlotChemicalPlantInput(final IInventory inventory, final int index, final int x, final int y) { + super(inventory, index, x, y); + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + return isItemValidForChemicalPlantSlot(itemstack); + } + + public static boolean isItemValidForChemicalPlantSlot(ItemStack aStack) { + boolean validItem = Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.containsInput(aStack); + if (!validItem) { + for (Recipe_GT f : Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) { + if (f.mFluidInputs.length > 0) { + for (FluidStack g : f.mFluidInputs) { + if (g != null) { + if (FluidContainerRegistry.containsFluid(aStack, g)) { + return true; + } + } + } + } + } + } + return validItem; + } + + @Override + public int getSlotStackLimit() { + return 64; + } + +} diff --git a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java index d4c389d9cc..533539d914 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java +++ b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java @@ -6,9 +6,8 @@ import net.minecraft.item.ItemStack; public class SlotGeneric extends Slot { - public SlotGeneric(final IInventory inventory, final int x, final int y, final int z) { - super(inventory, x, y, z); - + public SlotGeneric(final IInventory inventory, final int aSlotID, final int x, final int y) { + super(inventory, aSlotID, x, y); } @Override diff --git a/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java b/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java index c41a385c4b..48b050d678 100644 --- a/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java +++ b/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java @@ -10,12 +10,13 @@ import gtPlusPlus.core.recipe.common.CI; public class SlotIntegratedCircuit extends Slot { public static Item mCircuitItem; + public static Item mCircuitItem2; private final short mCircuitLock; public SlotIntegratedCircuit(final IInventory inventory, final int slot, final int x, final int y) { this(Short.MAX_VALUE+1, inventory, slot, x, y); } - + public SlotIntegratedCircuit(int mTypeLock, final IInventory inventory, final int slot, final int x, final int y) { super(inventory, slot, x, y); if (mTypeLock > Short.MAX_VALUE || mTypeLock < Short.MIN_VALUE) { @@ -28,18 +29,29 @@ public class SlotIntegratedCircuit extends Slot { @Override public synchronized boolean isItemValid(final ItemStack itemstack) { + return isItemValidForSlot(mCircuitLock, itemstack); + } + + public static synchronized boolean isItemValidForSlot(final ItemStack itemstack) { + return isItemValidForSlot(-1, itemstack); + } + + public static synchronized boolean isItemValidForSlot(int aLockedCircuitNumber, final ItemStack itemstack) { boolean isValid = false; if (mCircuitItem == null) { mCircuitItem = CI.getNumberedCircuit(0).getItem(); } - if (mCircuitItem != null) { + if (mCircuitItem2 == null) { + mCircuitItem2 = CI.getNumberedBioCircuit(0).getItem(); + } + if (mCircuitItem != null && mCircuitItem2 != null) { if (itemstack != null) { - if (itemstack.getItem() == mCircuitItem) { - if (mCircuitLock == -1) { + if (itemstack.getItem() == mCircuitItem || itemstack.getItem() == mCircuitItem2) { + if (aLockedCircuitNumber == -1) { isValid = true; } else { - if (itemstack.getItemDamage() == mCircuitLock) { + if (itemstack.getItemDamage() == aLockedCircuitNumber) { isValid = true; } } @@ -49,6 +61,33 @@ public class SlotIntegratedCircuit extends Slot { return isValid; } + /** + * Returns the circuit type. -1 is invalid, 0 is standard, 1 is GT++ bio. + * @param itemstack - the Circuit Stack. + * @return + */ + public static synchronized int isRegularProgrammableCircuit(final ItemStack itemstack) { + if (mCircuitItem == null) { + mCircuitItem = CI.getNumberedCircuit(0).getItem(); + } + if (mCircuitItem2 == null) { + mCircuitItem2 = CI.getNumberedBioCircuit(0).getItem(); + } + if (mCircuitItem != null && mCircuitItem2 != null) { + if (itemstack != null) { + if (itemstack.getItem() == mCircuitItem || itemstack.getItem() == mCircuitItem2) { + if (itemstack.getItem() == mCircuitItem) { + return 0; + } + else if (itemstack.getItem() == mCircuitItem2) { + return 1; + } + } + } + } + return -1; + } + @Override public int getSlotStackLimit() { return 64; diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java b/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java new file mode 100644 index 0000000000..762714ac94 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotNoInputLogging.java @@ -0,0 +1,36 @@ +package gtPlusPlus.core.slots; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.block.Block; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public class SlotNoInputLogging extends SlotNoInput { + + private final int aSlotIndex; + + public SlotNoInputLogging(final IInventory inventory, final int index, final int x, final int y) { + super(inventory, index, x, y); + aSlotIndex = index; + Logger.INFO("Slot "+index+" is doing logging"); + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + if (ItemUtils.checkForInvalidItems(itemstack)) { + Logger.INFO("Tried Inserting "+ItemUtils.getItemName(itemstack)+" into slot "+aSlotIndex); + Block b = Block.getBlockFromItem(itemstack.getItem()); + Logger.INFO(""+itemstack.getUnlocalizedName()); + if (b != null) { + Logger.INFO(""+b.getLocalizedName()); + Logger.INFO(""+b.getUnlocalizedName()); + } + } + else { + Logger.INFO("Bad Itemstack"); + } + return false; + } + +} diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java index c3670ef959..e7b7c46e7b 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -1,14 +1,26 @@ package gtPlusPlus.core.tileentities; import cpw.mods.fml.common.registry.GameRegistry; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.general.BlockSuperLight.TileEntitySuperLight; import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.tileentities.general.*; -import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; -import gtPlusPlus.core.tileentities.machines.*; +import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; +import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; +import gtPlusPlus.core.tileentities.general.TileEntityFirepit; +import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; +import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid; +import gtPlusPlus.core.tileentities.general.TileEntityPlayerDoorBase; +import gtPlusPlus.core.tileentities.general.TileEntityXpConverter; +import gtPlusPlus.core.tileentities.machines.TileEntityAdvPooCollector; +import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; +import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; +import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector; +import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; +import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; +import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; public class ModTileEntities { @@ -32,6 +44,8 @@ public class ModTileEntities { GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest"); GameRegistry.registerTileEntity(TileEntitySuperJukebox.class, "TileEntitySuperJukebox"); GameRegistry.registerTileEntity(TileEntitySuperLight.class, "TileEntitySuperLight"); + GameRegistry.registerTileEntity(TileEntityPestKiller.class, "TileEntityPestKiller"); + GameRegistry.registerTileEntity(TileEntityRoundRobinator.class, "TileEntityRoundRobinator"); //Mod TEs diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java index 4f9a8d3748..65ae9218fe 100644 --- a/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java +++ b/src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java @@ -1315,6 +1315,24 @@ public class TileEntityBase extends TileEntity implements ILazyCoverable, IGregT } return false; } + + + /** + * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d + */ + public boolean inputEnergyFrom(byte arg0, boolean arg1) { + // TODO Auto-generated method stub + return false; + } + + + /** + * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d + */ + public boolean outputsEnergyTo(byte arg0, boolean arg1) { + // TODO Auto-generated method stub + return false; + } diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java index 0cda40c616..23ad2a3233 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java @@ -11,6 +11,7 @@ import net.minecraft.tileentity.TileEntity; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.inventories.InventoryCircuitProgrammer; import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.slots.SlotIntegratedCircuit; import gtPlusPlus.core.util.minecraft.PlayerUtils; public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInventory { @@ -76,16 +77,21 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv boolean doAdd = false; ItemStack g = this.getStackInSlot(e); int aSize = 0; - ItemStack aInputStack = null; - if (g != null) { + ItemStack aInputStack = null; + int aTypeInSlot = SlotIntegratedCircuit.isRegularProgrammableCircuit(g); + if (aTypeInSlot >= 0 && g != null) { + // No Existing Output if (!hasOutput) { aSize = g.stackSize; doAdd = true; } + // Existing Output else { ItemStack f = this.getStackInSlot(25); - if (f != null) { - if (f.getItemDamage() == e) { + int aTypeInCheckedSlot = SlotIntegratedCircuit.isRegularProgrammableCircuit(f); + // Check that the Circuit in the Output slot is not null and the same type as the circuit input. + if (aTypeInCheckedSlot >= 0 && (aTypeInSlot == aTypeInCheckedSlot) && f != null) { + if (g.getItem() == f.getItem() && f.getItemDamage() == e) { aSize = f.stackSize + g.stackSize; if (aSize > 64) { aInputStack = g.copy(); @@ -93,16 +99,23 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv } doAdd = true; } - } - else { - doAdd = true; - aSize = g.stackSize; } } - if (doAdd) { - ItemStack aOutput = CI.getNumberedCircuit(e); - aOutput.stackSize = aSize; + if (doAdd) { + // Check Circuit Type + ItemStack aOutput; + if (aTypeInSlot == 0) { + aOutput = CI.getNumberedCircuit(e); + } + else if (aTypeInSlot == 1) { + aOutput = CI.getNumberedBioCircuit(e); + } + else { + aOutput = null; + } + if (aOutput != null) { + aOutput.stackSize = aSize; this.setInventorySlotContents(e, aInputStack); this.setInventorySlotContents(25, aOutput); return true; diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java new file mode 100644 index 0000000000..3ebe5be40d --- /dev/null +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPestKiller.java @@ -0,0 +1,506 @@ +package gtPlusPlus.core.tileentities.machines; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; +import gtPlusPlus.core.inventories.InventoryPestKiller; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.MISC_MATERIALS; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.DamageSource; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidEvent; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTank; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; +import net.minecraftforge.oredict.OreDictionary; + +public class TileEntityPestKiller extends TileEntity implements ISidedInventory, IFluidHandler { + + private final int mBaseTickRate = 20 * 30; + private final InventoryPestKiller mInventory; + private final FluidTank mTank; + private int mChunkX; + private int mChunkZ; + private boolean mSet = false; + + private int mTickCounter = 0; + private int mUpdateTick = 0; + private boolean mNeedsUpdate = false; + private String mCustomName; + + private static final AutoMap<Class<?>> mEntityMap = new AutoMap<Class<?>>(); + + static { + mEntityMap.put(EntityBat.class); + if (LoadedMods.Forestry) { + mEntityMap.put(ReflectionUtils.getClass("forestry.lepidopterology.entities.EntityButterfly")); + } + } + + public TileEntityPestKiller() { + this.mInventory = new InventoryPestKiller(); + mTank = new BTF_FluidTank(2000); + } + + public InventoryPestKiller getInventory() { + return this.mInventory; + } + + public FluidTank getTank() { + return mTank; + } + + private final void setup() { + World w = this.worldObj; + if (w != null) { + Chunk c = w.getChunkFromBlockCoords(this.xCoord, this.zCoord); + if (c != null) { + mChunkX = c.xPosition; + mChunkZ = c.zPosition; + mSet = true; + } + } + } + + @SuppressWarnings("rawtypes") + public boolean tryKillPests() { + int min = 0; + int max = 0; + switch (getTier()) { + case 1: + min = -2; + max = 3; + break; + case 2: + min = -4; + max = 5; + break; + default: + // code block + } + int aChunkCount = 0; + AutoMap<Entity> entities = new AutoMap<Entity>(); + if (min != 0 && max != 0) { + for (int x = min; x < max; x++) { + for (int z = min; z < max; z++) { + Chunk c = getChunkFromOffsetIfLoaded(x, z); + if (c != null) { + if (c.hasEntities) { + aChunkCount++; + List[] lists = c.entityLists; + for (List o : lists) { + for (Object e : o) { + if (e instanceof Entity) { + for (Class<?> C : mEntityMap) { + if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) { + entities.put((Entity) e); + } + } + } + } + } + } + } + } + } + } else { + Chunk c = getChunkFromOffsetIfLoaded(0, 0); + if (c != null) { + if (c.hasEntities) { + List[] lists = c.entityLists; + for (List o : lists) { + for (Object e : o) { + if (e instanceof Entity) { + for (Class<?> C : mEntityMap) { + if (e.getClass().equals(C) || C.isAssignableFrom(e.getClass())) { + entities.put((Entity) e); + } + } + } + } + } + } + } + } + boolean killed = false; + if (!entities.isEmpty()) { + for (Entity e : entities) { + if (e != null) { + if (e.isEntityAlive()) { + if (this.mTank.getFluidAmount() >= 1 || getTier() == 0) { + if (getTier() > 0) { + int aChanceToUse = MathUtils.randInt(1, (100 * getTier())); + if (aChanceToUse == 1) { + this.mTank.drain(1, true); + } + } + e.performHurtAnimation(); + EntityUtils.doDamage(e, DamageSource.generic, Short.MAX_VALUE); + e.setDead(); + killed = true; + } + } + } + } + } + updateTileEntity(); + return killed; + } + + public Chunk getChunkFromOffsetIfLoaded(int x, int y) { + Chunk c = this.worldObj.getChunkFromChunkCoords(mChunkX + x, mChunkZ + y); + if (c.isChunkLoaded) { + return c; + } + return null; + } + + public int getTier() { + if (this.mTank != null) { + FluidStack f = mTank.getFluid(); + if (f != null) { + if (f.isFluidEqual(FluidUtils.getWildcardFluidStack("formaldehyde", 1))) { + return 1; + } else if (f.isFluidEqual(MISC_MATERIALS.HYDROGEN_CYANIDE.getFluid(1))) { + return 2; + } + } + } + return 0; + } + + @Override + public void updateEntity() { + if (worldObj.isRemote) { + return; + } + if (!mSet) { + setup(); + } + this.mTickCounter++; + if (this.mTank != null) { + if (this.hasFluidSpace()) { + handleInventory(); + } + } + if (this.mTickCounter % this.mBaseTickRate == 0) { + tryKillPests(); + } + updateTick(); + } + + public boolean anyPlayerInRange() { + return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; + } + + public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { + if (!nbt.hasKey(tag)) { + nbt.setTag(tag, new NBTTagCompound()); + } + return nbt.getCompoundTag(tag); + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + mTank.writeToNBT(nbt); + super.writeToNBT(nbt); + // Utils.LOG_MACHINE_INFO("Trying to write NBT data to TE."); + final NBTTagCompound chestData = new NBTTagCompound(); + this.mInventory.writeToNBT(chestData); + nbt.setTag("ContentsChest", chestData); + if (this.hasCustomInventoryName()) { + nbt.setString("CustomName", this.getCustomName()); + } + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + mTank.readFromNBT(nbt); + super.readFromNBT(nbt); + // Utils.LOG_MACHINE_INFO("Trying to read NBT data from TE."); + this.mInventory.readFromNBT(nbt.getCompoundTag("ContentsChest")); + if (nbt.hasKey("CustomName", 8)) { + this.setCustomName(nbt.getString("CustomName")); + } + } + + @Override + public int getSizeInventory() { + return this.getInventory().getSizeInventory(); + } + + @Override + public ItemStack getStackInSlot(final int slot) { + return this.getInventory().getStackInSlot(slot); + } + + @Override + public ItemStack decrStackSize(final int slot, final int count) { + return this.getInventory().decrStackSize(slot, count); + } + + @Override + public ItemStack getStackInSlotOnClosing(final int slot) { + return this.getInventory().getStackInSlotOnClosing(slot); + } + + @Override + public void setInventorySlotContents(final int slot, final ItemStack stack) { + this.getInventory().setInventorySlotContents(slot, stack); + } + + @Override + public int getInventoryStackLimit() { + return this.getInventory().getInventoryStackLimit(); + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { + return this.getInventory().isUseableByPlayer(entityplayer); + } + + @Override + public void openInventory() { + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + this.getInventory().openInventory(); + } + + @Override + public void closeInventory() { + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + this.getInventory().closeInventory(); + } + + @Override + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { + return this.getInventory().isItemValidForSlot(slot, itemstack); + } + + @Override + public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { + final int[] accessibleSides = new int[this.getSizeInventory()]; + for (int r = 0; r < this.getInventory().getSizeInventory(); r++) { + accessibleSides[r] = r; + } + return accessibleSides; + + } + + @Override + public boolean canInsertItem(final int aSlot, final ItemStack aStack, final int p_102007_3_) { + if (this.getInventory().getInventory()[0] == null) { + return true; + } else if (GT_Utility.areStacksEqual(aStack, this.getInventory().getInventory()[0])) { + if (this.getInventory().getInventory()[0].stackSize < 64) { + int diff = 64 - this.getInventory().getInventory()[0].stackSize; + if (aStack.stackSize <= diff) { + return true; + } + } + } + return false; + } + + @Override + public boolean canExtractItem(final int aSlot, final ItemStack aStack, final int p_102008_3_) { + if (this.getInventory().getInventory()[1] == null) { + return false; + } else { + return true; + } + } + + public String getCustomName() { + return this.mCustomName; + } + + public void setCustomName(final String customName) { + this.mCustomName = customName; + } + + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.mCustomName : "container.pestkiller"; + } + + @Override + public boolean hasCustomInventoryName() { + return (this.mCustomName != null) && !this.mCustomName.equals(""); + } + + @Override + public final int fill(ForgeDirection from, FluidStack resource, boolean doFill) { + updateTileEntity(); + return this.mTank.fill(resource, doFill); + } + + @Override + public final FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { + updateTileEntity(); + return this.mTank.drain(resource.amount, doDrain); + } + + @Override + public final FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) { + FluidStack fluid = this.mTank.getFluid(); + // return this.tank.drain(maxDrain, doDrain); + if (fluid == null) { + return null; + } + + int drained = maxDrain; + if (fluid.amount < drained) { + drained = fluid.amount; + } + + FluidStack stack = new FluidStack(fluid, drained); + if (doDrain) { + fluid.amount -= drained; + if (fluid.amount <= 0) { + fluid = null; + } + + if (this != null) { + FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(fluid, this.getWorldObj(), this.xCoord, + this.yCoord, this.zCoord, this.mTank, 0)); + } + } + updateTileEntity(); + return stack; + } + + @Override + public boolean canFill(ForgeDirection from, Fluid fluid) { + return mTank.getFluid() == null || mTank.getFluid().getFluid().equals(fluid); + } + + @Override + public boolean canDrain(ForgeDirection from, Fluid fluid) { + return false; + } + + @Override + public final FluidTankInfo[] getTankInfo(ForgeDirection from) { + return new FluidTankInfo[] { this.mTank.getInfo() }; + } + + @Override + public final Packet getDescriptionPacket() { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); + } + + @Override + public final void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { + NBTTagCompound tag = pkt.func_148857_g(); + readFromNBT(tag); + } + + + public boolean hasFluidSpace() { + if (this.mTank.getFluidAmount() <= 1000) { + return true; + } + return false; + } + + public boolean drainCell() { + boolean didFill = false; + ItemStack aInput = this.getStackInSlot(0); + if (aInput == null) { + return false; + } + aInput = aInput.copy(); + if (aInput != null && (this.getStackInSlot(1) == null || this.getStackInSlot(1).stackSize < 64)) { + ArrayList<ItemStack> t1Cells = OreDictionary.getOres("cellFormaldehyde"); + ArrayList<ItemStack> t2Cells = OreDictionary.getOres("cellHydrogenCyanide"); + didFill = addFluid(t1Cells, aInput, FluidUtils.getWildcardFluidStack("formaldehyde", 1000)); + if (!didFill) { + didFill = addFluid(t2Cells, aInput, MISC_MATERIALS.HYDROGEN_CYANIDE.getFluid(1000)); + } + } + + return didFill; + } + + public boolean handleInventory() { + if (this.getInventory() != null && drainCell()) { + this.decrStackSize(0, 1); + if (this.getStackInSlot(1) == null) { + this.setInventorySlotContents(1, CI.emptyCells(1)); + } else { + this.getStackInSlot(1).stackSize++; + } + this.updateTileEntity(); + return true; + } else { + return false; + } + } + + public boolean addFluid(ArrayList<ItemStack> inputs, ItemStack aInput, FluidStack aFluidForInput) { + for (ItemStack a : inputs) { + if (GT_Utility.areStacksEqual(a, aInput)) { + if (mTank.getFluid() == null || mTank.getFluid() + .isFluidEqual(aFluidForInput)) { + boolean didFill = fill(ForgeDirection.UNKNOWN, aFluidForInput, true) > 0; + return didFill; + } + } else { + continue; + } + } + return false; + } + + public void updateTileEntity() { + this.getInventory().markDirty(); + this.markDirty(); + this.mNeedsUpdate = true; + } + + private final void updateTick() { + if (mNeedsUpdate) { + if (mUpdateTick == 0) { + mUpdateTick = 4; // every 4 ticks it will send an update + } else { + --mUpdateTick; + if (mUpdateTick == 0) { + markDirty(); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + mNeedsUpdate = false; + } + } + } + } + + + +} diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java new file mode 100644 index 0000000000..a220997c84 --- /dev/null +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityRoundRobinator.java @@ -0,0 +1,739 @@ +package gtPlusPlus.core.tileentities.machines; + +import java.util.List; + +import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.handler.GuiHandler; +import gtPlusPlus.core.inventories.Inventory_RoundRobinator; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.tileentity.IHopper; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Facing; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class TileEntityRoundRobinator extends TileEntity implements ISidedInventory, IHopper { + + private int tickCount = 0; + private final Inventory_RoundRobinator inventoryContents; + private String customName; + public int locationX; + public int locationY; + public int locationZ; + private int aData = 1111; + private int aTier = 1; + private int aTickRate = 100; + + public TileEntityRoundRobinator() { + this.inventoryContents = new Inventory_RoundRobinator(); + this.setTileLocation(); + } + + public boolean setTileLocation() { + if (this.hasWorldObj()) { + if (!this.getWorldObj().isRemote) { + this.locationX = this.xCoord; + this.locationY = this.yCoord; + this.locationZ = this.zCoord; + this.aTier = this.getWorldObj().getBlockMetadata(locationX, locationY, locationZ) + 1; + return true; + } + } + return false; + } + + //Rename to hasCircuitToConfigure + public final boolean hasInventoryContents() { + for (ItemStack i : this.aHopperInventory) { + if (i == null) { + continue; + } + else { + return true; + } + } + return false; + } + + public Inventory_RoundRobinator getInventory() { + return this.inventoryContents; + } + + public int getTier() { + return this.aTier; + } + + public int getTickRate() { + return this.aTickRate; + } + + @Override + public void updateEntity() { + try{ + // TODO + if (this.worldObj != null && !this.worldObj.isRemote){ + setTileLocation(); + aTickRate = (60-(aTier*10)); + if (this.getTier() == 1) { + // 20 s + aTickRate = 400; + } + else if (this.getTier() == 2) { + // 5 + aTickRate = 100; + } + else if (this.getTier() == 3) { + // 1 + aTickRate = 20; + } + else if (this.getTier() == 4) { + // 1/5 + aTickRate = 10; + } + else if (this.getTier() == 5) { + // 1/20 + aTickRate = 1; + } + else { + aTickRate = 999999; + } + + if (tickCount % getTickRate() == 0) { + if (hasInventoryContents()) { + Logger.WARNING("Trying to move items. "+aTickRate); + this.tryProcessItems(); + } + } + this.tickCount++; + } + } + catch (final Throwable t){ + t.printStackTrace(); + } + } + + public boolean anyPlayerInRange() { + return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null; + } + + public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) { + if (!nbt.hasKey(tag)) { + nbt.setTag(tag, new NBTTagCompound()); + } + return nbt.getCompoundTag(tag); + } + + @Override + public void writeToNBT(final NBTTagCompound nbt) { + super.writeToNBT(nbt); + if (this.hasCustomInventoryName()) { + nbt.setString("CustomName", this.getCustomName()); + } + nbt.setInteger("aCurrentMode", aData); + this.writeToNBT2(nbt); + } + + @Override + public void readFromNBT(final NBTTagCompound nbt) { + super.readFromNBT(nbt); + if (nbt.hasKey("CustomName", 8)) { + this.setCustomName(nbt.getString("CustomName")); + } + aData = nbt.getInteger("aCurrentMode"); + this.readFromNBT2(nbt); + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer entityplayer) { + return this.getInventory().isUseableByPlayer(entityplayer); + } + + @Override + public void openInventory() { + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + //this.getInventory().openInventory(); + } + + @Override + public void closeInventory() { + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + //this.getInventory().closeInventory(); + } + + @Override + public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { + return true; + } + + @Override + public int[] getAccessibleSlotsFromSide(final int aSide) { + return new int[] {0, 1, 2, 3, 4}; + } + + @Override + public boolean canInsertItem(final int aSlot, final ItemStack aStack, final int aSide) { + return aSide < 2; + } + + @Override + public boolean canExtractItem(final int aSlot, final ItemStack aStack, final int aSide) { + return false; + } + + public String getCustomName() { + return this.customName; + } + + public void setCustomName(final String customName) { + this.customName = customName; + } + + @Override + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.customName : "container.roundrobinator"; + } + + @Override + public boolean hasCustomInventoryName() { + return (this.customName != null) && !this.customName.equals(""); + } + + @Override + public Packet getDescriptionPacket() { + final NBTTagCompound tag = new NBTTagCompound(); + this.writeToNBT(tag); + return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag); + } + + @Override + public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) { + final NBTTagCompound tag = pkt.func_148857_g(); + this.readFromNBT(tag); + } + + + public boolean onRightClick(byte side, EntityPlayer player, int x, int y, int z) { + if (player != null && player.getHeldItem() == null) { + if (!player.isSneaking() && !KeyboardUtils.isShiftKeyDown()) { + player.openGui(GTplusplus.instance, GuiHandler.GUI16, player.getEntityWorld(), x, y, z); + } + else { + String InventoryContents = ItemUtils.getArrayStackNames(this.aHopperInventory); + PlayerUtils.messagePlayer(player, "Contents: "+InventoryContents+" | "+getDataString()); + } + return true; + } + else { + return false; + } + } + + public boolean onScrewdriverRightClick(byte side, EntityPlayer player, int x, int y, int z) { + try { + if (side < 2) { + // Top/Bottom + } + else { + if (toggleSide(side)) { + PlayerUtils.messagePlayer(player, "Enabling side "+side+"."); + } + else { + PlayerUtils.messagePlayer(player, "Disabling side "+side+"."); + } + PlayerUtils.messagePlayer(player, "Mode String: "+aData+""); + } + return true; + } + catch (Throwable t) { + t.printStackTrace(); + return false; + } + } + + public int getDataString() { + return aData; + } + + public boolean[] getActiveSides() { + this.markDirty(); + String s = String.valueOf(aData); + if (s == null || s.length() != 4) { + s = "1111"; + } + boolean[] aActiveSides = new boolean[4]; + for (int i=0;i<4;i++) { + char ch = s.charAt(i); + if (ch == '1') { + aActiveSides[i] = true; + } + else { + aActiveSides[i] = false; + } + } + return aActiveSides; + } + + /** + * Toggle active state of side + * @param aSide - Forge Direction / Side + * @return - True if the side is now Active, false if now disabled. + */ + public boolean toggleSide(int aSide) { + setSideActive(!getSideActive(aSide), aSide); + return getSideActive(aSide); + } + + + public void setSideActive(boolean aActive, int aSide) { + try { + if (aSide < 2) { + } + else { + if (aData < 1111) { + aData = 1111; + } + else if (aData > 2222) { + aData = 2222; + } + String s = String.valueOf(aData); + StringBuilder aDataString = new StringBuilder(s); + int aIndex = aSide - 2; + if (aActive) { + aDataString.setCharAt(aIndex, '1'); + } + else { + aDataString.setCharAt(aIndex, '2'); + } + aData = Integer.valueOf(aDataString.toString()); + this.markDirty(); + } + } + catch (Throwable t) { + t.printStackTrace(); + } + } + + public boolean getSideActive(int aSide) { + this.markDirty(); + try { + if (aSide < 2) { + return false; + } + else { + if (aData < 1111) { + aData = 1111; + } + else if (aData > 2222) { + aData = 2222; + } + String s = String.valueOf(aData); + int aIndex = aSide - 2; + char ch = s.charAt(aIndex); + if (ch == '1') { + return true; + } + else { + return false; + } + + } + } + catch (Throwable t) { + t.printStackTrace(); + return false; + } + } + + @Override + public double getXPos() { + return this.locationX; + } + + @Override + public double getYPos() { + return this.locationY; + } + + @Override + public double getZPos() { + return this.locationZ; + } + + + + + + + + + // TODO + + + + /* + * Hopper Code + */ + + + private ItemStack[] aHopperInventory = new ItemStack[5]; + + public int getSizeInventory() { + return this.aHopperInventory.length; + } + + public ItemStack getStackInSlot(int aSlot) { + return this.aHopperInventory[aSlot]; + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + public ItemStack decrStackSize(int aSlot, int aMinimumSizeOfExistingStack) + { + if (this.aHopperInventory[aSlot] != null) + { + ItemStack itemstack; + + if (this.aHopperInventory[aSlot].stackSize <= aMinimumSizeOfExistingStack) + { + itemstack = this.aHopperInventory[aSlot]; + this.aHopperInventory[aSlot] = null; + return itemstack; + } + else + { + itemstack = this.aHopperInventory[aSlot].splitStack(aMinimumSizeOfExistingStack); + + if (this.aHopperInventory[aSlot].stackSize == 0) + { + this.aHopperInventory[aSlot] = null; + } + + return itemstack; + } + } + else + { + return null; + } + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int aSlot) + { + if (this.aHopperInventory[aSlot] != null) + { + ItemStack itemstack = this.aHopperInventory[aSlot]; + this.aHopperInventory[aSlot] = null; + return itemstack; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int aSlot, ItemStack aStack) + { + this.aHopperInventory[aSlot] = aStack; + + if (aStack != null && aStack.stackSize > this.getInventoryStackLimit()) + { + aStack.stackSize = this.getInventoryStackLimit(); + } + } + + public boolean tryProcessItems() { + if (this.worldObj != null && !this.worldObj.isRemote) { + boolean didSomething = false; + if (!this.isEmpty()) { + Logger.WARNING("Has Items, Trying to push to all active directions."); + didSomething = this.tryPushItemsIntoNeighbours(); + } + if (didSomething) { + this.markDirty(); + return true; + } + } + return false; + } + + /** + * Is Empty + * @return + */ + private boolean isEmpty() { + ItemStack[] aitemstack = this.aHopperInventory; + int i = aitemstack.length; + + for (int j = 0; j < i; ++j) { + ItemStack itemstack = aitemstack[j]; + + if (itemstack != null) { + return false; + } + } + + return true; + } + + private boolean tryPushItemsIntoNeighbours() { + + boolean aDidPush = false; + + for (int u = 2; u < 6; u++) { + if (!this.getSideActive(u)) { + Logger.WARNING("Not pushing on side "+u); + continue; + } + + Logger.WARNING("Pushing on side "+u); + IInventory iinventory = this.getInventoryFromFacing(u); + + if (iinventory == null) { + Logger.WARNING("No inventory found."); + continue; + } + else { + + int i = Facing.oppositeSide[u]; + Logger.WARNING("Using Opposite direction: "+i); + + if (this.isInventoryFull(iinventory, i)) { + Logger.WARNING("Target is full, skipping."); + continue; + } + else { + Logger.WARNING("Target has space, let's move a single item."); + for (int j = 0; j < this.getSizeInventory(); ++j) { + if (this.getStackInSlot(j) != null) { + ItemStack itemstack = this.getStackInSlot(j).copy(); + ItemStack itemstack1 = setStackInNeighbour(iinventory, this.decrStackSize(j, 1), i); + if (itemstack1 == null || itemstack1.stackSize == 0) { + iinventory.markDirty(); + aDidPush = true; + continue; + } + this.setInventorySlotContents(j, itemstack); + } + } + } + } + } + + return aDidPush; + } + + private boolean isInventoryFull(IInventory aInv, int aSide) { + if (aInv instanceof ISidedInventory && aSide > -1) { + ISidedInventory isidedinventory = (ISidedInventory)aInv; + int[] aint = isidedinventory.getAccessibleSlotsFromSide(aSide); + + for (int l = 0; l < aint.length; ++l) + { + ItemStack itemstack1 = isidedinventory.getStackInSlot(aint[l]); + + if (itemstack1 == null || itemstack1.stackSize != itemstack1.getMaxStackSize()) + { + return false; + } + } + } + else { + int j = aInv.getSizeInventory(); + + for (int k = 0; k < j; ++k) + { + ItemStack itemstack = aInv.getStackInSlot(k); + + if (itemstack == null || itemstack.stackSize != itemstack.getMaxStackSize()) + { + return false; + } + } + } + return true; + } + + public static ItemStack setStackInNeighbour(IInventory aNeighbour, ItemStack aStack, int aSide) { + if (aNeighbour instanceof ISidedInventory && aSide > -1) + { + ISidedInventory isidedinventory = (ISidedInventory)aNeighbour; + int[] aint = isidedinventory.getAccessibleSlotsFromSide(aSide); + + for (int l = 0; l < aint.length && aStack != null && aStack.stackSize > 0; ++l) + { + aStack = tryMoveStack(aNeighbour, aStack, aint[l], aSide); + } + } + else + { + int j = aNeighbour.getSizeInventory(); + + for (int k = 0; k < j && aStack != null && aStack.stackSize > 0; ++k) + { + aStack = tryMoveStack(aNeighbour, aStack, k, aSide); + } + } + + if (aStack != null && aStack.stackSize == 0) + { + aStack = null; + } + + return aStack; + } + + private static boolean canInsertItemIntoNeighbour(IInventory aNeighbour, ItemStack aStack, int aSlot, int aSide) { + return !aNeighbour.isItemValidForSlot(aSlot, aStack) ? false : !(aNeighbour instanceof ISidedInventory) || ((ISidedInventory)aNeighbour).canInsertItem(aSlot, aStack, aSide); + } + + private static ItemStack tryMoveStack(IInventory aNeighbour, ItemStack aStack, int aSlot, int aSide) { + ItemStack itemstack1 = aNeighbour.getStackInSlot(aSlot); + if (canInsertItemIntoNeighbour(aNeighbour, aStack, aSlot, aSide)) { + boolean aDidSomething = false; + if (itemstack1 == null) { + //Forge: BUGFIX: Again, make things respect max stack sizes. + int max = Math.min(aStack.getMaxStackSize(), aNeighbour.getInventoryStackLimit()); + if (max >= aStack.stackSize) { + aNeighbour.setInventorySlotContents(aSlot, aStack); + aStack = null; + } + else { + aNeighbour.setInventorySlotContents(aSlot, aStack.splitStack(max)); + } + aDidSomething = true; + } + else if (areItemStacksEqual(itemstack1, aStack)) { + //Forge: BUGFIX: Again, make things respect max stack sizes. + int max = Math.min(aStack.getMaxStackSize(), aNeighbour.getInventoryStackLimit()); + if (max > itemstack1.stackSize) { + int l = Math.min(aStack.stackSize, max - itemstack1.stackSize); + aStack.stackSize -= l; + itemstack1.stackSize += l; + aDidSomething = l > 0; + } + } + if (aDidSomething){ + aNeighbour.markDirty(); + } + } + return aStack; + } + + private IInventory getInventoryFromFacing(int aSide) + { + int i = aSide; + return tryFindInvetoryAtXYZ(this.getWorldObj(), (double)(this.xCoord + Facing.offsetsXForSide[i]), (double)(this.yCoord + Facing.offsetsYForSide[i]), (double)(this.zCoord + Facing.offsetsZForSide[i])); + } + + public static IInventory tryFindInvetoryAtXYZ(World aWorld, double aX, double aY, double aZ) + { + IInventory iinventory = null; + int sX = MathHelper.floor_double(aX); + int sY = MathHelper.floor_double(aY); + int sZ = MathHelper.floor_double(aZ); + TileEntity tileentity = aWorld.getTileEntity(sX, sY, sZ); + + if (tileentity != null && tileentity instanceof IInventory) + { + iinventory = (IInventory)tileentity; + + if (iinventory instanceof TileEntityChest) + { + Block block = aWorld.getBlock(sX, sY, sZ); + + if (block instanceof BlockChest) + { + iinventory = ((BlockChest)block).func_149951_m(aWorld, sX, sY, sZ); + } + } + } + + if (iinventory == null) + { + List list = aWorld.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1.0D, aY + 1.0D, aZ + 1.0D), IEntitySelector.selectInventories); + + if (list != null && list.size() > 0) + { + iinventory = (IInventory)list.get(aWorld.rand.nextInt(list.size())); + } + } + + return iinventory; + } + + private static boolean areItemStacksEqual(ItemStack aStack, ItemStack aStack2) { + return aStack.getItem() != aStack2.getItem() ? false : (aStack.getItemDamage() != aStack2.getItemDamage() ? false : (aStack.stackSize > aStack.getMaxStackSize() ? false : ItemStack.areItemStackTagsEqual(aStack, aStack2))); + } + + public void readFromNBT2(NBTTagCompound p_145839_1_) { + super.readFromNBT(p_145839_1_); + NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10); + this.aHopperInventory = new ItemStack[this.getSizeInventory()]; + for (int i = 0; i < nbttaglist.tagCount(); ++i) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); + byte b0 = nbttagcompound1.getByte("Slot"); + if (b0 >= 0 && b0 < this.aHopperInventory.length) { + this.aHopperInventory[b0] = ItemStack.loadItemStackFromNBT( + nbttagcompound1 + ); + } + } + } + + public void writeToNBT2(NBTTagCompound aNBT) { + super.writeToNBT(aNBT); + NBTTagList nbttaglist = new NBTTagList(); + for (int i = 0; i < this.aHopperInventory.length; ++i) { + if (this.aHopperInventory[i] != null) { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + nbttagcompound1.setByte("Slot", (byte) i); + this.aHopperInventory[i].writeToNBT(nbttagcompound1); + nbttaglist.appendTag(nbttagcompound1); + } + } + aNBT.setTag("Items", nbttaglist); + } + + + + + + + +} diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index bb1d9064e8..c73f9ee7a4 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -2,13 +2,23 @@ package gtPlusPlus.core.util; import java.awt.Color; import java.awt.Graphics; -import java.io.*; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.ObjectOutput; +import java.io.ObjectOutputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; import javax.xml.bind.DatatypeConverter; @@ -17,30 +27,15 @@ import org.apache.commons.lang3.EnumUtils; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; -import net.minecraft.world.World; - import gregtech.GT_Mod; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TC_Aspects; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; - import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; @@ -59,6 +54,18 @@ import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; import ic2.core.Ic2Items; import ic2.core.init.InternalName; import ic2.core.item.resources.ItemCell; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.item.Item.ToolMaterial; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fluids.FluidContainerRegistry; @@ -73,6 +80,10 @@ public class Utils { public static final boolean isServer() { return FMLCommonHandler.instance().getEffectiveSide().isServer(); } + + public static final boolean isClient() { + return FMLCommonHandler.instance().getEffectiveSide().isClient(); + } static class ShortTimerTask extends TimerTask { @Override @@ -367,9 +378,6 @@ public class Utils { } final Color c = new Color(r, g, b); String temp = Integer.toHexString(c.getRGB() & 0xFFFFFF).toUpperCase(); - - // System.out.println( "hex: " + Integer.toHexString( c.getRGB() & - // 0xFFFFFF ) + " hex value:"+temp); temp = Utils.appenedHexNotationToString(String.valueOf(temp)); Logger.WARNING("Made " + temp + " - Hopefully it's not a mess."); Logger.WARNING("It will decode into " + Integer.decode(temp) + "."); diff --git a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java index cca58467ef..3e96220995 100644 --- a/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java +++ b/src/Java/gtPlusPlus/core/util/data/ArrayUtils.java @@ -1,10 +1,15 @@ package gtPlusPlus.core.util.data; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; -import net.minecraft.item.ItemStack; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import net.minecraft.item.ItemStack; public class ArrayUtils { @@ -75,5 +80,13 @@ public class ArrayUtils { } } + public static String toString(Object[] aArray, String string) { + return org.apache.commons.lang3.ArrayUtils.toString(aArray, string); + } + + public static String toString(Object[] aArray) { + return org.apache.commons.lang3.ArrayUtils.toString(aArray); + } + } diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index bda722b47e..2f4db2efcc 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -13,6 +13,8 @@ import gtPlusPlus.core.util.Utils; public class MathUtils { + final static Random rand = CORE.RANDOM; + /** * Returns a psuedo-random number between min and max, inclusive. * The difference between min and max can be at most @@ -23,9 +25,6 @@ public class MathUtils { * @return Integer between min and max, inclusive. * @see java.util.Random#nextInt(int) */ - - final static Random rand = CORE.RANDOM; - public static int randInt(final int min, final int max) { // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive @@ -692,6 +691,39 @@ public class MathUtils { public static int balance(int aInput, int aMin, int aMax) { return Math.max(Math.min(aInput, aMax), aMin); } + + /** + * Balances a number within a range. + * @param aInput - The number to balance + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds + * @return - A Number which will be between the bounds, or a boundary value. + */ + public static Number balance(Number aInput, Number aMin, Number aMax) { + return max(min(aInput, aMax), aMin); + } + + /** + * Balances a number within a range. + * @param aInput - The number to balance + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds + * @return - An Integer which will be between the bounds, or a boundary value. + */ + public static int balanceInt(Number aInput, Number aMin, Number aMax) { + return MathUtils.safeCast_LongToInt((long) balance(max(min(aInput, aMax), aMin), Integer.MIN_VALUE, Integer.MAX_VALUE)); + } + + /** + * Balances a number within a range. + * @param aInput - The number to balance + * @param aMin - The minimum bounds + * @param aMax - The maximum bounds + * @return - A Long which will be between the bounds, or a boundary value. + */ + public static long balanceLong(Number aInput, Number aMin, Number aMax) { + return (long) balance(max(min(aInput, aMax), aMin), Long.MIN_VALUE, Long.MAX_VALUE); + } public static int getValueWithinRange(int i, int aMin, int aMax) { int aAmount = Math.max(Math.min(i, aMax), aMin); @@ -703,5 +735,37 @@ public class MathUtils { int aRemainder = (int) (aLong - (aIntMaxInLong * Integer.MAX_VALUE)); return new Pair<Integer, Integer>(aIntMaxInLong, aRemainder); } + + + + + /** + * Returns the smaller of two {@code Number}s. That is, + * the result the argument closer to the value of + * {@link Long#MIN_VALUE}. If the arguments have the same + * value, the result is that same value. + * + * @param a an argument. + * @param b another argument. + * @return the smaller of {@code a} and {@code b}. + */ + public static Number min(Number a, Number b) { + return (a.longValue() <= b.longValue()) ? a : b; + } + + /** + * Returns the greater of two {@code Number}s. That is, the + * result is the argument closer to the value of + * {@link Long#MAX_VALUE}. If the arguments have the same value, + * the result is that same value. + * + * @param a an argument. + * @param b another argument. + * @return the larger of {@code a} and {@code b}. + */ + public static Number max(Number a, Number b) { + return (a.longValue() >= b.longValue()) ? a : b; + } + } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ClientUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ClientUtils.java new file mode 100644 index 0000000000..806f83d830 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/minecraft/ClientUtils.java @@ -0,0 +1,18 @@ +package gtPlusPlus.core.util.minecraft; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; + +public class ClientUtils { + + static { + if (FMLCommonHandler.instance().getSide() == Side.SERVER) { + Logger.ERROR("Something tried to access the ClientUtils class from the Server Side."); + Logger.ERROR("Soft crashing to prevent data corruption."); + CORE.crash(); + } + } + +} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java index 09263bb639..d7b6bc0a30 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java @@ -6,15 +6,17 @@ import net.minecraft.item.ItemStack; import gregtech.api.enums.Dyes; import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.minecraft.FluidGT6; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.item.base.cell.BaseItemPlasmaCell; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.material.MaterialStack; +import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import net.minecraftforge.fluids.*; @@ -147,7 +149,7 @@ public class FluidUtils { public static Fluid addGtFluid(final String aName, final String aLocalized, final GT_Materials aMaterial, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount, final boolean aGenerateCell) { - Fluid g = addGTFluid(aName, "fluid.autogenerated", aLocalized, aMaterial.mRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); + Fluid g = addGTFluid(aName, "fluid.autogenerated", aLocalized, aMaterial != null ? aMaterial.mRGBa : new short[]{255, 255, 255, 0}, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount, aGenerateCell); if (g != null) { if (aMaterial != null) { switch (aState) { @@ -203,7 +205,7 @@ public class FluidUtils { ItemStack temp = null; //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellPlasma"+aMaterial.getUnlocalizedName(), 1) == null){ - final Item temp2 = new BaseItemPlasmaCell(aMaterial); + new BaseItemPlasmaCell(aMaterial); temp = aMaterial.getPlasmaCell(1); } else { @@ -308,7 +310,7 @@ public class FluidUtils { rFluid.setTemperature((int) (aTemperatureK)); } if ((aFullContainer != null) && (aEmptyContainer != null) && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { - MaterialGenerator.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); + CORE.RA.addFluidCannerRecipe(CI.emptyCells(1), aFullContainer, new FluidStack(rFluid, aFluidAmount)); } else { //Utils.LOG_INFO("Failed creating recipes to fill/empty cells of "+aName+"."); @@ -460,21 +462,17 @@ public class FluidUtils { aGenerateCell); if (dustStack != null){ - MaterialGenerator.addFluidExtractionRecipe( - dustStack, //Input - null, //Input 2 + CORE.RA.addFluidExtractionRecipe( + dustStack, //Input 2 FluidUtils.getFluidStack(gtFluid, amountPerItem), //Fluid Output - 0, //Chance 1*20, //Duration 16 //Eu Tick ); } if (dustStack2 != null){ - MaterialGenerator.addFluidExtractionRecipe( - dustStack2, //Input - null, //Input 2 + CORE.RA.addFluidExtractionRecipe( + dustStack2, //Input 2 FluidUtils.getFluidStack(gtFluid, amountPerItem), //Fluid Output - 0, //Chance 1*20, //Duration 16 //Eu Tick ); @@ -564,12 +562,12 @@ public class FluidUtils { } public static FluidStack getWildcardFluidStack(String aFluidName, int amount) { - FluidStack aFStack1 = (FluidUtils.getFluidStack("molten"+"."+aFluidName.toLowerCase(), 1)); - FluidStack aFStack2 = (FluidUtils.getFluidStack("fluid"+"."+aFluidName.toLowerCase(), 1)); - FluidStack aFStack3 = (FluidUtils.getFluidStack(aFluidName.toLowerCase(), 1)); - FluidStack aFStack4 = (FluidUtils.getFluidStack(aFluidName, 1)); - FluidStack aFStack5 = (FluidUtils.getFluidStack("liquid_"+aFluidName.toLowerCase(), 1)); - FluidStack aFStack6 = (FluidUtils.getFluidStack("liquid"+"."+aFluidName.toLowerCase(), 1)); + FluidStack aFStack1 = (FluidUtils.getFluidStack("molten"+"."+aFluidName.toLowerCase(), amount)); + FluidStack aFStack2 = (FluidUtils.getFluidStack("fluid"+"."+aFluidName.toLowerCase(), amount)); + FluidStack aFStack3 = (FluidUtils.getFluidStack(aFluidName.toLowerCase(), amount)); + FluidStack aFStack4 = (FluidUtils.getFluidStack(aFluidName, amount)); + FluidStack aFStack5 = (FluidUtils.getFluidStack("liquid_"+aFluidName.toLowerCase(), amount)); + FluidStack aFStack6 = (FluidUtils.getFluidStack("liquid"+"."+aFluidName.toLowerCase(), amount)); if (aFStack1 != null) { return aFStack1; } @@ -590,6 +588,28 @@ public class FluidUtils { } return null; } + + public static FluidStack getWildcardFluidStack(Materials aMaterial, int amount) { + FluidStack aFStack1 = aMaterial.getFluid(amount); + FluidStack aFStack2 = aMaterial.getGas(amount); + FluidStack aFStack3 = aMaterial.getMolten(amount); + FluidStack aFStack4 = aMaterial.getSolid(amount); + if (aFStack1 != null) { + return aFStack1; + } + else if (aFStack2 != null) { + return aFStack2; + } + else if (aFStack3 != null) { + return aFStack3; + } + else if (aFStack4 != null) { + return aFStack4; + } + else { + return null; + } + } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java index c529f60ba1..d69dd5d66e 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -306,7 +306,14 @@ public class HazmatUtils { //Logger.INFO("[Hazmat] Item was mapped for TTs"); Collections.sort(aTempTooltipData); //Logger.INFO("[Hazmat] Sorted TTs"); - return aTempTooltipData.toArray(); + + String[] mBuiltOutput = new String[aTempTooltipData.size()]; + int aIndex = 0; + for (String i : aTempTooltipData) { + mBuiltOutput[aIndex++] = i; + } + + return mBuiltOutput; } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index adeaf8c8ad..cb490203df 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -7,6 +7,7 @@ import java.util.Map; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -30,6 +31,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; @@ -41,10 +43,11 @@ import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; @@ -57,13 +60,13 @@ public class ItemUtils { public static ItemStack getSimpleStack(final Block x) { return simpleMetaStack(Item.getItemFromBlock(x), 0, 1); } - + public static ItemStack getSimpleStack(final Block x, int i) { if (i == 0) { return getSimpleStack(x, i, 1); } - + return getSimpleStack(x, 0, i); } @@ -205,29 +208,28 @@ public class ItemUtils { } } - @SuppressWarnings("unused") - public static ItemStack simpleMetaStack(final Item item, final int meta, final int size) { - try { - if (item == null) { - return null; - } - Item em = item; - final Item em1 = item; - Logger.WARNING("Found: " + em1.getUnlocalizedName() + ":" + meta); - if (em1 != null) { - if (null == em) { - em = em1; - } - if (em != null) { - final ItemStack metaStack = new ItemStack(em, size, meta); - return metaStack; - } - } - return null; - } catch (final NullPointerException e) { - // Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]"); + public static ItemStack simpleMetaStack(ItemStack simpleStack, int meta, int size) { + return simpleMetaStack(simpleStack.getItem(), meta, size); + } + + public static ItemStack simpleMetaStack(final Item item, int meta, int size) { + if (item == null) { return null; } + if (meta < 0 || meta > Short.MAX_VALUE) { + meta = 0; + } + if (size < 0 || size > 64) { + size = 1; + } + //Logger.INFO("Found Metastack: " + item.getUnlocalizedName() + ":" + meta); + //Logger.INFO(""+ReflectionUtils.getMethodName(0)); + //Logger.INFO(""+ReflectionUtils.getMethodName(1)); + //Logger.INFO(""+ReflectionUtils.getMethodName(2)); + //Logger.INFO(""+ReflectionUtils.getMethodName(3)); + //Logger.INFO(""+ReflectionUtils.getMethodName(4)); + final ItemStack metaStack = new ItemStack(item, size, meta); + return metaStack; } public static ItemStack simpleMetaStack(final Block block, final int meta, final int size) { @@ -302,9 +304,9 @@ public class ItemUtils { else { mTemp = Utils.sanitizeString(mTemp); } - - - + + + if (oredictName.contains("rod")) { String s = "stick"+oredictName.substring(3); oredictName = s; @@ -371,7 +373,7 @@ public class ItemUtils { return returnValue.copy(); } } - + Logger.RECIPE(oredictName + " was not valid."); return null; } catch (final Throwable t) { @@ -402,7 +404,7 @@ public class ItemUtils { new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, mChemForm, Colour, "Dust"), new BaseItemDustUnique("itemDustSmall" + unlocalizedName, materialName, mChemForm, Colour, "Small"), new BaseItemDustUnique("itemDustTiny" + unlocalizedName, materialName, mChemForm, Colour, "Tiny") }; - + //Generate Shaped/Shapeless Recipes final ItemStack normalDust = ItemUtils.getSimpleStack(output[0]); @@ -456,7 +458,7 @@ public class ItemUtils { Logger.WARNING("4 Small dust from 1 Dust Recipe: "+materialName+" - Failed"); } } - + return output; } @@ -486,7 +488,7 @@ public class ItemUtils { public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust) { return generateSpecialUseDusts(material, onlyLargeDust, false); } - + public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust, final boolean disableExtraRecipes) { final String materialName = material.getLocalizedName(); final String unlocalizedName = Utils.sanitizeString(materialName); @@ -693,20 +695,22 @@ public class ItemUtils { public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack) { final String[] itemNames = aStack == null ? new String[] {} : new String[aStack.length]; - Logger.INFO(""+aStack.length); - + if (aStack != null){ + Logger.INFO(""+aStack.length); + } + if (aStack == null || aStack.length < 1) { return itemNames; } - + int arpos = 0; for (final ItemStack alph : aStack) { if (alph == null) { continue; } try { - itemNames[arpos] = alph.getDisplayName(); - arpos++; + itemNames[arpos] = alph.getDisplayName(); + arpos++; } catch (Throwable t) { t.printStackTrace(); @@ -998,15 +1002,15 @@ public class ItemUtils { return true; } - - + + public static IInventory organiseInventory(IInventory aInputInventory) { ItemStack[] p = new ItemStack[aInputInventory.getSizeInventory()]; for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { p[o] = aInputInventory.getStackInSlot(o); } //ItemStack[] g = organiseInventory(p); - + IInventory aTemp = aInputInventory; for (int i = 0; i < p.length; ++i) { for (int j = i + 1; j < p.length; ++j) { @@ -1016,22 +1020,22 @@ public class ItemUtils { } } } - + /* for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { aTemp.setInventorySlotContents(o, g[o]); }*/ return aTemp; } - - + + public static ItemStack[] organiseInventory(ItemStack[] aInputs) { //Update Slots int aInvSize = aInputs.length; ItemStack[] newArray = new ItemStack[aInvSize]; - - + + //Try merge stacks for (int i = 0; i < aInvSize; i++) { for (int i2 = 0; i2 < aInvSize; i2++) { @@ -1045,29 +1049,29 @@ public class ItemUtils { } //Try Merge else { - + if (GT_Utility.areStacksEqual(t1[0], t1[1])) { - while ((t1[0].stackSize < 64 && t1[1].stackSize > 0)) { - t1[0].stackSize++; - t1[1].stackSize--; - if (t1[1].stackSize <= 0) { - t1[1] = null; - break; - } - if (t1[0].stackSize == 64) { - break; - } - } - newArray[i] = t1[1]; - newArray[i2] = t1[0]; + while ((t1[0].stackSize < 64 && t1[1].stackSize > 0)) { + t1[0].stackSize++; + t1[1].stackSize--; + if (t1[1].stackSize <= 0) { + t1[1] = null; + break; + } + if (t1[0].stackSize == 64) { + break; + } + } + newArray[i] = t1[1]; + newArray[i2] = t1[0]; } } } } } - + ItemStack[] newArray2 = new ItemStack[aInvSize]; - + //Move nulls to end int count2 = 0; for (int i = 0; i < aInvSize; i++) @@ -1075,10 +1079,18 @@ public class ItemUtils { newArray2[count2++] = newArray[i]; while (count2 < aInvSize) newArray2[count2++] = null; - + return newArray2; + + } + public static String getFluidName(FluidStack aFluid) { + return aFluid != null ? aFluid.getFluid().getLocalizedName(aFluid) : "NULL"; + } + + public static String getFluidName(Fluid aFluid) { + return aFluid != null ? aFluid.getLocalizedName() : "NULL"; } public static String getItemName(ItemStack aStack) { @@ -1089,7 +1101,7 @@ public class ItemUtils { try { aDisplay = ("" + StatCollector .translateToLocal(aStack.getItem().getUnlocalizedNameInefficiently(aStack) + ".name")) - .trim(); + .trim(); if (aStack.hasTagCompound()) { if (aStack.stackTagCompound != null && aStack.stackTagCompound.hasKey("display", 10)) { NBTTagCompound nbttagcompound = aStack.stackTagCompound.getCompoundTag("display"); @@ -1117,7 +1129,7 @@ public class ItemUtils { String aDisplay = null; try { aDisplay = (aStack.getUnlocalizedName()).trim(); - + } catch (Throwable t) { aDisplay = aStack.getItem().getUnlocalizedName(); } @@ -1126,7 +1138,7 @@ public class ItemUtils { } return aDisplay; } - + public static boolean isItemGregtechTool(ItemStack aStack) { if (aStack == null) { return false; @@ -1139,49 +1151,49 @@ public class ItemUtils { } return false; } - + public static boolean isToolWrench(ItemStack aWrench) { if (isItemGregtechTool(aWrench) && (aWrench.getItemDamage() == 16 || aWrench.getItemDamage() == 120 || aWrench.getItemDamage() == 122 || aWrench.getItemDamage() == 124 || aWrench.getItemDamage() == 7734)) { return true; } return false; } - + public static boolean isToolMallet(ItemStack aMallet) { if (isItemGregtechTool(aMallet) && (aMallet.getItemDamage() == 14)) { return true; } return false; } - + public static boolean isToolScrewdriver(ItemStack aScrewdriver) { if (isItemGregtechTool(aScrewdriver) && (aScrewdriver.getItemDamage() == 22 || aScrewdriver.getItemDamage() == 150)) { return true; } return false; } - + public static boolean isToolCrowbar(ItemStack aCrowbar) { if (isItemGregtechTool(aCrowbar) && (aCrowbar.getItemDamage() == 20)) { return true; } return false; } - + public static boolean isToolWirecutters(ItemStack aWirecutters) { if (isItemGregtechTool(aWirecutters) && (aWirecutters.getItemDamage() == 26)) { return true; } return false; } - + public static boolean isToolHammer(ItemStack aHammer) { if (isItemGregtechTool(aHammer) && (aHammer.getItemDamage() == 12 || aHammer.getItemDamage() == 7734)) { return true; } return false; } - + public static boolean isToolSolderingIron(ItemStack aSoldering) { if (isItemGregtechTool(aSoldering) && (aSoldering.getItemDamage() == 160)) { return true; @@ -1210,14 +1222,38 @@ public class ItemUtils { public static ItemStack getEnchantedBook(Enchantment aEnch, int aLevel) { return enchantItem(new ItemStack(Items.enchanted_book), aEnch, aLevel); } - + public static ItemStack enchantItem(ItemStack aStack, Enchantment aEnch, int aLevel) { Items.enchanted_book.addEnchantment(aStack, new EnchantmentData(aEnch, aLevel)); return aStack; } public static boolean doesOreDictHaveEntryFor(String string) { - return OreDictionary.doesOreNameExist(string); + return OreDictUtils.containsValidEntries(string); + } + + public static void hideItemFromNEI(ItemStack aItemToHide) { + codechicken.nei.api.API.hideItem(aItemToHide); + } + + public static ItemStack getNullStack() { + return GT_Values.NI; + } + + + public static ItemStack depleteStack(ItemStack aStack) { + return depleteStack(aStack, 1); + } + + public static ItemStack depleteStack(ItemStack aStack, int aAmount) { + final int cap = aStack.stackSize; + if (cap > 1 && cap > aAmount) { + aStack.stackSize = (MathUtils.balance((aStack.stackSize - 1), 0, 64)); + if (aStack.stackSize > 0) { + return aStack; + } + } + return getNullStack(); } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java new file mode 100644 index 0000000000..ea161e4adb --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java @@ -0,0 +1,56 @@ +package gtPlusPlus.core.util.minecraft; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import cpw.mods.fml.common.registry.LanguageRegistry; +import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + +public class LangUtils { + + + public static boolean rewriteEntryForLanguageRegistry(String aKey, String aNewValue){ + return rewriteEntryForLanguageRegistry("en_US", aKey, aNewValue); + } + + @SuppressWarnings("unchecked") + public static boolean rewriteEntryForLanguageRegistry(String aLang, String aKey, String aNewValue){ + LanguageRegistry aInstance = LanguageRegistry.instance(); + Field aModLanguageData = ReflectionUtils.getField(LanguageRegistry.class, "modLanguageData"); + if (aModLanguageData != null){ + Map<String,Properties> aProps = new HashMap<String, Properties>(); + Object aInstanceProps; + try { + aInstanceProps = aModLanguageData.get(aInstance); + if (aInstanceProps != null){ + aProps = (Map<String, Properties>) aInstanceProps; + Properties aLangProps = aProps.get(aLang); + if (aLangProps != null){ + if (aLangProps.containsKey(aKey)) { + aLangProps.remove(aKey); + aLangProps.put(aKey, aNewValue); + } + else { + aLangProps.put(aKey, aNewValue); + } + aProps.remove(aLang); + aProps.put(aLang, aLangProps); + ReflectionUtils.setField(aInstance, aModLanguageData, aProps); + } + } + } + catch (IllegalArgumentException | IllegalAccessException e) { + + } + } + return false; + } + + public static String trans(String aNr, String aEnglish) { + return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aNr, aEnglish, false); + } + +} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index 364430b07d..9c623bb9be 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -25,6 +25,7 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.data.EnumUtils; import gtPlusPlus.core.util.data.StringUtils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -207,9 +208,9 @@ public class MaterialUtils { return true; } - public static int getTierOfMaterial(final int aMeltingPoint){ + public static int getTierOfMaterial(final double aMeltingPoint){ - return aMeltingPoint < 1000 ? 0 : (Math.round(aMeltingPoint/1000)); + return aMeltingPoint < 1000 ? 0 : (MathUtils.roundToClosestInt(aMeltingPoint/1000f)); /*if ((aMeltingPoint >= 0) && (aMeltingPoint <= 1000)){ diff --git a/src/Java/gtPlusPlus/core/util/minecraft/OreDictUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/OreDictUtils.java new file mode 100644 index 0000000000..324d39b863 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/minecraft/OreDictUtils.java @@ -0,0 +1,25 @@ +package gtPlusPlus.core.util.minecraft; + +import java.util.List; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class OreDictUtils { + + public static boolean containsValidEntries(String aOreName) { + boolean a = OreDictionary.doesOreNameExist(aOreName); + List<ItemStack> b = OreDictionary.getOres(aOreName, false); + + if (!a) { + return false; + } + else { + if (b == null || b.isEmpty()) { + return false; + } + } + return true; + } + +} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java index aeeb4ae5be..2ae2a9f1de 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/gregtech/PollutionUtils.java @@ -1,16 +1,30 @@ package gtPlusPlus.core.util.minecraft.gregtech; +import static gtPlusPlus.core.lib.CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK; + import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import org.apache.commons.lang3.ArrayUtils; + import gregtech.GT_Mod; +import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.common.GT_Proxy; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.item.base.cell.BaseItemCell; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.MISC_MATERIALS; +import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.item.ItemStack; import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.fluids.FluidStack; public class PollutionUtils { @@ -22,13 +36,19 @@ public class PollutionUtils { private static Method mGetPollution; private static Method mGetPollution2; + public static AutoMap<FluidStack> mPollutionFluidStacks = new AutoMap<FluidStack>(); + static { - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) { + if (MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) { mIsPollutionEnabled = mPollution(); } else { mIsPollutionEnabled = false; } } + + public static boolean isPollutionEnabled() { + return mIsPollutionEnabled; + } public static boolean mPollution() { try { @@ -119,8 +139,57 @@ public class PollutionUtils { return addPollution(aChunk, -pollutionValue); } + public static boolean nullifyPollution(IGregTechTileEntity te) { + if (te == null) { + return false; + } + return nullifyPollution((IHasWorldObjectAndCoords) te); + } + + public static boolean nullifyPollution(IHasWorldObjectAndCoords aTileOfSomeSort) { + if (aTileOfSomeSort == null) { + return false; + } + IHasWorldObjectAndCoords j = (IHasWorldObjectAndCoords) aTileOfSomeSort; + Chunk c = j.getWorld().getChunkFromBlockCoords(j.getXCoord(), j.getZCoord()); + return nullifyPollution(c); + } + + public static boolean nullifyPollution(Chunk aChunk) { + try { + if (aChunk == null) { + return false; + } + long getCurrentPollution = getPollution(aChunk); + if (getCurrentPollution <= 0) { + return false; + } + else { + if (mAddPollution2 != null) { + mAddPollution2.invoke(null, aChunk, -getCurrentPollution); + return true; + } + else { + Class<?> GT_Pollution = ReflectionUtils.getClass("gregtech.common.GT_Pollution"); + if (GT_Pollution != null) { + Method addPollution = ReflectionUtils.getMethod(GT_Pollution, "addPollution", Chunk.class, int.class); + if (addPollution != null) { + mAddPollution2 = addPollution; + mAddPollution2.invoke(null, aChunk, 0); + return true; + } + } + } + } + + } catch (SecurityException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { + } + return false; + } + public static int getPollution(IGregTechTileEntity te) { - if (mIsPollutionEnabled) + if (MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) try { if (te == null) { return 0; @@ -143,7 +212,7 @@ public class PollutionUtils { } public static int getPollution(Chunk te) { - if (mIsPollutionEnabled) + if (MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) try { if (te == null) { return 0; @@ -164,5 +233,73 @@ public class PollutionUtils { } return 0; } + + public static boolean setPollutionFluids() { + if (mPollutionFluidStacks.isEmpty()) { + FluidStack CD, CM, SD; + CD = FluidUtils.getFluidStack("carbondioxide", 1000); + CM = FluidUtils.getFluidStack("carbonmonoxide", 1000); + SD = FluidUtils.getFluidStack("sulfurdioxide", 1000); + if (PollutionUtils.mPollutionFluidStacks.size() == 0) { + if (CD != null) { + Logger.INFO("[PollutionCompat] Found carbon dioxide fluid, registering it."); + PollutionUtils.mPollutionFluidStacks.put(CD); + MISC_MATERIALS.CARBON_DIOXIDE.registerComponentForMaterial(CD); + ItemStack cellCD = ItemUtils.getItemStackOfAmountFromOreDict("cellCarbonDioxide", 1); + if (ItemUtils.checkForInvalidItems(cellCD)) { + Logger.INFO("[PollutionCompat] Found carbon dioxide cell, registering component."); + MISC_MATERIALS.CARBON_DIOXIDE.registerComponentForMaterial(OrePrefixes.cell, cellCD); + } + else { + Logger.INFO("[PollutionCompat] Did not find carbon dioxide cell, registering new component."); + new BaseItemCell(MISC_MATERIALS.CARBON_DIOXIDE); + } + } + else { + MaterialGenerator.generate(MISC_MATERIALS.CARBON_DIOXIDE, false, false); + } + + if (CM != null) { + Logger.INFO("[PollutionCompat] Found carbon monoxide fluid, registering it."); + PollutionUtils.mPollutionFluidStacks.put(CM); + MISC_MATERIALS.CARBON_MONOXIDE.registerComponentForMaterial(CM); + ItemStack cellCD = ItemUtils.getItemStackOfAmountFromOreDict("cellCarbonMonoxide", 1); + if (ItemUtils.checkForInvalidItems(cellCD)) { + Logger.INFO("[PollutionCompat] Found carbon monoxide cell, registering component."); + MISC_MATERIALS.CARBON_MONOXIDE.registerComponentForMaterial(OrePrefixes.cell, cellCD); + } + else { + Logger.INFO("[PollutionCompat] Did not find carbon monoxide cell, registering new component."); + new BaseItemCell(MISC_MATERIALS.CARBON_MONOXIDE); + } + } + else { + MaterialGenerator.generate(MISC_MATERIALS.CARBON_MONOXIDE, false, false); + } + + if (SD != null) { + Logger.INFO("[PollutionCompat] Found sulfur dioxide fluid, registering it."); + PollutionUtils.mPollutionFluidStacks.put(SD); + } + } + if (PollutionUtils.mPollutionFluidStacks.size() > 0) { + return true; + } + return false; + } + else { + if (mPollutionFluidStacks.size() != 3) { + Logger.INFO("Unable to detect all 3 pollution fluids. Found: "); + Logger.INFO(ArrayUtils.toString(mPollutionFluidStacks)); + return false; + } + else { + return true; + } + } + + + + } } diff --git a/src/Java/gtPlusPlus/core/util/reflect/OreDictUtils.java b/src/Java/gtPlusPlus/core/util/reflect/OreDictUtils.java deleted file mode 100644 index 6d34733545..0000000000 --- a/src/Java/gtPlusPlus/core/util/reflect/OreDictUtils.java +++ /dev/null @@ -1,7 +0,0 @@ -package gtPlusPlus.core.util.reflect; - -public class OreDictUtils { - - - -} diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 2371753fe6..135f98dd17 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -25,10 +25,25 @@ import gtPlusPlus.core.util.data.StringUtils; public class ReflectionUtils { - public static Map<String, Class> mCachedClasses = new LinkedHashMap<String, Class>(); + public static Map<String, Class<?>> mCachedClasses = new LinkedHashMap<String, Class<?>>(); public static Map<String, CachedMethod> mCachedMethods = new LinkedHashMap<String, CachedMethod>(); public static Map<String, CachedField> mCachedFields = new LinkedHashMap<String, CachedField>(); + public static Map<String, CachedConstructor> mCachedConstructors = new LinkedHashMap<String, CachedConstructor>(); + private static class CachedConstructor { + + private final Constructor<?> METHOD; + + public CachedConstructor(Constructor<?> aCons) { + METHOD = aCons; + } + + public Constructor<?> get() { + return METHOD; + } + + } + private static class CachedMethod { private final boolean STATIC; @@ -69,11 +84,11 @@ public class ReflectionUtils { } - private static boolean cacheClass(Class aClass) { + private static boolean cacheClass(Class<?> aClass) { if (aClass == null) { return false; } - Class y = mCachedClasses.get(aClass.getCanonicalName()); + Class<?> y = mCachedClasses.get(aClass.getCanonicalName()); if (y == null) { mCachedClasses.put(aClass.getCanonicalName(), aClass); return true; @@ -81,7 +96,7 @@ public class ReflectionUtils { return false; } - private static boolean cacheMethod(Class aClass, Method aMethod) { + private static boolean cacheMethod(Class<?> aClass, Method aMethod) { if (aMethod == null) { return false; } @@ -94,7 +109,7 @@ public class ReflectionUtils { return false; } - private static boolean cacheField(Class aClass, Field aField) { + private static boolean cacheField(Class<?> aClass, Field aField) { if (aField == null) { return false; } @@ -107,17 +122,60 @@ public class ReflectionUtils { return false; } + private static boolean cacheConstructor(Class<?> aClass, Constructor<?> aConstructor) { + if (aConstructor == null) { + return false; + } + CachedConstructor y = mCachedConstructors.get(aClass.getName()+"."+ArrayUtils.toString(aConstructor.getParameterTypes())); + if (y == null) { + mCachedConstructors.put(aClass.getName()+"."+ArrayUtils.toString(aConstructor.getParameterTypes()), new CachedConstructor(aConstructor)); + return true; + } + return false; + } + + + /** + * Returns a cached {@link Constructor} object. + * @param aClass - Class containing the Constructor. + * @param aTypes - Varags Class Types for objects constructor. + * @return - Valid, non-final, {@link Method} object, or {@link null}. + */ + public static Constructor<?> getConstructor(Class<?> aClass, Class<?>... aTypes) { + if (aClass == null || aTypes == null) { + return null; + } + + String aMethodKey = ArrayUtils.toString(aTypes); + //Logger.REFLECTION("Looking up method in cache: "+(aClass.getName()+"."+aMethodName + "." + aMethodKey)); + CachedConstructor y = mCachedConstructors.get(aClass.getName() + "." + aMethodKey); + if (y == null) { + Constructor<?> u = getConstructor_Internal(aClass, aTypes); + if (u != null) { + Logger.REFLECTION("Caching Constructor: "+aClass.getName() + "." + aMethodKey); + cacheConstructor(aClass, u); + return u; + } else { + return null; + } + } else { + return y.get(); + } + } + + + /** * Returns a cached {@link Class} object. * @param aClassCanonicalName - The canonical name of the underlying class. * @return - Valid, {@link Class} object, or {@link null}. */ - public static Class getClass(String aClassCanonicalName) { + public static Class<?> getClass(String aClassCanonicalName) { if (aClassCanonicalName == null || aClassCanonicalName.length() <= 0) { return null; } - Class y = mCachedClasses.get(aClassCanonicalName); + Class<?> y = mCachedClasses.get(aClassCanonicalName); if (y == null) { y = getClass_Internal(aClassCanonicalName); if (y != null) { @@ -149,7 +207,7 @@ public class ReflectionUtils { * @param aTypes - Varags Class Types for {@link Method}'s constructor. * @return - Valid, non-final, {@link Method} object, or {@link null}. */ - public static Method getMethod(Class aClass, String aMethodName, Class... aTypes) { + public static Method getMethod(Class<?> aClass, String aMethodName, Class<?>... aTypes) { if (aClass == null || aMethodName == null || aMethodName.length() <= 0) { return null; } @@ -169,6 +227,17 @@ public class ReflectionUtils { return y.get(); } } + + public static boolean isStaticMethod(Class<?> aClass, String aMethodName, Class<?>... aTypes) { + return isStaticMethod(ReflectionUtils.getMethod(aClass, aMethodName, aTypes)); + } + + public static boolean isStaticMethod(Method aMethod) { + if (aMethod != null && Modifier.isStatic(aMethod.getModifiers())) { + return true; + } + return false; + } @@ -178,7 +247,7 @@ public class ReflectionUtils { * @param aFieldName - Field name in {@link String} form. * @return - Valid, non-final, {@link Field} object, or {@link null}. */ - public static Field getField(final Class aClass, final String aFieldName) { + public static Field getField(final Class<?> aClass, final String aFieldName) { if (aClass == null || aFieldName == null || aFieldName.length() <= 0) { return null; } @@ -293,7 +362,7 @@ public class ReflectionUtils { return loaded > 0; } - + public static boolean setField(final Object object, final String fieldName, final Object fieldValue) { Class<?> clazz = object.getClass(); @@ -313,8 +382,8 @@ public class ReflectionUtils { } } return false; - - + + } public static boolean setField(final Object object, final Field field, final Object fieldValue) { @@ -381,7 +450,6 @@ public class ReflectionUtils { public static boolean invoke(Object objectInstance, String methodName, Class[] parameters, Object[] values){ if (objectInstance == null || methodName == null || parameters == null || values == null){ - //Logger.REFLECTION("Null value when trying to Dynamically invoke "+methodName+" on an object of type: "+objectInstance.getClass().getName()); return false; } Class<?> mLocalClass = (objectInstance instanceof Class ? (Class<?>) objectInstance : objectInstance.getClass()); @@ -389,6 +457,28 @@ public class ReflectionUtils { try { Method mInvokingMethod = mLocalClass.getDeclaredMethod(methodName, parameters); if (mInvokingMethod != null){ + return invoke(objectInstance, mInvokingMethod, values); + } + } + catch (NoSuchMethodException | SecurityException | IllegalArgumentException e) { + Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName()); + } + + Logger.REFLECTION("Invoke failed or did something wrong."); + return false; + } + + public static boolean invoke(Object objectInstance, Method method, Object[] values){ + if (method == null || values == null || (!ReflectionUtils.isStaticMethod(method) && objectInstance == null)){ + //Logger.REFLECTION("Null value when trying to Dynamically invoke "+methodName+" on an object of type: "+objectInstance.getClass().getName()); + return false; + } + String methodName = method.getName(); + String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName(); + Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+classname+"."); + try { + Method mInvokingMethod = method; + if (mInvokingMethod != null){ Logger.REFLECTION(methodName+" was not null."); if ((boolean) mInvokingMethod.invoke(objectInstance, values)){ Logger.REFLECTION("Successfully invoked "+methodName+"."); @@ -398,14 +488,10 @@ public class ReflectionUtils { Logger.REFLECTION("Invocation failed for "+methodName+"."); } } - else { - Logger.REFLECTION(methodName+" is null."); - } } - catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName()); - } - + catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+classname); + } Logger.REFLECTION("Invoke failed or did something wrong."); return false; } @@ -484,11 +570,11 @@ public class ReflectionUtils { * Internal Magic that probably should not get exposed. */ - - - - - + + + + + @@ -662,7 +748,7 @@ public class ReflectionUtils { return m; } - private static Method getMethod_Internal(Class aClass, String aMethodName, Class... aTypes) { + private static Method getMethod_Internal(Class<?> aClass, String aMethodName, Class<?>... aTypes) { Method m = null; try { Logger.REFLECTION("Method: Internal Lookup: "+aMethodName); @@ -688,6 +774,55 @@ public class ReflectionUtils { } return m; } + + private static Constructor<?> getConstructor_Internal(Class<?> aClass, Class<?>... aTypes) { + Constructor<?> c = null; + try { + Logger.REFLECTION("Constructor: Internal Lookup: "+aClass.getName()); + c = aClass.getDeclaredConstructor(aTypes); + if (c != null) { + c.setAccessible(true); + int modifiers = c.getModifiers(); + Field modifierField = c.getClass().getDeclaredField("modifiers"); + modifiers = modifiers & ~Modifier.FINAL; + modifierField.setAccessible(true); + modifierField.setInt(c, modifiers); + } + } + catch (Throwable t) { + Logger.REFLECTION("Constructor: Internal Lookup Failed: "+aClass.getName()); + try { + c = getConstructorRecursively(aClass, aTypes); + } catch (Exception e) { + Logger.REFLECTION("Unable to find method '"+aClass.getName()+"'"); + e.printStackTrace(); + dumpClassInfo(aClass); + } + } + return c; + } + + private static Constructor<?> getConstructorRecursively(Class<?> aClass, Class<?>... aTypes) throws Exception { + try { + Logger.REFLECTION("Constructor: Recursion Lookup: "+aClass.getName()); + Constructor<?> c = aClass.getConstructor(aTypes); + if (c != null) { + c.setAccessible(true); + int modifiers = c.getModifiers(); + Field modifierField = c.getClass().getDeclaredField("modifiers"); + modifiers = modifiers & ~Modifier.FINAL; + modifierField.setAccessible(true); + modifierField.setInt(c, modifiers); + } + return c; + } catch (final NoSuchMethodException | IllegalArgumentException | IllegalAccessException e) { + final Class<?> superClass = aClass.getSuperclass(); + if (superClass == null || superClass == Object.class) { + throw e; + } + return getConstructor_Internal(superClass, aTypes); + } + } private static Method getMethodRecursively(final Class<?> clazz, final String aMethodName) throws NoSuchMethodException { try { @@ -704,7 +839,7 @@ public class ReflectionUtils { } } - private static void dumpClassInfo(Class aClass) { + private static void dumpClassInfo(Class<?> aClass) { Logger.INFO("We ran into an error processing reflection in "+aClass.getName()+", dumping all data for debugging."); // Get the methods Method[] methods = aClass.getDeclaredMethods(); @@ -720,7 +855,7 @@ public class ReflectionUtils { System.out.println(f.getName()); } Logger.INFO("Dumping all Constructors."); - for (Constructor c : consts) { + for (Constructor<?> c : consts) { System.out.println(c.getName()+" | "+c.getParameterCount()+" | "+StringUtils.getDataStringFromArray(c.getParameterTypes())); } } @@ -767,15 +902,52 @@ public class ReflectionUtils { } private static Class<?> getClass_Internal(String string) { + Class<?> aClass = null; if (ReflectionUtils.doesClassExist(string)) { try { - return Class.forName(string); + aClass = Class.forName(string); } catch (ClassNotFoundException e) { - return getNonPublicClass(string); + aClass = getNonPublicClass(string); } } - return null; + + if (aClass == null) { + String aClassName = ""; + Logger.REFLECTION("Splitting "+string+" to try look for hidden classes."); + String[] aData = string.split("\\."); + Logger.REFLECTION("Obtained "+aData.length+" pieces."); + for (int i=0;i<(aData.length-1);i++) { + aClassName += (i > 0) ? "."+aData[i] : ""+aData[i]; + Logger.REFLECTION("Building: "+aClassName); + } + Logger.REFLECTION("Trying to search '"+aClassName+"' for inner classes."); + Class<?> clazz = ReflectionUtils.getClass(aClassName); + + Class[] y = clazz.getDeclaredClasses(); + if (y == null || y.length <= 0) { + Logger.REFLECTION("No hidden inner classes found."); + return null; + } + else { + boolean found = false; + for (Class<?> h : y) { + Logger.REFLECTION("Found hidden inner class: "+h.getCanonicalName()); + if (h.getSimpleName().toLowerCase().equals(aData[aData.length-1].toLowerCase())) { + Logger.REFLECTION("Found correct class. ["+aData[aData.length-1]+"] Caching at correct location: "+string); + Logger.REFLECTION("Found at location: "+h.getCanonicalName()); + ReflectionUtils.mCachedClasses.put(string, h); + aClass = h; + found = true; + break; + } + } + if (!found) { + return null; + } + } + } + return aClass; } /** @@ -800,4 +972,30 @@ public class ReflectionUtils { } + public static boolean doesFieldExist(String clazz, String string) { + return doesFieldExist(ReflectionUtils.getClass(clazz), string); + } + + public static boolean doesFieldExist(Class<?> clazz, String string) { + if (clazz != null) { + if (ReflectionUtils.getField(clazz, string) != null) { + return true; + } + } + return false; + } + + public static Object getFieldValue(Field field) { + return getFieldValue(field, null); + } + + public static Object getFieldValue(Field field, Object instance) { + try { + return field.get(instance); + } catch (IllegalArgumentException | IllegalAccessException e) { + } + return null; + } + + } diff --git a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java index 698a5ec80a..6c8a790037 100644 --- a/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java +++ b/src/Java/gtPlusPlus/everglades/GTplusplus_Everglades.java @@ -115,6 +115,7 @@ public class GTplusplus_Everglades implements ActionListener { MaterialGenerator.generateOreMaterial(ORES.MIESSIITE); MaterialGenerator.generateOreMaterial(ORES.KASHINITE); MaterialGenerator.generateOreMaterial(ORES.IRARSITE); + MaterialGenerator.generateOreMaterial(ORES.GREENOCKITE); MaterialGenerator.generateOreMaterial(ORES.RADIOBARITE); MaterialGenerator.generateOreMaterial(ORES.DEEP_EARTH_REACTOR_FUEL_DEPOSIT); diff --git a/src/Java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java b/src/Java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java index 83dedc376a..0f8acd75b4 100644 --- a/src/Java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java +++ b/src/Java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java @@ -21,10 +21,6 @@ import net.minecraftforge.event.terraingen.OreGenEvent; import net.minecraftforge.event.terraingen.TerrainGen; public class BiomeGenerator_Custom extends BiomeDecorator { - /** The world the BiomeDecorator is currently decorating */ - public World currentWorld; - /** The Biome Decorator's random number generator. */ - public Random randomGenerator; public WorldGenerator fluoriteGen; diff --git a/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java b/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java new file mode 100644 index 0000000000..dae1a663d7 --- /dev/null +++ b/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java @@ -0,0 +1,262 @@ +package gtPlusPlus.nei; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.gui.machine.GUI_DecayablesChest; +import gtPlusPlus.core.handler.Recipes.DecayableRecipe; +import gtPlusPlus.core.item.base.dusts.BaseItemDustUnique; +import gtPlusPlus.core.item.materials.DustDecayable; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.VanillaColours; +import gtPlusPlus.nei.handlers.NeiTextureHandler; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; + +public class DecayableRecipeHandler extends TemplateRecipeHandler { + + public String getRecipeName() { + return StatCollector.translateToLocal("GTPP.container.decaychest.name"); + } + + public String getGuiTexture() { + return CORE.MODID + ":textures/gui/nei/decayables.png"; + } + + public Class<? extends GuiContainer> getGuiClass() { + return GUI_DecayablesChest.class; + } + + public String getOverlayIdentifier() { + return "GTPP_Decayables"; + } + + public int recipiesPerPage() { + return 1; + } + + public void loadTransferRects() { + this.transferRects.add(new RecipeTransferRect(new Rectangle(6, 3, 16, 16), "GTPP_Decayables", new Object[0])); + } + + public void loadCraftingRecipes(ItemStack result) { + if (result == null || (!DustDecayable.class.isInstance(result.getItem()) + && !BaseItemDustUnique.class.isInstance(result.getItem()))) { + return; + } + if (result != null) { + //Logger.INFO("Looking up crafting recipes for "+ItemUtils.getItemName(result)); + } + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + if (!GT_Utility.areStacksEqual(result, output, true)) { + continue; + } + //Logger.INFO("Showing Usage result for "+ItemUtils.getItemName(result)); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + this.arecipes.add(rec); + sort(); + } + } + } + + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier()) && this.getClass() == DecayableRecipeHandler.class) { + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + this.arecipes.add(rec); + sort(); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + public void loadUsageRecipes(ItemStack ingredient) { + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + if (ingredient != null) { + //Logger.INFO("Looking up Usage results for "+ItemUtils.getItemName(ingredient)); + } + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + if (!GT_Utility.areStacksEqual(ingredient, input, true)) { + continue; + } + //Logger.INFO("Showing up Usage results for "+ItemUtils.getItemName(ingredient)); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + //rec.setIngredientPermutation((Collection) rec.input, ingredient); + this.arecipes.add(rec); + sort(); + } + } + } + + private final void sort() { + List<DecayableRecipeNEI> g = new ArrayList<DecayableRecipeNEI>(); + for (CachedRecipe u : arecipes) { + g.add((DecayableRecipeNEI) u); + } + if (g != null && !g.isEmpty()) { + Collections.sort(g); + } + } + + public void drawExtras(int recipeIndex) { + DecayableRecipeNEI recipe = (DecayableRecipeNEI) this.arecipes.get(recipeIndex); + + //GuiDraw.drawStringC(I18n.format("GTPP.container.decaychest.result", new Object[]{}), 43, 10, 8421504, false); + + int cost = recipe.time; + if (cost > 0) { + + // NEI Strings + String s = I18n.format("GTPP.nei.info", new Object[] { cost }); + String s0 = I18n.format("GTPP.nei.timetaken", new Object[] { cost }); + + // Time Strings + String s1 = I18n.format("GTPP.time.ticks", new Object[] { cost }); + String s2 = I18n.format("GTPP.time.seconds", new Object[] { cost }); + String s3 = I18n.format("GTPP.time.minutes", new Object[] { cost }); + String s4 = I18n.format("GTPP.time.hours", new Object[] { cost }); + String s5 = I18n.format("GTPP.time.days", new Object[] { cost }); + String s6 = I18n.format("GTPP.time.months", new Object[] { cost }); + int y = 20; + + int secs = cost / 20; + int mins = secs / 60; + int hours = mins / 60; + int days = hours / 24; + int months = days / 30; + + String suffix; + int formattedTime; + if (cost <= 20) { + suffix = s1; + formattedTime = cost; + } else if (cost <= (20 * 60)) { + suffix = s2; + formattedTime = secs; + } else if (cost <= (20 * 60 * 60)) { + suffix = s3; + formattedTime = mins; + } else if (cost <= (20 * 60 * 60 * 24)) { + suffix = s4; + formattedTime = hours; + } else if (cost < (20 * 60 * 60 * 24 * 30)) { + suffix = s5; + formattedTime = days; + } else if (cost <= (20 * 60 * 60 * 24 * 30)) { + suffix = s6; + formattedTime = months; + } else { + suffix = s1; + formattedTime = cost; + } + + int x = 5; + GuiDraw.drawString(s, x, 25, VanillaColours.DYE_BLACK.getAsInt(), false); + GuiDraw.drawString(s0, x, 40, VanillaColours.DYE_BLACK.getAsInt(), false); + + GuiDraw.drawString(suffix, x + 16, y + 30, VanillaColours.DYE_BLACK.getAsInt(), false); + + //Values + GuiDraw.drawString(("" + formattedTime), x, y + 30, VanillaColours.DYE_GREEN.getAsInt(), false); + + if (hours > 1) { + int aLeftoverMinutes = (cost - (hours * (20 * 60 * 60))); + if (aLeftoverMinutes > 0) { + int secs2 = aLeftoverMinutes / 20; + int mins2 = secs2 / 60; + GuiDraw.drawString(s3, x + 16, y + 42, VanillaColours.DYE_BLACK.getAsInt(), false); + GuiDraw.drawString(("" + mins2), x, y + 42, VanillaColours.DYE_GREEN.getAsInt(), false); + + } + + } + + } + + NeiTextureHandler.RECIPE_BUTTON.renderIcon(6.0D, 3.0D, 16.0D, 16.0D, 0.0D, true); + } + + public class DecayableRecipeNEI extends TemplateRecipeHandler.CachedRecipe implements Comparable<CachedRecipe> { + private PositionedStack input; + private PositionedStack output; + public int time; + + @Override + public PositionedStack getIngredient() { + return this.input; + } + + public PositionedStack getResult() { + return this.output; + } + + public DecayableRecipeNEI(final ItemStack input, final ItemStack result, final int time) { + super(); + this.input = new PositionedStack(input, 93, 24); + this.output = new PositionedStack(result, 142, 42); + this.time = time; + } + + @Override + public int compareTo(CachedRecipe o) { + boolean b = DecayableRecipeNEI.class.isInstance(o); + if (b) { + DecayableRecipeNEI p = (DecayableRecipeNEI) o; + if (p.time > this.time) { + return 1; + } else if (p.time == this.time) { + return 0; + } else { + return -1; + } + } + return 0; + } + + @Override + public boolean equals(Object obj) { + if (obj != null) { + if (DecayableRecipeNEI.class.isInstance(obj)) { + DecayableRecipeNEI p = (DecayableRecipeNEI) obj; + if (p != null) { + // Time check first to keep it simple and not unbox the Recipes. + if (p.time == this.time) { + ItemStack aInput = p.input.item; + ItemStack aOutput = p.output.item; + if (GT_Utility.areStacksEqual(aInput, this.input.item, true)) { + if (GT_Utility.areStacksEqual(aOutput, this.output.item, true)) { + return true; + } + } + } + } + + } + } + return false; + } + + + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java new file mode 100644 index 0000000000..e4279cf489 --- /dev/null +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -0,0 +1,458 @@ +package gtPlusPlus.nei; + +import java.awt.Point; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.common.event.FMLInterModComms; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.objects.ItemData; +import gregtech.api.util.*; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import gtPlusPlus.core.lib.CORE; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.guihook.IContainerInputHandler; +import codechicken.nei.guihook.IContainerTooltipHandler; +import codechicken.nei.recipe.*; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class GT_NEI_FluidReactor +extends TemplateRecipeHandler { + public static final int sOffsetX = 5; + public static final int sOffsetY = 11; + + static { + GuiContainerManager.addInputHandler(new GT_RectHandler()); + GuiContainerManager.addTooltipHandler(new GT_RectHandler()); + } + + protected final Gregtech_Recipe_Map mRecipeMap; + + public GT_NEI_FluidReactor(final Gregtech_Recipe_Map sfluidchemicalreactorrecipes) { + this.mRecipeMap = sfluidchemicalreactorrecipes; + this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getOverlayIdentifier(), new Object[0])); + if (!NEI_GT_Config.sIsAdded) { + FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } + + public static void drawText(final int aX, final int aY, final String aString, final int aColor) { + Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); + } + + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_FluidReactor(this.mRecipeMap); + } + + @Override + public void loadCraftingRecipes(final String outputId, final Object... results) { + if (outputId.equals(this.mRecipeMap.mNEIName)) { + for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (!tRecipe.mHidden) { + this.arecipes.add(new CachedDefaultRecipe(tRecipe)); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(final ItemStack aResult) { + final ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); + + final ArrayList<ItemStack> tResults = new ArrayList<ItemStack>(); + tResults.add(aResult); + tResults.add(GT_OreDictUnificator.get(true, aResult)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (final OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); + if (tFluid != null) { + tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (final FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (!tRecipe.mHidden) { + final CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (final ItemStack tStack : tResults) { + if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + } + + @Override + public void loadUsageRecipes(final ItemStack aInput) { + final ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); + + final ArrayList<ItemStack> tInputs = new ArrayList<ItemStack>(); + tInputs.add(aInput); + tInputs.add(GT_OreDictUnificator.get(false, aInput)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (final OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + final FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); + if (tFluid != null) { + tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (final FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + if (!tRecipe.mHidden) { + final CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (final ItemStack tStack : tInputs) { + if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + } + + @Override + public String getOverlayIdentifier() { + //return this.mRecipeMap.mNEIName; + return "Penis"; + } + + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public String getRecipeName() { + //return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + return " Chem Plant"; + } + + @Override + public String getGuiTexture() { + return CORE.MODID+":textures/gui/FluidReactor.png"; + } + + @Override + public List<String> handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { + final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if ((tObject instanceof CachedDefaultRecipe)) { + final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + for (final PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { + break; + } + currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); + break; + } + } + for (final PositionedStack tStack : tRecipe.mInputs) { + if (aStack == tStack.item) { + if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || + (tStack.item.stackSize != 0)) { + break; + } + currenttip.add("Does not get consumed in the process"); + break; + } + } + } + return currenttip; + } + + @Override + public void drawExtras(final int aRecipeIndex) { + final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + if (tEUt != 0) { + drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); + //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); + if (this.mRecipeMap.mShowVoltageAmperageInNEI) { + drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); + drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); + } else { + drawText(10, 93, "Voltage: unspecified", -16777216); + drawText(10, 103, "Amperage: unspecified", -16777216); + } + } + if (tDuration > 0) { + drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); + } + if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { + drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); + } + } + + public static class GT_RectHandler + implements IContainerInputHandler, IContainerTooltipHandler { + @Override + public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + if (this.canHandle(gui)) { + if (button == 0) { + return this.transferRect(gui, false); + } + if (button == 1) { + return this.transferRect(gui, true); + } + } + return false; + } + + @Override + public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + public boolean canHandle(final GuiContainer gui) { + return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); + } + + @Override + public List<String> handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List<String> currenttip) { + if ((this.canHandle(gui)) && (currenttip.isEmpty())) { + if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + }*/ + + } + return currenttip; + } + + private boolean transferRect(final GuiContainer gui, final boolean usage) { + if (gui instanceof GT_GUIContainer_BasicMachine) { + return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { + return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); + }*/ + return false; + } + + @Override + public List<String> handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List<String> currenttip) { + return currenttip; + } + + @Override + public List<String> handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List<String> currenttip) { + return currenttip; + } + + @Override + public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + @Override + public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { + } + + @Override + public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + return false; + } + + @Override + public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + } + + @Override + public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { + } + } + + public class FixedPositionedStack + extends PositionedStack { + public final int mChance; + public boolean permutated = false; + + public FixedPositionedStack(final Object object, final int x, final int y) { + this(object, x, y, 0); + } + + public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { + super(object, x, y, true); + this.mChance = aChance; + } + + @Override + public void generatePermutations() { + if (this.permutated) { + return; + } + final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); + for (final ItemStack tStack : this.items) { + if (GT_Utility.isStackValid(tStack)) { + if (tStack.getItemDamage() == 32767) { + final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + if (!permutations.isEmpty()) { + ItemStack stack; + for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { + stack = i$.next(); + } + } else { + final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); + base.stackTagCompound = tStack.stackTagCompound; + tDisplayStacks.add(base); + } + } else { + tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); + } + } + } + this.items = (tDisplayStacks.toArray(new ItemStack[0])); + if (this.items.length == 0) { + this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; + } + this.permutated = true; + this.setPermutationToRender(0); + } + } + + public class CachedDefaultRecipe + extends TemplateRecipeHandler.CachedRecipe { + public final GT_Recipe mRecipe; + public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); + public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); + + public CachedDefaultRecipe(final GT_Recipe aRecipe) { + super(); + this.mRecipe = aRecipe; + + int tStartIndex = 0; + + // Four Input Slots + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 3, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 21, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 39, -4)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 57, -4)); + } + tStartIndex++; + + + if (aRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + } + tStartIndex = 0; + + //Four Output Slots + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + + + //New fluid display behaviour when 3 fluid inputs are detected. (Basically a mix of the code below for outputs an the code above for 9 input slots.) + if (aRecipe.mFluidInputs.length >= 1) { + if ((aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 3, 31)); + } + if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 21, 31)); + } + if ((aRecipe.mFluidInputs.length > 2) && (aRecipe.mFluidInputs[2] != null) && (aRecipe.mFluidInputs[2].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[2], true), 39, 31)); + } + if ((aRecipe.mFluidInputs.length > 3) && (aRecipe.mFluidInputs[3] != null) && (aRecipe.mFluidInputs[3].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[3], true), 57, 31)); + } + } + + if (aRecipe.mFluidOutputs.length > 0) { + if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 138, 5)); + } + if ((aRecipe.mFluidOutputs.length > 1) && (aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 138, 23)); + } + } + } + + @Override + public List<PositionedStack> getIngredients() { + return this.getCycledIngredients(GT_NEI_FluidReactor.this.cycleticks / 10, this.mInputs); + } + + @Override + public PositionedStack getResult() { + return null; + } + + @Override + public List<PositionedStack> getOtherStacks() { + return this.mOutputs; + } + } +} diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_MultiBlockHandler.java b/src/Java/gtPlusPlus/nei/GT_NEI_MultiBlockHandler.java index 6612ab703f..e3c980e6a4 100644 --- a/src/Java/gtPlusPlus/nei/GT_NEI_MultiBlockHandler.java +++ b/src/Java/gtPlusPlus/nei/GT_NEI_MultiBlockHandler.java @@ -928,7 +928,7 @@ extends TemplateRecipeHandler { } - public class recipeCompare implements Comparator<GT_Recipe> { + public class RecipeCompare implements Comparator<GT_Recipe> { public int compare(GT_Recipe a, GT_Recipe b) { if (a.mEUt != b.mEUt) { return a.mEUt - b.mEUt; diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index aca6dd5662..ad03040059 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -1,10 +1,10 @@ package gtPlusPlus.nei; +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; -import codechicken.nei.api.IConfigureNEI; - public class NEI_GT_Config implements IConfigureNEI { public static boolean sIsAdded = true; @@ -18,11 +18,16 @@ implements IConfigureNEI { } } for (final Gregtech_Recipe_Map tMap : gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map.sMappings) { - if (tMap.mNEIAllowed) { - new GT_NEI_MultiBlockHandler(tMap); + if (tMap.mNEIAllowed) { + if (!tMap.mUnlocalizedName.equals(Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mUnlocalizedName)) { + new GT_NEI_MultiBlockHandler(tMap); + } } } + new GT_NEI_FluidReactor(Gregtech_Recipe_Map.sFluidChemicalReactorRecipes); sIsAdded = true; + API.registerRecipeHandler(new DecayableRecipeHandler()); + API.registerUsageHandler(new DecayableRecipeHandler()); } @Override diff --git a/src/Java/gtPlusPlus/nei/handlers/NeiTextureHandler.java b/src/Java/gtPlusPlus/nei/handlers/NeiTextureHandler.java new file mode 100644 index 0000000000..30c159ca93 --- /dev/null +++ b/src/Java/gtPlusPlus/nei/handlers/NeiTextureHandler.java @@ -0,0 +1,164 @@ +package gtPlusPlus.nei.handlers; + +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + + +/** + * Based on crazypants.enderio.gui.IconEIO + * + * @author Original EIO Author + * + * This is free and unencumbered software released into the public + * domain. + * + * Anyone is free to copy, modify, publish, use, compile, sell, or + * distribute this software, either in source code form or as a compiled + * binary, for any purpose, commercial or non-commercial, and by any + * means. + * + * In jurisdictions that recognize copyright laws, the author or authors + * of this software dedicate any and all copyright interest in the + * software to the public domain. We make this dedication for the + * benefit of the public at large and to the detriment of our heirs and + * successors. We intend this dedication to be an overt act of + * relinquishment in perpetuity of all present and future rights to this + * software under copyright law. + * + * 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 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. + * + * For more information, please refer to <http://unlicense.org/> + * + * https://github.com/SleepyTrousers/EnderIO/blob/release/1.7.10/2.2/src/main/java/crazypants/render/RenderUtil.java + * + */ +public final class NeiTextureHandler { + + public static final NeiTextureHandler RECIPE = new NeiTextureHandler(16, 132, 16, 16); + public static final NeiTextureHandler RECIPE_BUTTON = new NeiTextureHandler(128, 116, 24, 24); + + public final double minU; + public final double maxU; + public final double minV; + public final double maxV; + public final double width; + public final double height; + + public static final ResourceLocation TEXTURE = new ResourceLocation(CORE.MODID + ":textures/gui/nei/widgets.png"); + + public NeiTextureHandler(int x, int y) { + this(x, y, 16, 16); + } + + public NeiTextureHandler(int x, int y, int width, int height) { + this((double) width, (double) height, (double) ((float) (0.00390625D * (double) x)), + (double) ((float) (0.00390625D * (double) (x + width))), (double) ((float) (0.00390625D * (double) y)), + (double) ((float) (0.00390625D * (double) (y + height)))); + } + + public NeiTextureHandler(double width, double height, double minU, double maxU, double minV, double maxV) { + this.width = width; + this.height = height; + this.minU = minU; + this.maxU = maxU; + this.minV = minV; + this.maxV = maxV; + } + + public void renderIcon(double x, double y) { + this.renderIcon(x, y, this.width, this.height, 0.0D, false); + } + + public void renderIcon(double x, double y, boolean doDraw) { + this.renderIcon(x, y, this.width, this.height, 0.0D, doDraw); + } + + public void renderIcon(double x, double y, double width, double height, double zLevel, boolean doDraw) { + this.renderIcon(x, y, width, height, zLevel, doDraw, false); + } + + public void renderIcon(double x, double y, double width, double height, double zLevel, boolean doDraw, + boolean flipY) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Tessellator tessellator = Tessellator.instance; + if (doDraw) { + bindTexture(TEXTURE); + tessellator.startDrawingQuads(); + } + + if (flipY) { + tessellator.addVertexWithUV(x, y + height, zLevel, this.minU, this.minV); + tessellator.addVertexWithUV(x + width, y + height, zLevel, this.maxU, this.minV); + tessellator.addVertexWithUV(x + width, y + 0.0D, zLevel, this.maxU, this.maxV); + tessellator.addVertexWithUV(x, y + 0.0D, zLevel, this.minU, this.maxV); + } else { + tessellator.addVertexWithUV(x, y + height, zLevel, this.minU, this.maxV); + tessellator.addVertexWithUV(x + width, y + height, zLevel, this.maxU, this.maxV); + tessellator.addVertexWithUV(x + width, y + 0.0D, zLevel, this.maxU, this.minV); + tessellator.addVertexWithUV(x, y + 0.0D, zLevel, this.minU, this.minV); + } + + if (doDraw) { + tessellator.draw(); + } + + } + + public static final ResourceLocation BLOCK_TEX; + public static final ResourceLocation ITEM_TEX; + public static final ResourceLocation GLINT_TEX; + public static int BRIGHTNESS_MAX; + + static { + BLOCK_TEX = TextureMap.locationBlocksTexture; + ITEM_TEX = TextureMap.locationItemsTexture; + GLINT_TEX = new ResourceLocation("textures/misc/enchanted_item_glint.png"); + BRIGHTNESS_MAX = 15728880; + } + + public static TextureManager engine() { + return Minecraft.getMinecraft().renderEngine; + } + + public static void bindItemTexture(ItemStack stack) { + engine().bindTexture(stack.getItemSpriteNumber() == 0 ? BLOCK_TEX : ITEM_TEX); + } + + public static void bindItemTexture() { + engine().bindTexture(ITEM_TEX); + } + + public static void bindBlockTexture() { + engine().bindTexture(BLOCK_TEX); + } + + public static void bindGlintTexture() { + engine().bindTexture(BLOCK_TEX); + } + + public static void bindTexture(String string) { + engine().bindTexture(new ResourceLocation(string)); + } + + public static void bindTexture(ResourceLocation tex) { + engine().bindTexture(tex); + } + + public static FontRenderer fontRenderer() { + return Minecraft.getMinecraft().fontRenderer; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/plugin/agrichem/AlgaeDefinition.java b/src/Java/gtPlusPlus/plugin/agrichem/AlgaeDefinition.java new file mode 100644 index 0000000000..c6e98581ff --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/AlgaeDefinition.java @@ -0,0 +1,60 @@ +package gtPlusPlus.plugin.agrichem; + +public enum AlgaeDefinition { + + /* + * In general, the productivity of freshwater algae is primarily limited by + * the availability of the nutrient phosphate (PO4-3), while that of + * marine algae is limited by nitrate (NO3-) or ammonium (NH4+). + * Some algal species, however, may have unusual nutrient requirements, + * and their productivity may be limited by certain micronutrients, + * such as silica, in the case of diatoms. + */ + + Euglenophyta("Euglenophyta", "Euglenoids", true, false, getRGB(147, 168, 50)), + Chrysophyta("Chrysophyta", "Golden-Brown Algae", true, true, getRGB(186, 146, 0)), + Pyrrophyta("Pyrrophyta", "Fire Algae", true, true, getRGB(250, 118, 2)), + Chlorophyta("Chlorophyta", "Green Algae", true, true, getRGB(99, 181, 62)), + Rhodophyta("Rhodophyta", "Red Algae", false, true, getRGB(153, 5, 22)), + Paeophyta("Paeophyta", "Brown Algae", false, true, getRGB(94, 78, 47)), + Xanthophyta("Xanthophyta", "Yellow-Green Algae", true, false, getRGB(118, 138, 16)); + + public final String mScientificName; + public final String mSimpleName; + public final boolean mSaltWater; + public final boolean mFreshWater; + public final int mColour; + + AlgaeDefinition(String aScientificName, String aSimpleName, boolean aFresh, boolean aSalt, int aColour) { + mScientificName = aScientificName; + mSimpleName = aSimpleName; + mFreshWater = aFresh; + mSaltWater = aSalt; + mColour = aColour; + } + + public static AlgaeDefinition getByIndex(int aIndex) { + switch(aIndex) { + default: + case 0: + return Euglenophyta; + case 1: + return Chrysophyta; + case 2: + return Pyrrophyta; + case 3: + return Chlorophyta; + case 4: + return Rhodophyta; + case 5: + return Paeophyta; + case 6: + return Xanthophyta; + } + } + + private final static int getRGB(int r, int g, int b) { + return AlgaeUtils.rgbtoHexValue(r, g, b); + } + +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/AlgaeUtils.java b/src/Java/gtPlusPlus/plugin/agrichem/AlgaeUtils.java new file mode 100644 index 0000000000..73ff23888c --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/AlgaeUtils.java @@ -0,0 +1,11 @@ +package gtPlusPlus.plugin.agrichem; + +import gtPlusPlus.core.util.Utils; + +public class AlgaeUtils { + + public static int rgbtoHexValue(final int r, final int g, final int b) { + return Utils.rgbtoHexValue(r, g, b); + } + +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java b/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java new file mode 100644 index 0000000000..1179e13a2f --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java @@ -0,0 +1,1428 @@ +package gtPlusPlus.plugin.agrichem; + +import static gtPlusPlus.core.lib.CORE.GTNH; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.MISC_MATERIALS; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.minecraft.OreDictUtils; +import gtPlusPlus.core.util.minecraft.RecipeUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.railcraft.utils.RailcraftUtils; +import ic2.core.Ic2Items; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; + +public class BioRecipes { + + private static Item mFert; + private static Item mDustDirt; + + private static Fluid mSalineWater; + private static Fluid mDistilledWater; + private static Fluid mThermalWater; + private static Fluid mAir; + private static Fluid mSulfuricWasteWater; + private static Fluid mAmmonia; + private static Fluid mMethanol; + private static Fluid mAceticAcid; + private static Fluid mPropionicAcid; + private static Fluid mLiquidPlastic; + private static Fluid mFermentationBase; + private static Fluid mCarbonDioxide; + private static Fluid mCarbonMonoxide; + private static Fluid mEthylene; + private static Fluid mEthanol; + private static Fluid mChlorine; + private static Fluid mHydrogen; + private static Fluid mDilutedSulfuricAcid; + private static Fluid mSulfuricAcid; + private static Fluid mUrea; + private static Fluid mFormaldehyde; + private static Fluid mLiquidResin; + private static Fluid mMethane; + private static Fluid mBenzene; + private static Fluid mEthylbenzene; + private static Fluid mStyrene; + private static Fluid mButanol; + private static Fluid mAcetone; + + + private static final ItemStack getGreenAlgaeRecipeChip() { + return getBioChip(4); + } + private static final ItemStack getBrownAlgaeRecipeChip() { + return getBioChip(8); + } + private static final ItemStack getGoldenBrownAlgaeRecipeChip() { + return getBioChip(12); + } + private static final ItemStack getRedAlgaeRecipeChip() { + return getBioChip(16); + } + + private static final ItemStack getBioChip(int aID) { + return ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, aID, 0); + } + + public static void init() { + Logger.INFO("[Bio] Setting Variables"); + initRecipeVars(); + Logger.INFO("[Bio] Generating Biochip Recipes"); + recipeBioChip(); + Logger.INFO("[Bio] Generating Recipes"); + recipeAlgaeBiomass(); + Logger.INFO("[Bio] Finished with recipes"); + } + + private static final void initRecipeVars() { + mFert = AgriculturalChem.dustOrganicFertilizer; + mDustDirt = AgriculturalChem.dustDirt; + + // 5.08 Salt Water Solution ;) + if (!FluidUtils.doesFluidExist("saltwater")){ + mSalineWater = FluidUtils.generateFluidNoPrefix("saltwater", "Salt Water", 200, new short[]{10, 30, 220, 100}); + } + else { + Materials aSaltWater = MaterialUtils.getMaterial("saltwater"); + if (aSaltWater != null) { + FluidStack aWaterStack = aSaltWater.getFluid(1); + if (aWaterStack != null) { + mSalineWater = aSaltWater.getFluid(1).getFluid(); + } + } + if (mSalineWater == null) { + mSalineWater = FluidUtils.getWildcardFluidStack("saltwater", 1).getFluid(); + } + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellSaltWater", 1) == null){ + new BaseItemComponent("saltwater", "Salt Water", new short[] {10, 30, 220}); + } + } + + mDistilledWater = FluidUtils.getDistilledWater(1).getFluid(); + mThermalWater = FluidUtils.getFluidStack("ic2hotwater", 1).getFluid(); + mAir = FluidUtils.getFluidStack("air", 1).getFluid(); + mSulfuricWasteWater = FluidUtils.getFluidStack("sulfuricapatite", 1).getFluid(); + mAmmonia = MISC_MATERIALS.AMMONIA.getFluid(1).getFluid(); + mEthylene = FluidUtils.getFluidStack("ethylene", 1).getFluid(); + mEthanol = FluidUtils.getFluidStack("bioethanol", 1).getFluid(); + mDilutedSulfuricAcid = FluidUtils.getFluidStack("dilutedsulfuricacid", 1).getFluid(); + mSulfuricAcid = FluidUtils.getFluidStack("sulfuricacid", 1).getFluid(); + mFormaldehyde = FluidUtils.getFluidStack("fluid.formaldehyde", 1).getFluid(); + mMethane = FluidUtils.getFluidStack("methane", 1).getFluid(); + mBenzene = FluidUtils.getFluidStack("benzene", 1).getFluid(); + mEthylbenzene = FluidUtils.getFluidStack("fluid.ethylbenzene", 1).getFluid(); + mStyrene = FluidUtils.getFluidStack("styrene", 1).getFluid(); + mMethanol = FluidUtils.getFluidStack("methanol", 1).getFluid(); + mLiquidPlastic = FluidUtils.getWildcardFluidStack("plastic", 1).getFluid(); + mCarbonDioxide = MISC_MATERIALS.CARBON_DIOXIDE.getFluid(1).getFluid(); + mCarbonMonoxide = MISC_MATERIALS.CARBON_MONOXIDE.getFluid(1).getFluid(); + mChlorine = FluidUtils.getFluidStack("chlorine", 1).getFluid(); + mHydrogen = FluidUtils.getFluidStack("hydrogen", 1).getFluid(); + mAceticAcid = AgrichemFluids.mAceticAcid; + mPropionicAcid = AgrichemFluids.mPropionicAcid; + mUrea = AgrichemFluids.mUrea; + mLiquidResin = AgrichemFluids.mLiquidResin; + mFermentationBase = AgrichemFluids.mFermentationBase; + mButanol = AgrichemFluids.mButanol; + mAcetone = AgrichemFluids.mAcetone; + } + + private static void recipeAlgaeBiomass() { + + // TODO + // Add in recipes to get initial Biomass + + recipeGreenAlgae(); + recipeBrownAlgae(); + recipeGoldenBrownAlgae(); + recipeRedAlgae(); + recipeWoodPellets(); + recipeWoodBricks(); + recipeCellulosePulp(); + recipeCatalystCarrier(); + recipeAluminiumSilverCatalyst(); + recipeAceticAcid(); + recipePropionicAcid(); + recipeFermentationBase(); + recipeEthanol(); + recipeCelluloseFibre(); + recipeGoldenBrownCelluloseFiber(); + recipeRedCelluloseFiber(); + recipeSodiumHydroxide(); + recipeSodiumCarbonate(); + recipePelletMold(); + recipeAluminiumPellet(); + recipeAlumina(); + recipeAluminium(); + recipeCalciumCarbonate(); + recipeLithiumChloride(); + recipeAlginicAcid(); + recipeSulfuricAcid(); + recipeUrea(); + recipeRawBioResin(); + recipeLiquidResin(); + recipeCompost(); + recipeMethane(); + recipeBenzene(); + recipeStyrene(); + registerFuels(); + } + + private static void registerFuels() { + + // Burnables + ItemUtils.registerFuel(ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), 800); + ItemUtils.registerFuel(ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 1), 4800); + + // Gas Fuels + //GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalGas", 1), null, 96, 1); + + //Combustion Fuels + GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellButanol", 1), null, 1125, 0); + + } + private static void recipeGreenAlgae() { + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); + + // Turn into Cellulose + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getGreenAlgaeRecipeChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 30) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 5), + 30 * 30, + 16); + + + } + + private static void recipeBrownAlgae() { + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); + + // Alginic acid + CORE.RA.addExtractorRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 1), + 20 * 15, + 30); + + // Lithium Chloride + GT_Values.RA.addBlastRecipe( + getBrownAlgaeRecipeChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 20), + GT_Values.NF, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 1), + GT_Values.NI, + 120, + 120, + 1200); + + // Sodium Carbonate + CORE.RA.addChemicalRecipe( + getBrownAlgaeRecipeChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 20), + FluidUtils.getDistilledWater(2000), + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 1), + 20 * 30, + 30); + + } + + private static void recipeGoldenBrownAlgae() { + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); + + // Turn into Cellulose + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getGoldenBrownAlgaeRecipeChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, 30) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 5), + 30 * 30, + 120); + + } + + private static void recipeRedAlgae() { + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); + + // Turn into Cellulose + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getRedAlgaeRecipeChip(), + ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 30) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 5), + 30 * 30, + 240); + + } + + private static void recipeCelluloseFibre() { + + CORE.RA.addChemicalRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 20), + ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 2), + GT_Values.NF, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 10), + 45 * 20, + 16); + + // Craft into Wood Pellets + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(2), + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), + 20 * 4, + 8); + + // Methanol Extraction + GT_Values.RA.addFluidExtractionRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12), + GT_Values.NI, + FluidUtils.getFluidStack(mMethanol, 50), + 10000, + 20 * 30, + 30); + + // Compost + GT_ModHandler.addPulverisationRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 5), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1)); + + // Plastic + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(16), + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 64), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mAceticAcid, 500), + FluidUtils.getFluidStack(BioRecipes.mPropionicAcid, 500), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidPlastic, (144)), + }, + 120 * 20, + 240, + 2); + + + } + + private static void recipeWoodPellets() { + // Shapeless Recipe + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1) + }, ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 2)); + + // Extruder Recipe + GT_Values.RA.addExtruderRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 12), + ItemUtils.getSimpleStack(AgriculturalChem.mPelletMold, 0), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 3), + 20 * 10, + 16); + + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(2), + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 8) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 2), + 20 * 5, + 8); + + // CO2 + CORE.RA.addFluidExtractionRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 1), + FluidUtils.getFluidStack(mCarbonDioxide, 70), + 10*20, + 30); + + + // Add Charcoal Recipe + if (LoadedMods.Railcraft) { + RailcraftUtils.addCokeOvenRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), + true, + true, + ItemUtils.getItemStackOfAmountFromOreDict("gemCharcoal", 3), + GT_Values.NF, + 1200); + } + CORE.RA.addCokeOvenRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mWoodPellet, 2), + getBioChip(3), + null, + GT_Values.NF, + ItemUtils.getItemStackOfAmountFromOreDict("gemCharcoal", 3), + 120, + 16); + + + } + + private static void recipeWoodBricks() { + + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(3), + ItemUtils.getOrePrefixStack(OrePrefixes.dust, Materials.Wood, 50) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mWoodBrick, 1), + 100 * 20, + 16); + } + + private static void recipeCellulosePulp() { + + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(2), + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 4) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(Items.paper, 1), + 60 * 20, + 16); + } + + private static void recipeCatalystCarrier() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(20), + ItemUtils.getItemStackOfAmountFromOreDict("plateSteel", GTNH ? 8 : 4), + ItemUtils.getItemStackOfAmountFromOreDict("wireFineCopper", GTNH ? 4 : 2), + ItemUtils.getItemStackOfAmountFromOreDict("screwTin", GTNH ? 6 : 3) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1), + 300 * 20, + 16); + } + + private static void recipeAluminiumSilverCatalyst() { + // Assembly Recipe + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(4), + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 10), + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), + ItemUtils.getItemStackOfAmountFromOreDict("dustSilver", 4) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 10), + 20 * 20, + 30); + } + + private static void recipeAceticAcid() { + + /* GT_Values.RA.addMixerRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 10), + var2, + var3, var4, + var5, // Fluid in + var6, // Fluid out + var7, // Item Out + var8, // Time + var9); // Eu + */ + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethanol, 700), + FluidUtils.getFluidStack(BioRecipes.mCarbonMonoxide, 300), + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 2000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mAceticAcid, 250), + }, + 120 * 20, + 60, + 1); + + CORE.RA.addDehydratorRecipe( + CI.emptyCells(1), + FluidUtils.getFluidStack(mFermentationBase, 4000), + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1), + ItemUtils.getItemStackOfAmountFromOreDict("cellAceticAcid", 1) + }, + 60 * 20, + 16); + + + } + + + + public final static HashSet<GT_ItemStack> mFruits = new HashSet<GT_ItemStack>(); + public final static HashSet<GT_ItemStack> mVege = new HashSet<GT_ItemStack>(); + public final static HashSet<GT_ItemStack> mNuts = new HashSet<GT_ItemStack>(); + public final static HashSet<GT_ItemStack> mSeeds = new HashSet<GT_ItemStack>(); + + public final static AutoMap<ItemStack> mList_Master_FruitVege = new AutoMap<ItemStack>(); + public final static AutoMap<ItemStack> mList_Master_Seeds = new AutoMap<ItemStack>(); + + private static void processFermentationOreDict() { + processOreDictEntry("listAllfruit", mFruits); + processOreDictEntry("listAllFruit", mFruits); + processOreDictEntry("listAllveggie", mVege); + processOreDictEntry("listAllVeggie", mVege); + processOreDictEntry("listAllnut", mNuts); + processOreDictEntry("listAllNut", mNuts); + processOreDictEntry("listAllseed", mSeeds); + processOreDictEntry("listAllSeed", mSeeds); + + if (!mFruits.isEmpty()) { + for (GT_ItemStack g : mFruits) { + mList_Master_FruitVege.put(g.toStack()); + } + } + if (!mVege.isEmpty()) { + for (GT_ItemStack g : mVege) { + mList_Master_FruitVege.put(g.toStack()); + } + } + if (!mNuts.isEmpty()) { + for (GT_ItemStack g : mNuts) { + mList_Master_FruitVege.put(g.toStack()); + } + } + if (!mSeeds.isEmpty()) { + for (GT_ItemStack g : mSeeds) { + mList_Master_Seeds.put(g.toStack()); + } + } + } + + // Make Fermentation + private static void processOreDictEntry(String aOreName, HashSet<GT_ItemStack> mfruits2) { + ArrayList<ItemStack> aTemp = OreDictionary.getOres(aOreName); + if (!aTemp.isEmpty()) { + for (ItemStack stack : aTemp) { + mfruits2.add(new GT_ItemStack(stack)); + } + } + } + + + private static void recipeFermentationBase() { + processFermentationOreDict(); + AutoMap<ItemStack> aFruitVege = mList_Master_FruitVege; + AutoMap<ItemStack> aSeeds = mList_Master_Seeds; + ArrayList<ItemStack> aMap = OreDictionary.getOres("cropSugarbeet"); + for (ItemStack a : aFruitVege) { + if (aMap.contains(a)) { + continue; + } + if (ItemUtils.checkForInvalidItems(a)) { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(2), + ItemUtils.getSimpleStack(a, 10) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 200), + }, + 60 * 20, + 2, + 1); + } + + } + for (ItemStack a : aSeeds) { + if (ItemUtils.checkForInvalidItems(a)) { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(3), + ItemUtils.getSimpleStack(a, 20) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 50), + }, + 60 * 20, + 2, + 1); + } + } + + // Sugar Cane + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(4), + ItemUtils.getSimpleStack(Items.reeds, 16) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 75), + }, + 90 * 20, + 30, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(5), + ItemUtils.getSimpleStack(Items.reeds, 32), + ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 4) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mThermalWater, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 150), + }, + 120 * 20, + 30, + 1); + + // Sugar Beet + if (OreDictUtils.containsValidEntries("cropSugarbeet")) { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(4), + ItemUtils.getItemStackOfAmountFromOreDict("cropSugarbeet", 8), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 75), + }, + 60 * 20, + 30, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(5), + ItemUtils.getItemStackOfAmountFromOreDict("cropSugarbeet", 16), + ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 4) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mThermalWater, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 150), + }, + 90 * 20, + 30, + 1); + } + + // Produce Acetone, Butanol and Ethanol + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(5), + ItemUtils.getItemStackOfAmountFromOreDict("cellFermentationBase", 48), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 16), + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 16), + }, + new FluidStack[] { + + }, + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("cellButanol", 6), + ItemUtils.getItemStackOfAmountFromOreDict("cellAcetone", 3), + ItemUtils.getItemStackOfAmountFromOreDict("cellEthanol", 1), + CI.emptyCells(38) + }, + new FluidStack[] { + + }, + 900 * 20, + 32, + 2); + + + } + + private static void recipePropionicAcid() { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthylene, 500), + FluidUtils.getFluidStack(BioRecipes.mCarbonMonoxide, 500), + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 2000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mPropionicAcid, 250), + }, + 20 * 20, + 60, + 1); + } + + private static void recipeEthanol() { + + CORE.RA.addDistilleryRecipe( + BioRecipes.getBioChip(2), + FluidUtils.getFluidStack(BioRecipes.mFermentationBase, 1000), + FluidUtils.getFluidStack(BioRecipes.mEthanol, 100), + null, + 20 * 20, + 60, + false); + + } + + private static void recipeGoldenBrownCelluloseFiber() { + CORE.RA.addFluidExtractionRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 20), + FluidUtils.getFluidStack(BioRecipes.mAmmonia, 50), + 20 * 30, + 120); + } + + private static void recipeRedCelluloseFiber() { + CORE.RA.addExtractorRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 20), + ItemUtils.getSimpleStack(ModItems.dustCalciumCarbonate, 5), + 20 * 30, + 240); + } + + private static void recipeSodiumHydroxide() { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(4) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mSalineWater, 1000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mChlorine, 400), + FluidUtils.getFluidStack(BioRecipes.mHydrogen, 600), + }, + 300 * 20, + 120, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(5), + ItemUtils.getItemStackOfAmountFromOreDict("dustSodium", 5) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 5000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 5) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mHydrogen, 5000), + }, + 60 * 20, + 60, + 1); + } + + private static void recipeSodiumCarbonate() { + + if (OreDictUtils.containsValidEntries("fuelCoke")) { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(18), + ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 3), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 3), + ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 6) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 18) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mHydrogen, 200), + FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 1600), + }, + 120 * 20, + 120, + 1); + + } + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(18), + ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 6), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 4), + ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 6) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 16) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mHydrogen, 100), + FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 1750), + }, + 180 * 20, + 120, + 1); + + } + + private static void recipePelletMold() { + GregtechItemList.Pellet_Mold.set(ItemUtils.getSimpleStack(AgriculturalChem.mPelletMold, 1)); + GT_Values.RA.addLatheRecipe( + ALLOY.TUMBAGA.getBlock(1), + GregtechItemList.Pellet_Mold.get(1), + null, + 20 * 30 * 15, + 90); + } + + private static void recipeAluminiumPellet() { + + // Ore Names, no prefix + AutoMap<String> aOreNames = new AutoMap<String>(); + + aOreNames.put("Lazurite"); + aOreNames.put("Bauxite"); + aOreNames.put("Grossular"); + aOreNames.put("Pyrope"); + aOreNames.put("Sodalite"); + aOreNames.put("Spodumene"); + aOreNames.put("Ruby"); + aOreNames.put("Sapphire"); + aOreNames.put("GreenSapphire"); + + // Voltage + HashMap<String, Integer> aOreData1 = new HashMap<String, Integer>(); + // Input Count + HashMap<String, Integer> aOreData2 = new HashMap<String, Integer>(); + // Output Count + HashMap<String, Integer> aOreData3 = new HashMap<String, Integer>(); + + aOreData1.put("Lazurite", 120); + aOreData1.put("Bauxite", 90); + aOreData1.put("Grossular", 90); + aOreData1.put("Pyrope", 90); + aOreData1.put("Sodalite", 90); + aOreData1.put("Spodumene", 90); + aOreData1.put("Ruby", 60); + aOreData1.put("Sapphire", 30); + aOreData1.put("GreenSapphire", 30); + aOreData2.put("Lazurite", 14); + aOreData2.put("Bauxite", 39); + aOreData2.put("Grossular", 20); + aOreData2.put("Pyrope", 20); + aOreData2.put("Sodalite", 11); + aOreData2.put("Spodumene", 10); + aOreData2.put("Ruby", 6); + aOreData2.put("Sapphire", 5); + aOreData2.put("GreenSapphire", 5); + aOreData3.put("Lazurite", 3); + aOreData3.put("Bauxite", 16); + aOreData3.put("Grossular", 2); + aOreData3.put("Pyrope", 2); + aOreData3.put("Sodalite", 3); + aOreData3.put("Spodumene", 1); + aOreData3.put("Ruby", 2); + aOreData3.put("Sapphire", 2); + aOreData3.put("GreenSapphire", 2); + + // Assemble all valid crushed ore types for making pellet mix + HashMap<String, ItemStack> aOreCache = new HashMap<String, ItemStack>(); + for (String aOreName : aOreNames) { + String aTemp = aOreName; + aOreName = "crushedPurified" + aOreName; + if (ItemUtils.doesOreDictHaveEntryFor(aOreName)) { + aOreCache.put(aTemp, ItemUtils.getItemStackOfAmountFromOreDict(aOreName, 1)); + } + } + + for (String aOreName : aOreNames) { + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(14), + ItemUtils.getSimpleStack(aOreCache.get(aOreName), aOreData2.get(aOreName)) + }, + new FluidStack[] { + FluidUtils.getSteam(2000 * aOreData2.get(aOreName)) + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCleanAluminiumMix, (int) (Math.ceil(aOreData3.get(aOreName) * 1.4))) + }, + new FluidStack[] { + FluidUtils.getFluidStack(AgriculturalChem.RedMud, 100 * (int) (Math.ceil(aOreData3.get(aOreName) * 1.4))) + }, + 20 * 60, + aOreData1.get(aOreName), + aOreName.equals("Bauxite") ? 2 : 1); + } + + GT_Values.RA.addExtruderRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mCleanAluminiumMix, 3), + ItemUtils.getSimpleStack(AgriculturalChem.mPelletMold, 0), + ItemUtils.getSimpleStack(AgriculturalChem.mAluminiumPellet, 4), + 20 * 30, + 64); + + + } + + private static void recipeAlumina() { + GT_Values.RA.addBlastRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumAluminate, 24), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumHydroxide, 3), + FluidUtils.getFluidStack(mCarbonDioxide, 6000), + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 24), + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 2), + 20 * 120, + 120, + 1200); + } + + private static void recipeAluminium() { + GT_Values.RA.addBlastRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 24), + ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 4), + GT_Values.NF, + GT_Values.NF, + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 24), + null, + 20 * 120, + 120, + 1600); + } + + private static void recipeCalciumCarbonate() { + + } + + private static void recipeLithiumChloride() { + + if (OreDictUtils.containsValidEntries("dustRockSalt")) { + GT_Values.RA.addElectrolyzerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustRockSalt", 8), + ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 10), + FluidUtils.getFluidStack(BioRecipes.mAir, 4000), + FluidUtils.getFluidStack(BioRecipes.mChlorine, 500), + ItemUtils.getItemStackOfAmountFromOreDict("dustLithium", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 3), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 3), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyLithium", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustPotassium", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallPotassium", 5), + new int[] {7500, 8000, 8500, 9000, 7500, 8500}, + 60 * 30, + 60); + } + if (OreDictUtils.containsValidEntries("dustPotash")) { + GT_Values.RA.addElectrolyzerRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustPotash", 10), + ItemUtils.getSimpleStack(AgriculturalChem.mLithiumChloride, 16), + FluidUtils.getFluidStack(BioRecipes.mThermalWater, 2000), + FluidUtils.getFluidStack(BioRecipes.mChlorine, 250), + ItemUtils.getItemStackOfAmountFromOreDict("dustLithium", 3), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustSmallLithium", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyLithium", 7), + ItemUtils.getItemStackOfAmountFromOreDict("dustAsh", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustAsh", 2), + new int[] {7500, 8000, 8500, 9000, 9000, 9000}, + 45 * 30, + 90); + } + + } + + private static void recipeAlginicAcid() { + + /*// Turn into Cellulose Pulp + CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] { + getBioChip(7), + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 20), + ItemUtils.getSimpleStack(AgriculturalChem.mAlginicAcid, 5) + }, + GT_Values.NF, + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 20), + 90 * 20, + 16);*/ + } + + private static void recipeSulfuricAcid() { + + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(7), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 10), + ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, 30) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mSulfuricAcid, 50), + }, + 60 * 20, + 60, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(7), + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 5), + ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, 30) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mSulfuricAcid, 250), + }, + 60 * 20, + 120, + 2); + + } + + private static void recipeUrea() { + + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(9), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mAmmonia, 600), + FluidUtils.getFluidStack(BioRecipes.mCarbonDioxide, 400), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 400), + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 600), + }, + 120 * 20, + 30, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(9), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 200), + FluidUtils.getFluidStack(BioRecipes.mFormaldehyde, 200), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 200) + }, + 120 * 20, + 30, + 1); + } + + private static void recipeRawBioResin() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(3), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 10), + ItemUtils.getSimpleStack(Blocks.dirt, 20) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 1000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mRawBioResin, 1), + }, + new FluidStack[] { + + }, + 60 * 20, + 30, + 1); + } + + private static void recipeLiquidResin() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(3), + ItemUtils.getSimpleStack(AgriculturalChem.mRawBioResin, 1) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthanol, 200), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 50), + }, + 60 * 20, + 30, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(3), + ItemUtils.getSimpleStack(AgriculturalChem.mCellulosePulp, 8) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mLiquidResin, 144), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(Ic2Items.resin, 1) + }, + new FluidStack[] { + + }, + 120 * 20, + 30, + 1); + + + } + + private static void recipeCompost() { + ItemStack aFert; + if (LoadedMods.Forestry) { + aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertForestry, 2); + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(11), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 8) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 500), + }, + new ItemStack[] { + aFert + }, + new FluidStack[] { + + }, + 120 * 20, + 60, + 2); + } + + aFert = ItemUtils.getSimpleStack(AgriculturalChem.aFertIC2, 2); + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(12), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 16), + ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 8) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mUrea, 500), + }, + new ItemStack[] { + aFert + }, + new FluidStack[] { + + }, + 120 * 20, + 60, + 2); + + } + + private static void recipeMethane() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(12), + ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 20) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mDistilledWater, 500), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethane, 20), + }, + 20 * 20, + 8, + 1); + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(13), + ItemUtils.getSimpleStack(AgriculturalChem.mCelluloseFiber, 64), + ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownCelluloseFiber, 48), + ItemUtils.getSimpleStack(AgriculturalChem.mRedCelluloseFiber, 32) + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethane, 2000), + }, + new ItemStack[] { + + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthylene, 1250), + }, + 60 * 20, + 60, + 2); + } + + private static void recipeBenzene() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(19), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mMethane, 1000), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mBenzene, 500), + }, + 8 * 20, + 120, + 2); + } + + private static void recipeStyrene() { + + CORE.RA.addFluidReactorRecipe( + new ItemStack[] { + getBioChip(20), + ItemUtils.getSimpleStack(AgriculturalChem.mGreenCatalyst, 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mEthylbenzene, 100), + }, + new ItemStack[] { + ItemUtils.getSimpleStack(AgriculturalChem.mCatalystCarrier, 1), + }, + new FluidStack[] { + FluidUtils.getFluidStack(BioRecipes.mStyrene, 25), + }, + 16 * 20, + 480, + 3); + } + + private static void recipeBioChip() { + + GT_ModHandler.addShapelessCraftingRecipe( + GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 0L), 0, new Object[]{OrePrefixes.circuit.get(Materials.Primitive)}); + + long bits = 0; + + + + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 1L, new Object[0]), bits, + new Object[]{"d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 2L, new Object[0]), bits, + new Object[]{" d ", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 3L, new Object[0]), bits, + new Object[]{" d", " P ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 4L, new Object[0]), bits, + new Object[]{" ", " Pd", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 5L, new Object[0]), bits, + new Object[]{" ", " P ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 6L, new Object[0]), bits, + new Object[]{" ", " P ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 7L, new Object[0]), bits, + new Object[]{" ", " P ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 8L, new Object[0]), bits, + new Object[]{" ", "dP ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 9L, new Object[0]), bits, + new Object[]{"P d", " ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 10L, new Object[0]), bits, + new Object[]{"P ", " d", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 11L, new Object[0]), bits, + new Object[]{"P ", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 12L, new Object[0]), bits, + new Object[]{"P ", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 13L, new Object[0]), bits, + new Object[]{" P", " ", " d", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 14L, new Object[0]), bits, + new Object[]{" P", " ", " d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 15L, new Object[0]), bits, + new Object[]{" P", " ", "d ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 16L, new Object[0]), bits, + new Object[]{" P", "d ", " ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 17L, new Object[0]), bits, + new Object[]{" ", " ", "d P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 18L, new Object[0]), bits, + new Object[]{" ", "d ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 19L, new Object[0]), bits, + new Object[]{"d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 20L, new Object[0]), bits, + new Object[]{" d ", " ", " P", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 21L, new Object[0]), bits, + new Object[]{"d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 22L, new Object[0]), bits, + new Object[]{" d ", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 23L, new Object[0]), bits, + new Object[]{" d", " ", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + addCraftingRecipe(GregtechItemList.Circuit_BioRecipeSelector.getWithDamage(1L, 24L, new Object[0]), bits, + new Object[]{" ", " d", "P ", 'P', GregtechItemList.Circuit_BioRecipeSelector.getWildcard(1L, new Object[0])}); + } + + public static boolean addCraftingRecipe(ItemStack aResult, long aBitMask, Object[] aRecipe) { + Method mAddRecipe = ReflectionUtils.getMethod(GT_ModHandler.class, "addCraftingRecipe", new Class[] { + ItemStack.class, Enchantment[].class, int[].class, + boolean.class, boolean.class, boolean.class, boolean.class, + boolean.class, boolean.class, boolean.class, boolean.class, + boolean.class, boolean.class, boolean.class, boolean.class, + boolean.class, Object[].class}); + boolean didInvoke = false; + if (mAddRecipe != null) { + try { + didInvoke = (boolean) mAddRecipe.invoke(null, aResult, + new Enchantment[] {}, + new int[] {}, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + aRecipe); + } + catch (IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return didInvoke; + + + } + + +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java index d515375149..4cf31e9335 100644 --- a/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java +++ b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java @@ -1,12 +1,24 @@ package gtPlusPlus.plugin.agrichem; +import java.util.List; + import gtPlusPlus.api.interfaces.IPlugin; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.plugin.agrichem.block.AgrichemFluids; import gtPlusPlus.plugin.agrichem.fluids.FluidLoader; +import gtPlusPlus.plugin.agrichem.item.algae.ItemAgrichemBase; +import gtPlusPlus.plugin.agrichem.item.algae.ItemAlgaeBase; +import gtPlusPlus.plugin.agrichem.item.algae.ItemBioChip; import gtPlusPlus.plugin.manager.Core_Manager; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; public class Core_Agrichem implements IPlugin { final static Core_Agrichem mInstance; + static { mInstance = new Core_Agrichem(); @@ -15,18 +27,33 @@ public class Core_Agrichem implements IPlugin { } @Override - public boolean preInit() { + public boolean preInit() { + mInstance.log("Generating Fluids"); FluidLoader.generate(); + AgrichemFluids.init(); + mInstance.log("Generating Items"); return true; } @Override public boolean init() { + mInstance.log("Setting Items"); return true; } @Override public boolean postInit() { + mInstance.log("Generating Recipes"); + return true; + } + + @Override + public boolean serverStart() { + return true; + } + + @Override + public boolean serverStop() { return true; } diff --git a/src/Java/gtPlusPlus/plugin/agrichem/IAlgalItem.java b/src/Java/gtPlusPlus/plugin/agrichem/IAlgalItem.java new file mode 100644 index 0000000000..fada07d062 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/IAlgalItem.java @@ -0,0 +1,12 @@ +package gtPlusPlus.plugin.agrichem; + +import gtPlusPlus.plugin.agrichem.logic.AlgaeGeneticData; +import net.minecraft.item.ItemStack; + +public interface IAlgalItem { + + public abstract AlgaeDefinition getAlgaeType(ItemStack aStack); + + public abstract AlgaeGeneticData getSpeciesData(ItemStack aStack); + +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java b/src/Java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java new file mode 100644 index 0000000000..039dd702da --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/block/AgrichemFluids.java @@ -0,0 +1,88 @@ +package gtPlusPlus.plugin.agrichem.block; + +import gtPlusPlus.core.util.minecraft.FluidUtils; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + +public class AgrichemFluids { + + /* + * Saline Water - saltwater + * Sulfuric Waste Water - sulfuricapatite + * Methanol - methanol + * Hot Water - ic2hotwater + * Acetic Acid + * Propionic Acid + * Fermentation Base + * Ethylene - ethylene + * Ethanol - bioethanol + * Diluted SA - filutedsulfuricacid + * Sulfuric Acid - sulfuricacid + * Urea + * Formaldehyde - fluid.formaldehyde + * Liquid Resin + * Methane - methane + * Benzene - benzene + * Ethylbenzene - fluid.ethylbenzene + * Styrene - styrene + */ + + public static Fluid mAceticAcid; + public static Fluid mPropionicAcid; + public static Fluid mFermentationBase; + public static Fluid mUrea; + public static Fluid mLiquidResin; + public static Fluid mAcetone; + public static Fluid mButanol; + + + + public static void init() { + if (!FluidRegistry.isFluidRegistered("aceticacid")) { + mAceticAcid = FluidUtils.generateFluidNoPrefix("aceticacid", "Acetic Acid", 200, new short[] { 97, 168, 96, 100 }, true); + } + else { + mAceticAcid = FluidRegistry.getFluid("aceticacid"); + } + if (!FluidRegistry.isFluidRegistered("propionicacid")) { + mPropionicAcid = FluidUtils.generateFluidNoPrefix("propionicacid", "Propionic Acid", 200, new short[] { 198, 209, 148, 100 }, true); + } + else { + mPropionicAcid = FluidRegistry.getFluid("propionicacid"); + } + if (!FluidRegistry.isFluidRegistered("fermentation.base")) { + mFermentationBase = FluidUtils.generateFluidNoPrefix("fermentation.base", "Fermentation Base", 200, new short[] { 107, 100, 63, 100 }, true); + } + else { + mFermentationBase = FluidRegistry.getFluid("fermentation.base"); + } + if (!FluidRegistry.isFluidRegistered("ureamix")) { + mUrea = FluidUtils.generateFluidNoPrefix("ureamix", "Urea Mix", 200, new short[] { 71, 55, 12, 100 }, true); + } + else { + mUrea = FluidRegistry.getFluid("ureamix"); + } + if (!FluidRegistry.isFluidRegistered("liquidresin")) { + mLiquidResin = FluidUtils.generateFluidNoPrefix("liquidresin", "Liquid Resin", 200, new short[] { 59, 58, 56, 100 }, true); + } + else { + mLiquidResin = FluidRegistry.getFluid("liquidresin"); + } + + if (!FluidRegistry.isFluidRegistered("acetone")) { + mAcetone = FluidUtils.generateFluidNoPrefix("acetone", "Acetone", 200, new short[] { 59, 58, 56, 100 }, true); + } + else { + mAcetone = FluidRegistry.getFluid("acetone"); + } + if (!FluidRegistry.isFluidRegistered("butanol")) { + mButanol = FluidUtils.generateFluidNoPrefix("butanol", "Butanol", 200, new short[] { 159, 58, 56, 100 }, true); + } + else { + mButanol = FluidRegistry.getFluid("butanol"); + } + } + + + +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java new file mode 100644 index 0000000000..201da99488 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java @@ -0,0 +1,247 @@ +package gtPlusPlus.plugin.agrichem.item.algae; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.OreDictUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; + +public class ItemAgrichemBase extends Item { + + final protected IIcon base[]; + + /* + * 0 - Algae Biomass + * 1 - Green Algae Biomass + * 2 - Brown Algae Biomass + * 3 - Golden-Brown Algae Biomass + * 4 - Red Algae Biomass + * 5 - Cellulose Fiber + * 6 - Golden-Brown Cellulose Fiber + * 7 - Red Cellulose Fiber + * 8 - Compost + * 9 - Wood Pellet + * 10 - Wood Brick + * 11 - Cellulose Pulp + * 12 - Raw Bio Resin + * 13 - Catalyst Carrier + * 14 - Green Metal Catalyst + * 15 - Alginic Acid + * 16 - Alumina + * 17 - Aluminium Pellet + * 18 - Sodium Aluminate + * 19 - Sodium Hydroxide // Exists in Newer GT + * 20 - Sodium Carbonate + * 21 - Lithium Chloride + * 22 - Pellet Mold + * 23 - Clean Aluminium Mix + */ + + public ItemAgrichemBase() { + this.setHasSubtypes(true); + this.setNoRepair(); + this.setMaxStackSize(64); + this.setMaxDamage(0); + base = new IIcon[24]; + this.setUnlocalizedName("BasicAgrichemItem"); + GameRegistry.registerItem(this, this.getUnlocalizedName()); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean shouldRotateAroundWhenRendering() { + return super.shouldRotateAroundWhenRendering(); + } + + @Override + public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + return super.getItemStackDisplayName(aStack); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + try { + + } + catch (Throwable t) { + t.printStackTrace(); + } + super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); + } + + @Override + public EnumRarity getRarity(ItemStack p_77613_1_) { + return EnumRarity.common; + } + + @Override + public boolean requiresMultipleRenderPasses() { + return false; + } + + private static boolean mHasCheckedForSodiumHydroxide = false; + private static boolean mShowSodiumHydroxide = true; + + private static boolean checkSodiumHydroxide() { + if (mHasCheckedForSodiumHydroxide) { + return mShowSodiumHydroxide; + } + else { + if (OreDictUtils.containsValidEntries("dustSodiumHydroxide_GT5U") + || OreDictUtils.containsValidEntries("dustSodiumHydroxide")) { + List<ItemStack> aTest = OreDictionary.getOres( + "dustSodiumHydroxide", false + ); + if (aTest.isEmpty()) { + aTest = OreDictionary.getOres( + "dustSodiumHydroxide_GT5U", false + ); + if (!aTest.isEmpty()) { + mShowSodiumHydroxide = false; + } + } + else { + mShowSodiumHydroxide = false; + } + } + } + mHasCheckedForSodiumHydroxide = true; + return mShowSodiumHydroxide; + } + + @Override + public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { + for (int i=0;i<base.length;i++) { + if (i == 19) { + // Only show if it doesn't exist. + if (checkSodiumHydroxide()) { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } + else { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return stack.getItemDamage(); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } + + @Override + public void registerIcons(final IIconRegister u) { + for (int i=0;i<this.base.length;i++) { + String aPath = CORE.MODID + ":" + "bioscience/MetaItem1/"+i; + this.base[i] = u.registerIcon(aPath); + } + } + + + private boolean isTextureValid(String aPath) { + if (aPath == null) { + return false; + } + else if (aPath.indexOf(92) == -1) { + Constructor aTextureAtlasSprite = ReflectionUtils.getConstructor( + TextureAtlasSprite.class, String.class + ); + if (aTextureAtlasSprite != null) { + try { + TextureAtlasSprite aTestAtlas = (TextureAtlasSprite) aTextureAtlasSprite.newInstance( + aPath + ); + if (aTestAtlas != null) { + return true; + } + } + catch (InstantiationException | IllegalAccessException + | IllegalArgumentException + | InvocationTargetException e) { + } + } + } + return false; + } + + @Override + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { + return this.base[damage]; + } + + @Override + public IIcon getIconFromDamage(int damage) { + return this.base[damage]; + } + + @Override + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + return this.base[stack.getItemDamage()]; + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return this.base[stack.getItemDamage()]; + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName() + "." + stack.getItemDamage(); + } + + +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAlgaeBase.java b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAlgaeBase.java new file mode 100644 index 0000000000..6b31a42809 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAlgaeBase.java @@ -0,0 +1,235 @@ +package gtPlusPlus.plugin.agrichem.item.algae; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.plugin.agrichem.AlgaeDefinition; +import gtPlusPlus.plugin.agrichem.IAlgalItem; +import gtPlusPlus.plugin.agrichem.logic.AlgaeGeneticData; +import gtPlusPlus.plugin.agrichem.logic.AlgaeGrowthRequirement; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class ItemAlgaeBase extends Item implements IAlgalItem { + + protected IIcon base; + protected IIcon overlay; + + public ItemAlgaeBase() { + this.setHasSubtypes(true); + this.setMaxDamage(127); + this.setNoRepair(); + this.setMaxStackSize(32); + this.setUnlocalizedName("BasicAlgaeItem"); + GameRegistry.registerItem(this, this.getUnlocalizedName()); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean shouldRotateAroundWhenRendering() { + return super.shouldRotateAroundWhenRendering(); + } + + @Override + public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + if (!p_77663_1_.hasTagCompound() || p_77663_1_.getTagCompound().hasNoTags()) { + p_77663_1_ = initNBT(p_77663_1_); + } + super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + return EnumChatFormatting.UNDERLINE+super.getItemStackDisplayName(aStack); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + int aDam = aStack.getItemDamage(); + try { + aList.add(AlgaeDefinition.getByIndex(aDam).mSimpleName); + if (!aStack.hasTagCompound() || aStack.getTagCompound().hasNoTags()) { + aStack = initNBT(aStack); + } + else { + NBTTagCompound aNBT = aStack.getTagCompound(); + boolean mRequiresLight = aNBT.getBoolean("mRequiresLight"); + boolean mSaltWater = aNBT.getBoolean("mSaltWater"); + boolean mFreshWater = aNBT.getBoolean("mFreshWater"); + byte mTempTolerance = aNBT.getByte("mTempTolerance"); + float mFertility = aNBT.getFloat("mFertility"); + float mProductionSpeed = aNBT.getFloat("mProductionSpeed"); + byte mLifespan = aNBT.getByte("mLifespan"); + int mGeneration = aNBT.getInteger("mGeneration"); + + aList.add("Requires Light: "+mRequiresLight); + aList.add("Salt Water: "+mSaltWater); + aList.add("Fresh Water: "+mFreshWater); + aList.add("Temp Tolerance: "+mTempTolerance); + aList.add("Growth: "+mFertility); + aList.add("Production: "+mProductionSpeed); + aList.add("Lifespan in days: "+mLifespan); + aList.add("Generation: "+mGeneration); + } + } + catch (Throwable t) { + t.printStackTrace(); + } + super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); + } + + @Override + public EnumRarity getRarity(ItemStack p_77613_1_) { + return EnumRarity.uncommon; + } + + @Override + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { + for (int i=0;i<AlgaeDefinition.values().length;i++) { + aList.add(ItemUtils.simpleMetaStack(aItem, i, 1)); + } + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return stack.getItemDamage(); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } + + @Override + public int getColorFromItemStack(ItemStack aStack, int aMeta) { + return AlgaeDefinition.getByIndex(aStack.getItemDamage()).mColour; + } + + @Override + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { + if(pass == 0) { + return this.base; + } + return this.overlay; + } + + @Override + public void registerIcons(final IIconRegister i) { + this.base = i.registerIcon(CORE.MODID + ":" + "bioscience/BasicAlgae"); + this.overlay = i.registerIcon(CORE.MODID + ":" + "bioscience/BasicAlgae" + "_Overlay"); + } + + public static ItemStack initNBT(ItemStack aFreshAlgae) { + NBTTagCompound aNewTag = new NBTTagCompound(); + ItemAlgaeBase aItem; + if (aFreshAlgae.getItem() instanceof ItemAlgaeBase) { + aItem = (ItemAlgaeBase) aFreshAlgae.getItem(); + if (!aFreshAlgae.hasTagCompound()) { + AlgaeGeneticData y = aItem.getSpeciesData(aFreshAlgae); + aNewTag = y.writeToNBT(); + aFreshAlgae.setTagCompound(aNewTag); + } + else { + aNewTag = aFreshAlgae.getTagCompound(); + } + } + return aFreshAlgae; + } + + @Override + public AlgaeDefinition getAlgaeType(ItemStack aStack) { + return AlgaeDefinition.getByIndex(aStack != null ? aStack.getItemDamage() : 3); + } + + @Override + public AlgaeGeneticData getSpeciesData(ItemStack aStack) { + NBTTagCompound aTag; + if (!aStack.hasTagCompound() || aStack.getTagCompound().hasNoTags()) { + aTag = new NBTTagCompound(); + AlgaeGeneticData aGenes; + if (aStack.getItemDamage() < 3 || aStack.getItemDamage() > 5) { + aGenes = new AlgaeGeneticData(); + aTag = aGenes.writeToNBT(); + } + else { + byte aTemp, aLifespan; + float aFert, aSpeed; + + int aDam = aStack.getItemDamage(); + aTemp = (byte) (aDam == 3 ? 0 : aDam == 4 ? 2 : 1); + aLifespan = (byte) (aDam == 3 ? 1 : aDam == 4 ? 3f : 2f); + aFert = (float) (aDam == 3 ? 2f : aDam == 4 ? 1f : 1.75f); + aSpeed = (float) (aDam == 3 ? 1f : aDam == 4 ? 1.5f : 2f); + + aGenes = new AlgaeGeneticData( + true, true, + AlgaeDefinition.getByIndex(aDam).mSaltWater, AlgaeDefinition.getByIndex(aDam).mFreshWater, + aTemp, + aFert, + aSpeed, + aLifespan, + 0, + new AutoMap<AlgaeGrowthRequirement>()); + aTag = aGenes.writeToNBT(); + } + } + else { + aTag = aStack.getTagCompound(); + } + + + + + return new AlgaeGeneticData(aTag); + } + + + + +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java new file mode 100644 index 0000000000..5ecfbbabe9 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemBioChip.java @@ -0,0 +1,138 @@ +package gtPlusPlus.plugin.agrichem.item.algae; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class ItemBioChip extends Item { + + protected IIcon base; + + public ItemBioChip() { + this.setHasSubtypes(true); + this.setNoRepair(); + this.setMaxStackSize(64); + this.setMaxDamage(0); + this.setUnlocalizedName("BioRecipeSelector"); + GameRegistry.registerItem(this, this.getUnlocalizedName()); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean shouldRotateAroundWhenRendering() { + return super.shouldRotateAroundWhenRendering(); + } + + @Override + public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) { + super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_); + } + + @Override + public String getItemStackDisplayName(ItemStack aStack) { + return super.getItemStackDisplayName(aStack); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + try { + aList.add("Configuration == "+aStack.getItemDamage()); + } + catch (Throwable t) { + t.printStackTrace(); + } + super.addInformation(aStack, p_77624_2_, aList, p_77624_4_); + } + + @Override + public EnumRarity getRarity(ItemStack p_77613_1_) { + return EnumRarity.common; + } + + @Override + public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) { + aList.add(ItemUtils.simpleMetaStack(aItem, 0, 1)); + } + + @Override + public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) { + return false; + } + + @Override + public boolean isRepairable() { + return false; + } + + @Override + public boolean isBookEnchantable(ItemStack stack, ItemStack book) { + return false; + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return stack.getItemDamage(); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public int getItemEnchantability(ItemStack stack) { + return 0; + } + + @Override + public void registerIcons(final IIconRegister u) { + this.base = u.registerIcon(CORE.MODID + ":" + "bioscience/BioCircuit"); + } + + @Override + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { + return this.base; + } + + @Override + public IIcon getIconFromDamage(int damage) { + return this.base; + } + + @Override + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + return this.base; + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return this.base; + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName(); + } + + +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/logic/AlgaeGeneticData.java b/src/Java/gtPlusPlus/plugin/agrichem/logic/AlgaeGeneticData.java new file mode 100644 index 0000000000..dfe0f50b47 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/logic/AlgaeGeneticData.java @@ -0,0 +1,130 @@ +package gtPlusPlus.plugin.agrichem.logic; + +import gtPlusPlus.api.objects.data.AutoMap; +import net.minecraft.nbt.NBTTagCompound; + +public class AlgaeGeneticData { + + private final int mLifespan; + + private final int mGeneration; + + private final boolean mIsDominant; + + private final boolean mRequiresLight; + + private final boolean mSaltWater; + + private final boolean mFreshWater; + + private final byte mTempTolerance; + + private final float mFertility; + + private final float mProductionSpeed; + + private final AutoMap<AlgaeGrowthRequirement> mSpecialRequirements; + + + public AlgaeGeneticData() { + this(true, true, true, true, (byte) 0, 1f, 1f, (byte) 30, 0, new AutoMap<AlgaeGrowthRequirement>()); + } + + public AlgaeGeneticData(boolean isDominant, boolean requiresLight, boolean isSalt, boolean isFresh, + byte aTempTolerance, float aFertility, float aSpeed, byte aLifespan, int aGeneration, AutoMap<AlgaeGrowthRequirement> aRequirements) { + mIsDominant = isDominant; + mRequiresLight = requiresLight; + mSaltWater = isSalt; + mFreshWater = isFresh; + mTempTolerance = aTempTolerance; + mFertility = aFertility; + mProductionSpeed = aSpeed; + mLifespan = aLifespan; + mGeneration = aGeneration; + mSpecialRequirements = aRequirements; + } + + + public AlgaeGeneticData(NBTTagCompound aNBT) { + if (aNBT == null || aNBT.hasNoTags()) { + mIsDominant = true; + mRequiresLight = true; + mSaltWater = true; + mFreshWater = true; + mTempTolerance = 0; + mFertility = 1; + mProductionSpeed = 1; + mLifespan = 30; + mGeneration = 0; + } + else { + mIsDominant = aNBT.getBoolean("mIsDominant"); + mRequiresLight = aNBT.getBoolean("mRequiresLight"); + mSaltWater = aNBT.getBoolean("mSaltWater"); + mFreshWater = aNBT.getBoolean("mFreshWater"); + mTempTolerance = aNBT.getByte("mTempTolerance"); + mFertility = aNBT.getFloat("mFertility"); + mProductionSpeed = aNBT.getFloat("mProductionSpeed"); + mLifespan = aNBT.getByte("mLifespan"); + mGeneration = aNBT.getInteger("mGeneration"); + } + mSpecialRequirements = new AutoMap<AlgaeGrowthRequirement>(); + } + + /** + * In MC Days + */ + public final int getLifespan() { + return this.mLifespan; + } + + public final boolean isDominant() { + return this.mIsDominant; + } + + public final boolean RequiresLight() { + return this.mRequiresLight; + } + + public final boolean isSaltWater() { + return this.mSaltWater; + } + + public final boolean isFreshWater() { + return this.mFreshWater; + } + + public final byte getTempTolerance() { + return this.mTempTolerance; + } + + public final float getFertility() { + return this.mFertility; + } + + public final float getProductionSpeed() { + return this.mProductionSpeed; + } + + public final int getGeneration() { + return this.mGeneration; + } + + public final AutoMap<AlgaeGrowthRequirement> getSpecialRequirements() { + return this.mSpecialRequirements; + } + + public NBTTagCompound writeToNBT() { + NBTTagCompound aGenes = new NBTTagCompound(); + aGenes.setBoolean("mIsDominant", this.mIsDominant); + aGenes.setBoolean("mRequiresLight", this.mRequiresLight); + aGenes.setBoolean("mSaltWater", this.mSaltWater); + aGenes.setBoolean("mFreshWater", this.mFreshWater); + aGenes.setInteger("mLifespan", this.mLifespan); + aGenes.setInteger("mGeneration", this.mGeneration); + aGenes.setByte("mTempTolerance", this.mTempTolerance); + aGenes.setFloat("mFertility", this.mFertility); + aGenes.setFloat("mProductionSpeed", this.mProductionSpeed); + return aGenes; + } +} diff --git a/src/Java/gtPlusPlus/plugin/agrichem/logic/AlgaeGrowthRequirement.java b/src/Java/gtPlusPlus/plugin/agrichem/logic/AlgaeGrowthRequirement.java new file mode 100644 index 0000000000..6bddc9d085 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/agrichem/logic/AlgaeGrowthRequirement.java @@ -0,0 +1,5 @@ +package gtPlusPlus.plugin.agrichem.logic; + +public class AlgaeGrowthRequirement { + +} diff --git a/src/Java/gtPlusPlus/plugin/fishing/Core_Fishing.java b/src/Java/gtPlusPlus/plugin/fishing/Core_Fishing.java index 1a7d6833aa..48706bc986 100644 --- a/src/Java/gtPlusPlus/plugin/fishing/Core_Fishing.java +++ b/src/Java/gtPlusPlus/plugin/fishing/Core_Fishing.java @@ -32,6 +32,16 @@ public class Core_Fishing implements IPlugin { } @Override + public boolean serverStart() { + return false; + } + + @Override + public boolean serverStop() { + return false; + } + + @Override public String getPluginName() { return "GT++ Fishing Module"; } diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java index cf9676635d..2bfd05e5be 100644 --- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java @@ -11,10 +11,12 @@ public class Core_VanillaFixes implements IPlugin { final static Core_VanillaFixes mInstance; final static VanillaBedHeightFix mBedFixInstance; + final static VanillaBackgroundMusicFix mMusicFixInstance; static { mInstance = new Core_VanillaFixes(); mBedFixInstance = new VanillaBedHeightFix(mInstance); + mMusicFixInstance = new VanillaBackgroundMusicFix(mInstance); mInstance.log("Preparing "+mInstance.getPluginName()+" for use."); } @@ -38,6 +40,17 @@ public class Core_VanillaFixes implements IPlugin { } @Override + public boolean serverStart() { + mMusicFixInstance.manage(); + return true; + } + + @Override + public boolean serverStop() { + return true; + } + + @Override public String getPluginName() { return "GT++ Vanilla Fixes Module"; } @@ -48,6 +61,7 @@ public class Core_VanillaFixes implements IPlugin { } private boolean fixVanillaOD() { + registerToOreDict(ItemUtils.getSimpleStack(Items.blaze_rod), "rodBlaze"); registerToOreDict(ItemUtils.getSimpleStack(Items.nether_wart), "cropNetherWart"); registerToOreDict(ItemUtils.getSimpleStack(Items.reeds), "sugarcane"); registerToOreDict(ItemUtils.getSimpleStack(Items.paper), "paper"); @@ -58,7 +72,7 @@ public class Core_VanillaFixes implements IPlugin { registerToOreDict(ItemUtils.getSimpleStack(Items.nether_star), "netherStar"); registerToOreDict(ItemUtils.getSimpleStack(Items.leather), "leather"); registerToOreDict(ItemUtils.getSimpleStack(Items.feather), "feather"); - registerToOreDict(ItemUtils.getSimpleStack(Items.egg), "egg"); + registerToOreDict(ItemUtils.getSimpleStack(Items.egg), "egg"); registerToOreDict(ItemUtils.getSimpleStack(Blocks.end_stone), "endstone"); registerToOreDict(ItemUtils.getSimpleStack(Blocks.vine), "vine"); registerToOreDict(ItemUtils.getSimpleStack(Blocks.cactus), "blockCactus"); @@ -69,7 +83,12 @@ public class Core_VanillaFixes implements IPlugin { } private void registerToOreDict(ItemStack aStack, String aString) { - mInstance.log("Registering "+aStack.getDisplayName()+" to OreDictionary under the tag '"+aString+"'. (Added to Forge in 1.8.9)"); + if (aStack.getItem() == Items.blaze_rod) { + mInstance.log("Registering "+aStack.getDisplayName()+" to OreDictionary under the tag '"+aString+"'."); + } + else { + mInstance.log("Registering "+aStack.getDisplayName()+" to OreDictionary under the tag '"+aString+"'. (Added to Forge in 1.8.9)"); + } ItemUtils.addItemToOreDictionary(aStack, aString); } diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java new file mode 100644 index 0000000000..bfd73407f7 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBackgroundMusicFix.java @@ -0,0 +1,63 @@ +package gtPlusPlus.plugin.fixes.vanilla; + +import java.util.Timer; +import java.util.TimerTask; + +import gtPlusPlus.api.interfaces.IPlugin; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.plugin.fixes.interfaces.IBugFix; +import gtPlusPlus.plugin.fixes.vanilla.music.MusicTocker; +import gtPlusPlus.preloader.CORE_Preloader; + +public class VanillaBackgroundMusicFix implements IBugFix { + + private final IPlugin mParent; + private final boolean enabled; + private MusicTocker mFixInstance; + + public VanillaBackgroundMusicFix(IPlugin minstance) { + mParent = minstance; + if (CORE_Preloader.enableWatchdogBGM > 0 && Utils.isClient()) { + mParent.log("[BGM] Registering BGM delay Fix."); + enabled = true; + mFixInstance = new MusicTocker(mParent); + } else if (CORE_Preloader.enableWatchdogBGM > 0 && Utils.isServer()) { + mParent.log("[BGM] Tried registering BGM delay Fix on Server, disabling."); + enabled = false; + } else { + mParent.log("[BGM] Not registering BGM delay Fix."); + enabled = false; + } + } + + public boolean isFixValid() { + return enabled; + } + + public void manage() { + if (CORE_Preloader.enableWatchdogBGM > 0 && Utils.isClient()) { + TimerTask task = new ManageTask(this.mFixInstance); + Timer timer = new Timer("BGM-WatchDog"); + long delay = 1000 * 60; + timer.scheduleAtFixedRate(task, delay, 5000); + } + } + + private static class ManageTask extends TimerTask { + private final MusicTocker A; + + public ManageTask(MusicTocker a) { + A = a; + } + + @Override + public void run() { + if (CORE_Preloader.enableWatchdogBGM > 0 && Utils.isClient()) { + if (!A.mVanillaManager) { + A.run(); + } + } + } + } + +} diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java index 5f3b1d8abd..f33cc71fc6 100644 --- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java @@ -23,7 +23,7 @@ public class VanillaBedHeightFix implements IBugFix { mParent = minstance; if (DevHelper.isValidHelperObject()) { Method m; - if (DevHelper.IsObfuscatedEnvironment()) { + if (DevHelper.isObfuscatedEnvironment()) { m = ReflectionUtils.getMethod(EntityPlayer.class, "func_71018_a", int.class, int.class, int.class); } else { diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java new file mode 100644 index 0000000000..452c902e05 --- /dev/null +++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/music/MusicTocker.java @@ -0,0 +1,130 @@ +package gtPlusPlus.plugin.fixes.vanilla.music; + +import java.lang.reflect.Field; +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.interfaces.IPlugin; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.random.XSTR; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.CORE_Preloader; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.ISound; +import net.minecraft.client.audio.MusicTicker; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.util.MathHelper; + +@SideOnly(Side.CLIENT) +public class MusicTocker extends MusicTicker implements Runnable { + + private final Random mRandom = new XSTR(); + private final Minecraft mMinecraft; + private final IPlugin mPlugin; + private ISound mSound; + private int mTimeUntilNextTrack = 100; + + public boolean mVanillaManager = false; + + public MusicTocker(IPlugin aPlugin) { + super(Minecraft.getMinecraft()); + mPlugin = aPlugin; + mMinecraft = Minecraft.getMinecraft(); + mPlugin.log("[BGM] Created BGM Watchdog with a delay of "+getDelay()+" ticks."); + inject(); + } + + private static int getDelay() { + return CORE_Preloader.enableWatchdogBGM; + } + + private boolean inject() { + mPlugin.log("[BGM] Inject new Watchdog into Minecraft instance."); + ReflectionUtils.setField(Minecraft.getMinecraft(), "mcMusicTicker", this); + mPlugin.log("[BGM] Verifying..."); + Field f = ReflectionUtils.getField(Minecraft.class, "mcMusicTicker"); + try { + Object m = f.get(mMinecraft); + if (m != null) { + if (m instanceof MusicTocker || m.getClass().isAssignableFrom(getClass())) { + mPlugin.log("[BGM] Success."); + return true; + } + else if (m instanceof MusicTicker || m.getClass().isAssignableFrom(MusicTicker.class)) { + mPlugin.log("[BGM] Found Vanilla MusicTicker, but may be instance of MusicTocker."); + return true; + } + } + } catch (IllegalArgumentException | IllegalAccessException e) { + } + + mPlugin.log("[BGM] Failed."); + return false; + } + + private final void updateInternalNumber() { + if (ReflectionUtils.doesFieldExist(getClass(), "field_147676_d")) { + ReflectionUtils.setField(this, "field_147676_d", mTimeUntilNextTrack); + } + } + + private final void updateInternalSound(ISound aSound) { + if (ReflectionUtils.doesFieldExist(getClass(), "field_147678_c")) { + ReflectionUtils.setField(this, "field_147678_c", aSound); + } + } + + /** + * Updates the JList with a new model. + */ + @Override + public void update() { + run(); + mVanillaManager = true; + } + + @Override + public void run() { + MusicType musictype = this.mMinecraft.func_147109_W(); + + if (this.mSound != null) { + if (!musictype.getMusicTickerLocation().equals(this.mSound.getPositionedSoundLocation())) { + this.mMinecraft.getSoundHandler().stopSound(this.mSound); + this.mTimeUntilNextTrack = MathHelper.getRandomIntegerInRange(this.mRandom, 0, getDelay() / 2); + updateInternalNumber(); + Logger.INFO("[BGM] Adjusted BGM delay 1"); + } + if (!this.mMinecraft.getSoundHandler().isSoundPlaying(this.mSound)) { + this.mSound = null; + updateInternalSound(null); + this.mTimeUntilNextTrack = Math.min(MathHelper.getRandomIntegerInRange(this.mRandom, getDelay(), getDelay() * 2), this.mTimeUntilNextTrack); + updateInternalNumber(); + Logger.INFO("[BGM] Adjusted BGM delay 2"); + } + } + else if (this.mSound == null && this.mTimeUntilNextTrack-- <= 0) { + this.mSound = PositionedSoundRecord.func_147673_a(musictype.getMusicTickerLocation()); + updateInternalSound(mSound); + this.mMinecraft.getSoundHandler().playSound(this.mSound); + this.mTimeUntilNextTrack = getDelay(); + updateInternalNumber(); + Logger.INFO("[BGM] Adjusted BGM 3"); + } + + /* + * try { // Get Value stored in underlying object. Integer aRealDelay = + * (Integer) ReflectionUtils.getField(getClass(), "field_147676_d").get(this); + * + * if (aRealDelay == null) { return; } else { if (aRealDelay > getDelay() || + * aRealDelay <= 0) { this.mTimeUntilNextTrack = getDelay(); + * updateInternalNumber(); } else { this.mTimeUntilNextTrack -= 5 * 20; + * updateInternalNumber(); } aRealDelay = (Integer) + * ReflectionUtils.getField(getClass(), "field_147676_d").get(this); + * Logger.INFO("[BGM] Adjusted BGM - "+aRealDelay); } + * + * } catch (IllegalArgumentException | IllegalAccessException e) { } + */ + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/plugin/manager/Core_Manager.java b/src/Java/gtPlusPlus/plugin/manager/Core_Manager.java index 4526a43a5b..45e85d68ac 100644 --- a/src/Java/gtPlusPlus/plugin/manager/Core_Manager.java +++ b/src/Java/gtPlusPlus/plugin/manager/Core_Manager.java @@ -74,5 +74,37 @@ public class Core_Manager { return false; } + public static boolean serverStart() { + try { + for (IPlugin h : mPlugins) { + if (h.serverStart()) { + Logger.INFO("[Plugin] Completed Server Start Phase for "+h.getPluginName()+"."); + } + else { + Logger.INFO("[Plugin] Failed during Server Start Phase for "+h.getPluginName()+"."); + } + } + return true; + } + catch (Throwable t) {} + return false; + } + + public static boolean serverStop() { + try { + for (IPlugin h : mPlugins) { + if (h.serverStop()) { + Logger.INFO("[Plugin] Completed Server Stop Phase for "+h.getPluginName()+"."); + } + else { + Logger.INFO("[Plugin] Failed during Server Stop Phase for "+h.getPluginName()+"."); + } + } + return true; + } + catch (Throwable t) {} + return false; + } + } diff --git a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java index 92dae4e913..6da6ddccaa 100644 --- a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java +++ b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java @@ -85,6 +85,16 @@ public class Core_SulfuricChemistry implements IPlugin { } @Override + public boolean serverStart() { + return false; + } + + @Override + public boolean serverStop() { + return false; + } + + @Override public String getPluginName() { return "GT++ Revised Sulfuric Chemistry Module"; } diff --git a/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java b/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java index 01fd549c7b..09e4c4865f 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java +++ b/src/Java/gtPlusPlus/plugin/villagers/Core_VillagerAdditions.java @@ -102,6 +102,22 @@ public class Core_VillagerAdditions implements IPlugin { } @Override + public boolean serverStart() { + if (shouldLoad) { + return true; + } + return false; + } + + @Override + public boolean serverStop() { + if (shouldLoad) { + return true; + } + return false; + } + + @Override public String getPluginName() { return "GT++ Enhanced Villagers"; } diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java index 4dc5a15b4b..c29aadb16b 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java @@ -70,7 +70,7 @@ public class EntityBaseVillager extends EntityVillager { @Override public void readEntityFromNBT(NBTTagCompound aNBT) { if (aNBT.hasKey("aCustomName")) { - if (this.getCustomNameTag() != aNBT.getString("aCustomName")) { + if (!this.getCustomNameTag().equals(aNBT.getString("aCustomName"))) { this.setCustomNameTag(aNBT.getString("aCustomName")); } } @@ -202,9 +202,10 @@ public class EntityBaseVillager extends EntityVillager { protected MerchantRecipeList getBuyingList() { Field v82191; - MerchantRecipeList o; + MerchantRecipeList o = null; v82191 = ReflectionUtils.getField(getClass(), "buyingList"); try { + if (v82191 != null) o = (MerchantRecipeList) v82191.get(this); Logger.WARNING("Is BuyingList Valid? " + (v82191 != null)); return v82191 != null ? o : null; diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java index 967647cff6..4f9e2954a4 100644 --- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java +++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java @@ -79,7 +79,7 @@ public class EntityNativeAustralian extends EntityVillager { @Override public void readEntityFromNBT(NBTTagCompound aNBT) { if (aNBT.hasKey("aCustomName")) { - if (this.getCustomNameTag() != aNBT.getString("aCustomName")) { + if (!this.getCustomNameTag().equals(aNBT.getString("aCustomName"))) { this.setCustomNameTag(aNBT.getString("aCustomName")); } } @@ -105,7 +105,7 @@ public class EntityNativeAustralian extends EntityVillager { @Override public void setProfession(int p_70938_1_) { - super.setProfession(mRoleID); + super.setProfession(7738); } @Override @@ -190,9 +190,10 @@ public class EntityNativeAustralian extends EntityVillager { protected MerchantRecipeList getBuyingList() { Field v82191; - MerchantRecipeList o; + MerchantRecipeList o = null; v82191 = ReflectionUtils.getField(getClass(), "buyingList"); try { + if (v82191 != null) o = (MerchantRecipeList) v82191.get(this); Logger.WARNING("Is BuyingList Valid? " + (v82191 != null)); return v82191 != null ? o : null; diff --git a/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java b/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java index e3af6d9681..3317ef6a11 100644 --- a/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java +++ b/src/Java/gtPlusPlus/plugin/waila/Core_WailaPlugin.java @@ -37,6 +37,16 @@ public class Core_WailaPlugin implements IPlugin { } @Override + public boolean serverStart() { + return mActive; + } + + @Override + public boolean serverStop() { + return mActive; + } + + @Override public String getPluginName() { return "GT++ WAILA module"; } diff --git a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java index 09ce810ccd..b8ebdaf49c 100644 --- a/src/Java/gtPlusPlus/preloader/CORE_Preloader.java +++ b/src/Java/gtPlusPlus/preloader/CORE_Preloader.java @@ -7,7 +7,8 @@ import java.util.List; public class CORE_Preloader { public static final String NAME = "GT++ Preloader"; public static final String MODID = "GT++_Preloader"; - public static final String VERSION = "0.3-Alpha"; + public static final String VERSION = "0.4-Beta"; public static boolean enableOldGTcircuits = false; + public static int enableWatchdogBGM = 0; public static List<?> DEPENDENCIES = new ArrayList<>(Arrays.asList(new String[] {"required-before:gregtech;"})); } diff --git a/src/Java/gtPlusPlus/preloader/DevHelper.java b/src/Java/gtPlusPlus/preloader/DevHelper.java index d942de503a..81d36d591b 100644 --- a/src/Java/gtPlusPlus/preloader/DevHelper.java +++ b/src/Java/gtPlusPlus/preloader/DevHelper.java @@ -32,7 +32,7 @@ public class DevHelper { - public static boolean IsObfuscatedEnvironment() { + public static boolean isObfuscatedEnvironment() { // Are we in a 'decompiled' environment? boolean deobfuscatedEnvironment = false; byte[] bs; diff --git a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java index c29d8423d8..b3fbcb2d61 100644 --- a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java +++ b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java @@ -19,7 +19,11 @@ public class AsmConfig { public static boolean enableCofhPatch; public static boolean enableGcFuelChanges; public static boolean enableRcFlowFix; + public static boolean enableRcItemDupeFix; public static boolean enableTcAspectSafety; + public static boolean enabledLwjglKeybindingFix; + + public static boolean disableAllLogging; public AsmConfig(File file) { if (!loaded) { @@ -40,7 +44,13 @@ public class AsmConfig { Property prop; - //Debug + //Debug + prop = config.get("debug", "disableAllLogging", false); + prop.comment = "Disables ALL logging from GT++."; + prop.setLanguageKey("gtpp.disableAllLogging").setRequiresMcRestart(false); + disableAllLogging = prop.getBoolean(false); + propOrderDebug.add(prop.getName()); + prop = config.get("debug", "enableChunkDebugging", false); prop.comment = "Enable/Disable Chunk Debugging Features, Must Be enabled on Client and Server."; prop.setLanguageKey("gtpp.enableChunkDebugging").setRequiresMcRestart(true); @@ -68,6 +78,12 @@ public class AsmConfig { prop.setLanguageKey("gtpp.enableTiConFluidLighting").setRequiresMcRestart(true); enableTiConFluidLighting = prop.getBoolean(true); propOrder.add(prop.getName()); + + prop = config.get("general", "enabledLwjglKeybindingFix", true); + prop.comment = "Prevents the game crashing from having invalid keybinds. https://github.com/alkcorp/GTplusplus/issues/544"; + prop.setLanguageKey("gtpp.enabledLwjglKeybindingFix").setRequiresMcRestart(true); + enabledLwjglKeybindingFix = prop.getBoolean(true); + propOrder.add(prop.getName()); prop = config.get("general", "enableGtTooltipFix", true); prop.comment = "Enable/Disable Custom GT Tooltips"; @@ -91,6 +107,13 @@ public class AsmConfig { enableRcFlowFix = prop.getBoolean(true); propOrder.add(prop.getName()); + //Railcraft Dupe Fix + prop = config.get("general", "enableRcItemDupeFix", true); + prop.comment = "Fixes possible negative itemstacks"; + prop.setLanguageKey("gtpp.enableRcItemDupeFix").setRequiresMcRestart(true); + enableRcItemDupeFix = prop.getBoolean(true); + propOrder.add(prop.getName()); + //TC Aspect Safety prop = config.get("general", "enableTcAspectSafety", true); diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java index c175d921b1..d8a4bf96f5 100644 --- a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java +++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java @@ -15,6 +15,7 @@ import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.versioning.ArtifactVersion; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.preloader.CORE_Preloader; import net.minecraftforge.common.config.Configuration; @@ -72,12 +73,28 @@ public class Preloader_DummyContainer extends DummyModContainer { } public static void handleConfigFile(final FMLPreInitializationEvent event) { - final Configuration config = new Configuration( - new File(event.getModConfigurationDirectory(), "GTplusplus/GTplusplus.cfg")); + final Configuration config = new Configuration(new File(event.getModConfigurationDirectory(), "GTplusplus/GTplusplus.cfg")); config.load(); + //BGM Watchdog + CORE_Preloader.enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s."); + // Circuits - CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, - "Restores circuits and their recipes from Pre-5.09.28 times."); + CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, "Restores circuits and their recipes from Pre-5.09.28 times."); + } + + public static boolean getConfig(){ + final Configuration config = new Configuration( new File(Utils.getMcDir(), "config/GTplusplus/GTplusplus.cfg")); + if (config != null){ + config.load(); + // Circuits + CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, "Restores circuits and their recipes from Pre-5.09.28 times."); + CORE_Preloader.enableWatchdogBGM = config.getInt("enableWatchdogBGM", "features", 0, 0, Short.MAX_VALUE, "Set to a value greater than 0 to reduce the ticks taken to delay between BGM tracks. Acceptable Values are 1-32767, where 0 is disabled. Vanilla Uses 12,000 & 24,000. 200 is 10s."); + + Logger.INFO("GT++ Preloader - Loaded the configuration file."); + return true; + } + Logger.INFO("GT++ Preloader - Failed loading the configuration file."); + return false; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java new file mode 100644 index 0000000000..9c79db265d --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit.java @@ -0,0 +1,142 @@ +package gtPlusPlus.preloader.asm.transformers; + +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.IRETURN; + +import java.util.ArrayList; + +import org.apache.logging.log4j.Level; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; + +import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gregtech.api.enums.OrePrefixes; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class ClassTransformer_GT_CharcoalPit { + + private final boolean isValid; + private final ClassReader reader; + private final ClassWriter writer; + + public static boolean isWoodLog(Block log) { + //Logger.INFO("checking for log"); + boolean isLog1 = OrePrefixes.log.contains(new ItemStack(log, 1)); + if (isLog1) { + //Logger.INFO("Found 1"); + return true; + } + ArrayList<ItemStack> oredict = OreDictionary.getOres("logWood"); + if (oredict.contains(ItemUtils.getSimpleStack(log))) { + //Logger.INFO("found 2"); + return true; + } + //Logger.INFO("Did not find. "+(log != null ? ""+log.getLocalizedName() : "Null or invalid block?")); + return false; + } + + public ClassTransformer_GT_CharcoalPit(byte[] basicClass, boolean obfuscated) { + ClassReader aTempReader = null; + ClassWriter aTempWriter = null; + aTempReader = new ClassReader(basicClass); + aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); + aTempReader.accept(new AddFieldAdapter(aTempWriter), 0); + injectMethod("isWoodLog", obfuscated, aTempWriter); + if (aTempReader != null && aTempWriter != null) { + isValid = true; + } else { + isValid = false; + } + FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, + "Valid? " + isValid + "."); + reader = aTempReader; + writer = aTempWriter; + } + + public boolean isValidTransformer() { + return isValid; + } + + public ClassReader getReader() { + return reader; + } + + public ClassWriter getWriter() { + return writer; + } + + public boolean injectMethod(String aMethodName, boolean obfuscated, ClassWriter cw) { + MethodVisitor mv; + boolean didInject = false; + FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Injecting " + aMethodName + "."); + + String aBlockClassName = "net/minecraft/block/Block"; + if (obfuscated) { + aBlockClassName = "aji"; + } + if (aMethodName.equals("isWoodLog")) { + mv = cw.visitMethod(ACC_PUBLIC, "isWoodLog", "(L"+aBlockClassName+";)Z", null, null); + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(49, l0); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_CharcoalPit", "isWoodLog", "(L"+aBlockClassName+";)Z", false); + mv.visitInsn(IRETURN); + Label l1 = new Label(); + mv.visitLabel(l1); + mv.visitLocalVariable("this", "Lgregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit;", null, l0, l1, 0); + mv.visitLocalVariable("log", "L"+aBlockClassName+";", null, l0, l1, 1); + mv.visitMaxs(1, 2); + mv.visitEnd(); + didInject = true; + } + FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Method injection complete."); + return didInject; + } + + public class AddFieldAdapter extends ClassVisitor { + + public AddFieldAdapter(ClassVisitor cv) { + super(ASM5, cv); + this.cv = cv; + } + + private final String[] aMethodsToStrip = new String[] { "isWoodLog" }; + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + MethodVisitor methodVisitor; + boolean found = false; + + for (String s : aMethodsToStrip) { + if (name.equals(s)) { + found = true; + break; + } + } + if (!found) { + methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + } else { + methodVisitor = null; + } + if (found) { + FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Found method " + name + ", removing."); + } + return methodVisitor; + } + + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_LWJGL_Keyboard.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_LWJGL_Keyboard.java new file mode 100644 index 0000000000..7a92c3d18c --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_LWJGL_Keyboard.java @@ -0,0 +1,172 @@ +package gtPlusPlus.preloader.asm.transformers; + +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACC_STATIC; +import static org.objectweb.asm.Opcodes.ACC_SYNCHRONIZED; +import static org.objectweb.asm.Opcodes.ARETURN; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.ILOAD; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; + +import java.lang.reflect.Field; + +import org.apache.logging.log4j.Level; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; + +import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + +public class ClassTransformer_LWJGL_Keyboard { + + private final boolean isValid; + private final ClassReader reader; + private final ClassWriter writer; + + /** + * Gets a key's name + * + * @param key The key + * @return a String with the key's human readable name in it or null if the key + * is unnamed + */ + public static synchronized String getKeyName(int key) { + if (init()) { + String[] aTemp = getKeyName(); + if (key < aTemp.length && key >= 0) { + return aTemp[key]; + } + } + return getKeyName()[0x00]; // Return nothing + } + + @SuppressWarnings("rawtypes") + private static Class mKeyboard; + private static Field mKeyName; + + @SuppressWarnings("rawtypes") + private static boolean init() { + if (mKeyName != null) { + return true; + } + Class aKeyboard = ReflectionUtils.getClass("org.lwjgl.input.Keyboard"); + if (aKeyboard != null) { + mKeyboard = aKeyboard; + Field aKeyName = ReflectionUtils.getField(mKeyboard, "keyName"); + if (aKeyName != null) { + mKeyName = aKeyName; + } + } + return mKeyName != null; + } + + private static String[] getKeyName() { + if (init()) { + try { + Object o = mKeyName.get(null); + if (o instanceof String[]) { + String[] y = (String[]) o; + return y; + } + } catch (IllegalArgumentException | IllegalAccessException e) { + } + } + return new String[] {}; + } + + public ClassTransformer_LWJGL_Keyboard(byte[] basicClass) { + ClassReader aTempReader = null; + ClassWriter aTempWriter = null; + aTempReader = new ClassReader(basicClass); + aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); + aTempReader.accept(new AddFieldAdapter(aTempWriter), 0); + injectMethod("getKeyName", aTempWriter); + if (aTempReader != null && aTempWriter != null) { + isValid = true; + } else { + isValid = false; + } + FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, + "Valid? " + isValid + "."); + reader = aTempReader; + writer = aTempWriter; + } + + public boolean isValidTransformer() { + return isValid; + } + + public ClassReader getReader() { + return reader; + } + + public ClassWriter getWriter() { + return writer; + } + + public boolean injectMethod(String aMethodName, ClassWriter cw) { + MethodVisitor mv; + boolean didInject = false; + FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, + "Injecting " + aMethodName + "."); + if (aMethodName.equals("getKeyName")) { + mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC + ACC_SYNCHRONIZED, "getKeyName", "(I)Ljava/lang/String;", null, + null); + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(49, l0); + mv.visitVarInsn(ILOAD, 0); + mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/ClassTransformer_LWJGL_Keyboard", + "getKeyName", "(I)Ljava/lang/String;", false); + mv.visitInsn(ARETURN); + Label l1 = new Label(); + mv.visitLabel(l1); + mv.visitLocalVariable("key", "I", null, l0, l1, 0); + mv.visitMaxs(1, 1); + mv.visitEnd(); + didInject = true; + } + FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, + "Method injection complete."); + return didInject; + } + + public class AddFieldAdapter extends ClassVisitor { + + public AddFieldAdapter(ClassVisitor cv) { + super(ASM5, cv); + this.cv = cv; + } + + private final String[] aMethodsToStrip = new String[] { "getKeyName" }; + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + MethodVisitor methodVisitor; + boolean found = false; + + for (String s : aMethodsToStrip) { + if (name.equals(s)) { + found = true; + break; + } + } + if (!found) { + methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + } else { + methodVisitor = null; + } + if (found) { + FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, + "Found method " + name + ", removing."); + } + return methodVisitor; + } + + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Railcraft_InvTools.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Railcraft_InvTools.java new file mode 100644 index 0000000000..30ee37d7b3 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_Railcraft_InvTools.java @@ -0,0 +1,232 @@ +package gtPlusPlus.preloader.asm.transformers; + +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACC_STATIC; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ARETURN; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; + +import java.lang.reflect.Method; + +import org.apache.logging.log4j.Level; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; + +import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public class ClassTransformer_Railcraft_InvTools { + + private final boolean isValid; + private final ClassReader reader; + private final ClassWriter writer; + private boolean obfuscated = true; + + + public static ItemStack depleteItem(ItemStack stack) { + if (stack == null) { + return GT_Values.NI; + } else { + if (stack.stackSize <= 1) { + ItemStack container = stack.getItem().getContainerItem(stack); + if (container != null) { + return container; + } else { + return GT_Values.NI; + } + } else { + ItemUtils.depleteStack(stack); + return stack; + } + } + } + + public ClassTransformer_Railcraft_InvTools(byte[] basicClass, boolean obfuscated2) { + ClassReader aTempReader = null; + ClassWriter aTempWriter = null; + + boolean devEnv = false; + boolean a1 = false; + boolean a2 = false; + + //Find Non-Obf method + try { + Method aGetStackInSlot = IInventory.class.getDeclaredMethod("getStackInSlot", int.class); + if (aGetStackInSlot != null) { + a1 = true; + } + } catch (NoSuchMethodException | SecurityException e) {} + + //Find Obf method + try { + Method aGetStackInSlotObf = IInventory.class.getDeclaredMethod("func_70301_a", int.class); + if (aGetStackInSlotObf != null) { + a2 = true; + } + } catch (NoSuchMethodException | SecurityException e) {} + + + if (a1) { + devEnv = false; + } + else if (a2) { + devEnv = true; + } + else { + //Fallback + devEnv = false; + } + + if (obfuscated && devEnv) { + + } + else { + + + } + + + + FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, "Are we patching obfuscated method? "+obfuscated); + + aTempReader = new ClassReader(basicClass); + aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); + aTempReader.accept(new AddFieldAdapter(aTempWriter), 0); + + injectMethod("depleteItem", aTempWriter, obfuscated); + + if (aTempReader != null && aTempWriter != null) { + isValid = true; + } + else { + isValid = false; + } + + FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, "Valid? "+isValid+"."); + reader = aTempReader; + writer = aTempWriter; + } + + public boolean isValidTransformer() { + return isValid; + } + + public ClassReader getReader() { + return reader; + } + + public ClassWriter getWriter() { + return writer; + } + + public boolean injectMethod(String aMethodName, ClassWriter cw, boolean obfuscated) { + MethodVisitor mv; + boolean didInject = false; + FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, "Injecting " + aMethodName + "."); + if (aMethodName.equals("depleteItem") && !obfuscated) { + mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "depleteItem", "(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;", null, null); + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(36, l0); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/ClassTransformer_Railcraft_InvTools", "depleteItem", "(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;", false); + mv.visitInsn(ARETURN); + Label l1 = new Label(); + mv.visitLabel(l1); + mv.visitLocalVariable("stack", "Lnet/minecraft/item/ItemStack;", null, l0, l1, 0); + mv.visitMaxs(1, 1); + mv.visitEnd(); + didInject = true; + } + else if (aMethodName.equals("depleteItem") && obfuscated) { + mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "depleteItem", "(Ladd;)Ladd;", null, null); + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(36, l0); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/preloader/asm/transformers/ClassTransformer_Railcraft_InvTools", "depleteItem", "(Ladd;)Ladd;", false); + mv.visitInsn(ARETURN); + Label l1 = new Label(); + mv.visitLabel(l1); + mv.visitLocalVariable("stack", "Ladd;", null, l0, l1, 0); + mv.visitMaxs(1, 1); + mv.visitEnd(); + didInject = true; + } + FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, "Method injection complete. "+(obfuscated ? "Obfuscated" : "Non-Obfuscated")); + return didInject; + } + + + + + + + + + + public class AddFieldAdapter extends ClassVisitor { + + public AddFieldAdapter(ClassVisitor cv) { + super(ASM5, cv); + this.cv = cv; + } + + private final String[] aMethodsToStrip = new String[] {"depleteItem"}; + + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + + MethodVisitor methodVisitor; + boolean found = false; + + for (String s : aMethodsToStrip) { + if (name.equals(s)) { + found = true; + break; + } + } + if (!found) { + methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + } + else { + if (desc.equals("(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/item/ItemStack;")) { + obfuscated = false; + } + else if (desc.equals("(Ladd;)Ladd;")) { + obfuscated = true; + } + else { + obfuscated = false; + } + FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, + "Method desc " + desc + ", using "+(obfuscated ? "obfuscated method handler" : "deobfuscated method handler")); + methodVisitor = null; + } + + if (found) { + FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, + "Found method " + name + ", removing."); + } + return methodVisitor; + } + + + } + + + + + + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TC_ItemWispEssence.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TC_ItemWispEssence.java index 06759429b9..8f65709478 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TC_ItemWispEssence.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TC_ItemWispEssence.java @@ -1,6 +1,36 @@ package gtPlusPlus.preloader.asm.transformers; -import static org.objectweb.asm.Opcodes.*; +import static org.objectweb.asm.Opcodes.AALOAD; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACONST_NULL; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ARETURN; +import static org.objectweb.asm.Opcodes.ARRAYLENGTH; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.ASTORE; +import static org.objectweb.asm.Opcodes.DUP; +import static org.objectweb.asm.Opcodes.F_APPEND; +import static org.objectweb.asm.Opcodes.F_CHOP; +import static org.objectweb.asm.Opcodes.F_SAME; +import static org.objectweb.asm.Opcodes.F_SAME1; +import static org.objectweb.asm.Opcodes.GETSTATIC; +import static org.objectweb.asm.Opcodes.GOTO; +import static org.objectweb.asm.Opcodes.I2L; +import static org.objectweb.asm.Opcodes.ICONST_0; +import static org.objectweb.asm.Opcodes.IFEQ; +import static org.objectweb.asm.Opcodes.IFLE; +import static org.objectweb.asm.Opcodes.IFNONNULL; +import static org.objectweb.asm.Opcodes.IFNULL; +import static org.objectweb.asm.Opcodes.ILOAD; +import static org.objectweb.asm.Opcodes.INVOKESPECIAL; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL; +import static org.objectweb.asm.Opcodes.IRETURN; +import static org.objectweb.asm.Opcodes.ISTORE; +import static org.objectweb.asm.Opcodes.L2I; +import static org.objectweb.asm.Opcodes.LDIV; +import static org.objectweb.asm.Opcodes.LREM; +import static org.objectweb.asm.Opcodes.NEW; import org.apache.logging.log4j.Level; import org.objectweb.asm.AnnotationVisitor; @@ -11,12 +41,7 @@ import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.preloader.DevHelper; -import net.minecraft.item.ItemStack; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; public class ClassTransformer_TC_ItemWispEssence { @@ -246,30 +271,6 @@ public class ClassTransformer_TC_ItemWispEssence { } } - static Aspect[] displayAspects; - - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack stack, int par2) { - if (stack == null) { - return 0; - } - if (this.getAspects(stack) != null) { - return this.getAspects(stack).getAspects()[0].getColor(); - } else { - int idx = (int) (System.currentTimeMillis() / 500L % (long) displayAspects.length); - return displayAspects[idx].getColor(); - } - } - - public AspectList getAspects(ItemStack itemstack) { - if (itemstack.hasTagCompound()) { - AspectList aspects = new AspectList(); - aspects.readFromNBT(itemstack.getTagCompound()); - return aspects.size() > 0 ? aspects : null; - } else { - return null; - } - } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer.java index cba11d4e29..05a476c1c8 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer.java @@ -1,8 +1,10 @@ package gtPlusPlus.preloader.asm.transformers; -import static org.objectweb.asm.Opcodes.*; - -import java.io.File; +import static org.objectweb.asm.Opcodes.ALOAD; +import static org.objectweb.asm.Opcodes.ASM5; +import static org.objectweb.asm.Opcodes.IFEQ; +import static org.objectweb.asm.Opcodes.INVOKESTATIC; +import static org.objectweb.asm.Opcodes.RETURN; import org.apache.logging.log4j.Level; import org.objectweb.asm.ClassVisitor; @@ -11,26 +13,7 @@ import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.preloader.CORE_Preloader; -import net.minecraftforge.common.config.Configuration; - -public class Preloader_ClassTransformer { - - public static boolean getConfig(){ - final Configuration config = new Configuration( new File(Utils.getMcDir(), "config/GTplusplus/GTplusplus.cfg")); - if (config != null){ - config.load(); - // Circuits - CORE_Preloader.enableOldGTcircuits = config.getBoolean("enableOldGTcircuits", "gregtech", false, - "Restores circuits and their recipes from Pre-5.09.28 times."); - Logger.INFO("GT++ ASM - Loaded the configuration file."); - return CORE_Preloader.enableOldGTcircuits; - } - Logger.INFO("GT++ ASM - Failed loading the configuration file."); - return false; - } +public class Preloader_ClassTransformer { public static final class OreDictionaryVisitor extends ClassVisitor { diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java index 390289d162..507e2cf974 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_ClassTransformer2.java @@ -329,8 +329,6 @@ public class Preloader_ClassTransformer2 { Logger.REFLECTION("mItemStorageNBT: "+(mItemStorageNBT != null)); //mItemStorageNBT - - ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, tID); NBTTagCompound tNBT = new NBTTagCompound(); if (tRecipeStuff != null && !tRecipeStuff.hasNoTags()) tNBT.setTag("GT.CraftingComponents", tRecipeStuff); diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java index e12213003f..c269e9463e 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java @@ -65,6 +65,12 @@ public class Preloader_Transformer_Handler implements IClassTransformer { boolean obfuscated = checkObfuscated(); boolean probablyShouldBeFalse = false; + // Fix LWJGL index array out of bounds on keybinding IDs + if (transformedName.equals("org.lwjgl.input.Keyboard") && mConfig.enabledLwjglKeybindingFix) { + FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, "Transforming %s", transformedName); + return new ClassTransformer_LWJGL_Keyboard(basicClass).getWriter().toByteArray(); + } + //Enable mapping of Tickets and loaded chunks. - Forge if (transformedName.equals("net.minecraftforge.common.ForgeChunkManager") && mConfig.enableChunkDebugging) { FMLRelaunchLog.log("[GT++ ASM] Chunkloading Patch", Level.INFO, "Transforming %s", transformedName); @@ -96,6 +102,11 @@ public class Preloader_Transformer_Handler implements IClassTransformer { FMLRelaunchLog.log("[GT++ ASM] Railcraft PROCESS_VOLUME Patch", Level.INFO, "Transforming %s", transformedName); return new ClassTransformer_Railcraft_FluidHelper(basicClass, obfuscated).getWriter().toByteArray(); } + //Fix Weird glitch involving negative itemstacks. + if (transformedName.equals("mods.railcraft.common.util.inventory.InvTools") && mConfig.enableRcItemDupeFix) { + FMLRelaunchLog.log("[GT++ ASM] Railcraft negative ItemStack Fix", Level.INFO, "Transforming %s", transformedName); + return new ClassTransformer_Railcraft_InvTools(basicClass, obfuscated).getWriter().toByteArray(); + } //Fix GC stuff if (mConfig.enableGcFuelChanges) { @@ -156,6 +167,12 @@ public class Preloader_Transformer_Handler implements IClassTransformer { return new ClassTransformer_GT_BaseMetaTileEntity(basicClass).getWriter().toByteArray(); } + //Fix log handling on the charcoal pit + if (transformedName.equals("gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_Charcoal_Pit")) { + FMLRelaunchLog.log("[GT++ ASM] GT Charcoal Pit Fix", Level.INFO, "Transforming %s", transformedName); + return new ClassTransformer_GT_CharcoalPit(basicClass, obfuscated).getWriter().toByteArray(); + } + @@ -214,8 +231,8 @@ public class Preloader_Transformer_Handler implements IClassTransformer { return new ClassTransformer_IC2_GetHarvestTool(basicClass, obfuscated, transformedName).getWriter().toByteArray(); } } - //Fix IC2 Hazmat + //Fix IC2 Hazmat if (transformedName.equals("ic2.core.item.armor.ItemArmorHazmat")) { FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Transforming %s", transformedName); return new ClassTransformer_IC2_Hazmat(basicClass, transformedName).getWriter().toByteArray(); diff --git a/src/Java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java b/src/Java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java index b152be46b1..9d646e3eb5 100644 --- a/src/Java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java +++ b/src/Java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java @@ -1,13 +1,6 @@ package gtPlusPlus.xmod.bop; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; public class HANDLER_BiomesOPlenty { @@ -29,12 +22,7 @@ public class HANDLER_BiomesOPlenty { public static void postInit(){ if (LoadedMods.BiomesOPlenty){ - RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {ItemUtils.getSimpleStack(BOP_Block_Registrator.log_Rainforest)}, ItemUtils.getSimpleStack(Item.getItemFromBlock(Blocks.planks), 2)); - RecipeUtils.recipeBuilder( - CI.craftingToolSaw, null, null, - ItemUtils.getSimpleStack(BOP_Block_Registrator.log_Rainforest), null, null, - null, null, null, - ItemUtils.getSimpleStack(Item.getItemFromBlock(Blocks.planks), 4)); + BOP_Block_Registrator.recipes(); } } diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java b/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java index 99d2d56936..f5e1d429f7 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java @@ -1,30 +1,178 @@ package gtPlusPlus.xmod.bop.blocks; -import net.minecraft.block.Block; - +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.helpers.MaterialHelper; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.xmod.bop.blocks.rainforest.LeavesRainforestTree; import gtPlusPlus.xmod.bop.blocks.rainforest.LogRainforestTree; import gtPlusPlus.xmod.bop.blocks.rainforest.SaplingRainforestTree; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; public class BOP_Block_Registrator { public static Block log_Rainforest; public static Block leaves_Rainforest; public static Block sapling_Rainforest; - + //Runs Each tree Type separately public static final void run(){ registerTree_Rainforest(); } - - + + private static final boolean registerTree_Rainforest(){ log_Rainforest = new LogRainforestTree(); leaves_Rainforest = new LeavesRainforestTree(); - sapling_Rainforest = new SaplingRainforestTree(); + sapling_Rainforest = new SaplingRainforestTree(); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(log_Rainforest), "logWood"); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(leaves_Rainforest), "treeLeaves"); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(sapling_Rainforest), "treeSapling"); return true; } - - - + + public static final void recipes() { + //Rainforest Oak + addLogRecipes(ItemUtils.getSimpleStack(log_Rainforest)); + addSaplingRecipes(ItemUtils.getSimpleStack(sapling_Rainforest)); + + } + + public static final void addLogRecipes(final ItemStack aStack) { + RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {aStack}, ItemUtils.getSimpleStack(Item.getItemFromBlock(Blocks.planks), GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 4)); + RecipeUtils.recipeBuilder( + CI.craftingToolSaw, null, null, + aStack, null, null, + null, null, null, + ItemUtils.getSimpleStack(Item.getItemFromBlock(Blocks.planks), 4)); + GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 6L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), 80, false); + GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Wood, 2L), GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "sLf", 'L', GT_Utility.copyAmount(1L, aStack) }); + GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Wood, 4L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L), 160, 8); + + if (!CORE.GTNH) { + GT_Values.RA.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), ItemList.Circuit_Integrated.getWithDamage(0L, 2L, new Object[0]), Materials.SeedOil.getFluid(50L), ItemList.FR_Stick.get(1L, new Object[0]), 16, 8); + GT_Values.RA.addAssemblerRecipe(GT_Utility.copyAmount(8L, aStack), ItemList.Circuit_Integrated.getWithDamage(0L, 8L, new Object[0]), Materials.SeedOil.getFluid(250L), ItemList.FR_Casing_Impregnated.get(1L, new Object[0]), 64, 16); + GT_Values.RA.addChemicalBathRecipe(GT_Utility.copyAmount(1L, aStack), Materials.Creosote.getFluid(1000L), GT_ModHandler.getModItem("Railcraft", "tile.railcraft.cube", 1L, 8), null, null, null, 16, 16); + } + + final short aMeta = (short)aStack.getItemDamage(); + if (aMeta == 32767) { + if (GT_Utility.areStacksEqual(GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(1L, aStack), false, null), new ItemStack(Items.coal, 1, 1))) { + addPyrolyeOvenRecipes(aStack); + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) { + GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, aStack)); + } + } + for (int i = 0; i < 32767; ++i) { + if (GT_Utility.areStacksEqual(GT_ModHandler.getSmeltingOutput(new ItemStack(aStack.getItem(), 1, i), false, null), new ItemStack(Items.coal, 1, 1))) { + addPyrolyeOvenRecipes(aStack); + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) { + GT_ModHandler.removeFurnaceSmelting(new ItemStack(aStack.getItem(), 1, i)); + } + } + final ItemStack tStack = GT_ModHandler.getRecipeOutput(new ItemStack(aStack.getItem(), 1, i)); + if (tStack == null) { + if (i >= 16) { + break; + } + } + else { + final ItemStack tPlanks = GT_Utility.copy(tStack); + tPlanks.stackSize = tPlanks.stackSize * 3 / 2; + GT_Values.RA.addCutterRecipe(new ItemStack(aStack.getItem(), 1, i), Materials.Lubricant.getFluid(1L), GT_Utility.copy(tPlanks), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), 200, 8); + GT_Values.RA.addCutterRecipe(new ItemStack(aStack.getItem(), 1, i), GT_Utility.copyAmount(GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long)tStack.stackSize) : ((long)(tStack.stackSize * 5 / 4)), tStack), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L), 200, 8); + GT_ModHandler.addSawmillRecipe(new ItemStack(aStack.getItem(), 1, i), tPlanks, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L)); + GT_ModHandler.removeRecipe(new ItemStack(aStack.getItem(), 1, i)); + GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long)tStack.stackSize) : ((long)(tStack.stackSize * 5 / 4)), tStack), new Object[] { "s", "L", 'L', new ItemStack(aStack.getItem(), 1, i) }); + GT_ModHandler.addShapelessCraftingRecipe(GT_Utility.copyAmount(tStack.stackSize / (GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 1), tStack), new Object[] { new ItemStack(aStack.getItem(), 1, i) }); + } + } + } + else { + if (GT_Utility.areStacksEqual(GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(1L, aStack), false, null), new ItemStack(Items.coal, 1, 1))) { + addPyrolyeOvenRecipes(aStack); + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) { + GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, aStack)); + } + } + final ItemStack tStack2 = GT_ModHandler.getRecipeOutput(GT_Utility.copyAmount(1L, aStack)); + if (tStack2 != null) { + final ItemStack tPlanks2 = GT_Utility.copy(tStack2); + tPlanks2.stackSize = tPlanks2.stackSize * 3 / 2; + GT_Values.RA.addCutterRecipe(GT_Utility.copyAmount(1L, aStack), Materials.Lubricant.getFluid(1L), GT_Utility.copy(tPlanks2), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), 200, 8); + GT_Values.RA.addCutterRecipe(GT_Utility.copyAmount(1L, aStack), GT_Utility.copyAmount(GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long)tStack2.stackSize) : ((long)(tStack2.stackSize * 5 / 4)), tStack2), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L), 200, 8); + GT_ModHandler.addSawmillRecipe(GT_Utility.copyAmount(1L, aStack), tPlanks2, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L)); + GT_ModHandler.removeRecipe(GT_Utility.copyAmount(1L, aStack)); + GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long)tStack2.stackSize) : ((long)(tStack2.stackSize * 5 / 4)), tStack2), new Object[] { "s", "L", 'L', GT_Utility.copyAmount(1L, aStack) }); + GT_ModHandler.addShapelessCraftingRecipe(GT_Utility.copyAmount(tStack2.stackSize / (GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 1), tStack2), new Object[] { GT_Utility.copyAmount(1L, aStack) }); + } + } + if (GT_Utility.areStacksEqual(GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(1L, aStack), false, null), new ItemStack(Items.coal, 1, 1))) { + addPyrolyeOvenRecipes(aStack); + if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) { + GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, aStack)); + } + } + } + + public static void addSaplingRecipes(final ItemStack aStack) { + GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Wood, 2L), null, 0, false); + GT_ModHandler.addCompressionRecipe(GT_Utility.copyAmount(8L, aStack), ItemList.IC2_Plantball.get(1L, new Object[0])); + GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Wood, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Wood, 1L), 16, 8); + } + + public static void addPyrolyeOvenRecipes(final ItemStack logStack) { + + Materials aOilHeavy = MaterialUtils.getMaterial("OilHeavy"); + Materials aCharcoalByproducts = MaterialUtils.getMaterial("CharcoalByproducts"); + Materials aWoodGas = MaterialUtils.getMaterial("WoodGas"); + Materials aWoodVinegar = MaterialUtils.getMaterial("WoodVinegar"); + Materials aWoodTar = MaterialUtils.getMaterial("WoodTar"); + + + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 1, MaterialHelper.getGems(Materials.Charcoal, 20), Materials.Creosote.getFluid(4000L), 640, 64); + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 2, MaterialHelper.getGems(Materials.Charcoal, 20), Materials.Creosote.getFluid(4000L), 320, 96); + + if (aOilHeavy != null) { + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 3, MaterialHelper.getDust(Materials.Ash, 4), aOilHeavy.getFluid(200L), 320, 192); + + } + if (aCharcoalByproducts != null) { + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 3, MaterialHelper.getGems(Materials.Charcoal, 20), aCharcoalByproducts.getGas(4000L), 640, 64); + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 4, MaterialHelper.getGems(Materials.Charcoal, 20), aCharcoalByproducts.getGas(4000L), 320, 96); + + } + if (aWoodGas != null) { + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 5, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodGas.getGas(1500L), 640, 64); + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 6, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodGas.getGas(1500L), 320, 96); + + } + if (aWoodVinegar != null) { + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 7, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodVinegar.getFluid(3000L), 640, 64); + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 8, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodVinegar.getFluid(3000L), 320, 96); + + } + if (aWoodTar != null) { + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 9, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodTar.getFluid(1500L), 640, 64); + CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 10, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodTar.getFluid(1500L), 320, 96); + + } + } + } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java index bb360d5a87..49b8da0d1b 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java @@ -7,25 +7,21 @@ import java.lang.reflect.Method; import org.apache.commons.lang3.reflect.FieldUtils; import cpw.mods.fml.common.Loader; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gregtech.GT_Mod; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Materials; - import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; +import gregtech.GT_Mod; +import gregtech.api.enums.Materials; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.base.ingots.BaseItemIngot_OLD; import gtPlusPlus.core.item.base.misc.BaseItemMisc; import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes; -import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public class GTPP_Bees { @@ -111,11 +107,9 @@ public class GTPP_Bees { } private void addExtractorRecipe(ItemStack input, FluidStack output){ - MaterialGenerator.addFluidExtractionRecipe( + CORE.RA.addFluidExtractionRecipe( input, - null, output, - 0, 30, 8); } diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/HANDLER_GalactiCraft.java b/src/Java/gtPlusPlus/xmod/galacticraft/HANDLER_GalactiCraft.java index f58bd06cab..d5c7a7e4e5 100644 --- a/src/Java/gtPlusPlus/xmod/galacticraft/HANDLER_GalactiCraft.java +++ b/src/Java/gtPlusPlus/xmod/galacticraft/HANDLER_GalactiCraft.java @@ -1,15 +1,10 @@ package gtPlusPlus.xmod.galacticraft; -import java.util.HashMap; - -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.xmod.galacticraft.system.core.space.BaseSolarSystem; -import gtPlusPlus.xmod.galacticraft.system.hd10180.SystemHD10180; public class HANDLER_GalactiCraft { - private static final HashMap<String, BaseSolarSystem> mSystemsCache = new HashMap<String, BaseSolarSystem>(); + //private static final HashMap<String, BaseSolarSystem> mSystemsCache = new HashMap<String, BaseSolarSystem>(); public static void preInit(){ if (LoadedMods.GalacticraftCore){ diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java index 64f1cfbe23..3b59b58cab 100644 --- a/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java +++ b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java @@ -21,6 +21,10 @@ public class HandlerTooltip_GC { private static Class<?> oMainClass; private static Class<?> oFuelLoaderClass; private static HashMap <Integer, String> mFuelNames; + + static { + mFuelNames = new LinkedHashMap<Integer, String>(); + } @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event) { @@ -38,7 +42,7 @@ public class HandlerTooltip_GC { oFuelLoaderClass = GCFuelLoader; } - Field aField = ReflectionUtils.getField(GCBlocks, "fuelLoader"); + Field aField = ReflectionUtils.getField(oMainClass, "fuelLoader"); if (aField != null) { Block aBlock = (Block) aField.get(null); if (aBlock != null) { @@ -49,10 +53,12 @@ public class HandlerTooltip_GC { } } catch (Throwable t) { } - } + } + if (mFuelNames == null) { + mFuelNames = new LinkedHashMap<Integer, String>(); + } - if (mFuelNames == null || mFuelNames.isEmpty()) { - mFuelNames = new LinkedHashMap<Integer, String>(); + if (mFuelNames.isEmpty()) { for (int aMapKey : RocketFuels.mValidRocketFuels.keySet()) { Fluid aFuel = RocketFuels.mValidRocketFuels.get(aMapKey); if (aFuel != null) { diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BaseWorldProviderGalactic.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BaseWorldProviderGalactic.java deleted file mode 100644 index 6b15b388cd..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BaseWorldProviderGalactic.java +++ /dev/null @@ -1,129 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.core.dim; - -import java.util.Random; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.XSTR; -import gtPlusPlus.xmod.galacticraft.system.core.space.BaseGalacticDimension; -import gtPlusPlus.xmod.galacticraft.system.core.world.gen.GalacticBiomeGenBase; -import gtPlusPlus.xmod.galacticraft.system.objects.BiomeSettings; -import gtPlusPlus.xmod.galacticraft.system.objects.DimensionSettings; -import gtPlusPlus.xmod.galacticraft.system.objects.PlanetGenerator; -import gtPlusPlus.xmod.galacticraft.system.objects.WorldProviderSettings; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeDecorator; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.common.BiomeDictionary; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.BiomeDictionary.Type; -import net.minecraftforge.event.terraingen.TerrainGen; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Post; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Pre; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType; - -public class BaseWorldProviderGalactic { - - private final PlanetGenerator mThisPlanet; - private final BaseGalacticDimension mDim; - public final BiomeGenBase mBiome; - - //new DimensionSettings(b, aCP, 5, true, 1, false, 240f, 0.1f, 0.2f, false, 48000L) - - public BaseWorldProviderGalactic(WorldProviderSettings b) { - this(b.getPlanet(), b.getDimSettings(), b.getBiomeSettings()); - } - - private BaseWorldProviderGalactic(PlanetGenerator b, DimensionSettings aDimSettings, BiomeSettings aBiomeSettings) { - mThisPlanet = b; - mBiome = tryCreateBiome(aBiomeSettings); - if (mBiome != null) { - Logger.SPACE("Created Biome for "+b.getPlanet().getLocalizedName()+"."); - mDim = new BaseGalacticDimension(b, mBiome, aDimSettings.getChunkProvider(), aDimSettings); - } - else { - Logger.SPACE("Failed to Create Biome for "+b.getPlanet().getLocalizedName()+", Using Deep Ocean as fallback."); - mDim = new BaseGalacticDimension(b, BiomeGenBase.deepOcean, aDimSettings.getChunkProvider(), aDimSettings); - } - } - - public synchronized final BaseGalacticDimension getDim() { - return mDim; - } - - public BiomeGenBase tryCreateBiome(BiomeSettings aSettings) { - BiomeGenBase x = (new BiomeGenMain(aSettings.getID())).setBiomeName(aSettings.getName()).setHeight(aSettings.getHeight()); - return x; - } - - public class BiomeGenBasePlanetSurface extends GalacticBiomeGenBase { - public BiomeGenBase aBiome; - - public BiomeGenBasePlanetSurface(int id) { - super(id); - this.enableRain = true; - this.enableSnow = true; - this.topBlock = Blocks.stone; - this.fillerBlock = Blocks.stone; - } - - public BiomeDecorator createBiomeDecorator() { - return new BiomeDecoratorGalactic(); - } - - protected BiomeDecoratorGalactic getBiomeDecorator() { - return (BiomeDecoratorGalactic) this.theBiomeDecorator; - } - - } - - public class BiomeGenMain extends BiomeGenBasePlanetSurface { - public BiomeGenMain(int aID) { - super(aID); - this.enableRain = false; - this.enableSnow = false; - this.topBlock = mThisPlanet.getTask().getTopLayer(); - this.topMeta = 0; - this.fillerBlock = mThisPlanet.getTask().getSoil(); - this.fillerMeta = 0; - this.stoneBlock = mThisPlanet.getTask().getStone(); - this.stoneMeta = 0; - this.spawnableCaveCreatureList.clear(); - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.clear(); - this.spawnableWaterCreatureList.clear(); - if (!ConfigManagerCore.disableBiomeTypeRegistrations) { - BiomeDictionary.registerBiomeType(this, new Type[]{Type.COLD, Type.DRY, Type.DEAD, Type.SPOOKY}); - } - - } - } - - public class BiomeDecoratorGalactic extends BiomeDecorator { - - public void decorateChunk(World world, Random rand, BiomeGenBase biome, int x, int z) { - if (this.currentWorld != null) { - throw new RuntimeException("Already decorating!!"); - } else { - this.currentWorld = world; - this.randomGenerator = new XSTR(rand.nextLong()); - this.chunk_X = x; - this.chunk_Z = z; - this.genDecorations(biome); - this.currentWorld = null; - this.randomGenerator = null; - } - } - - protected void genDecorations(BiomeGenBase biome) { - MinecraftForge.EVENT_BUS.post(new Pre(this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z)); - MinecraftForge.EVENT_BUS.post(new Post(this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z)); - } - - protected boolean getGen(EventType event) { - return TerrainGen.decorate(this.currentWorld, this.randomGenerator, this.chunk_X, this.chunk_Z, event); - } - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BasicChunkProviderGalactic.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BasicChunkProviderGalactic.java deleted file mode 100644 index 9a912fdfc0..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/dim/BasicChunkProviderGalactic.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.core.dim; - -import gtPlusPlus.xmod.galacticraft.system.core.world.gen.ChunkProviderGalactic; -import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeDecoratorSpace; -import net.minecraft.world.World; - -public class BasicChunkProviderGalactic extends ChunkProviderGalactic { - - public BasicChunkProviderGalactic(World par1World, long seed, boolean mapFeaturesEnabled) { - super(par1World, seed, mapFeaturesEnabled); - } - - @Override - public BiomeDecoratorSpace getBiomeGenerator() { - return null; - } - -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/space/BaseGalacticDimension.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/space/BaseGalacticDimension.java deleted file mode 100644 index c0283604e8..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/space/BaseGalacticDimension.java +++ /dev/null @@ -1,304 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.core.space; - -import java.util.Random; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.xmod.galacticraft.system.objects.DimensionSettings; -import gtPlusPlus.xmod.galacticraft.system.objects.PlanetGenerator; -import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody; -import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldChunkManagerSpace; -import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldProviderSpace; -import micdoodle8.mods.galacticraft.api.vector.Vector3; -import micdoodle8.mods.galacticraft.api.world.IExitHeight; -import micdoodle8.mods.galacticraft.api.world.ISolarLevel; -import micdoodle8.mods.galacticraft.api.world.ITeleportType; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; -import micdoodle8.mods.galacticraft.planets.mars.entities.EntityLandingBalloons; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.chunk.IChunkProvider; - -public class BaseGalacticDimension { - - private final WorldChunkManagerGalactic mGlobalChunkManager; - private final WorldProviderGalactic mWorldProvider; - private final Class<? extends IChunkProvider> mChunkProvider; - private final PlanetGenerator mPlanet; - - public BaseGalacticDimension(PlanetGenerator aPlanet, BiomeGenBase aBiomeForDim, Class<? extends IChunkProvider> aChunkProvider, DimensionSettings aSettings) { - mPlanet = aPlanet; - mGlobalChunkManager = new WorldChunkManagerGalactic(aBiomeForDim); - mChunkProvider = aChunkProvider; - mWorldProvider = new WorldProviderGalactic(aSettings); - } - - public class WorldChunkManagerGalactic extends WorldChunkManagerSpace { - private final BiomeGenBase mBiome; - - public WorldChunkManagerGalactic(BiomeGenBase aDimBiome) { - mBiome = aDimBiome; - } - - public BiomeGenBase getBiome() { - return mBiome; - } - } - - public class WorldProviderGalactic extends WorldProviderSpace implements IExitHeight, ISolarLevel, ITeleportType { - - private final int mTierRequirement; - private final PlanetGenerator mPlanet; - private final boolean mAtmosphere; - private final int mPressure; - private final boolean mSolarRadiation; - private final float mCloudHeight; - private final float mGravity; - private final float mMeteorFreq; - private final boolean mCanRainOrSnow; - private final long mDayLength; - private final Class<? extends IChunkProvider> mChunkProvider; - - public WorldProviderGalactic(DimensionSettings aSettings) { - mPlanet = aSettings.getPlanet(); - mTierRequirement = aSettings.getTierRequirement(); - mAtmosphere = aSettings.hasAtmosphere(); - mPressure = aSettings.getPressure(); - mSolarRadiation = aSettings.hasSolarRadiation(); - mCloudHeight = aSettings.getCloudHeight(); - mGravity = aSettings.getGravity(); - mMeteorFreq = aSettings.getMeteorFreq(); - mCanRainOrSnow = aSettings.hasRainOrSnow(); - mDayLength = aSettings.getDayLength(); - mChunkProvider = aSettings.getChunkProvider(); - } - - public WorldProviderGalactic(PlanetGenerator aPlanet, Class<? extends IChunkProvider> aChunkProvider, int aTierRequirement, boolean aHasBreathableAtmo, - int aPressure, boolean aSolarRadiation, float aCloudHeight, float aGravity, float aMeteorFreq, boolean aCanRainOrSnow, long aDayLength) { - mPlanet = aPlanet; - mTierRequirement = aTierRequirement; - mAtmosphere = aHasBreathableAtmo; - mPressure = aPressure; - mSolarRadiation = aSolarRadiation; - mCloudHeight = aCloudHeight; - mGravity = aGravity; - mMeteorFreq = aMeteorFreq; - mCanRainOrSnow = aCanRainOrSnow; - mDayLength = aDayLength; - mChunkProvider = aChunkProvider; - } - - public boolean canSpaceshipTierPass(int tier) { - return tier >= mTierRequirement; - } - - @SideOnly(Side.CLIENT) - public float getCloudHeight() { - return mCloudHeight; - } - - public double getHorizon() { - return 44.0D; - } - - public float getFallDamageModifier() { - return 0.16F; - } - - public double getFuelUsageMultiplier() { - return 0.8D; - } - - public float getGravity() { - return mGravity; - } - - public double getMeteorFrequency() { - return mMeteorFreq; - } - - public float getSoundVolReductionAmount() { - return Float.MAX_VALUE; - } - - public float getThermalLevelModifier() { - return 0.0F; - } - - public float getWindLevel() { - return 0.6F; - } - - public boolean canRainOrSnow() { - return mCanRainOrSnow; - } - - public boolean canBlockFreeze(int x, int y, int z, boolean byWater) { - return false; - } - - public CelestialBody getCelestialBody() { - return mPlanet.getPlanet(); - } - - public Class<? extends IChunkProvider> getChunkProviderClass() { - return mChunkProvider; - } - - public long getDayLength() { - return mDayLength; - } - - public boolean hasBreathableAtmosphere() { - return mAtmosphere; - } - - public Vector3 getFogColor() { - float f = 1.0F - this.getStarBrightness(1.0F); - return new Vector3((double) (0.65882355F * f), (double) (0.84705883F * f), (double) (1.0F * f)); - } - - public Vector3 getSkyColor() { - float f = 1.0F - this.getStarBrightness(1.0F); - return new Vector3((double) (0.25882354F * f), (double) (0.6666667F * f), (double) (1.0F * f)); - } - - public boolean isSkyColored() { - return true; - } - - public Class<? extends WorldChunkManagerGalactic> getWorldChunkManagerClass() { - return WorldChunkManagerGalactic.class; - } - - public boolean hasSunset() { - return false; - } - - public boolean shouldForceRespawn() { - return !ConfigManagerCore.forceOverworldRespawn; - } - - public double getSolarEnergyMultiplier() { - return 0.8D; - } - - public double getYCoordinateToTeleport() { - return 800.0D; - } - - public Vector3 getEntitySpawnLocation(WorldServer arg0, Entity arg1) { - return new Vector3(arg1.posX, ConfigManagerCore.disableLander ? 250.0D : 900.0D, arg1.posZ); - } - - public Vector3 getParaChestSpawnLocation(WorldServer arg0, EntityPlayerMP arg1, Random arg2) { - if (ConfigManagerCore.disableLander) { - double x = (arg2.nextDouble() * 2.0D - 1.0D) * 5.0D; - double z = (arg2.nextDouble() * 2.0D - 1.0D) * 5.0D; - return new Vector3(x, 220.0D, z); - } else { - return null; - } - } - - public Vector3 getPlayerSpawnLocation(WorldServer arg0, EntityPlayerMP arg1) { - if (arg1 != null) { - GCPlayerStats stats = GCPlayerStats.get(arg1); - return new Vector3(stats.coordsTeleportedFromX, ConfigManagerCore.disableLander ? 250.0D : 900.0D, - stats.coordsTeleportedFromZ); - } else { - return null; - } - } - - public void onSpaceDimensionChanged(World arg0, EntityPlayerMP player, boolean arg2) { - if (player != null && GCPlayerStats.get(player).teleportCooldown <= 0) { - if (player.capabilities.isFlying) { - player.capabilities.isFlying = false; - } - - EntityLandingBalloons lander = new EntityLandingBalloons(player); - if (!arg0.isRemote) { - arg0.spawnEntityInWorld(lander); - } - - GCPlayerStats.get(player).teleportCooldown = 10; - } - - } - - public boolean useParachute() { - return ConfigManagerCore.disableLander; - } - - @SideOnly(Side.CLIENT) - public float getStarBrightness(float par1) { - float var2 = this.worldObj.getCelestialAngle(par1); - float var3 = 1.0F - (MathHelper.cos(var2 * 3.1415927F * 2.0F) * 2.0F + 0.25F); - if (var3 < 0.0F) { - var3 = 0.0F; - } - - if (var3 > 1.0F) { - var3 = 1.0F; - } - - return var3 * var3 * 0.5F + 0.3F; - } - - @SideOnly(Side.CLIENT) - public float getSunBrightness(float par1) { - float f1 = this.worldObj.getCelestialAngle(1.0F); - float f2 = 1.25F - (MathHelper.cos(f1 * 3.1415927F * 2.0F) * 2.0F + 0.2F); - if (f2 < 0.0F) { - f2 = 0.0F; - } - - if (f2 > 1.0F) { - f2 = 1.0F; - } - - f2 = 1.2F - f2; - return f2 * 0.2F; - } - - public void setupAdventureSpawn(EntityPlayerMP player) { - } - - public int AtmosphericPressure() { - return mPressure; - } - - public boolean SolarRadiation() { - return mSolarRadiation; - } - } - - public synchronized final WorldChunkManagerGalactic getGlobalChunkManager() { - return mGlobalChunkManager; - } - - public synchronized final WorldProviderGalactic getWorldProvider() { - return mWorldProvider; - } - - public synchronized final Class<? extends WorldProviderSpace> getWorldProviderClass() { - return mWorldProvider.getClass(); - } - - public synchronized final Class<? extends IChunkProvider> getChunkProvider() { - return mChunkProvider; - } - - public synchronized final PlanetGenerator getPlanet() { - return mPlanet; - } - - - -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/space/BaseSolarSystem.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/space/BaseSolarSystem.java deleted file mode 100644 index cb629f211f..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/space/BaseSolarSystem.java +++ /dev/null @@ -1,126 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.core.space; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.galacticraft.system.objects.IPlanetBlockRegister; -import gtPlusPlus.xmod.galacticraft.system.objects.PlanetGenerator; -import micdoodle8.mods.galacticraft.api.GalacticraftRegistry; -import micdoodle8.mods.galacticraft.api.galaxies.GalaxyRegistry; -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.prefab.world.gen.WorldProviderSpace; -import micdoodle8.mods.galacticraft.api.galaxies.CelestialBody.ScalableDistance; -import micdoodle8.mods.galacticraft.api.vector.Vector3; -import micdoodle8.mods.galacticraft.api.world.ITeleportType; -import micdoodle8.mods.galacticraft.planets.mars.dimension.WorldProviderMars; -import net.minecraft.util.ResourceLocation; - -public abstract class BaseSolarSystem { - - public final String mSystemName; - private SolarSystem mSolarSystem; - private Star mStar; - private AutoMap<Planet> mPlanetMap = new AutoMap<Planet>(); - - - public BaseSolarSystem(String aSystemName) { - mSystemName = aSystemName; - Logger.SPACE("Creating new Solar System: "+aSystemName); - } - - public SolarSystem getSystem() { - return mSolarSystem; - } - - public Star getStar() { - return mStar; - } - - public AutoMap<Planet> getPlanets(){ - return mPlanetMap; - } - - public abstract void preInit(); - - public final void init() { - Logger.SPACE("Initialising planetary masses within "+mSystemName); - initSolarSystem(); - } - - public abstract void initSolarSystem(); - - public static void registryteleport(Class<? extends WorldProviderSpace> aWorldProvider, ITeleportType aWorldProviderInstance) { - Logger.SPACE("Registering world teleporter for "+aWorldProvider.getName()); - GalacticraftRegistry.registerTeleportType(aWorldProvider, aWorldProviderInstance); - } - - public boolean registerSolarSystem(SolarSystem aSystem) { - this.mSolarSystem = aSystem; - Logger.SPACE("Registering "+mSystemName); - return GalaxyRegistry.registerSolarSystem(aSystem); - } - - public boolean registerPlanet(BaseGalacticDimension aDimension) { - return registerPlanet(aDimension.getPlanet().getPlanet(), aDimension.getWorldProviderClass(), aDimension.getWorldProvider()); - } - public boolean registerPlanet(Planet aPlanet, Class<? extends WorldProviderSpace> aWorldProvider, ITeleportType aWorldProviderInstance) { - try { - Logger.SPACE("Registering "+aPlanet.getLocalizedName()); - mPlanetMap.put(aPlanet); - GalaxyRegistry.registerPlanet(aPlanet); - registryteleport(aWorldProvider, aWorldProviderInstance); - GalacticraftRegistry.registerRocketGui(aWorldProvider, new ResourceLocation(CORE.MODID, "textures/space/RocketGui.png")); - return true; - } - catch(Throwable t) { - return false; - } - } - - public SolarSystem createSolarSystem(String aSystemName, String aParentGalaxyName, Vector3 aMapPosition) { - Logger.SPACE("Creating Solar System in GC using information from "+mSystemName); - SolarSystem aSolarSystem = (new SolarSystem(aSystemName, aParentGalaxyName)).setMapPosition(aMapPosition); - return aSolarSystem; - } - - public Star createStar(String aStarName, int aTierRequired) { - Logger.SPACE("Creating new Star named "+aStarName); - Star aStar = (Star) (new Star(aStarName)).setParentSolarSystem(getSystem()).setTierRequired(aTierRequired); - aStar.setBodyIcon(getGalacticTexture(aStarName)); - return aStar; - } - - public PlanetGenerator createPlanet(String aPlanetName, int aTier, float[] aRingRGB, float aPhaseShift, float aRelativeDistanceFromCentMin, float aRelativeDistanceFromCentMax, float aRelativeOrbitTime, IPlanetBlockRegister aPlanetBlocks) { - Logger.SPACE("Creating "+aPlanetName); - Planet aNewPlanet = (new Planet(aPlanetName)).setParentSolarSystem(getSystem()); - aNewPlanet.setRingColorRGB(aRingRGB[0], aRingRGB[1], aRingRGB[2]); - aNewPlanet.setPhaseShift(aPhaseShift); - aNewPlanet.setBodyIcon(getGalacticTexture(aPlanetName)); - aNewPlanet.setRelativeDistanceFromCenter(new ScalableDistance(aRelativeDistanceFromCentMin, aRelativeDistanceFromCentMax)); - aNewPlanet.setRelativeOrbitTime(aRelativeOrbitTime); - if (aTier > 0) - aNewPlanet.setTierRequired(aTier); - PlanetGenerator aPlanet = new PlanetGenerator(aNewPlanet, aPlanetBlocks); - return aPlanet; - } - - public void setMainStarForSolarSystem(Star aStar) { - this.mStar = aStar; - getSystem().setMainStar(aStar); - Logger.SPACE("Setting "+aStar.getName()+" as main Star for "+getSystem().getName()+" within the "+getSystem().getLocalizedParentGalaxyName()+" Galaxy."); - } - - private ResourceLocation getGalacticTexture(String aName) { - String aText = getSystem().getUnlocalizedName(); - aText = aText.replace("solarsystem.", ""); - aName = aName.replace(aText+"-", ""); - - ResourceLocation aVal = new ResourceLocation(CORE.MODID, "textures/space/"+aText.toLowerCase()+"/"+aName+".png"); - Logger.SPACE("Trying to obtain ResourceLocation for "+aVal.toString()); - return aVal; - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalactic.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalactic.java deleted file mode 100644 index aafa9ef9a1..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalactic.java +++ /dev/null @@ -1,127 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.core.world.gen; - -import java.util.List; - -import com.google.common.collect.Lists; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import micdoodle8.mods.galacticraft.api.prefab.core.BlockMetaPair; -import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeDecoratorSpace; -import micdoodle8.mods.galacticraft.api.prefab.world.gen.MapGenBaseMeta; -import net.minecraft.block.Block; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry; -import net.minecraft.world.chunk.IChunkProvider; - -public abstract class ChunkProviderGalactic extends ChunkProviderGalaxyLakes { - - private List<MapGenBaseMeta> worldGenerators; - private BiomeGenBase[] biomesForGeneration = this.getBiomesForGeneration(); - private final GalacticMapGenCavesBase caveGenerator = new GalacticMapGenCavesBase(); - - protected List<MapGenBaseMeta> getWorldGenerators() { - List<MapGenBaseMeta> generators = Lists.newArrayList(); - return generators; - } - - public ChunkProviderGalactic(World par1World, long seed, boolean mapFeaturesEnabled) { - super(par1World, seed, mapFeaturesEnabled); - } - - public abstract BiomeDecoratorSpace getBiomeGenerator(); - - protected BiomeGenBase[] getBiomesForGeneration() { - return new BiomeGenBase[] { GalacticBiomeGenBase.mGalaxy }; - } - - protected SpawnListEntry[] getCreatures() { - return new SpawnListEntry[0]; - } - - public double getHeightModifier() { - return 24.0D; - } - - protected SpawnListEntry[] getMonsters() { - - Class aSkele = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSkeleton"); - Class aCreeper = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.entities.EntityEvolvedCreeper"); - Class aSpider = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider"); - Class aEnderman = ReflectionUtils.getClass("galaxyspace.SolarSystem.planets.pluto.entities.EntityEvolvedEnderman"); - - SpawnListEntry skele; - SpawnListEntry creeper; - SpawnListEntry spider; - SpawnListEntry enderman; - - AutoMap<SpawnListEntry> aMobs = new AutoMap<SpawnListEntry>(); - - if (aSkele != null) { - skele = new SpawnListEntry(aSkele, 100, 4, 4); - aMobs.put(skele); - } - if (aCreeper != null) { - creeper = new SpawnListEntry(aCreeper, 100, 4, 4); - aMobs.put(creeper); - } - if (aSpider != null) { - spider = new SpawnListEntry(aSpider, 100, 4, 4); - aMobs.put(spider); - } - if (aEnderman != null) { - enderman = new SpawnListEntry(aEnderman, 100, 4, 4); - aMobs.put(enderman); - } - - return aMobs.toArray(); - } - - public void onPopulate(IChunkProvider arg0, int arg1, int arg2) { - } - - public boolean chunkExists(int x, int y) { - return false; - } - - protected SpawnListEntry[] getWaterCreatures() { - return new SpawnListEntry[0]; - } - - public BlockMetaPair getGrassBlock() { - return new BlockMetaPair(null, (byte) 0); - } - - public BlockMetaPair getDirtBlock() { - return new BlockMetaPair(null, (byte) 0); - } - - public BlockMetaPair getStoneBlock() { - return new BlockMetaPair(null, (byte) 0); - } - - protected boolean enableBiomeGenBaseBlock() { - return false; - } - - public void onChunkProvider(int cX, int cZ, Block[] blocks, byte[] metadata) { - } - - public int getWaterLevel() { - return 110; - } - - public boolean canGenerateWaterBlock() { - return true; - } - - protected BlockMetaPair getWaterBlock() { - return new BlockMetaPair(null, (byte) 0); - } - - public boolean canGenerateIceBlock() { - return false; - } - -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalaxyLakes.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalaxyLakes.java deleted file mode 100644 index a3d696d7c5..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/ChunkProviderGalaxyLakes.java +++ /dev/null @@ -1,529 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.core.world.gen; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -import gtPlusPlus.api.objects.random.XSTR; -import micdoodle8.mods.galacticraft.api.prefab.core.BlockMetaPair; -import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeDecoratorSpace; -import micdoodle8.mods.galacticraft.api.prefab.world.gen.MapGenBaseMeta; -import micdoodle8.mods.galacticraft.core.perlin.generator.Gradient; -import net.minecraft.block.Block; -import net.minecraft.block.BlockFalling; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.init.Blocks; -import net.minecraft.util.IProgressUpdate; -import net.minecraft.util.MathHelper; -import net.minecraft.world.ChunkPosition; -import net.minecraft.world.SpawnerAnimals; -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.NoiseGeneratorOctaves; -import net.minecraft.world.gen.NoiseGeneratorPerlin; - -public abstract class ChunkProviderGalaxyLakes extends ChunkProviderGenerate { - protected Random rand; - private NoiseGeneratorOctaves noiseGen4; - public NoiseGeneratorOctaves noiseGen5; - public NoiseGeneratorOctaves noiseGen6; - public NoiseGeneratorOctaves mobSpawnerNoise; - protected World worldObj; - private BiomeGenBase[] biomesForGeneration = this.getBiomesForGeneration(); - double[] noise3; - double[] noise1; - double[] noise2; - double[] noise5; - double[] noise6; - float[] squareTable; - private NoiseGeneratorOctaves field_147431_j; - private NoiseGeneratorOctaves field_147432_k; - private NoiseGeneratorOctaves field_147429_l; - private NoiseGeneratorPerlin field_147430_m; - private double[] terrainCalcs; - private float[] parabolicField; - double[] field_147427_d; - double[] field_147428_e; - double[] field_147425_f; - double[] field_147426_g; - int[][] field_73219_j = new int[32][32]; - private final Gradient noiseGen8; - private List<MapGenBaseMeta> worldGenerators; - - public ChunkProviderGalaxyLakes(World world, long seed, boolean flag) { - super(world, seed, flag); - this.worldObj = world; - this.rand = new XSTR(seed); - this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4); - this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); - this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); - this.noiseGen8 = new Gradient(this.rand.nextLong(), 2, 0.25F); - this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); - this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16); - this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16); - this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8); - this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4); - this.terrainCalcs = new double[825]; - this.parabolicField = new float[25]; - - for (int j = -2; j <= 2; ++j) { - for (int k = -2; k <= 2; ++k) { - float f = 10.0F / MathHelper.sqrt_float((float) (j * j + k * k) + 0.2F); - this.parabolicField[j + 2 + (k + 2) * 5] = f; - } - } - - } - - public Chunk provideChunk(int x, int z) { - this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L); - Block[] blockStorage = new Block[65536]; - byte[] metaStorage = new byte[65536]; - this.generateTerrain(x, z, blockStorage, metaStorage); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, - x * 16, z * 16, 16, 16); - this.replaceBlocksForBiome(x, z, blockStorage, metaStorage, this.biomesForGeneration); - this.onChunkProvider(x, z, blockStorage, metaStorage); - Chunk chunk = new Chunk(this.worldObj, blockStorage, metaStorage, x, z); - byte[] chunkBiomes = chunk.getBiomeArray(); - if (this.worldGenerators == null) { - this.worldGenerators = this.getWorldGenerators(); - } - - Iterator<MapGenBaseMeta> i$ = this.worldGenerators.iterator(); - - while (i$.hasNext()) { - MapGenBaseMeta generator = (MapGenBaseMeta) i$.next(); - generator.generate(this, this.worldObj, x, z, blockStorage, metaStorage); - } - - for (int i = 0; i < chunkBiomes.length; ++i) { - chunkBiomes[i] = (byte) this.biomesForGeneration[i].biomeID; - } - - chunk.generateSkylightMap(); - return chunk; - } - - public void generateTerrain(int chunkX, int chunkZ, Block[] blockStorage, byte[] metaStorage) { - int seaLevel = this.getWaterLevel(); - metaStorage = new byte[65536]; - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, - chunkX * 4 - 2, chunkZ * 4 - 2, 10, 10); - this.makeLandPerBiome2(chunkX * 4, 0, chunkZ * 4); - - for (int k = 0; k < 4; ++k) { - int l = k * 5; - int i1 = (k + 1) * 5; - - for (int j1 = 0; j1 < 4; ++j1) { - int k1 = (l + j1) * 33; - int l1 = (l + j1 + 1) * 33; - int i2 = (i1 + j1) * 33; - int j2 = (i1 + j1 + 1) * 33; - - for (int k2 = 0; k2 < 32; ++k2) { - double d0 = 0.125D; - double d1 = this.terrainCalcs[k1 + k2]; - double d2 = this.terrainCalcs[l1 + k2]; - double d3 = this.terrainCalcs[i2 + k2]; - double d4 = this.terrainCalcs[j2 + k2]; - double d5 = (this.terrainCalcs[k1 + k2 + 1] - d1) * d0; - double d6 = (this.terrainCalcs[l1 + k2 + 1] - d2) * d0; - double d7 = (this.terrainCalcs[i2 + k2 + 1] - d3) * d0; - double d8 = (this.terrainCalcs[j2 + k2 + 1] - d4) * d0; - - for (int l2 = 0; l2 < 8; ++l2) { - double d9 = 0.25D; - double d10 = d1; - double d11 = d2; - double d12 = (d3 - d1) * d9; - double d13 = (d4 - d2) * d9; - - for (int i3 = 0; i3 < 4; ++i3) { - int j3 = i3 + k * 4 << 12 | 0 + j1 * 4 << 8 | k2 * 8 + l2; - short short1 = 256; - j3 -= short1; - double d14 = 0.25D; - double d16 = (d11 - d10) * d14; - double d15 = d10 - d16; - - for (int k3 = 0; k3 < 4; ++k3) { - if ((d15 += d16) > 0.0D) { - blockStorage[j3 += short1] = this.getStoneBlock().getBlock(); - } else if (k2 * 8 + l2 < seaLevel && this.canGenerateWaterBlock()) { - blockStorage[j3 += short1] = this.getWaterBlock().getBlock(); - } else { - blockStorage[j3 += short1] = null; - } - } - - d10 += d12; - d11 += d13; - } - - d1 += d5; - d2 += d6; - d3 += d7; - d4 += d8; - } - } - } - } - - } - - private void makeLandPerBiome2(int x, int zero, int z) { - this.field_147426_g = this.noiseGen6.generateNoiseOctaves(this.field_147426_g, x, z, 5, 5, 200.0D, 200.0D, - 0.5D); - this.field_147427_d = this.field_147429_l.generateNoiseOctaves(this.field_147427_d, x, zero, z, 5, 33, 5, - 8.555150000000001D, 4.277575000000001D, 8.555150000000001D); - this.field_147428_e = this.field_147431_j.generateNoiseOctaves(this.field_147428_e, x, zero, z, 5, 33, 5, - 684.412D, 684.412D, 684.412D); - this.field_147425_f = this.field_147432_k.generateNoiseOctaves(this.field_147425_f, x, zero, z, 5, 33, 5, - 684.412D, 684.412D, 684.412D); - int terrainIndex = 0; - int noiseIndex = 0; - - for (int ax = 0; ax < 5; ++ax) { - for (int az = 0; az < 5; ++az) { - float totalVariation = 0.0F; - float totalHeight = 0.0F; - float totalFactor = 0.0F; - byte two = 2; - BiomeGenBase biomegenbase = this.biomesForGeneration[ax + 2 + (az + 2) * 10]; - - for (int ox = -two; ox <= two; ++ox) { - for (int oz = -two; oz <= two; ++oz) { - BiomeGenBase biomegenbase1 = this.biomesForGeneration[ax + ox + 2 + (az + oz + 2) * 10]; - float rootHeight = biomegenbase1.rootHeight; - float heightVariation = biomegenbase1.heightVariation; - float heightFactor = this.parabolicField[ox + 2 + (oz + 2) * 5] / (rootHeight + 2.0F); - if (biomegenbase1.rootHeight > biomegenbase.rootHeight) { - heightFactor /= 2.0F; - } - - totalVariation += heightVariation * heightFactor; - totalHeight += rootHeight * heightFactor; - totalFactor += heightFactor; - } - } - - totalVariation /= totalFactor; - totalHeight /= totalFactor; - totalVariation = totalVariation * 0.9F + 0.1F; - totalHeight = (totalHeight * 4.0F - 1.0F) / 8.0F; - double terrainNoise = this.field_147426_g[noiseIndex] / 8000.0D; - if (terrainNoise < 0.0D) { - terrainNoise = -terrainNoise * 0.3D; - } - - terrainNoise = terrainNoise * 3.0D - 2.0D; - if (terrainNoise < 0.0D) { - terrainNoise /= 2.0D; - if (terrainNoise < -1.0D) { - terrainNoise = -1.0D; - } - - terrainNoise /= 1.4D; - terrainNoise /= 2.0D; - } else { - if (terrainNoise > 1.0D) { - terrainNoise = 1.0D; - } - - terrainNoise /= 8.0D; - } - - ++noiseIndex; - double heightCalc = (double) totalHeight; - double variationCalc = (double) totalVariation * this.getHeightModifier() / 10.0D; - heightCalc += terrainNoise * 0.2D; - heightCalc = heightCalc * 8.5D / 8.0D; - double d5 = 8.5D + heightCalc * 4.0D; - - for (int ay = 0; ay < 33; ++ay) { - double d6 = ((double) ay - d5) * 12.0D * 128.0D / 256.0D / variationCalc; - if (d6 < 0.0D) { - d6 *= 4.0D; - } - - double d7 = this.field_147428_e[terrainIndex] / 512.0D; - double d8 = this.field_147425_f[terrainIndex] / 512.0D; - double d9 = (this.field_147427_d[terrainIndex] / 10.0D + 1.0D) / 2.0D; - double terrainCalc = MathHelper.denormalizeClamp(d7, d8, d9) - d6; - if (ay > 29) { - double d11 = (double) ((float) (ay - 29) / 3.0F); - terrainCalc = terrainCalc * (1.0D - d11) + -10.0D * d11; - } - - this.terrainCalcs[terrainIndex] = terrainCalc; - ++terrainIndex; - } - } - } - - } - - public void replaceBlocksForBiome(int par1, int par2, Block[] arrayOfIDs, byte[] arrayOfMeta, - BiomeGenBase[] par4ArrayOfBiomeGenBase) { - this.noiseGen8.setFrequency(0.0625F); - - for (int var8 = 0; var8 < 16; ++var8) { - for (int var9 = 0; var9 < 16; ++var9) { - GalacticBiomeGenBase biomegenbase = (GalacticBiomeGenBase) par4ArrayOfBiomeGenBase[var8 + var9 * 16]; - int var12 = (int) ((double) this.noiseGen8.getNoise((float) (par1 * 16 + var8), - (float) (par2 * 16 + var9)) / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); - int var13 = -1; - Block var14 = this.enableBiomeGenBaseBlock() ? biomegenbase.topBlock : this.getGrassBlock().getBlock(); - byte var14m = this.enableBiomeGenBaseBlock() - ? biomegenbase.topMeta - : this.getGrassBlock().getMetadata(); - Block var15 = this.enableBiomeGenBaseBlock() - ? biomegenbase.fillerBlock - : this.getDirtBlock().getBlock(); - byte var15m = this.enableBiomeGenBaseBlock() - ? biomegenbase.fillerMeta - : this.getDirtBlock().getMetadata(); - - for (int var16 = 255; var16 >= 0; --var16) { - int index = this.getIndex(var8, var16, var9); - if (var16 <= 0 + this.rand.nextInt(5)) { - arrayOfIDs[index] = Blocks.bedrock; - } - - if (var16 != 5 && var16 != 6 + this.rand.nextInt(3)) { - Block var18 = arrayOfIDs[index]; - if (Blocks.air == var18) { - var13 = -1; - } else if (var18 == this.getStoneBlock().getBlock() && !this.enableBiomeGenBaseBlock()) { - arrayOfMeta[index] = this.getStoneBlock().getMetadata(); - if (var13 == -1) { - if (var12 <= 0) { - var14 = Blocks.air; - var14m = 0; - var15 = this.getStoneBlock().getBlock(); - var15m = this.getStoneBlock().getMetadata(); - } else if (var16 >= 36 && var16 <= 21) { - if (this.enableBiomeGenBaseBlock()) { - var14 = biomegenbase.topBlock; - var14m = biomegenbase.topMeta; - var14 = biomegenbase.fillerBlock; - var14m = biomegenbase.fillerMeta; - } else { - var14 = this.getGrassBlock().getBlock(); - var14m = this.getGrassBlock().getMetadata(); - var14 = this.getDirtBlock().getBlock(); - var14m = this.getDirtBlock().getMetadata(); - } - } - - var13 = var12; - if (var16 >= 19) { - arrayOfIDs[index] = var14; - arrayOfMeta[index] = var14m; - } else { - arrayOfIDs[index] = var15; - arrayOfMeta[index] = var15m; - } - } else if (var13 > 0) { - --var13; - arrayOfIDs[index] = var15; - arrayOfMeta[index] = var15m; - } - } else if (var18 == biomegenbase.stoneBlock) { - arrayOfMeta[index] = biomegenbase.stoneMeta; - if (var13 == -1) { - if (var12 <= 0) { - var14 = Blocks.air; - var14m = 0; - if (this.enableBiomeGenBaseBlock()) { - var15 = biomegenbase.stoneBlock; - var15m = biomegenbase.stoneMeta; - } else { - var15 = this.getStoneBlock().getBlock(); - var15m = this.getStoneBlock().getMetadata(); - } - } else if (var16 >= 36 && var16 <= 21) { - if (this.enableBiomeGenBaseBlock()) { - var14 = biomegenbase.topBlock; - var14m = biomegenbase.topMeta; - var14 = biomegenbase.fillerBlock; - var14m = biomegenbase.fillerMeta; - } else { - var14 = this.getGrassBlock().getBlock(); - var14m = this.getGrassBlock().getMetadata(); - var14 = this.getDirtBlock().getBlock(); - var14m = this.getDirtBlock().getMetadata(); - } - } - - var13 = var12; - if (var16 >= 19) { - arrayOfIDs[index] = var14; - arrayOfMeta[index] = var14m; - } else { - arrayOfIDs[index] = var15; - arrayOfMeta[index] = var15m; - } - } else if (var13 > 0) { - --var13; - arrayOfIDs[index] = var15; - arrayOfMeta[index] = var15m; - } - } - } else { - arrayOfIDs[index] = this.canGenerateIceBlock() ? Blocks.packed_ice : Blocks.bedrock; - } - } - } - } - - } - - private int getIndex(int x, int y, int z) { - return (x * 16 + z) * 256 + y; - } - - public Chunk loadChunk(int x, int z) { - return this.provideChunk(x, z); - } - - public boolean chunkExists(int x, int z) { - return true; - } - - public void populate(IChunkProvider chunk, int x, int z) { - BlockFalling.fallInstantly = true; - int var4 = x * 16; - int var5 = z * 16; - BiomeGenBase biomeGen = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); - this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); - this.rand.setSeed(this.worldObj.getSeed()); - long var7 = this.rand.nextLong() / 2L * 2L + 1L; - long var9 = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed((long) x * var7 + (long) z * var9 ^ this.worldObj.getSeed()); - biomeGen.decorate(this.worldObj, this.rand, var4, var5); - this.decoratePlanet(this.worldObj, this.rand, var4, var5); - SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomeGen, var4 + 8, var5 + 8, 16, 16, this.rand); - this.onPopulate(chunk, x, z); - BlockFalling.fallInstantly = false; - } - - public void decoratePlanet(World world, Random rand, int x, int z) { - this.getBiomeGenerator().decorate(world, rand, x, z); - } - - public boolean saveChunks(boolean flag, IProgressUpdate progress) { - return true; - } - - public boolean canSave() { - return true; - } - - public String makeString() { - return "RandomLevelSource"; - } - - public List<SpawnListEntry> getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int i, int j, int k) { - ArrayList<SpawnListEntry> watercreatures; - SpawnListEntry[] arr$; - int len$; - int i$; - SpawnListEntry watercreature; - if (par1EnumCreatureType == EnumCreatureType.monster) { - watercreatures = new ArrayList<SpawnListEntry>(); - arr$ = this.getMonsters(); - len$ = arr$.length; - - for (i$ = 0; i$ < len$; ++i$) { - watercreature = arr$[i$]; - watercreatures.add(watercreature); - } - - return watercreatures; - } else if (par1EnumCreatureType == EnumCreatureType.creature) { - watercreatures = new ArrayList<SpawnListEntry>(); - arr$ = this.getCreatures(); - len$ = arr$.length; - - for (i$ = 0; i$ < len$; ++i$) { - watercreature = arr$[i$]; - watercreatures.add(watercreature); - } - - return watercreatures; - } else if (par1EnumCreatureType != EnumCreatureType.waterCreature) { - return null; - } else { - watercreatures = new ArrayList<SpawnListEntry>(); - arr$ = this.getWaterCreatures(); - len$ = arr$.length; - - for (i$ = 0; i$ < len$; ++i$) { - watercreature = arr$[i$]; - watercreatures.add(watercreature); - } - - return watercreatures; - } - } - - public int getLoadedChunkCount() { - return 0; - } - - public void recreateStructures(int x, int z) { - } - - public boolean unloadQueuedChunks() { - return false; - } - - public void saveExtraData() { - } - - public ChunkPosition func_147416_a(World world, String string, int x, int y, int z) { - return null; - } - - protected abstract BiomeDecoratorSpace getBiomeGenerator(); - - protected abstract BiomeGenBase[] getBiomesForGeneration(); - - public abstract void onChunkProvider(int var1, int var2, Block[] var3, byte[] var4); - - public abstract void onPopulate(IChunkProvider var1, int var2, int var3); - - protected abstract SpawnListEntry[] getMonsters(); - - protected abstract SpawnListEntry[] getCreatures(); - - protected abstract SpawnListEntry[] getWaterCreatures(); - - protected abstract List<MapGenBaseMeta> getWorldGenerators(); - - public abstract double getHeightModifier(); - - public abstract int getWaterLevel(); - - public abstract boolean canGenerateWaterBlock(); - - public abstract boolean canGenerateIceBlock(); - - protected abstract BlockMetaPair getWaterBlock(); - - protected abstract BlockMetaPair getGrassBlock(); - - protected abstract BlockMetaPair getDirtBlock(); - - protected abstract BlockMetaPair getStoneBlock(); - - protected abstract boolean enableBiomeGenBaseBlock(); -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/GalacticBiomeGenBase.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/GalacticBiomeGenBase.java deleted file mode 100644 index 9ebb7d3908..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/GalacticBiomeGenBase.java +++ /dev/null @@ -1,39 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.core.world.gen; - -import gtPlusPlus.xmod.galacticraft.system.core.world.gen.biome.BiomeGenGalaxy; -import net.minecraft.block.Block; -import net.minecraft.world.biome.BiomeGenBase; - -public abstract class GalacticBiomeGenBase extends BiomeGenBase { - - public static BiomeGenBase mGalaxy; - public Block stoneBlock; - public byte topMeta; - public byte fillerMeta; - public byte stoneMeta; - - public int mBiomeID; - - public GalacticBiomeGenBase(int id) { - super(id); - this.spawnableMonsterList.clear(); - this.spawnableWaterCreatureList.clear(); - this.spawnableCreatureList.clear(); - this.spawnableCaveCreatureList.clear(); - this.rainfall = 0.0F; - this.setColor(-16744448); - mBiomeID = id; - } - - public GalacticBiomeGenBase setColor(int var1) { - return (GalacticBiomeGenBase) super.setColor(var1); - } - - public float getSpawningChance() { - return 0.1F; - } - - static { - mGalaxy = (new BiomeGenGalaxy(177)).setBiomeName("Galaxy"); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/GalacticMapGenCavesBase.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/GalacticMapGenCavesBase.java deleted file mode 100644 index 713682b921..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/GalacticMapGenCavesBase.java +++ /dev/null @@ -1,191 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.core.world.gen; - -import galaxyspace.SolarSystem.core.registers.blocks.GSBlocks; -import java.util.Random; -import micdoodle8.mods.galacticraft.api.prefab.world.gen.MapGenBaseMeta; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -public class GalacticMapGenCavesBase extends MapGenBaseMeta { - public static final int BREAK_THROUGH_CHANCE = 25; - - protected void generateLargeCaveNode(long par1, int par3, int par4, Block[] blockIdArray, byte[] metaArray, - double par6, double par8, double par10) { - this.generateCaveNode(par1, par3, par4, blockIdArray, metaArray, par6, par8, par10, - 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); - } - - protected void generateCaveNode(long par1, int par3, int par4, Block[] blockIdArray, byte[] metaArray, double par6, - double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) { - double d4 = (double) (par3 * 16 + 8); - double d5 = (double) (par4 * 16 + 8); - float f3 = 0.0F; - float f4 = 0.0F; - Random random = new Random(par1); - if (par16 <= 0) { - int j1 = this.range * 16 - 16; - par16 = j1 - random.nextInt(j1 / 4); - } - - boolean flag = false; - if (par15 == -1) { - par15 = par16 / 2; - flag = true; - } - - int k1 = random.nextInt(par16 / 2) + par16 / 4; - - for (boolean flag1 = random.nextInt(6) == 0; par15 < par16; ++par15) { - double d6 = 1.5D + (double) (MathHelper.sin((float) par15 * 3.1415927F / (float) par16) * par12 * 1.0F); - double d7 = d6 * par17; - float f5 = MathHelper.cos(par14); - float f6 = MathHelper.sin(par14); - par6 += (double) (MathHelper.cos(par13) * f5); - par8 += (double) f6; - par10 += (double) (MathHelper.sin(par13) * f5); - if (flag1) { - par14 *= 0.92F; - } else { - par14 *= 0.7F; - } - - par14 += f4 * 0.1F; - par13 += f3 * 0.1F; - f4 *= 0.9F; - f3 *= 0.75F; - f4 += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F; - f3 += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F; - if (!flag && par15 == k1 && par12 > 1.0F && par16 > 0) { - this.generateCaveNode(random.nextLong(), par3, par4, blockIdArray, metaArray, par6, par8, par10, - random.nextFloat() * 0.5F + 0.5F, par13 - 1.5707964F, par14 / 3.0F, par15, par16, 1.0D); - this.generateCaveNode(random.nextLong(), par3, par4, blockIdArray, metaArray, par6, par8, par10, - random.nextFloat() * 0.5F + 0.5F, par13 + 1.5707964F, par14 / 3.0F, par15, par16, 1.0D); - return; - } - - if (flag || random.nextInt(4) != 0) { - double d8 = par6 - d4; - double d9 = par10 - d5; - double d10 = (double) (par16 - par15); - double d11 = (double) (par12 + 2.0F + 16.0F); - if (d8 * d8 + d9 * d9 - d10 * d10 > d11 * d11) { - return; - } - - if (par6 >= d4 - 16.0D - d6 * 2.0D && par10 >= d5 - 16.0D - d6 * 2.0D && par6 <= d4 + 16.0D + d6 * 2.0D - && par10 <= d5 + 16.0D + d6 * 2.0D) { - int l1 = MathHelper.floor_double(par6 - d6) - par3 * 16 - 1; - int i2 = MathHelper.floor_double(par6 + d6) - par3 * 16 + 1; - int j2 = MathHelper.floor_double(par8 - d7) - 1; - int k2 = MathHelper.floor_double(par8 + d7) + 1; - int l2 = MathHelper.floor_double(par10 - d6) - par4 * 16 - 1; - int i3 = MathHelper.floor_double(par10 + d6) - par4 * 16 + 1; - if (l1 < 0) { - l1 = 0; - } - - if (i2 > 16) { - i2 = 16; - } - - if (j2 < 1) { - j2 = 1; - } - - if (k2 > 120) { - k2 = 120; - } - - if (l2 < 0) { - l2 = 0; - } - - if (i3 > 16) { - i3 = 16; - } - - boolean flag2 = false; - - int localY; - for (int j3 = l1; j3 < i2; ++j3) { - for (localY = l2; localY < i3; ++localY) { - for (int i4 = k2 + 1; i4 >= j2 - 1; --i4) { - if (i4 >= 0 && i4 < 128 && i4 != j2 - 1 && j3 != l1 && j3 != i2 - 1 && localY != l2 - && localY != i3 - 1) { - i4 = j2; - } - } - } - } - - for (localY = j2; localY < k2; ++localY) { - double yfactor = ((double) localY + 0.5D - par8) / d7; - double yfactorSq = yfactor * yfactor; - - for (int localX = l1; localX < i2; ++localX) { - double zfactor = ((double) (localX + par3 * 16) + 0.5D - par6) / d6; - double zfactorSq = zfactor * zfactor; - - for (int localZ = l2; localZ < i3; ++localZ) { - double xfactor = ((double) (localZ + par4 * 16) + 0.5D - par10) / d6; - double xfactorSq = xfactor * xfactor; - if (xfactorSq + zfactorSq < 1.0D) { - int coords = (localX * 16 + localZ) * 256 + localY; - if (yfactor > -0.7D && xfactorSq + yfactorSq + zfactorSq < 1.0D) { - if (blockIdArray[coords] == GSBlocks.HaumeaBlocks && metaArray[coords] == 0 - && random.nextInt(25) == 0) { - blockIdArray[coords] = Blocks.air; - } else if (blockIdArray[coords] == GSBlocks.HaumeaBlocks - && metaArray[coords] == 0) { - blockIdArray[coords] = Blocks.air; - } - } - } - } - } - } - - if (flag) { - break; - } - } - } - } - - } - - protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, Block[] blockIdArray, - byte[] metaArray) { - int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(40) + 1) + 1); - if (this.rand.nextInt(15) != 0) { - var7 = 0; - } - - for (int var8 = 0; var8 < var7; ++var8) { - double var9 = (double) (par2 * 16 + this.rand.nextInt(16)); - double var11 = (double) this.rand.nextInt(this.rand.nextInt(120) + 8); - double var13 = (double) (par3 * 16 + this.rand.nextInt(16)); - int var15 = 1; - if (this.rand.nextInt(4) == 0) { - this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, blockIdArray, metaArray, var9, var11, - var13); - var15 += this.rand.nextInt(4); - } - - for (int var16 = 0; var16 < var15; ++var16) { - float var17 = this.rand.nextFloat() * 3.1415927F * 2.0F; - float var18 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; - float var19 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); - if (this.rand.nextInt(10) == 0) { - var19 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F; - } - - this.generateCaveNode(this.rand.nextLong(), par4, par5, blockIdArray, metaArray, var9, var11, var13, - var19, var17, var18, 0, 0, 1.0D); - } - } - - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/biome/BiomeGenGalaxy.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/biome/BiomeGenGalaxy.java deleted file mode 100644 index 56d34831b8..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/core/world/gen/biome/BiomeGenGalaxy.java +++ /dev/null @@ -1,20 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.core.world.gen.biome; - -import gtPlusPlus.xmod.galacticraft.system.core.world.gen.GalacticBiomeGenBase; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; -import net.minecraftforge.common.BiomeDictionary; -import net.minecraftforge.common.BiomeDictionary.Type; - -public class BiomeGenGalaxy extends GalacticBiomeGenBase { - public BiomeGenGalaxy(int var1) { - super(var1); - this.spawnableCaveCreatureList.clear(); - this.spawnableCreatureList.clear(); - this.spawnableMonsterList.clear(); - this.spawnableWaterCreatureList.clear(); - if (!ConfigManagerCore.disableBiomeTypeRegistrations) { - BiomeDictionary.registerBiomeType(this, new Type[]{Type.COLD, Type.DRY, Type.DEAD, Type.SPOOKY}); - } - - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/SystemHD10180.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/SystemHD10180.java deleted file mode 100644 index a6f51255db..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/SystemHD10180.java +++ /dev/null @@ -1,58 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.hd10180; - -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.galacticraft.system.core.dim.BasicChunkProviderGalactic; -import gtPlusPlus.xmod.galacticraft.system.core.space.BaseSolarSystem; -import gtPlusPlus.xmod.galacticraft.system.hd10180.planets.b.blocks.BlockRegistrationHD10180B; -import gtPlusPlus.xmod.galacticraft.system.hd10180.planets.b.dim.WorldProviderHD10180B; -import gtPlusPlus.xmod.galacticraft.system.hd10180.planets.c.blocks.BlockRegistrationHD10180C; -import gtPlusPlus.xmod.galacticraft.system.hd10180.planets.c.dim.WorldProviderHD10180C; -import gtPlusPlus.xmod.galacticraft.system.hd10180.planets.d.blocks.BlockRegistrationHD10180D; -import gtPlusPlus.xmod.galacticraft.system.hd10180.planets.d.dim.WorldProviderHD10180D; -import gtPlusPlus.xmod.galacticraft.system.objects.BiomeSettings; -import gtPlusPlus.xmod.galacticraft.system.objects.DimensionSettings; -import gtPlusPlus.xmod.galacticraft.system.objects.PlanetGenerator; -import gtPlusPlus.xmod.galacticraft.system.objects.WorldProviderSettings; -import micdoodle8.mods.galacticraft.api.galaxies.SolarSystem; -import micdoodle8.mods.galacticraft.api.galaxies.Star; -import micdoodle8.mods.galacticraft.api.vector.Vector3; - -public class SystemHD10180 extends BaseSolarSystem { - - public SystemHD10180() { - super("HD10180"); - } - - public void preInit() { - //Init Blocks - BlockRegistrationHD10180B.initialize(); - } - - @Override - public void initSolarSystem() { - //Lets pick a nice place - SolarSystem aSystemHD10180 = createSolarSystem(mSystemName, "milkyWay", new Vector3(-1.2D, 0.0D, 0.0D)); - this.registerSolarSystem(aSystemHD10180); - //turn the lights on - Star aMainStar = this.createStar(mSystemName+"-A",3); - this.setMainStarForSolarSystem(aMainStar); - - //Planet B - PlanetGenerator B = this.createPlanet(mSystemName+"-B", 5, new float[] {0.2f, 0.2f, 0.2f}, CORE.PI/2, 0.3f, 0.3f, 0.24096386F, new BlockRegistrationHD10180B()); - DimensionSettings Planet_B_Settings = new DimensionSettings(B, BasicChunkProviderGalactic.class, 5, false, 1, false, 240f, 0.1f, 0.2f, false, 12000L); - BiomeSettings Planet_B_Biome = new BiomeSettings(mSystemName+"-B", 255, 0.1f, 0.2f); - this.registerPlanet(new WorldProviderHD10180B(new WorldProviderSettings(Planet_B_Settings, Planet_B_Biome)).getDim()); - - //Planet C - PlanetGenerator C = this.createPlanet(mSystemName+"-C", 4, new float[] {0.2f, 0.2f, 0.8f}, CORE.PI/2+0.45f, 0.5f, 0.5f, 2.861994F, new BlockRegistrationHD10180C()); - DimensionSettings Planet_C_Settings = new DimensionSettings(C, BasicChunkProviderGalactic.class, 4, true, 1, false, 120f, 2f, 2f, false, 24000L); - BiomeSettings Planet_C_Biome = new BiomeSettings(mSystemName+"-C", 255, 0.1f, 0.5f); - this.registerPlanet(new WorldProviderHD10180C(new WorldProviderSettings(Planet_C_Settings, Planet_C_Biome)).getDim()); - - //Planet D - PlanetGenerator D = this.createPlanet(mSystemName+"-D", 3, new float[] {0.2f, 0.2f, 0.2f}, CORE.PI-0.55f, 1.2f, 1.2f, 16.861994F, new BlockRegistrationHD10180D()); - DimensionSettings Planet_D_Settings = new DimensionSettings(D, BasicChunkProviderGalactic.class, 3, true, 1, false, 240f, 1f, 0.0f, false, 48000L); - BiomeSettings Planet_D_Biome = new BiomeSettings(mSystemName+"-D", 255, 0.2f, 0.4f); - this.registerPlanet(new WorldProviderHD10180D(new WorldProviderSettings(Planet_D_Settings, Planet_D_Biome)).getDim()); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/b/blocks/BlockRegistrationHD10180B.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/b/blocks/BlockRegistrationHD10180B.java deleted file mode 100644 index d79b5f47ce..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/b/blocks/BlockRegistrationHD10180B.java +++ /dev/null @@ -1,62 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.hd10180.planets.b.blocks; - -import java.util.LinkedHashMap; -import java.util.Map; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.xmod.galacticraft.system.objects.IPlanetBlockRegister; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; - -public class BlockRegistrationHD10180B implements IPlanetBlockRegister { - - private Map<Integer, Block> mBlocks = new LinkedHashMap<Integer, Block>(); - private static AutoMap<Block> mBlocksToRegister = new AutoMap<Block>(); - - public static void initialize() { - //mBlocksToRegister.put(new TCetiEBlocks()); - //mBlocksToRegister.put(new TCetiEBlockDandelions()); - } - - @Override - public Map<Integer, Block> getBlocks() { - return mBlocks; - } - - @Override - public Block getTopLayer() { - return mBlocks.get(0); - } - - @Override - public Block getSoil() { - return mBlocks.get(1); - } - - @Override - public Block getSoil2() { - return mBlocks.get(2); - } - - @Override - public Block getStone() { - return mBlocks.get(3); - } - - @Override - public Block getWaterBlock() { - return mBlocks.get(4); - } - - @Override - public void register() { - //Register Blocks, Add to List - mBlocks.put(0, Blocks.grass); - mBlocks.put(1, Blocks.dirt); - mBlocks.put(2, Blocks.gravel); - mBlocks.put(3, Blocks.stone); - mBlocks.put(4, Blocks.lava); - - } - -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/b/dim/WorldProviderHD10180B.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/b/dim/WorldProviderHD10180B.java deleted file mode 100644 index 2566ef6280..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/b/dim/WorldProviderHD10180B.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.hd10180.planets.b.dim; - -import gtPlusPlus.xmod.galacticraft.system.core.dim.BaseWorldProviderGalactic; -import gtPlusPlus.xmod.galacticraft.system.objects.WorldProviderSettings; - -public class WorldProviderHD10180B extends BaseWorldProviderGalactic { - - public WorldProviderHD10180B(WorldProviderSettings b) { - super(b); - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/c/blocks/BlockRegistrationHD10180C.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/c/blocks/BlockRegistrationHD10180C.java deleted file mode 100644 index 8cf401be40..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/c/blocks/BlockRegistrationHD10180C.java +++ /dev/null @@ -1,62 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.hd10180.planets.c.blocks; - -import java.util.LinkedHashMap; -import java.util.Map; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.xmod.galacticraft.system.objects.IPlanetBlockRegister; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; - -public class BlockRegistrationHD10180C implements IPlanetBlockRegister { - - private Map<Integer, Block> mBlocks = new LinkedHashMap<Integer, Block>(); - private static AutoMap<Block> mBlocksToRegister = new AutoMap<Block>(); - - public static void initialize() { - //mBlocksToRegister.put(new TCetiEBlocks()); - //mBlocksToRegister.put(new TCetiEBlockDandelions()); - } - - @Override - public Map<Integer, Block> getBlocks() { - return mBlocks; - } - - @Override - public Block getTopLayer() { - return mBlocks.get(0); - } - - @Override - public Block getSoil() { - return mBlocks.get(1); - } - - @Override - public Block getSoil2() { - return mBlocks.get(2); - } - - @Override - public Block getStone() { - return mBlocks.get(3); - } - - @Override - public Block getWaterBlock() { - return mBlocks.get(4); - } - - @Override - public void register() { - //Register Blocks, Add to List - mBlocks.put(0, Blocks.grass); - mBlocks.put(1, Blocks.dirt); - mBlocks.put(2, Blocks.gravel); - mBlocks.put(3, Blocks.stone); - mBlocks.put(4, Blocks.lava); - - } - -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/c/dim/WorldProviderHD10180C.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/c/dim/WorldProviderHD10180C.java deleted file mode 100644 index 05d2a7155d..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/c/dim/WorldProviderHD10180C.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.hd10180.planets.c.dim; - -import gtPlusPlus.xmod.galacticraft.system.core.dim.BaseWorldProviderGalactic; -import gtPlusPlus.xmod.galacticraft.system.objects.WorldProviderSettings; - -public class WorldProviderHD10180C extends BaseWorldProviderGalactic { - - public WorldProviderHD10180C(WorldProviderSettings b) { - super(b); - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/d/blocks/BlockRegistrationHD10180D.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/d/blocks/BlockRegistrationHD10180D.java deleted file mode 100644 index e577d2bf6f..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/d/blocks/BlockRegistrationHD10180D.java +++ /dev/null @@ -1,62 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.hd10180.planets.d.blocks; - -import java.util.LinkedHashMap; -import java.util.Map; - -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.xmod.galacticraft.system.objects.IPlanetBlockRegister; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; - -public class BlockRegistrationHD10180D implements IPlanetBlockRegister { - - private Map<Integer, Block> mBlocks = new LinkedHashMap<Integer, Block>(); - private static AutoMap<Block> mBlocksToRegister = new AutoMap<Block>(); - - public static void initialize() { - //mBlocksToRegister.put(new TCetiEBlocks()); - //mBlocksToRegister.put(new TCetiEBlockDandelions()); - } - - @Override - public Map<Integer, Block> getBlocks() { - return mBlocks; - } - - @Override - public Block getTopLayer() { - return mBlocks.get(0); - } - - @Override - public Block getSoil() { - return mBlocks.get(1); - } - - @Override - public Block getSoil2() { - return mBlocks.get(2); - } - - @Override - public Block getStone() { - return mBlocks.get(3); - } - - @Override - public Block getWaterBlock() { - return mBlocks.get(4); - } - - @Override - public void register() { - //Register Blocks, Add to List - mBlocks.put(0, Blocks.grass); - mBlocks.put(1, Blocks.dirt); - mBlocks.put(2, Blocks.gravel); - mBlocks.put(3, Blocks.stone); - mBlocks.put(4, Blocks.lava); - - } - -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/d/dim/WorldProviderHD10180D.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/d/dim/WorldProviderHD10180D.java deleted file mode 100644 index 67bb43369d..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/hd10180/planets/d/dim/WorldProviderHD10180D.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.hd10180.planets.d.dim; - -import gtPlusPlus.xmod.galacticraft.system.core.dim.BaseWorldProviderGalactic; -import gtPlusPlus.xmod.galacticraft.system.objects.WorldProviderSettings; - -public class WorldProviderHD10180D extends BaseWorldProviderGalactic { - - public WorldProviderHD10180D(WorldProviderSettings b) { - super(b); - } - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/BiomeSettings.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/BiomeSettings.java deleted file mode 100644 index 33873f3f9e..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/BiomeSettings.java +++ /dev/null @@ -1,29 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.objects; - -import net.minecraft.world.biome.BiomeGenBase.Height; - -public class BiomeSettings { - - private final String mBiomeName; - private final int mBiomeID; - private final Height mHeight; - - public BiomeSettings(String aName, int aID, float aHeightMin, float aHeightMax) { - mBiomeName = aName; - mBiomeID = aID; - mHeight = new Height(aHeightMin, aHeightMax); - - } - - public synchronized final String getName() { - return mBiomeName; - } - - public synchronized final int getID() { - return mBiomeID; - } - - public synchronized final Height getHeight() { - return mHeight; - } -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/DimensionSettings.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/DimensionSettings.java deleted file mode 100644 index 5e444805e0..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/DimensionSettings.java +++ /dev/null @@ -1,77 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.objects; - -import net.minecraft.world.chunk.IChunkProvider; - -public class DimensionSettings { - - private final int TierRequirement; - private final PlanetGenerator Planet; - private final boolean Atmosphere; - private final int Pressure; - private final boolean SolarRadiation; - private final float CloudHeight; - private final float Gravity; - private final float MeteorFreq; - private final boolean CanRainOrSnow; - private final long DayLength; - private final Class<? extends IChunkProvider> ChunkProvider; - - public DimensionSettings(PlanetGenerator aPlanet, Class<? extends IChunkProvider> aChunkProvider, int aTierRequirement, boolean aHasBreathableAtmo, - int aPressure, boolean aSolarRadiation, float aCloudHeight, float aGravity, float aMeteorFreq, boolean aCanRainOrSnow, long aDayLength) { - Planet = aPlanet; - TierRequirement = aTierRequirement; - Atmosphere = aHasBreathableAtmo; - Pressure = aPressure; - SolarRadiation = aSolarRadiation; - CloudHeight = aCloudHeight; - Gravity = aGravity; - MeteorFreq = aMeteorFreq; - CanRainOrSnow = aCanRainOrSnow; - DayLength = aDayLength; - ChunkProvider = aChunkProvider; - } - - public synchronized final int getTierRequirement() { - return TierRequirement; - } - - public synchronized final PlanetGenerator getPlanet() { - return Planet; - } - - public synchronized final boolean hasAtmosphere() { - return Atmosphere; - } - - public synchronized final int getPressure() { - return Pressure; - } - - public synchronized final boolean hasSolarRadiation() { - return SolarRadiation; - } - - public synchronized final float getCloudHeight() { - return CloudHeight; - } - - public synchronized final float getGravity() { - return Gravity; - } - - public synchronized final float getMeteorFreq() { - return MeteorFreq; - } - - public synchronized final boolean hasRainOrSnow() { - return CanRainOrSnow; - } - - public synchronized final long getDayLength() { - return DayLength; - } - - public synchronized final Class<? extends IChunkProvider> getChunkProvider() { - return ChunkProvider; - } -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/IPlanetBlockRegister.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/IPlanetBlockRegister.java deleted file mode 100644 index 60199406a7..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/IPlanetBlockRegister.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.objects; - -import java.util.Map; - -import gtPlusPlus.api.objects.data.AutoMap; -import net.minecraft.block.Block; - -public interface IPlanetBlockRegister extends Runnable { - - public abstract Map<Integer, Block> getBlocks(); - - public abstract Block getWaterBlock(); - - public abstract Block getTopLayer(); - - public abstract Block getSoil(); - - public abstract Block getSoil2(); - - public abstract Block getStone(); - - public abstract void register(); - - @Override - default void run() { - register(); - } - - - -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/PlanetGenerator.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/PlanetGenerator.java deleted file mode 100644 index fad40e5f41..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/PlanetGenerator.java +++ /dev/null @@ -1,54 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.objects; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; - -import gtPlusPlus.api.objects.data.Pair; -import micdoodle8.mods.galacticraft.api.galaxies.Planet; -import net.minecraft.block.Block; - -public class PlanetGenerator { - - private final Planet mPlanet; - private final IPlanetBlockRegister mTask; - private final Map<Integer, Pair<String, Block>> mPlanetBlocks; - private final Thread mTaskThread; - - public static final Map<String, PlanetGenerator> mGlobalPlanetCache = new HashMap<String, PlanetGenerator>(); - - public PlanetGenerator(Planet aPlanet, IPlanetBlockRegister aBlockRegistrationTask) { - mPlanet = aPlanet; - mTask = aBlockRegistrationTask; - mPlanetBlocks = new LinkedHashMap<Integer, Pair<String, Block>>(); - for (int i=0;i<4;i++) { - Block b = aBlockRegistrationTask.getBlocks().get(i); - if (b != null) - mPlanetBlocks.put(i, new Pair<String, Block>(b.getUnlocalizedName(), b)); - } - if (mGlobalPlanetCache.get(mPlanet.getName().toUpperCase()) == null) { - mGlobalPlanetCache.put(mPlanet.getName().toUpperCase(), this); - } - else { - try { - this.finalize(); - } catch (Throwable e) { - } - } - mTaskThread = new Thread(aBlockRegistrationTask); - mTaskThread.start(); - } - - public synchronized final Planet getPlanet() { - return mPlanet; - } - - public synchronized final IPlanetBlockRegister getTask() { - return mTask; - } - - public synchronized final Map<Integer, Pair<String, Block>> getPlanetBlocks() { - return mPlanetBlocks; - } - -} diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/WorldProviderSettings.java b/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/WorldProviderSettings.java deleted file mode 100644 index e5ef3b43d9..0000000000 --- a/src/Java/gtPlusPlus/xmod/galacticraft/system/objects/WorldProviderSettings.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.xmod.galacticraft.system.objects; - -public class WorldProviderSettings { - - private PlanetGenerator mPlanet; - private final DimensionSettings mDimSettings; - private final BiomeSettings mBiomeSettings; - - public WorldProviderSettings(DimensionSettings d, BiomeSettings b) { - mPlanet = d.getPlanet(); - mDimSettings = d; - mBiomeSettings = b; - } - - public synchronized final PlanetGenerator getPlanet() { - return mPlanet; - } - - public synchronized final void setPlanet(PlanetGenerator aPlanet) { - mPlanet = aPlanet; - } - - public synchronized final DimensionSettings getDimSettings() { - return mDimSettings; - } - - public synchronized final BiomeSettings getBiomeSettings() { - return mBiomeSettings; - } -} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 7acd76882e..80839f0f64 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -19,9 +19,11 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.api.objects.minecraft.multi.NoOutputBonusMultiBehaviour; import gtPlusPlus.australia.gen.gt.WorldGen_GT_Australia; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.handler.OldCircuitHandler; @@ -30,21 +32,25 @@ import gtPlusPlus.core.lib.CORE.ConfigSwitches; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.core.util.reflect.AddGregtechRecipe; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.everglades.gen.gt.WorldGen_GT; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; import gtPlusPlus.xmod.gregtech.api.world.GTPP_Worldgen; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.Gregtech_Blocks; -import gtPlusPlus.xmod.gregtech.loaders.ProcessingAngelGrinder; +import gtPlusPlus.xmod.gregtech.loaders.ProcessingAngleGrinder; import gtPlusPlus.xmod.gregtech.loaders.ProcessingElectricButcherKnife; import gtPlusPlus.xmod.gregtech.loaders.ProcessingElectricLighter; import gtPlusPlus.xmod.gregtech.loaders.ProcessingElectricSnips; import gtPlusPlus.xmod.gregtech.loaders.ProcessingToolHeadChoocher; +import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_AlgaeFarm; import gtPlusPlus.xmod.gregtech.recipes.RecipesToRemove; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechNitroDieselFix; @@ -59,6 +65,7 @@ public class HANDLER_GT { public static final List<WorldGen_GT> sWorldgenListEverglades = new ArrayList<WorldGen_GT>(); public static final List<WorldGen_GT_Australia> sWorldgenListAustralia = new ArrayList<WorldGen_GT_Australia>(); public static final List<GTPP_Worldgen> sCustomWorldgenList = new ArrayList<GTPP_Worldgen>(); + public static GT_MetaGenerated_Tool sMetaGeneratedToolInstance; public static void preInit(){ @@ -88,7 +95,7 @@ public class HANDLER_GT { //Only loads if the config option is true (default: true) if (CORE.ConfigSwitches.enableSkookumChoochers){ - new MetaGeneratedGregtechTools(); + sMetaGeneratedToolInstance= MetaGeneratedGregtechTools.getInstance(); } if (ConfigSwitches.enableOldGTcircuits && !CORE.GTNH){ @@ -107,7 +114,7 @@ public class HANDLER_GT { if (CORE.ConfigSwitches.enableSkookumChoochers){ new ProcessingToolHeadChoocher().run(); } - new ProcessingAngelGrinder().run(); + new ProcessingAngleGrinder().run(); new ProcessingElectricSnips().run(); new ProcessingElectricButcherKnife().run(); new ProcessingElectricLighter().run(); @@ -121,6 +128,9 @@ public class HANDLER_GT { } + // Register the No-Bonus Special Behaviour. + Multiblock_API.registerSpecialMultiBehaviour(new NoOutputBonusMultiBehaviour()); + //Register some custom recipe maps for any enabled multiblocks. //MultiblockRecipeMapHandler.run(); } @@ -133,17 +143,23 @@ public class HANDLER_GT { } RecipesToRemove.go(); convertPyroToCokeOven(); + Meta_GT_Proxy.fixIC2FluidNames(); + RecipeLoader_AlgaeFarm.generateRecipes(); } private static void convertPyroToCokeOven() { - int aCount = 0; - for (GT_Recipe g : GT_Recipe.GT_Recipe_Map.sPyrolyseRecipes.mRecipeList) { - if (AddGregtechRecipe.importPyroRecipe(g)) { - aCount++; + if (ReflectionUtils.doesFieldExist(GT_Recipe.GT_Recipe_Map.class, "sPyrolyseRecipes")) { + int aCount = 0; + GT_Recipe_Map aMap = StaticFields59.getPyrolyseRecipeMap(); + if (aMap != null) { + for (GT_Recipe g : aMap.mRecipeList) { + if (AddGregtechRecipe.importPyroRecipe(g)) { + aCount++; + } + } + Logger.INFO("Converted "+aCount+" Pyrolyse recipes into Industrial Coke Oven recipes."); } - } - Logger.INFO("Converted "+aCount+" Pyrolyse recipes into Industrial Coke Oven recipes."); - + } } private static GT_Recipe replaceItemInRecipeWithAnother(GT_Recipe aRecipe, ItemStack aExisting, ItemStack aNewItem) { @@ -346,6 +362,10 @@ public class HANDLER_GT { OrePrefixes.wireGt01.get(Materials.Superconductor)});*/ } else { + + + Materials aPolytetrafluoroethylene = MaterialUtils.getMaterial("Polytetrafluoroethylene", "Plastic"); + Logger.INFO("Adding new hard Shaped recipes for Hulls."); GT_ModHandler.addCraftingRecipe(ItemList.Hull_LuV.get(1), RecipeBits.NOT_REMOVABLE | RecipeBits.BUFFERED, @@ -357,13 +377,13 @@ public class HANDLER_GT { new Object[]{"PHP", "CMC", 'M', ItemList.Casing_ZPM, 'C', OrePrefixes.cableGt01.get(Materials.Naquadah), 'H', CI.getPlate(aTier_ZPM, 1), 'P', - OrePrefixes.plate.get(Materials.Polytetrafluoroethylene)}); + OrePrefixes.plate.get(aPolytetrafluoroethylene)}); GT_ModHandler.addCraftingRecipe(ItemList.Hull_UV.get(1), RecipeBits.NOT_REMOVABLE | RecipeBits.BUFFERED, new Object[]{"PHP", "CMC", 'M', ItemList.Casing_UV, 'C', OrePrefixes.wireGt04.get(Materials.NaquadahAlloy), 'H', CI.getPlate(aTier_UV, 1), 'P', - OrePrefixes.plate.get(Materials.Polytetrafluoroethylene)}); + OrePrefixes.plate.get(aPolytetrafluoroethylene)}); /*GT_ModHandler.addCraftingRecipe(ItemList.Hull_MAX.get(1), RecipeBits.NOT_REMOVABLE | RecipeBits.BUFFERED, new Object[]{"PHP", "CMC", 'M', ItemList.Casing_MAX, 'C', diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 933ec227ba..7c395392a3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -39,6 +39,9 @@ public enum GregtechItemList implements GregtechItemContainer { Emitter_ULV, Sensor_ULV, + //Recipe Circuit + Circuit_BioRecipeSelector, + //Circuits Old_Circuit_Primitive, Old_Circuit_Basic, Old_Circuit_Good, Old_Circuit_Advanced, Old_Circuit_Data, Old_Circuit_Elite, @@ -102,6 +105,7 @@ public enum GregtechItemList implements GregtechItemContainer { Carbyne_Sheet_Finished, //End Game Laser Engraver Lens + Laser_Lens_WoodsGlass, Laser_Lens_Special, //Bombs @@ -109,6 +113,9 @@ public enum GregtechItemList implements GregtechItemContainer { Bomb_Cast_Set, Bomb_Cast_Broken, Bomb_Cast_Mold, + // Pellet Mold + Pellet_Mold, + //Charged Items for Tree Farms Farm_Processor_EV, Farm_Processor_IV, @@ -224,7 +231,12 @@ public enum GregtechItemList implements GregtechItemContainer { //Fish Pond Industrial_FishingPond, Casing_FishPond, - + + //Algae + AlgaeFarm_Controller, + + //Chemical Plant + ChemicalPlant_Controller, //GT4 autoCrafter GT4_Multi_Crafter, @@ -318,6 +330,9 @@ public enum GregtechItemList implements GregtechItemContainer { Casing_Vacuum_Furnace, Controller_Vacuum_Furnace, + // Large Rocket Engine + Casing_RocketEngine, + Controller_RocketEngine, //---------------------------------------------------------------------------- @@ -336,6 +351,9 @@ public enum GregtechItemList implements GregtechItemContainer { //XL Turbine Rotor Hatch Hatch_Turbine_Rotor, + //Standard Turbine Rotor Hatch + Hatch_Input_TurbineHousing, + //Control Core Hatch_Control_Core, @@ -471,6 +489,10 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_ZPM_Component_Maker, Machine_UV_Component_Maker, + // Fluid Reactor + FluidReactor_LV, FluidReactor_HV, + FluidReactor_IV, FluidReactor_ZPM, + //Breakers BreakerBox_ULV, BreakerBox_LV, BreakerBox_MV, BreakerBox_HV, BreakerBox_EV, BreakerBox_IV, @@ -594,7 +616,7 @@ public enum GregtechItemList implements GregtechItemContainer { FakeMachineCasingPlate_MV, FakeMachineCasingPlate_HV, FakeMachineCasingPlate_EV, FakeMachineCasingPlate_IV, FakeMachineCasingPlate_LuV, FakeMachineCasingPlate_ZPM, - FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX, + FakeMachineCasingPlate_UV, FakeMachineCasingPlate_MAX, //---------------------------------------------------------------------------- @@ -607,7 +629,6 @@ public enum GregtechItemList implements GregtechItemContainer { private ItemStack mStack; private boolean mHasNotBeenSet = true; - public static Fluid sOilExtraHeavy, sOilHeavy, sOilMedium, sOilLight, sNaturalGas; @Override public GregtechItemList set(final Item aItem) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java index 921871cebe..6d0eb6b14c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_Cyclotron.java @@ -1,232 +1,37 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_LanguageManager; -import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; +/** + * NEVER INCLUDE THIS FILE IN YOUR MOD!!! + * <p/> + * The Container I use for all my Basic Machines + */ public class CONTAINER_Cyclotron extends GT_ContainerMetaTile_Machine { - - public int mActive = 0; - public int mMaxProgressTime = 0; - public int mProgressTime = 0; - public long mEnergy = 0; - public int mSteam = 0; - public int mSteamStorage = 0; - public int mStorage = 0; - public int mOutput = 0; - public int mInput = 0; - public int mID = 0; - public int mDisplayErrorCode = 0; - private int oActive = 0; - private int oMaxProgressTime = 0; - private int oProgressTime = 0; - private long oEnergy = 0; - private int oSteam = 0; - private int oSteamStorage = 0; - private int oStorage = 0; - private int oOutput = 0; - private int oInput = 0; - private int oID = 0; - private int oDisplayErrorCode = 0; - private int mTimer = 0; - public CONTAINER_Cyclotron(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(aInventoryPlayer, aTileEntity); - this.mTileEntity = aTileEntity; - if (this.mTileEntity != null && this.mTileEntity.getMetaTileEntity() != null) { - this.addSlots(aInventoryPlayer); - if (this.doesBindPlayerInventory()) { - this.bindPlayerInventory(aInventoryPlayer); - } - - this.detectAndSendChanges(); - } else { - aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; - } + public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { - } - - public CONTAINER_Cyclotron(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, - boolean doesBindInventory) { super(aInventoryPlayer, aTileEntity); - this.mTileEntity = aTileEntity; - if (this.mTileEntity != null && this.mTileEntity.getMetaTileEntity() != null) { - this.addSlots(aInventoryPlayer); - if (this.doesBindPlayerInventory() && doesBindInventory) { - this.bindPlayerInventory(aInventoryPlayer); - } - - this.detectAndSendChanges(); - } else { - aInventoryPlayer.player.openContainer = aInventoryPlayer.player.inventoryContainer; - } - } - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) { - this.mStorage = (int) Math.min(2147483647L, this.mTileEntity.getEUCapacity()); - this.mEnergy = this.mTileEntity.getStoredEU(); - this.mSteamStorage = (int) Math.min(2147483647L, this.mTileEntity.getSteamCapacity()); - this.mSteam = (int) Math.min(2147483647L, this.mTileEntity.getStoredSteam()); - this.mOutput = (int) Math.min(2147483647L, this.mTileEntity.getOutputVoltage()); - this.mInput = (int) Math.min(2147483647L, this.mTileEntity.getInputVoltage()); - this.mDisplayErrorCode = this.mTileEntity.getErrorDisplayID(); - this.mProgressTime = this.mTileEntity.getProgress(); - this.mMaxProgressTime = this.mTileEntity.getMaxProgress(); - this.mActive = this.mTileEntity.isActive() ? 1 : 0; - ++this.mTimer; - Iterator var2 = this.crafters.iterator(); - - while (true) { - ICrafting var1; - do { - if (!var2.hasNext()) { - this.oID = this.mID; - this.oSteam = this.mSteam; - this.oInput = this.mInput; - this.oActive = this.mActive; - this.oOutput = this.mOutput; - this.oEnergy = this.mEnergy; - this.oStorage = this.mStorage; - this.oSteamStorage = this.mSteamStorage; - this.oProgressTime = this.mProgressTime; - this.oMaxProgressTime = this.mMaxProgressTime; - this.oDisplayErrorCode = this.mDisplayErrorCode; - return; - } - - var1 = (ICrafting) var2.next(); - if (this.mTimer % 500 == 10 || this.oEnergy != this.mEnergy) { - - int uEnergy = (int) Math.min(2147483647L, this.mTileEntity.getStoredEU()); - - var1.sendProgressBarUpdate(this, 0, uEnergy & ''); - var1.sendProgressBarUpdate(this, 1, uEnergy >>> 16); - } - - if (this.mTimer % 500 == 10 || this.oStorage != this.mStorage) { - var1.sendProgressBarUpdate(this, 2, this.mStorage & ''); - var1.sendProgressBarUpdate(this, 3, this.mStorage >>> 16); - } - - if (this.mTimer % 500 == 10 || this.oOutput != this.mOutput) { - var1.sendProgressBarUpdate(this, 4, this.mOutput); - } - - if (this.mTimer % 500 == 10 || this.oInput != this.mInput) { - var1.sendProgressBarUpdate(this, 5, this.mInput); - } - - if (this.mTimer % 500 == 10 || this.oDisplayErrorCode != this.mDisplayErrorCode) { - var1.sendProgressBarUpdate(this, 6, this.mDisplayErrorCode); - } - - if (this.mTimer % 500 == 10 || this.oProgressTime != this.mProgressTime) { - var1.sendProgressBarUpdate(this, 11, this.mProgressTime & ''); - var1.sendProgressBarUpdate(this, 12, this.mProgressTime >>> 16); - } - - if (this.mTimer % 500 == 10 || this.oMaxProgressTime != this.mMaxProgressTime) { - var1.sendProgressBarUpdate(this, 13, this.mMaxProgressTime & ''); - var1.sendProgressBarUpdate(this, 14, this.mMaxProgressTime >>> 16); - } - - if (this.mTimer % 500 == 10 || this.oID != this.mID) { - var1.sendProgressBarUpdate(this, 15, this.mID); - } - - if (this.mTimer % 500 == 10 || this.oActive != this.mActive) { - var1.sendProgressBarUpdate(this, 16, this.mActive); - } - - if (this.mTimer % 500 == 10 || this.oSteam != this.mSteam) { - var1.sendProgressBarUpdate(this, 17, this.mSteam & ''); - var1.sendProgressBarUpdate(this, 18, this.mSteam >>> 16); - } - } while (this.mTimer % 500 != 10 && this.oSteamStorage == this.mSteamStorage); - - var1.sendProgressBarUpdate(this, 19, this.mSteamStorage & ''); - var1.sendProgressBarUpdate(this, 20, this.mSteamStorage >>> 16); - } - } + public CONTAINER_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); } - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 0 : - this.mEnergy = this.mEnergy & -65536 | par2; - break; - case 1 : - this.mEnergy = this.mEnergy & '' | par2 << 16; - break; - case 2 : - this.mStorage = this.mStorage & -65536 | par2; - break; - case 3 : - this.mStorage = this.mStorage & '' | par2 << 16; - break; - case 4 : - this.mOutput = par2; - break; - case 5 : - this.mInput = par2; - break; - case 6 : - this.mDisplayErrorCode = par2; - case 7 : - case 8 : - case 9 : - case 10 : - default : - break; - case 11 : - this.mProgressTime = this.mProgressTime & -65536 | par2; - break; - case 12 : - this.mProgressTime = this.mProgressTime & '' | par2 << 16; - break; - case 13 : - this.mMaxProgressTime = this.mMaxProgressTime & -65536 | par2; - break; - case 14 : - this.mMaxProgressTime = this.mMaxProgressTime & '' | par2 << 16; - break; - case 15 : - this.mID = par2; - break; - case 16 : - this.mActive = par2; - break; - case 17 : - this.mSteam = this.mSteam & -65536 | par2; - break; - case 18 : - this.mSteam = this.mSteam & '' | par2 << 16; - break; - case 19 : - this.mSteamStorage = this.mSteamStorage & -65536 | par2; - break; - case 20 : - this.mSteamStorage = this.mSteamStorage & '' | par2 << 16; - } - + @Override + public void addSlots(final InventoryPlayer aInventoryPlayer) { + //this.addSlotToContainer(new Slot(this.mTileEntity, 1, 154, 42)); } - public boolean canInteractWith(EntityPlayer player) { - return this.mTileEntity.isUseableByPlayer(player); + @Override + public int getSlotCount() { + return 0; } - public String trans(String aKey, String aEnglish) { - return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); + @Override + public int getShiftClickSlotCount() { + return 0; } -}
\ No newline at end of file +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java index bdf19454ce..88b9661c95 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java @@ -1,9 +1,22 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import net.minecraft.entity.player.InventoryPlayer; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Recipe; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ICrafting; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -11,6 +24,14 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; * The Container I use for all my Basic Machines */ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { + + public String[] mTileDescription; + private String[] oTileDescription; + + private GregtechMeta_MultiBlockBase mMCTEI; + private boolean mControllerSet = false; + + public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); } @@ -18,20 +39,245 @@ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine { public CONTAINER_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { super(aInventoryPlayer, aTileEntity, bindInventory); } -} + + public static void setControllerInstance(CONTAINER_MultiMachine aContainer, IGregTechTileEntity aTile) { + if (aTile == null) { + return; + } + final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return; + } + if (aMetaTileEntity instanceof GregtechMeta_MultiBlockBase) { + aContainer.mMCTEI = (GregtechMeta_MultiBlockBase) aMetaTileEntity; + } + } + + public int aTotalTickTime = 0; + public int aMaxParallel = 0; + public int aPollutionTick = 0; + public int aMaxInputVoltage = 0; + public int aInputTier = 0; + public int aOutputTier = 0; + public int aRecipeDuration = 0; + public int aRecipeEU = 0; + public int aRecipeSpecial = 0; + public int aPollutionReduction = 0; + public int aStoredEnergy = 0; + public int aMaxEnergy = 0; + public int aEfficiency = 0; + + private int oTotalTickTime = 0; + private int oMaxParallel = 0; + private int oPollutionTick = 0; + private int oMaxInputVoltage = 0; + private int oInputTier = 0; + private int oOutputTier = 0; + private int oRecipeDuration = 0; + private int oRecipeEU = 0; + private int oRecipeSpecial = 0; + private int oPollutionReduction = 0; + private int oStoredEnergy = 0; + private int oMaxEnergy = 0; + private int oEfficiency = 0; + + private static Field timer; + //private static Field crafters; + + @Override + public final void detectAndSendChanges() { + super.detectAndSendChanges(); + if (this.mTileEntity.isClientSide() || this.mTileEntity.getMetaTileEntity() == null) { + return; + } + if (!mControllerSet) { + setControllerInstance(this, this.mTileEntity); + } + mControllerSet = (mMCTEI != null); + if (timer == null) { + timer = ReflectionUtils.getField(getClass(), "mTimer"); + } + if (crafters == null) { + //crafters = ReflectionUtils.getField(getClass(), "crafters"); + } + if (timer != null && crafters != null && mControllerSet) { + //Logger.INFO("Trying to update clientside GUI data"); + try { + //Logger.INFO("0"); + int aTimer = (int) ReflectionUtils.getFieldValue(timer, this); + + //List crafters1List = (List) crafters1; + List<ICrafting> crafters2 = new ArrayList<ICrafting>(); + //Logger.INFO("1"); + for (Object o : crafters) { + if (o instanceof ICrafting) { + crafters2.add((ICrafting) o); + } + } + //Logger.INFO("2"); + if (!crafters2.isEmpty()) { + //Logger.INFO("3"); + handleInitialFieldSetting(); + + try { + //Logger.INFO("4"); + for (final ICrafting var3 : crafters2) { + handleCraftingEvent(aTimer, var3); + } + //Logger.INFO("5"); + handleInternalFieldSetting(); + //Logger.INFO("6"); + } catch (Throwable t) { -/*@Override - public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new Slot(mTileEntity, 1, 152, 5)); - } - - @Override - public int getSlotCount() { - return 1; - } - - @Override - public int getShiftClickSlotCount() { - return 0; - } -}*/ + } + } + } catch (Throwable t) { + t.printStackTrace(); + } + } + else { + Logger.INFO("Failed."); + } + } + + public void handleInitialFieldSetting() { + this.aTotalTickTime = MathUtils.balance((int) mMCTEI.getTotalRuntimeInTicks(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aMaxParallel = mMCTEI.getMaxParallelRecipes(); + this.aPollutionTick = mMCTEI.getPollutionPerTick(null); + this.aMaxInputVoltage = MathUtils.balance((int) mMCTEI.getMaxInputVoltage(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aInputTier = MathUtils.balance((int) mMCTEI.getInputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aOutputTier = MathUtils.balance((int) mMCTEI.getOutputTier(), Integer.MIN_VALUE, Integer.MAX_VALUE); + if (mMCTEI.mLastRecipe != null) { + GT_Recipe aRecipe = mMCTEI.mLastRecipe; + this.aRecipeDuration = MathUtils.balance(aRecipe.mDuration, Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aRecipeEU = MathUtils.balance(aRecipe.mEUt, Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aRecipeSpecial = MathUtils.balance(aRecipe.mSpecialValue, Integer.MIN_VALUE, Integer.MAX_VALUE); + } + this.aPollutionReduction = mMCTEI.getPollutionReductionForAllMufflers(); + + this.aStoredEnergy = MathUtils.balance((int) mMCTEI.getStoredEnergyInAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aMaxEnergy = MathUtils.balance((int) mMCTEI.getMaxEnergyStorageOfAllEnergyHatches(), Integer.MIN_VALUE, Integer.MAX_VALUE); + this.aEfficiency = MathUtils.balance(mMCTEI.mEfficiency, Integer.MIN_VALUE, Integer.MAX_VALUE); + } + + public void handleCraftingEvent(int aTimer, ICrafting aCrafter) { + int aID = 750; + if (aTimer % 500 == 10 || this.oTotalTickTime != this.aTotalTickTime) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aTotalTickTime); + } + if (aTimer % 500 == 10 || this.oMaxParallel != this.aMaxParallel) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxParallel); + } + if (aTimer % 500 == 10 || this.oPollutionTick != this.aPollutionTick) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aPollutionTick); + } + if (aTimer % 500 == 10 || this.oMaxInputVoltage != this.aMaxInputVoltage) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxInputVoltage); + } + if (aTimer % 500 == 10 || this.oInputTier != this.aInputTier) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aInputTier); + } + if (aTimer % 500 == 10 || this.oOutputTier != this.aOutputTier) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aOutputTier); + } + if (aTimer % 500 == 10 || this.oRecipeDuration != this.aRecipeDuration) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeDuration); + } + if (aTimer % 500 == 10 || this.oRecipeEU != this.aRecipeEU) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeEU); + } + if (aTimer % 500 == 10 || this.oRecipeSpecial != this.aRecipeSpecial) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aRecipeSpecial); + } + if (aTimer % 500 == 10 || this.oPollutionReduction != this.aPollutionReduction) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aPollutionReduction); + } + if (aTimer % 500 == 10 || this.oStoredEnergy != this.aStoredEnergy) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aStoredEnergy); + } + if (aTimer % 500 == 10 || this.oMaxEnergy != this.aMaxEnergy) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aMaxEnergy); + } + if (aTimer % 500 == 10 || this.oEfficiency != this.aEfficiency) { + aCrafter.sendProgressBarUpdate((Container) this, aID++, this.aEfficiency); + } + } + + public void handleInternalFieldSetting() { + this.oTotalTickTime = this.aTotalTickTime; + this.oMaxParallel = this.aMaxParallel; + this.oPollutionTick = this.aPollutionTick; + this.oMaxInputVoltage = this.aMaxInputVoltage; + this.oInputTier = this.aInputTier; + this.oOutputTier = this.aOutputTier; + this.oRecipeDuration = this.aRecipeDuration; + this.oRecipeEU = this.aRecipeEU; + this.oRecipeSpecial = this.aRecipeSpecial; + this.oPollutionReduction = this.aPollutionReduction; + this.oStoredEnergy = this.aStoredEnergy; + this.oMaxEnergy = this.aMaxEnergy; + this.oEfficiency = this.aEfficiency; + } + + @SideOnly(Side.CLIENT) + @Override + public void updateProgressBar(final int par1, final int par2) { + super.updateProgressBar(par1, par2); + int shiftedSwitch = par1 - 750; + switch (shiftedSwitch) { + case 0: { + this.aTotalTickTime = par2; + break; + } + case 1: { + this.aMaxParallel = par2; + break; + } + case 2: { + this.aPollutionTick = par2; + break; + } + case 3: { + this.aMaxInputVoltage = par2; + break; + } + case 4: { + this.aInputTier = par2; + break; + } + case 5: { + this.aOutputTier = par2; + break; + } + case 6: { + this.aRecipeDuration = par2; + break; + } + case 7: { + this.aRecipeEU = par2; + break; + } + case 8: { + this.aRecipeSpecial = par2; + break; + } + case 9: { + this.aPollutionReduction = par2; + break; + } + case 10: { + this.aStoredEnergy = par2; + break; + } + case 11: { + this.aMaxEnergy = par2; + break; + } + case 12: { + this.aEfficiency = par2; + break; + } + } + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java new file mode 100644 index 0000000000..2d63a13d60 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine_NoPlayerInventory.java @@ -0,0 +1,27 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + +public class CONTAINER_MultiMachine_NoPlayerInventory extends CONTAINER_MultiMachine { + + public CONTAINER_MultiMachine_NoPlayerInventory(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_MultiMachine_NoPlayerInventory(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } + + public boolean doesBindPlayerInventory() { + return false; + } + + @Override + public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer) { + return null; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java new file mode 100644 index 0000000000..0be44fa616 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_Cyclotron.java @@ -0,0 +1,44 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_Container_MultiMachine; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_Cyclotron extends GT_GUIContainerMetaTile_Machine +{ + public final String mNEI; + public final String mName; + + public GUI_Cyclotron(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aNEI) { + super(new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity, false), "gregtech:textures/gui/multimachines/" + "FusionComputer.png"); + this.mName = aName; + this.mNEI = aNEI; + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(this.mName, 8, -10, 16448255); + if (this.mContainer != null) { + if ((((GT_Container_MultiMachine)this.mContainer).mDisplayErrorCode & 0x40) != 0x0) { + this.fontRendererObj.drawString("Incomplete Structure.", 10, 8, 16448255); + } + if (((GT_Container_MultiMachine)this.mContainer).mDisplayErrorCode == 0) { + if (((GT_Container_MultiMachine)this.mContainer).mActive == 0) { + this.fontRendererObj.drawString("Hit with Soft Hammer to (re-)start the Machine if it doesn't start.", -70, 170, 16448255); + } + else { + this.fontRendererObj.drawString("Running perfectly.", 10, 170, 16448255); + } + } + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java index 425fe6d01f..c78e7789b8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine.java @@ -1,12 +1,26 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import net.minecraft.entity.player.InventoryPlayer; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - +import gregtech.api.util.GT_Utility; +import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -17,52 +31,261 @@ import gtPlusPlus.core.lib.CORE; */ public class GUI_MultiMachine extends GT_GUIContainerMetaTile_Machine { - String mName = ""; + private final static Materials GOOD; + private final static Materials BAD; + private final String mName; + + private final static ConcurrentHashMap<String, ItemStack> mToolStacks = new ConcurrentHashMap<String, ItemStack>(); + + //net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String) + private final static Method mDrawItemStack; + + static { + GOOD = Materials.Uranium; + BAD = Materials.Plutonium; + + //net.minecraft.client.gui.inventory.GuiContainer.drawItemStack(ItemStack, int, int, String) + mDrawItemStack = ReflectionUtils.getMethod(GuiContainer.class, "drawItemStack", new Class[] {ItemStack.class, int.class, int.class, String.class}); + } public GUI_MultiMachine(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { - super(new CONTAINER_MultiMachine(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); - this.mName = aName; + super(new CONTAINER_MultiMachine_NoPlayerInventory(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + this.mName = aName != null ? aName : ""; } @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { - this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); - + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { if (this.mContainer != null) { - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0) { - this.fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0) { - this.fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0) { - this.fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0) { - this.fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0) { - this.fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255); - } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0) { - this.fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); + drawGuiInfoTextLayer(par1, par2); + drawGuiRepairStatusLayer(par1, par2); + } + } + + + protected void drawGuiInfoTextLayer(final float par1, final int par2) { + + if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { + this.fontRendererObj.drawString(mName, 6, 7, 16448255); // Move down 8px + this.fontRendererObj.drawString("Incomplete Structure.", 6, 15, 16448255); // Move down 8px + } + else { + int aTotalTickTime = ((CONTAINER_MultiMachine) this.mContainer).aTotalTickTime; + int aMaxParallel = ((CONTAINER_MultiMachine) this.mContainer).aMaxParallel; + int aPollutionTick = ((CONTAINER_MultiMachine) this.mContainer).aPollutionTick; + int aMaxInputVoltage = ((CONTAINER_MultiMachine) this.mContainer).aMaxInputVoltage; + int aInputTier = ((CONTAINER_MultiMachine) this.mContainer).aInputTier; + int aOutputTier = ((CONTAINER_MultiMachine) this.mContainer).aOutputTier; + int aRecipeDuration = ((CONTAINER_MultiMachine) this.mContainer).aRecipeDuration; + int aRecipeEU = ((CONTAINER_MultiMachine) this.mContainer).aRecipeEU; + int aRecipeSpecial = ((CONTAINER_MultiMachine) this.mContainer).aRecipeSpecial; + int aEfficiency = ((CONTAINER_MultiMachine) this.mContainer).aEfficiency; + + int aPollutionReduction = ((CONTAINER_MultiMachine) this.mContainer).aPollutionReduction; + + + long aStoredEnergy = ((CONTAINER_MultiMachine) this.mContainer).aStoredEnergy; + long aMaxEnergy = ((CONTAINER_MultiMachine) this.mContainer).aMaxEnergy; + + /* + * Logic Block + */ + + long seconds = (aTotalTickTime/20); + int weeks = (int) (TimeUnit.SECONDS.toDays(seconds) / 7); + int days = (int) (TimeUnit.SECONDS.toDays(seconds) - 7 * weeks); + long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days) - TimeUnit.DAYS.toHours(7*weeks); + long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); + long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60); + + ArrayList<String> mInfo = new ArrayList<String>(); + + String EU = StatCollector.translateToLocal("GTPP.info.eu"); + + //GTPP.machines.tier + + mInfo.add(mName); + + if (aInputTier > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.machines.input")+" "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ EnumChatFormatting.GREEN +GT_Values.VOLTAGE_NAMES[aInputTier]); } - if ((((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 64) != 0) { - this.fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); + if (aOutputTier > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.machines.output")+" "+StatCollector.translateToLocal("GTPP.machines.tier")+": "+ EnumChatFormatting.GREEN +GT_Values.VOLTAGE_NAMES[aOutputTier]); + } + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+ + EnumChatFormatting.GREEN + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mProgressTime/20) + EnumChatFormatting.RESET +" s / "+ + EnumChatFormatting.YELLOW + Integer.toString(((CONTAINER_MultiMachine) this.mContainer).mMaxProgressTime/20) + EnumChatFormatting.RESET +" s"); + + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.energy")+": "+ + EnumChatFormatting.GREEN + Long.toString(aStoredEnergy) + EnumChatFormatting.RESET +" "+EU+" / "+ + EnumChatFormatting.YELLOW + Long.toString(aMaxEnergy) + EnumChatFormatting.RESET +" "+EU+""); + + if (aRecipeEU != 0 && aRecipeDuration > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.usage")+": "+ + EnumChatFormatting.RED + Integer.toString(-aRecipeEU) + EnumChatFormatting.RESET + " "+EU+"/t"); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.duration")+": "+ + EnumChatFormatting.RED + Integer.toString(aRecipeDuration) + EnumChatFormatting.RESET + " ticks"); + if (aRecipeSpecial > 0) { + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.specialvalue")+": "+ + EnumChatFormatting.RED + Integer.toString(aRecipeEU) + EnumChatFormatting.RESET + ""); + } + } + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.mei")+": "+ + EnumChatFormatting.YELLOW+Long.toString(aMaxInputVoltage)+EnumChatFormatting.RESET+ " "+EU+"/t"+EnumChatFormatting.RESET); + + mInfo.add(StatCollector.translateToLocal(StatCollector.translateToLocal("GTPP.machines.tier")+": "+ + EnumChatFormatting.YELLOW+GT_Values.VN[GT_Utility.getTier(aMaxInputVoltage)]+ EnumChatFormatting.RESET)); + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.efficiency")+": "+ EnumChatFormatting.YELLOW+Float.toString(aEfficiency / 100.0F)+EnumChatFormatting.RESET + " %"); + + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollution")+": "+ EnumChatFormatting.RED + (aPollutionTick*20)+ EnumChatFormatting.RESET+"/sec"); + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.pollutionreduced")+": "+ EnumChatFormatting.GREEN + aPollutionReduction + EnumChatFormatting.RESET+" %"); + + mInfo.add(StatCollector.translateToLocal("GTPP.CC.parallel")+": "+EnumChatFormatting.GREEN+(aMaxParallel)+EnumChatFormatting.RESET); + + mInfo.add("Total Time Since Built: "); + mInfo.add("" + EnumChatFormatting.DARK_GREEN + Integer.toString(weeks)+EnumChatFormatting.RESET+" Weeks,"); + mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Integer.toString(days) +EnumChatFormatting.RESET+ " Days,"); + mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Long.toString(hours) +EnumChatFormatting.RESET+ " Hours,"); + mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Long.toString(minutes) +EnumChatFormatting.RESET+ " Minutes,"); + mInfo.add("" + EnumChatFormatting.DARK_GREEN+ Long.toString(second) +EnumChatFormatting.RESET+ " Seconds"); + + + + // Machine Name + //fontRendererObj.drawString(this.mName, 6, 7, 16448255); + + for (int i=0;i<mInfo.size();i++) { + fontRendererObj.drawString(mInfo.get(i), 6, 7+(i*8), 16448255); } - if (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode == 0) { - if (((CONTAINER_MultiMachine) this.mContainer).mActive == 0) { - this.fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); - this.fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); - this.fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); - } else { - this.fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); + } + + + + + } + + + protected void drawGuiRepairStatusLayer(final float par1, final int par2) { + + boolean aWrench = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0; + boolean aScrewdriver = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0; + boolean aMallet = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0; + boolean aHammer = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0; + boolean aSoldering = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0; + boolean aCrowbar = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0; + + if (mToolStacks.isEmpty()) { + // Map Stacks of Repair items + aWrench = false; + aScrewdriver = false; + aMallet = false; + aHammer = false; + aSoldering = false; + aCrowbar = false; + mToolStacks.put(aWrench+"WRENCH", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, (aWrench ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aCrowbar+"CROWBAR", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, (aCrowbar ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aHammer+"HARDHAMMER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, (aHammer ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aMallet+"SOFTHAMMER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, (aMallet ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aScrewdriver+"SCREWDRIVER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, (aScrewdriver ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aSoldering+"SOLDERING_IRON_LV", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, (aSoldering ? BAD : GOOD), Materials.Tungsten, null)); + + // Map Stacks of valid items + aWrench = true; + aScrewdriver = true; + aMallet = true; + aHammer = true; + aSoldering = true; + aCrowbar = true; + mToolStacks.put(aWrench+"WRENCH", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.WRENCH, 1, (aWrench ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aCrowbar+"CROWBAR", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.CROWBAR, 1, (aCrowbar ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aHammer+"HARDHAMMER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.HARDHAMMER, 1, (aHammer ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aMallet+"SOFTHAMMER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOFTHAMMER, 1, (aMallet ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aScrewdriver+"SCREWDRIVER", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SCREWDRIVER, 1, (aScrewdriver ? BAD : GOOD), Materials.Tungsten, null)); + mToolStacks.put(aSoldering+"SOLDERING_IRON_LV", GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats(GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, 1, (aSoldering ? BAD : GOOD), Materials.Tungsten, null)); + + ItemStack aGlassPane1 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassRed", 1); + ItemStack aGlassPane2 = ItemUtils.getItemStackOfAmountFromOreDict("paneGlassLime", 1); + mToolStacks.put("falseGLASS", aGlassPane1); + mToolStacks.put("trueGLASS", aGlassPane2); + + // Reset vars to real state + aWrench = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 1) != 0; + aScrewdriver = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 2) != 0; + aMallet = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 4) != 0; + aHammer = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 8) != 0; + aSoldering = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 16) != 0; + aCrowbar = (((CONTAINER_MultiMachine) this.mContainer).mDisplayErrorCode & 32) != 0; + + } + + ItemStack aWrenchStack; + ItemStack aCrowbarStack; + ItemStack aHammerStack; + ItemStack aMalletStack; + ItemStack aScrewdriverStack; + ItemStack aSolderingStack; + if (!mToolStacks.isEmpty() && mDrawItemStack != null) { + + aWrenchStack = mToolStacks.get(aWrench + "WRENCH"); + aCrowbarStack = mToolStacks.get(aCrowbar + "CROWBAR"); + aHammerStack = mToolStacks.get(aHammer + "HARDHAMMER"); + aMalletStack = mToolStacks.get(aMallet + "SOFTHAMMER"); + aScrewdriverStack = mToolStacks.get(aScrewdriver + "SCREWDRIVER"); + aSolderingStack = mToolStacks.get(aSoldering + "SOLDERING_IRON_LV"); + + try { + + ItemStack[] aToolStacks2 = new ItemStack[] { + aWrenchStack, aCrowbarStack, + aHammerStack, aMalletStack, + aScrewdriverStack, aSolderingStack }; + + int aIndex = 0; + //Draw Repair status tools + for (aIndex = 0; aIndex < 6; aIndex++) { + int x = 156; + int y = 112 - (18 * 3) + (aIndex * 18); + mDrawItemStack.invoke(this, + new Object[] { + aToolStacks2[aIndex] != null ? aToolStacks2[aIndex] + : ItemUtils.getErrorStack(1, "Bad Times"), + x, y, "" + (aIndex == 2 ? "H" : aIndex == 3 ? "M" : "") // Stacksize Overlay + }); + //this.fontRendererObj.drawString("", 10, 64, 16448255); + } + + //Draw Running status + boolean running = ((CONTAINER_MultiMachine) this.mContainer).mActive != 0; + ItemStack aGlassPane = mToolStacks.get(running+"GLASS"); + + if (aGlassPane == null) { + aGlassPane = ItemUtils.getItemStackOfAmountFromOreDict("paneGlass" + (running ? "Lime" : "Red"), 1); + mToolStacks.put(running+"GLASS", aGlassPane); } + + mDrawItemStack.invoke(this, + new Object[] { + aGlassPane != null ? aGlassPane + : ItemUtils.getErrorStack(1, "Bad Times"), + 156, + 112 - (18 * 5), + running ? "On" : "Off"}); // Stacksize Overlay + + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); } } + + + + } + @Override protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java new file mode 100644 index 0000000000..0cfab4e71e --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MultiMachine_Default.java @@ -0,0 +1,68 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_MultiMachine_Default extends GT_GUIContainerMetaTile_Machine +{ + String mName; + + public GUI_MultiMachine_Default(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) { + super(new CONTAINER_MultiMachine(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + ((aTextureFile == null) ? "MultiblockDisplay" : aTextureFile)); + this.mName = ""; + this.mName = aName; + } + + @Override + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(this.mName, 10, 8, 16448255); + if (this.mContainer != null) { + if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x1) != 0x0) { + this.fontRendererObj.drawString(this.trans("132", "Pipe is loose."), 10, 16, 16448255); + } + if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x2) != 0x0) { + this.fontRendererObj.drawString(this.trans("133", "Screws are missing."), 10, 24, 16448255); + } + if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x4) != 0x0) { + this.fontRendererObj.drawString(this.trans("134", "Something is stuck."), 10, 32, 16448255); + } + if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x8) != 0x0) { + this.fontRendererObj.drawString(this.trans("135", "Platings are dented."), 10, 40, 16448255); + } + if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x10) != 0x0) { + this.fontRendererObj.drawString(this.trans("136", "Circuitry burned out."), 10, 48, 16448255); + } + if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x20) != 0x0) { + this.fontRendererObj.drawString(this.trans("137", "That doesn't belong there."), 10, 56, 16448255); + } + if ((((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode & 0x40) != 0x0) { + this.fontRendererObj.drawString(this.trans("138", "Incomplete Structure."), 10, 64, 16448255); + } + if (((CONTAINER_MultiMachine)this.mContainer).mDisplayErrorCode == 0) { + if (((CONTAINER_MultiMachine)this.mContainer).mActive == 0) { + this.fontRendererObj.drawString(this.trans("139", "Hit with Soft Hammer"), 10, 16, 16448255); + this.fontRendererObj.drawString(this.trans("140", "to (re-)start the Machine"), 10, 24, 16448255); + this.fontRendererObj.drawString(this.trans("141", "if it doesn't start."), 10, 32, 16448255); + } + else { + this.fontRendererObj.drawString(this.trans("142", "Running perfectly."), 10, 16, 16448255); + } + } + } + } + + public String trans(final String aKey, final String aEnglish) { + return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aKey, aEnglish, false); + } + + @Override + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java new file mode 100644 index 0000000000..cdca065e60 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/Container_FluidReactor.java @@ -0,0 +1,184 @@ +package gtPlusPlus.xmod.gregtech.api.gui.fluidreactor; + +import java.util.Iterator; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_Container_BasicMachine; +import gregtech.api.gui.GT_Slot_Render; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.slots.SlotChemicalPlantInput; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.slots.SlotNoInputLogging; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_ChemicalReactor; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.item.ItemStack; + +public class Container_FluidReactor extends GT_Container_BasicMachine { + + public boolean mFluidTransfer_1 = false; + public boolean mFluidTransfer_2 = false; + public boolean oFluidTransfer_1 = false; + public boolean oFluidTransfer_2 = false; + + public Container_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + @Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + + // Gui Buttons + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 0, 8, 63)); // Fluid 1 + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 1, 44, 63)); + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, 2, 26, 63)); // Fluid 2 + + int tStartIndex = 3; + // Input Slots + this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 8, 7)); + this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 26, 7)); + this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 44, 7)); + this.addSlotToContainer(new SlotChemicalPlantInput(this.mTileEntity, tStartIndex++, 62, 7)); + + // Output Slots + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 107, 16)); + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 125, 16)); + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 107, 34)); + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 125, 34)); + + // Cell Collector Slot + this.addSlotToContainer(new SlotNoInput(this.mTileEntity, tStartIndex++, 116, 63)); + + + // Inputs Fluids + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 8, 42)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 26, 42)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 44, 42)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 62, 42)); + + // Output Fluids + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 143, 16)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, tStartIndex++, 143, 34)); + + + + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex == 0 || aSlotIndex == 2) { + if (this.mTileEntity != null && this.mTileEntity.isServerSide()) { + try { + final IMetaTileEntity aMetaTileEntity = this.mTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return null; + } + if (aMetaTileEntity instanceof GregtechMetaTileEntity_ChemicalReactor) { + //Set Tile + if (aSlotIndex == 0) { + ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_1 = !((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_1; + } + else if (aSlotIndex == 2) { + ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_2 = !((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_2; + } + return null; + } + } + catch (Throwable t) { + t.printStackTrace(); + } + } + } + //Logger.INFO("Clicked slot "+aSlotIndex); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (this.mTileEntity != null && this.mTileEntity.isServerSide()) { + try { + Iterator var2 = this.crafters.iterator(); + final IMetaTileEntity aMetaTileEntity = this.mTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + Logger.INFO("bad"); + return; + } + if (aMetaTileEntity instanceof GregtechMetaTileEntity_ChemicalReactor) { + //Read from Tile + this.mFluidTransfer_1 = ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_1; + this.mFluidTransfer_2 = ((GregtechMetaTileEntity_ChemicalReactor)aMetaTileEntity).mFluidTransfer_2; + int mTimer; + mTimer = (int) ReflectionUtils.getField(this.getClass(), "mTimer").get(this); + while (true) { + ICrafting var1; + do { + if (!var2.hasNext()) { + this.oFluidTransfer_1 = this.mFluidTransfer_1; + this.oFluidTransfer_2 = this.mFluidTransfer_2; + return; + } + var1 = (ICrafting) var2.next(); + if (mTimer % 500 == 10 || this.oFluidTransfer_1 != this.mFluidTransfer_1) { + var1.sendProgressBarUpdate(this, -50, this.mFluidTransfer_1 ? 1 : 0); + } + if (mTimer % 500 == 10 || this.oFluidTransfer_2 != this.mFluidTransfer_2) { + var1.sendProgressBarUpdate(this, -51, this.mFluidTransfer_2 ? 1 : 0); + } + } while (mTimer % 500 != 10); + } + } + else { + Logger.INFO("bad cast"); + } + } + catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } + } + + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) { + super.addCraftingToCrafters(par1ICrafting); + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + if (par1 > 0) { + super.updateProgressBar(par1, par2); + } + else { + switch (par1) { + case -50 : + this.mFluidTransfer_1 = par2 != 0; + break; + case -51 : + this.mFluidTransfer_2 = par2 != 0; + break; + default : + break; + } + } + } + + public int getSlotStartIndex() { + return 3; + } + + public int getShiftClickStartIndex() { + return 3; + } + + public int getSlotCount() { + return this.getShiftClickSlotCount() + 5 + 2; + } + + public int getShiftClickSlotCount() { + return 4; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java new file mode 100644 index 0000000000..1be79b40cc --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/fluidreactor/GUI_FluidReactor.java @@ -0,0 +1,122 @@ +package gtPlusPlus.xmod.gregtech.api.gui.fluidreactor; + +import gregtech.api.gui.GT_Container_BasicMachine; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.entity.player.InventoryPlayer; + +public class GUI_FluidReactor extends GT_GUIContainerMetaTile_Machine { + public final String mName; + public final String mNEI; + public final byte mProgressBarDirection; + public final byte mProgressBarAmount; + + public GUI_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aTextureFile, String aNEI) { + this(aInventoryPlayer, aTileEntity, aName, aTextureFile, aNEI, (byte) 0, (byte) 1); + } + + public GUI_FluidReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, + String aTextureFile, String aNEI, byte aProgressBarDirection, byte aProgressBarAmount) { + super(new Container_FluidReactor(aInventoryPlayer, aTileEntity), CORE.MODID+":textures/gui/FluidReactor.png"); + this.mProgressBarDirection = aProgressBarDirection; + this.mProgressBarAmount = (byte) Math.max(1, aProgressBarAmount); + this.mName = aName; + this.mNEI = aNEI; + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRendererObj.drawString(this.mName, 82, 5, 4210752); + this.drawTooltip(par1, par2); + } + + private void drawTooltip(int x2, int y2) { + int xStart = (this.width - this.xSize) / 2; + int yStart = (this.height - this.ySize) / 2; + int x = x2 - xStart; + int y = y2 - yStart + 5; + List<String> list = new ArrayList(); + if (y >= 67 && y <= 84) { + if (x >= 7 && x <= 24) { + list.add("Fluid 1 Auto-Output"); + } + if (x >= 25 && x <= 42) { + list.add("Fluid 2 Auto-Output"); + } + if (x >= 43 && x <= 61) { + list.add("Item Auto-Output"); + } + } + + if (!list.isEmpty()) { + this.drawHoveringText(list, x, y, this.fontRendererObj); + } + + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null) { + if (((Container_FluidReactor) this.mContainer).mFluidTransfer_1) { + this.drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18); + } + if (((Container_FluidReactor) this.mContainer).mFluidTransfer_2) { + this.drawTexturedModalRect(x + 25, y + 62, 194, 18, 18, 18); + } + if (((GT_Container_BasicMachine) this.mContainer).mItemTransfer) { + this.drawTexturedModalRect(x + 43, y + 62, 176, 36, 18, 18); + } + + if (((GT_Container_BasicMachine) this.mContainer).mStuttering) { + this.drawTexturedModalRect(x + 79, y + 44, 176, 54, 18, 18); + } + + if (this.mContainer.mMaxProgressTime > 0) { + int tSize = this.mProgressBarDirection < 2 ? 20 : 18; + int tProgress = Math + .max(1, Math + .min(tSize * this.mProgressBarAmount, + (this.mContainer.mProgressTime > 0 ? 1 : 0) + this.mContainer.mProgressTime + * tSize * this.mProgressBarAmount / this.mContainer.mMaxProgressTime)) + % (tSize + 1); + switch (this.mProgressBarDirection) { + case 0 : + this.drawTexturedModalRect(x + 82, y + 24, 176, 0, tProgress, 18); + break; + case 1 : + this.drawTexturedModalRect(x + 82 + 20 - tProgress, y + 24, 196 - tProgress, 0, tProgress, 18); + break; + case 2 : + this.drawTexturedModalRect(x + 82, y + 24, 176, 0, 20, tProgress); + break; + case 3 : + this.drawTexturedModalRect(x + 82, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); + break; + case 4 : + tProgress = 20 - tProgress; + this.drawTexturedModalRect(x + 82, y + 24, 176, 0, tProgress, 18); + break; + case 5 : + tProgress = 20 - tProgress; + this.drawTexturedModalRect(x + 82 + 20 - tProgress, y + 24, 196 - tProgress, 0, tProgress, 18); + break; + case 6 : + tProgress = 18 - tProgress; + this.drawTexturedModalRect(x + 82, y + 24, 176, 0, 20, tProgress); + break; + case 7 : + tProgress = 18 - tProgress; + this.drawTexturedModalRect(x + 82, y + 24 + 18 - tProgress, 176, 18 - tProgress, 20, tProgress); + } + } + } + + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java index d4d2fcacd7..e6203823b6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/hatches/CONTAINER_1by1_Turbine.java @@ -36,11 +36,11 @@ public class CONTAINER_1by1_Turbine extends GT_Container_1by1 { } @Override public boolean isItemValid(final ItemStack itemstack) { - /*if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { + if (itemstack.getItem() instanceof GT_MetaGenerated_Tool) { if (itemstack.getItemDamage() >= 170 && itemstack.getItemDamage() <= 176) { return true; } - }*/ + } return false; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index e4a15d34ea..83f052a983 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -204,6 +204,7 @@ public interface IGregtech_RecipeAdder { public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, int time, int eu); public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, Object object, int time, int eu); public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, ItemStack object, int time); + public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, int aCircuit, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, ItemStack output2, int time, int eu); public boolean addMultiblockChemicalRecipe(ItemStack[] itemStacks, FluidStack[] fluidStacks, FluidStack[] fluidStacks2, ItemStack[] outputs, int time, int eu); @@ -215,8 +216,16 @@ public interface IGregtech_RecipeAdder { public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput); - public void addFluidExtractionRecipe(ItemStack input, Object input2, FluidStack output, int aTime, int aEu, int aSpecial); - + public boolean addFluidExtractionRecipe(ItemStack input, FluidStack output, int aTime, int aEu); + + public boolean addFluidExtractionRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidOut, int aTime, int aEu); + + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn); + + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut); + + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut, int aTime, int aEu); + /** * Adds a Fusion reactor Recipe * @@ -254,7 +263,25 @@ public interface IGregtech_RecipeAdder { public boolean addFusionReactorRecipe(ItemStack aInputStackA, ItemStack aInputStackB, FluidStack plasma, int aOutputChance, int aFusionDurationInTicks, int aEu, int aSpecial); - boolean addVacuumFurnaceRecipe(ItemStack aInput1, ItemStack aInput2, + public boolean addVacuumFurnaceRecipe(ItemStack aInput1, ItemStack aInput2, FluidStack aFluidInput, FluidStack aFluidOutput, ItemStack aOutput1, ItemStack aOutput2, int aDuration, int aEUt, int aLevel); + + + public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu); + public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu); + + public boolean addFluidReactorRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier); + + public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aHeat); + + public boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, FluidStack aFluidOutput, int aDuration, int aEUt); + + public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt); + + public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden); + + public boolean addPulverisationRecipe(final ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, final ItemStack aOutput3); + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java index e637365c1e..6967c8eb33 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java @@ -1,7 +1,9 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity; +import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; +import java.util.Random; import gregtech.GT_Mod; import gregtech.api.GregTech_API; @@ -9,18 +11,39 @@ import gregtech.api.enums.GT_Values; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; -import gregtech.common.GT_Pollution; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; import ic2.api.Direction; +import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class BaseCustomTileEntity extends BaseMetaTileEntity { protected NBTTagCompound mRecipeStuff2; + private static final Field ENTITY_ITEM_HEALTH_FIELD_2; + + static { + Field f = null; + try { + f = EntityItem.class.getDeclaredField("field_70291_e"); + f.setAccessible(true); + } catch (Exception var4) { + try { + f = EntityItem.class.getDeclaredField("health"); + f.setAccessible(true); + } catch (Exception var3) { + var4.printStackTrace(); + var3.printStackTrace(); + } + } + + ENTITY_ITEM_HEALTH_FIELD_2 = f; + } public BaseCustomTileEntity() { super(); @@ -73,7 +96,14 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { this.mReleaseEnergy = false; this.mMetaTileEntity.onExplosion(); int i; - if (GT_Mod.gregtechproxy.mExplosionItemDrop) { + + boolean aExplosionDropItem = false; + Object aProxyField = StaticFields59.getFieldFromGregtechProxy(false, "mExplosionItemDrop"); + if (boolean.class.isInstance(aProxyField) || Boolean.class.isInstance(aProxyField)) { + aExplosionDropItem = (boolean) aProxyField; + } + + if (aExplosionDropItem) { for (i = 0; i < this.getSizeInventory(); ++i) { ItemStack tItem = this.getStackInSlot(i); if (tItem != null && tItem.stackSize > 0 && this.isValidSlot(i)) { @@ -94,19 +124,70 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { } } + + + public void dropItems(ItemStack tItem) { + if (tItem != null) { + Random tRandom = new Random(); + EntityItem tItemEntity = new EntityItem(this.worldObj, + (double) ((float) this.xCoord + tRandom.nextFloat() * 0.8F + 0.1F), + (double) ((float) this.yCoord + tRandom.nextFloat() * 0.8F + 0.1F), + (double) ((float) this.zCoord + tRandom.nextFloat() * 0.8F + 0.1F), + new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage())); + if (tItem.hasTagCompound()) { + tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy()); + } + + tItemEntity.motionX = tRandom.nextGaussian() * 0.0500000007450581D; + tItemEntity.motionY = tRandom.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D; + tItemEntity.motionZ = tRandom.nextGaussian() * 0.0500000007450581D; + tItemEntity.hurtResistantTime = 999999; + tItemEntity.lifespan = 60000; + + try { + if (ENTITY_ITEM_HEALTH_FIELD_2 != null) { + ENTITY_ITEM_HEALTH_FIELD_2.setInt(tItemEntity, 99999999); + } + } catch (Exception var5) { + ; + } + + this.worldObj.spawnEntityInWorld(tItemEntity); + tItem.stackSize = 0; + } + } public ArrayList<ItemStack> getDrops() { - ItemStack rStack = new ItemStack(Meta_GT_Proxy.sBlockMachines, 1, this.getMetaTileID()); - NBTTagCompound aSuperNBT = super.getDrops().get(0).getTagCompound(); - NBTTagCompound tNBT = aSuperNBT; - if (this.hasValidMetaTileEntity()) { - this.mMetaTileEntity.setItemNBT(tNBT); + ArrayList<ItemStack> aDrops = new ArrayList<ItemStack>(); + ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, this.getMetaTileID()); + // Currently not using my custom block. + // ItemStack rStack = new ItemStack(Meta_GT_Proxy.sBlockMachines, 1, + // this.getMetaTileID()); + boolean fail = true; + + ArrayList<ItemStack> aSuperDrops = super.getDrops(); + if (aSuperDrops != null && !aSuperDrops.isEmpty()) { + ItemStack aSuperStack = super.getDrops().get(0); + if (aSuperStack != null && aSuperStack.hasTagCompound()) { + NBTTagCompound aSuperNBT = aSuperStack.getTagCompound(); + if (aSuperNBT != null && !aSuperNBT.hasNoTags()) { + NBTTagCompound tNBT = (NBTTagCompound) aSuperNBT.copy(); + if (tNBT != null && !tNBT.hasNoTags()) { + if (this.hasValidMetaTileEntity()) { + this.mMetaTileEntity.setItemNBT(tNBT); + rStack.setTagCompound(tNBT); + fail = false; + aDrops.add(rStack); + } + } + } + + } } - if (!tNBT.hasNoTags()) { - rStack.setTagCompound(tNBT); + if (fail) { + aDrops.add(rStack); } - - return new ArrayList<ItemStack>(Arrays.asList(new ItemStack[] { rStack })); + return aDrops; } public boolean isTeleporterCompatible(Direction aSide) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java index 1ce7fc49d3..e1b329c07f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java @@ -247,9 +247,9 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank public int getFuelValue(FluidStack aLiquid) { if (aLiquid != null && this.getRecipes() != null) { Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList; - Logger.WARNING("Fuels: "+tRecipeList.size()); if (tRecipeList != null) { - Iterator var4 = tRecipeList.iterator(); + Logger.WARNING("Fuels: "+tRecipeList.size()); + Iterator<GT_Recipe> var4 = tRecipeList.iterator(); while (var4.hasNext()) { GT_Recipe tFuel = (GT_Recipe) var4.next(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java index 19ba932a02..2eb1d36791 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicMachine.java @@ -11,11 +11,11 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.objects.XSTR; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.random.XSTR; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java deleted file mode 100644 index 68ec0ba0c9..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java +++ /dev/null @@ -1,532 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import java.util.ArrayList; -import java.util.Arrays; - -import gregtech.GT_Mod; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IEnergyConnected; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.BaseMetaPipeEntity; -import gregtech.api.metatileentity.MetaPipeEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_Utility; -import gregtech.common.GT_Client; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.interfaces.IHeatEntity; -import gtPlusPlus.xmod.gregtech.api.interfaces.IMetaTileEntityHeatPipe; -import gtPlusPlus.xmod.gregtech.common.StaticFields59; -import ic2.api.energy.tile.IEnergySink; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class GT_MetaPipeEntity_Heat extends MetaPipeEntity implements IMetaTileEntityHeatPipe, IHeatEntity { - - public final Materials mMaterial; - public final long mHeatLossPerMeter, mAmperage, mMaxTemp; - public final boolean mInsulated, mCanShock; - public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0; - public short mOverheat; - - private boolean mCheckConnections; - public byte mDisableInput; - - public GT_MetaPipeEntity_Heat(int aID, String aName, String aNameRegional, Materials aMaterial, long aMaxTemp) { - super(aID, aName, aNameRegional, 0); - mMaterial = aMaterial; - mAmperage = 1; - mMaxTemp = aMaxTemp; - mInsulated = false; - mCanShock = true; - mHeatLossPerMeter = aMaxTemp/1000; - } - - public GT_MetaPipeEntity_Heat(String aName, Materials aMaterial, long aMaxTemp) { - super(aName, 0); - mMaterial = aMaterial; - mAmperage = 1; - mMaxTemp = aMaxTemp; - mInsulated = false; - mCanShock = true; - mHeatLossPerMeter = aMaxTemp/1000; - } - - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaPipeEntity_Heat(mName, mMaterial, mMaxTemp); - } - - @Override - public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { - if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) - GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, mTransferredVoltageLast20); - } - - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); - } - - @Override - public boolean isSimpleMachine() { - return true; - } - - @Override - public boolean isFacingValid(byte aFacing) { - return false; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - @Override - public final boolean renderInside(byte aSide) { - return false; - } - - @Override - public int getProgresstime() { - return (int) mTransferredAmperage * 64; - } - - @Override - public int maxProgresstime() { - return (int) mAmperage * 64; - } - - @Override - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())) - return 0; - return transferHeat(aSide, aVoltage, aAmperage, new ArrayList<TileEntity>(Arrays.asList((TileEntity) getBaseMetaTileEntity()))); - } - - @Override - public long transferHeat(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) { - if (!this.isConnectedAtSide(aSide) && aSide != 6) { - return 0L; - } else { - long rUsedAmperes = 0L; - aVoltage -= this.mHeatLossPerMeter; - if (aVoltage > 0L) { - for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; ++i) { - if (i != aSide && this.isConnectedAtSide(i) - && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, - this.getBaseMetaTileEntity().getCoverIDAtSide(i), - this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) { - TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i); - if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { - aAlreadyPassedTileEntityList.add(tTileEntity); - if (tTileEntity instanceof IEnergyConnected) { - if (this.getBaseMetaTileEntity().getColorization() >= 0) { - byte tColor = ((IEnergyConnected) tTileEntity).getColorization(); - if (tColor >= 0 && tColor != this.getBaseMetaTileEntity().getColorization()) { - continue; - } - } - - if (tTileEntity instanceof IGregTechTileEntity - && ((IGregTechTileEntity) tTileEntity) - .getMetaTileEntity() instanceof IMetaTileEntityHeatPipe - && ((IGregTechTileEntity) tTileEntity) - .getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)) - .letsEnergyIn(GT_Utility.getOppositeSide(i), - ((IGregTechTileEntity) tTileEntity) - .getCoverIDAtSide(GT_Utility.getOppositeSide(i)), - ((IGregTechTileEntity) tTileEntity) - .getCoverDataAtSide(GT_Utility.getOppositeSide(i)), - (IGregTechTileEntity) tTileEntity)) { - if (((IGregTechTileEntity) tTileEntity).getTimer() > 50L) { - rUsedAmperes += ((IMetaTileEntityHeatPipe) ((IGregTechTileEntity) tTileEntity) - .getMetaTileEntity()).transferHeat(GT_Utility.getOppositeSide(i), - aVoltage, aAmperage - rUsedAmperes, - aAlreadyPassedTileEntityList); - } - } else { - rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits( - GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes); - } - } else { - ForgeDirection tDirection; - - if (tTileEntity instanceof IEnergySink) { - tDirection = ForgeDirection.getOrientation(i).getOpposite(); - if (((IEnergySink) tTileEntity) - .acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), tDirection) - && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0.0D - && ((IEnergySink) tTileEntity).injectEnergy(tDirection, (double) aVoltage, - (double) aVoltage) < (double) aVoltage) { - ++rUsedAmperes; - } - } - } - } - } - } - } - - this.mTransferredAmperage += rUsedAmperes; - this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage); - this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage); - if (aVoltage <= this.mMaxTemp && this.mTransferredAmperage <= this.mAmperage) { - return rUsedAmperes; - } else { - if (this.mOverheat > GT_Mod.gregtechproxy.mWireHeatingTicks * 100) { - //this.getBaseMetaTileEntity().setToFire(); - } else { - this.mOverheat = (short) (this.mOverheat + 100); - } - - return aAmperage; - } - } - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - this.mTransferredAmperage = 0L; - if (this.mOverheat > 0) { - --this.mOverheat; - } - - if (aTick % 20L == 0L) { - this.mTransferredVoltageLast20 = 0L; - this.mTransferredAmperageLast20 = 0L; - - for (byte tSide = 0; tSide < 6; ++tSide) { - IGregTechTileEntity tBaseMetaTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(tSide); - byte uSide = GT_Utility.getOppositeSide(tSide); - if ((this.mCheckConnections || this.isConnectedAtSide(tSide) - || aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide, - aBaseMetaTileEntity.getCoverIDAtSide(tSide), - aBaseMetaTileEntity.getCoverDataAtSide(tSide), aBaseMetaTileEntity) - || tBaseMetaTileEntity != null && tBaseMetaTileEntity.getCoverBehaviorAtSide(uSide) - .alwaysLookConnected(uSide, tBaseMetaTileEntity.getCoverIDAtSide(uSide), - tBaseMetaTileEntity.getCoverDataAtSide(uSide), tBaseMetaTileEntity)) - && this.connect(tSide) == 0) { - this.disconnect(tSide); - } - } - - if (isGT6Pipes()) { - this.mCheckConnections = false; - } - } - } else if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { - aBaseMetaTileEntity.issueTextureUpdate(); - } - - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; - } - - @Override - public String[] getDescription() { - return new String[]{ - "Max Voltage: " + EnumChatFormatting.GOLD + mMaxTemp + "C" + EnumChatFormatting.GRAY, - "Loss: " + EnumChatFormatting.RED + mHeatLossPerMeter + EnumChatFormatting.GRAY + " HU per meter", - CORE.GT_Tooltip - }; - } - - @Override - public float getThickNess() { - return 1; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("HeatBuffer", this.HeatBuffer); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - this.HeatBuffer = aNBT.getInteger("HeatBuffer"); - } - - - - - - - - - - - - - - protected int transmitHeat; - protected int maxHeatEmitpeerTick; - protected int HeatBuffer; - - - - - public byte getTileEntityBaseType() { - return 4; - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, - byte aColorIndex, boolean aConnected, boolean aRedstone) { - float tThickNess = this.getThickNess(); - if (this.mDisableInput == 0) { - return new ITexture[]{(ITexture) (aConnected - ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex) - : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa)))}; - } else { - byte tMask = 0; - byte[][] sRestrictionArray = new byte[][]{{2, 3, 5, 4}, {2, 3, 4, 5}, {1, 0, 4, 5}, {1, 0, 4, 5}, - {1, 0, 2, 3}, {1, 0, 2, 3}}; - if (aSide >= 0 && aSide < 6) { - for (byte i = 0; i < 4; ++i) { - if (this.isInputDisabledAtSide(sRestrictionArray[aSide][i])) { - tMask = (byte) (tMask | 1 << i); - } - } - } - - return new ITexture[]{ - (ITexture) (aConnected - ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex) - : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa))), - getRestrictorTexture(tMask)}; - } - } - - protected static final ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, - byte aColorIndex) { - if (aPipeAmount >= 9) { - return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - } else if (aPipeAmount >= 4) { - return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - } else if (aThickNess < 0.124F) { - return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - } else if (aThickNess < 0.374F) { - return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - } else if (aThickNess < 0.499F) { - return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - } else if (aThickNess < 0.749F) { - return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - } else { - return aThickNess < 0.874F - ? new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)) - : new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], - Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - } - } - - protected static final ITexture getRestrictorTexture(byte aMask) { - switch (aMask) { - case 1 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UP); - case 2 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DOWN); - case 3 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UD); - case 4 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LEFT); - case 5 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UL); - case 6 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DL); - case 7 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NR); - case 8 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_RIGHT); - case 9 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UR); - case 10 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DR); - case 11 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NL); - case 12 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LR); - case 13 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_ND); - case 14 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NU); - case 15 : - return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR); - default : - return null; - } - } - - - public final boolean isGT6Pipes() { - return StaticFields59.mGT6StylePipes; - } - - public void updateHeatEntity() { - int amount = this.getMaxHeatEmittedPerTick() - this.HeatBuffer; - if (amount > 0) { - this.addtoHeatBuffer(this.fillHeatBuffer(amount)); - } - } - - public boolean facingMatchesDirection(ForgeDirection direction) { - return true; - } - - public int maxrequestHeatTick(ForgeDirection directionFrom) { - return this.getMaxHeatEmittedPerTick(); - } - - public int requestHeat(ForgeDirection directionFrom, int requestheat) { - if (this.facingMatchesDirection(directionFrom)) { - int heatbuffertemp = this.getHeatBuffer(); - if (this.getHeatBuffer() >= requestheat) { - this.setHeatBuffer(this.getHeatBuffer() - requestheat); - this.transmitHeat = requestheat; - return requestheat; - } else { - this.transmitHeat = heatbuffertemp; - this.setHeatBuffer(0); - return heatbuffertemp; - } - } else { - return 0; - } - } - - - public int getHeatBuffer() { - return this.HeatBuffer; - } - - public void setHeatBuffer(int HeatBuffer) { - this.HeatBuffer = HeatBuffer; - } - - public void addtoHeatBuffer(int heat) { - this.setHeatBuffer(this.getHeatBuffer() + heat); - } - - - public int fillHeatBuffer(int maxAmount) { - return maxAmount >= this.getMaxHeatEmittedPerTick() ? this.getMaxHeatEmittedPerTick() : maxAmount; - } - - public int getMaxHeatEmittedPerTick() { - return (int) (this.mMaxTemp/1000); - } - - - public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { - if (isGT6Pipes()) { - byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); - byte tMask = (byte) (1 << tSide); - if (aPlayer.isSneaking()) { - if (this.isInputDisabledAtSide(tSide)) { - this.mDisableInput = (byte) (this.mDisableInput & ~tMask); - GT_Utility.sendChatToPlayer(aPlayer, this.trans("212", "Input enabled")); - if (!this.isConnectedAtSide(tSide)) { - this.connect(tSide); - } - } else { - this.mDisableInput |= tMask; - GT_Utility.sendChatToPlayer(aPlayer, this.trans("213", "Input disabled")); - } - } else if (!this.isConnectedAtSide(tSide)) { - if (this.connect(tSide) > 0) { - GT_Utility.sendChatToPlayer(aPlayer, this.trans("214", "Connected")); - } - } else { - this.disconnect(tSide); - GT_Utility.sendChatToPlayer(aPlayer, this.trans("215", "Disconnected")); - } - - return true; - } else { - return false; - } - } - - public boolean isInputDisabledAtSide(int aSide) { - return (this.mDisableInput & 1 << aSide) != 0; - } - - - - - @Override - public int maxHeatInPerTick(ForgeDirection var1) { - return (int) (this.mMaxTemp/500); - } - - @Override - public int addHeat(ForgeDirection var1, int var2) { - - - - /*ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing()); - TileEntity te = this.getBaseMetaTileEntity().getWorld().getTileEntity(this.xCoord + dir.offsetX, this.yCoord + dir.offsetY, - this.zCoord + dir.offsetZ); - if (te instanceof IHeatSource) { - int heatbandwith = ((IHeatSource) te).maxrequestHeatTick(dir.getOpposite()); - double freeEUstorage = (double) this.maxEUStorage - this.EUstorage; - if (freeEUstorage >= this.productionpeerheat * (double) heatbandwith) { - this.receivedheat = ((IHeatSource) te).requestHeat(dir.getOpposite(), heatbandwith); - if (this.receivedheat != 0) { - this.production = (double) this.receivedheat * this.productionpeerheat; - this.EUstorage += this.production; - return true; - } - } - } - - this.production = 0.0D; - this.receivedheat = 0;*/ - - - return 0; - } - - @Override - public int getTransmitHeat() { - return this.transmitHeat; - } - - - - - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java index 9b730c84a3..5fef0f1088 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DynamoBuffer.java @@ -34,14 +34,17 @@ public class GT_MetaTileEntity_Hatch_DynamoBuffer extends GT_MetaTileEntity_Hatc return new ITexture[]{aBaseTexture, TexturesGtBlock.OVERLAYS_ENERGY_OUT_MULTI_BUFFER[this.mTier]}; } + @Override public long getMinimumStoredEU() { return 0L; } + @Override public long maxEUStore() { return 512L + GT_Values.V[this.mTier + 1] * 2048L; } + @Override public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { return (MetaTileEntity) new GT_MetaTileEntity_Hatch_DynamoBuffer(this.mName, this.mTier, this.mDescription, this.mTextures); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java new file mode 100644 index 0000000000..752321506d --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_TurbineProvider.java @@ -0,0 +1,212 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_1by1_Turbine; +import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_1by1_Turbine; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +public class GT_MetaTileEntity_Hatch_TurbineProvider extends GT_MetaTileEntity_Hatch_InputBus { + + public GT_MetaTileEntity_Hatch_TurbineProvider(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + public GT_MetaTileEntity_Hatch_TurbineProvider(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription[0], aTextures); + } + + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_TurbineProvider(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Housing"); + } + + @Override + public String[] getDescription() { + return new String[]{ + "An automation port for Large Turbines", "Will attempt once per 1200 ticks to fill the turbine slot of it's parent turbine", "You may adjust this with a screwdriver", "Hold shift to adjust in finer amounts", "Hold control to adjust direction", "Left Click with Screwdriver to reset", "This module assumes the entire turbine is in the same Chunk"}; + } + + + private GT_MetaTileEntity_LargeTurbine mParent = null; + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + super.onPostTick(aBaseMetaTileEntity, aTimer); + if (aTimer % mRefreshTime == 0 && this.getBaseMetaTileEntity().isServerSide()) { + tryRefillTurbine(); + } + } + + private final void tryFindParentTurbine() { + Logger.INFO("This turbine housing has no parent, searching world."); + IGregTechTileEntity T = this.getBaseMetaTileEntity(); + World W = T.getWorld(); + Chunk C = W.getChunkFromBlockCoords(T.getXCoord(), T.getZCoord()); + for (Object o : C.chunkTileEntityMap.values()) { + if (o instanceof IGregTechTileEntity) { + IGregTechTileEntity G = (IGregTechTileEntity) o; + final IMetaTileEntity aMetaTileEntity = G.getMetaTileEntity(); + if (aMetaTileEntity == null) { + continue; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_LargeTurbine) { + GT_MetaTileEntity_LargeTurbine aTurb = (GT_MetaTileEntity_LargeTurbine) aMetaTileEntity; + for (GT_MetaTileEntity_Hatch_InputBus ee : aTurb.mInputBusses) { + if (ee.equals(this)) { + mParent = aTurb; + Logger.INFO("Found a Parent to attach to this housing."); + return; + } + } + } + } + } + } + + private final void tryRefillTurbine() { + if (mParent == null) { + tryFindParentTurbine(); + } + if (mParent != null && mParent.mInventory[1] == null) { + for (ItemStack aStack : this.mInventory) { + if (isItemStackTurbine(aStack)) { + setGUIItemStack(aStack); + } + } + } + } + + protected boolean setGUIItemStack(ItemStack aNewGuiSlotContents) { + boolean result = false; + if (mParent.mInventory[1] == null) { + mParent.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null; + mParent.depleteInput(aNewGuiSlotContents); + mParent.updateSlots(); + this.updateSlots(); + result = true; + } + return result; + } + + public boolean isItemStackTurbine(ItemStack aStack) { + if (aStack.getItem() instanceof GT_MetaGenerated_Tool) { + if (aStack.getItemDamage() >= 170 && aStack.getItemDamage() <= 176) { + return true; + } + } + return false; + } + + public boolean isItemStackScrewdriver(ItemStack aStack) { + if (aStack.getItem() instanceof GT_MetaGenerated_Tool) { + if (aStack.getItemDamage() == 22 || aStack.getItemDamage() == 150) { + return true; + } + } + return false; + } + + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return isItemStackTurbine(aStack); + } + + private int mRefreshTime = 1200; + private boolean mDescending = true; + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("mRefreshTime", mRefreshTime); + aNBT.setBoolean("mDescending", mDescending); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mRefreshTime = aNBT.getInteger("mRefreshTime"); + mDescending = aNBT.getBoolean("mDescending"); + } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (aPlayer != null) { + if (KeyboardUtils.isCtrlKeyDown()) { + mDescending = Utils.invertBoolean(mDescending); + PlayerUtils.messagePlayer(aPlayer, "Direction: "+(mDescending ? "DOWN" : "UP")); + } + else { + int aAmount = 0; + if (KeyboardUtils.isShiftKeyDown()) { + aAmount = 10; + } + else { + aAmount = 100; + } + if (mDescending) { + mRefreshTime -= aAmount; + if (mRefreshTime < 0) { + mRefreshTime = 1200; + } + } + else { + mRefreshTime += aAmount; + if (mRefreshTime > 1200) { + mRefreshTime = 0; + } + } + PlayerUtils.messagePlayer(aPlayer, "Set check time to be every "+mRefreshTime+" ticks."); + } + } + } + + @Override + public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + boolean aDidScrewdriver = false; + if (aPlayer != null) { + if (aPlayer.getHeldItem() != null) { + if (isItemStackScrewdriver(aPlayer.getHeldItem())) { + aDidScrewdriver = true; + mRefreshTime = 1200; + PlayerUtils.messagePlayer(aPlayer, "Reset check time to "+mRefreshTime+" ticks."); + } + } + } + if (!aDidScrewdriver) { + super.onLeftclick(aBaseMetaTileEntity, aPlayer); + } + } + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java index e0844bb071..4c60d9a932 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java @@ -9,7 +9,6 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; @@ -17,7 +16,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_InputBus { - public GT_Recipe_Map mRecipeMap = null; public GT_MetaTileEntity_SuperBus_Input(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java index 3afa3312b1..cca5a39de3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Output.java @@ -58,7 +58,7 @@ public class GT_MetaTileEntity_SuperBus_Output extends GT_MetaTileEntity_Hatch_O if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) { this.fillStacksIntoFirstSlots(); } - + super.onPostTick(aBaseMetaTileEntity, aTimer); } public void updateSlots() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java index 8a29dc5db2..be23123193 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java @@ -18,13 +18,7 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { public static final boolean mGt6Pipe; static { - Boolean aGt6 = (Boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe"); - if (aGt6 != null) { - mGt6Pipe = aGt6; - } - else { - mGt6Pipe = false; - } + mGt6Pipe = StaticFields59.mGT6StylePipes; } public final GT_Materials mMaterial; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java index 839fb3a14a..c9b98a6a64 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GT_MetaTileEntity_Hatch_CustomFluidBase.java @@ -102,7 +102,7 @@ public class GT_MetaTileEntity_Hatch_CustomFluidBase extends GT_MetaTileEntity_H String[] s2 = new String[]{ "Fluid Input for Multiblocks", "Capacity: " + getCapacity()+"L", - "Accepted Fluid: " + mTempMod + mLockedStack.getLocalizedName() + "Accepted Fluid: " + mTempMod + mLockedStack != null ? mLockedStack.getLocalizedName() : "Empty" }; return s2; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java index d17c820699..4dd5bf25d6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java @@ -5,6 +5,7 @@ import static gregtech.api.enums.GT_Values.VN; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashSet; import cofh.api.energy.IEnergyReceiver; import net.minecraft.entity.Entity; @@ -219,6 +220,18 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements return this.transferElectricity(aSide, aVoltage, aAmperage, new ArrayList<>(Arrays.asList((TileEntity) this.getBaseMetaTileEntity()))); } + + + /** + * Adds support for the newer function added by https://github.com/Blood-Asp/GT5-Unofficial/commit/73ee102b63efd92c0f164a7ed7a79ebcd2619617#diff-3051838621d8ae87aa5ccd1345e1f07d + */ + public long transferElectricity(byte arg0, long arg1, long arg2, HashSet<TileEntity> arg3) { + ArrayList<TileEntity> aTiles = new ArrayList<TileEntity>(); + for (TileEntity y : arg3) { + aTiles.add(y); + } + return transferElectricity(arg0, arg1, arg2, aTiles); + } @Override public long transferElectricity(final byte aSide, long aVoltage, final long aAmperage, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 0e1ef0e47e..3869adb7ab 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -4,9 +4,9 @@ import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.concurrent.TimeUnit; @@ -41,18 +41,28 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gtPlusPlus.GTplusplus; import gtPlusPlus.GTplusplus.INIT_PHASE; +import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.ConcurrentHashSet; +import gtPlusPlus.api.objects.data.ConcurrentSet; +import gtPlusPlus.api.objects.data.FlexiblePair; +import gtPlusPlus.api.objects.data.Triplet; import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.asm.AsmConfig; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine; +import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine_NoPlayerInventory; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; +import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine_Default; import gtPlusPlus.xmod.gregtech.api.gui.GUI_Multi_Basic_Slotted; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; @@ -66,16 +76,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; -public abstract class GregtechMeta_MultiBlockBase -extends -GT_MetaTileEntity_MultiBlockBase { - +public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_MultiBlockBase { public static final boolean DEBUG_DISABLE_CORES_TEMPORARILY = true; - static { Method a08 = findRecipe08 = ReflectionUtils.getMethod(GT_Recipe_Map.class, "findRecipe", IHasWorldObjectAndCoords.class, GT_Recipe.class, boolean.class, long.class, FluidStack[].class, ItemStack.class, ItemStack[].class); @@ -83,8 +90,19 @@ GT_MetaTileEntity_MultiBlockBase { Logger.MACHINE_INFO("Found .08 findRecipe method? "+(a08 != null)); Logger.MACHINE_INFO("Found .09 findRecipe method? "+(a09 != null)); - //gregtech.api.util.GT_Recipe.GT_Recipe_Map.findRecipe(IHasWorldObjectAndCoords, GT_Recipe, boolean, long, FluidStack[], ItemStack, ItemStack...) + if (CORE.DEBUG) { + aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class); + } + else { + aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); + } + try { + calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class); + } catch (NoSuchMethodException | SecurityException e) {} + + mCustomBehviours = new HashMap<String, SpecialMultiBehaviour>(); + } //Find Recipe Methods @@ -98,9 +116,14 @@ GT_MetaTileEntity_MultiBlockBase { //Control Core Hatch public ArrayList<GT_MetaTileEntity_Hatch_ControlCore> mControlCoreBus = new ArrayList<GT_MetaTileEntity_Hatch_ControlCore>(); + public ArrayList<GT_MetaTileEntity_Hatch_AirIntake> mAirIntakes = new ArrayList<GT_MetaTileEntity_Hatch_AirIntake>(); public ArrayList<GT_MetaTileEntity_Hatch_InputBattery> mChargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_InputBattery>(); public ArrayList<GT_MetaTileEntity_Hatch_OutputBattery> mDischargeHatches = new ArrayList<GT_MetaTileEntity_Hatch_OutputBattery>(); + // Custom Behaviour Map + private static final HashMap<String, SpecialMultiBehaviour> mCustomBehviours; + + public GregtechMeta_MultiBlockBase(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -120,13 +143,23 @@ GT_MetaTileEntity_MultiBlockBase { public abstract boolean hasSlotInGUI(); + public long getTotalRuntimeInTicks() { + return this.mTotalRunTime; + } + @Override public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { if (hasSlotInGUI()) { return new GT_Container_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); } - else { - return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + else { + String aCustomGUI = getCustomGUIResourceName(); + if (aCustomGUI == null) { + return new CONTAINER_MultiMachine_NoPlayerInventory(aPlayerInventory, aBaseMetaTileEntity); + } + else { + return new CONTAINER_MultiMachine(aPlayerInventory, aBaseMetaTileEntity); + } } } @@ -139,7 +172,7 @@ GT_MetaTileEntity_MultiBlockBase { @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { String aCustomGUI = getCustomGUIResourceName(); - aCustomGUI = aCustomGUI != null ? aCustomGUI : "MultiblockDisplay"; + aCustomGUI = aCustomGUI != null ? aCustomGUI : hasSlotInGUI() ? "MultiblockDisplay" : "MultiblockDisplay_Generic"; aCustomGUI = aCustomGUI + ".png"; if (hasSlotInGUI()) { if (!requiresVanillaGtGUI()) { @@ -150,7 +183,12 @@ GT_MetaTileEntity_MultiBlockBase { } } else { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); + if (getCustomGUIResourceName() == null && !hasSlotInGUI()) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); + } + else { + return new GUI_MultiMachine_Default(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), aCustomGUI); + } } } @@ -189,31 +227,17 @@ GT_MetaTileEntity_MultiBlockBase { long minutes = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60); long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60); - int mPollutionReduction=0; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - mPollutionReduction=Math.max(calculatePollutionReductionForHatch(tHatch, 100),mPollutionReduction); - } - } - - long storedEnergy=0; - long maxEnergy=0; - for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { - storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } - + int mPollutionReduction = getPollutionReductionForAllMufflers(); + long storedEnergy = getStoredEnergyInAllEnergyHatches(); + long maxEnergy = getMaxEnergyStorageOfAllEnergyHatches(); int tTier = this.getControlCoreTier(); - mInfo.add(getMachineTooltip()); //Lets borrow the GTNH handling - mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.Progress")+": "+ + mInfo.add(StatCollector.translateToLocal("GTPP.multiblock.progress")+": "+ EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+ EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s"); @@ -260,6 +284,36 @@ GT_MetaTileEntity_MultiBlockBase { } + public int getPollutionReductionForAllMufflers() { + int mPollutionReduction=0; + for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { + if (isValidMetaTileEntity(tHatch)) { + mPollutionReduction=Math.max(calculatePollutionReductionForHatch(tHatch, 100),mPollutionReduction); + } + } + return mPollutionReduction; + } + + public long getStoredEnergyInAllEnergyHatches() { + long storedEnergy=0; + for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); + } + } + return storedEnergy; + } + + public long getMaxEnergyStorageOfAllEnergyHatches() { + long maxEnergy=0; + for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (isValidMetaTileEntity(tHatch)) { + maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + } + } + return maxEnergy; + } + @Override public boolean isGivingInformation() { return true; @@ -294,7 +348,7 @@ GT_MetaTileEntity_MultiBlockBase { }*/ String aRequiresMuffler = "1x Muffler Hatch"; - String aRequiresCoreModule = "1x Core Module"; + //String aRequiresCoreModule = "1x Core Module"; String aRequiresMaint = "1x Maintanence Hatch"; String[] x = getTooltip(); @@ -330,7 +384,7 @@ GT_MetaTileEntity_MultiBlockBase { AutoMap<String> aOrderedMap = new AutoMap<String>(); if (showHatches) { aOrderedMap.put(aRequiresMaint); - aOrderedMap.put(aRequiresCoreModule); + //aOrderedMap.put(aRequiresCoreModule); if (showPollution) { aOrderedMap.put(aRequiresMuffler); } @@ -361,8 +415,11 @@ GT_MetaTileEntity_MultiBlockBase { String[] aToolTip = new String[(a2 + a3)]; aToolTip = ArrayUtils.addAll(aToolTip, x); aToolTip = ArrayUtils.addAll(aToolTip, z); - aCachedToolTip = aToolTip; - return aToolTip; + + if (aCachedToolTip == null || aCachedToolTip.length <= 0) { + aCachedToolTip = aToolTip; + } + return aCachedToolTip; } public abstract String[] getTooltip(); @@ -414,67 +471,316 @@ GT_MetaTileEntity_MultiBlockBase { public String getSound() { return ""; } + public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) { - if (aRecipe.mOutputs.length > 16) { - // Gendustry custom comb with a billion centrifuge outputs? Do it anyway. - return true; - } + return canBufferOutputs(aRecipe, aParallelRecipes, true); + } + + public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes, boolean aAllow16SlotWithoutCheck) { - // Count slots available in output buses - ArrayList<ItemStack> tBusStacks = new ArrayList<>(); + Logger.INFO("Determining if we have space to buffer outputs. Parallel: "+aParallelRecipes); - int tEmptySlots = 0; - for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { - if (!isValidMetaTileEntity(tBus)) { - continue; + // Null recipe or a recipe with lots of outputs? + // E.G. Gendustry custom comb with a billion centrifuge outputs? + // Do it anyway, provided the multi allows it. Default behaviour is aAllow16SlotWithoutCheck = true. + if (aRecipe == null || aRecipe.mOutputs.length > 16) { + if (aRecipe == null) { + return false; } - final IInventory tBusInv = tBus.getBaseMetaTileEntity(); - for (int i = 0; i < tBusInv.getSizeInventory(); i++) { - if (tBus.getStackInSlot(i) == null) { - tEmptySlots++; + else if (aRecipe.mOutputs.length > 16) { + if (aAllow16SlotWithoutCheck) { + return true; } else { - tBusStacks.add(tBus.getStackInSlot(i)); + // Do nothing, we want to check this recipe properly. } - } - } + } + } - int slotsNeeded = aRecipe.mOutputs.length; - for (final ItemStack tRecipeOutput: aRecipe.mOutputs) { - if (tRecipeOutput == null) continue; - int amount = tRecipeOutput.stackSize * aParallelRecipes; - for (final ItemStack tBusStack : tBusStacks) { - if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) { - if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) { - slotsNeeded--; - break; + // Do we even need to check for item outputs? + boolean aDoesOutputItems = aRecipe.mOutputs.length > 0; + // Do we even need to check for fluid outputs? + boolean aDoesOutputFluids = aRecipe.mFluidOutputs.length > 0; + + + + /* ======================================== + * Item Management + * ======================================== + */ + + if (aDoesOutputItems) { + Logger.INFO("We have items to output."); + + // How many slots are free across all the output buses? + int aInputBusSlotsFree = 0; + + /* + * Create Variables for Item Output + */ + + AutoMap<FlexiblePair<ItemStack, Integer>> aItemMap = new AutoMap<FlexiblePair<ItemStack, Integer>>(); + AutoMap<ItemStack> aOutputs = new AutoMap<ItemStack>(aRecipe.mOutputs); + + for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) { + if (!isValidMetaTileEntity(tBus)) { + continue; + } + final IInventory tBusInv = tBus.getBaseMetaTileEntity(); + for (int i = 0; i < tBusInv.getSizeInventory(); i++) { + if (tBus.getStackInSlot(i) == null) { + aInputBusSlotsFree++; + } + else { + ItemStack aT = tBus.getStackInSlot(i); + int aSize = aT.stackSize; + aT = aT.copy(); + aT.stackSize = 0; + aItemMap.put(new FlexiblePair<ItemStack, Integer>(aT, aSize)); } + } + } + + // Count the slots we need, later we can check if any are able to merge with existing stacks + int aRecipeSlotsRequired = 0; + + // A map to hold the items we will be 'inputting' into the output buses. These itemstacks are actually the recipe outputs. + ConcurrentSet<FlexiblePair<ItemStack, Integer>> aInputMap = new ConcurrentHashSet<FlexiblePair<ItemStack, Integer>>(); + + // Iterate over the outputs, calculating require stack spacing they will require. + for (int i=0;i<aOutputs.size();i++) { + ItemStack aY = aOutputs.get(i); + if (aY == null) { + continue; } + else { + int aStackSize = aY.stackSize * aParallelRecipes; + if (aStackSize > 64) { + int aSlotsNeedsForThisStack = (int) Math.ceil((double) ((float) aStackSize / 64f)); + // Should round up and add as many stacks as required nicely. + aRecipeSlotsRequired += aSlotsNeedsForThisStack; + for (int o=0;o<aRecipeSlotsRequired;o++) { + int aStackToRemove = (aStackSize -= 64) > 64 ? 64 : aStackSize; + aY = aY.copy(); + aY.stackSize = 0; + aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackToRemove)); + } + } + else { + // Only requires one slot + aRecipeSlotsRequired++; + aY = aY.copy(); + aY.stackSize = 0; + aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackSize)); + } + } + } + + // We have items to add to the output buses. See if any are not full stacks and see if we can make them full. + if (aInputMap.size() > 0) { + // Iterate over the current stored items in the Output busses, if any match and are not full, we can try account for merging. + busItems: for (FlexiblePair<ItemStack, Integer> y : aItemMap) { + // Iterate over the 'inputs', we can safely remove these as we go. + outputItems: for (FlexiblePair<ItemStack, Integer> u : aInputMap) { + // Create local vars for readability. + ItemStack aOutputBusStack = y.getKey(); + ItemStack aOutputStack = u.getKey(); + // Stacks match, including NBT. + if (GT_Utility.areStacksEqual(aOutputBusStack, aOutputStack, false)) { + // Stack Matches, but it's full, continue. + if (aOutputBusStack.stackSize >= 64) { + // This stack is full, no point checking it. + continue busItems; + } + else { + // We can merge these two stacks without any hassle. + if ((aOutputBusStack.stackSize + aOutputStack.stackSize) <= 64) { + // Update the stack size in the bus storage map. + y.setValue(aOutputBusStack.stackSize + aOutputStack.stackSize); + // Remove the 'input' stack from the recipe outputs, so we don't try count it again. + aInputMap.remove(u); + continue outputItems; + } + // Stack merging is too much, so we fill this stack, leave the remainder. + else { + int aRemainder = (aOutputBusStack.stackSize + aOutputStack.stackSize) - 64; + // Update the stack size in the bus storage map. + y.setValue(64); + // Create a new object to iterate over later, with the remainder data; + FlexiblePair<ItemStack, Integer> t = new FlexiblePair<ItemStack, Integer>(u.getKey(), aRemainder); + // Remove the 'input' stack from the recipe outputs, so we don't try count it again. + aInputMap.remove(u); + // Add the remainder stack. + aInputMap.add(t); + continue outputItems; + } + } + } + else { + continue outputItems; + } + } + } } + + // We have stacks that did not merge, do we have space for them? + if (aInputMap.size() > 0) { + if (aInputMap.size() > aInputBusSlotsFree) { + // We do not have enough free slots in total to accommodate the remaining managed stacks. + Logger.INFO("Failed to find enough space for all item outputs. Free: "+aInputBusSlotsFree+", Required: "+aInputMap.size()); + return false; + } + } + + /* + * End Item Management + */ + } - // Enough open slots? - if (tEmptySlots < slotsNeeded) return false; - // For each output fluid, make sure an output hatch can accept it. - for (FluidStack tRecipeFluid: aRecipe.mFluidOutputs) { - if (tRecipeFluid == null) continue; - boolean tCanBufferFluid = false; - int tRecipeAmount = tRecipeFluid.amount; - for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) { - FluidStack tHatchFluid = tHatch.getFluid(); - if (tHatchFluid == null) { - if(tHatch.getCapacity() > tRecipeAmount) { - tCanBufferFluid = true; - break; - } + + + + + /* ======================================== + * Fluid Management + * ======================================== + */ + + + + if (aDoesOutputFluids) { + Logger.INFO("We have Fluids to output."); + // How many slots are free across all the output buses? + int aFluidHatches = 0; + int aEmptyFluidHatches = 0; + int aFullFluidHatches = 0; + // Create Map for Fluid Output + ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = new ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>(); + for (final GT_MetaTileEntity_Hatch_Output tBus : this.mOutputHatches) { + if (!isValidMetaTileEntity(tBus)) { + continue; } - else if (tHatchFluid.isFluidEqual(tRecipeFluid) && tHatch.getCapacity() - tHatchFluid.amount > tRecipeAmount) { - tCanBufferFluid = true; - break; + aFluidHatches++; + // Map the Hatch with the space left for easy checking later. + if (tBus.getFluid() == null) { + aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(tBus, null, tBus.getCapacity())); + } + else { + int aSpaceLeft = tBus.getCapacity() - tBus.getFluidAmount(); + aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(tBus, tBus.getFluid(), aSpaceLeft)); + } + } + // Create a map of all the fluids we would like to output, we can iterate over this and see how many we can merge into existing hatch stacks. + ConcurrentHashSet<FluidStack> aOutputFluids = new ConcurrentHashSet<FluidStack>(); + // Ugly ass boxing + aOutputFluids.addAll(new AutoMap<FluidStack>(aRecipe.mFluidOutputs)); + // Iterate the Hatches, updating their 'stored' data. + aHatchIterator: for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aHatchData : aOutputHatches) { + // The Hatch Itself + GT_MetaTileEntity_Hatch_Output aHatch = aHatchData.getValue_1(); + // Fluid in the Hatch + FluidStack aHatchStack = aHatchData.getValue_2(); + // Space left in Hatch + int aSpaceLeftInHatch = aHatch.getCapacity() - aHatch.getFluidAmount(); + // Hatch is full, + if (aSpaceLeftInHatch <= 0) { + aFullFluidHatches++; + aOutputHatches.remove(aHatchData); + continue aHatchIterator; + } + // Hatch has space + else { + // Check if any fluids match + aFluidMatch: for (FluidStack aOutputStack : aOutputFluids) { + if (GT_Utility.areFluidsEqual(aHatchStack, aOutputStack)) { + int aFluidToPutIntoHatch = aOutputStack.amount; + // Not Enough space to insert all of the fluid. + // We fill this hatch and add a smaller Fluidstack back to the iterator. + if (aSpaceLeftInHatch < aFluidToPutIntoHatch) { + // Copy existing Hatch Stack + FluidStack aNewHatchStack = aHatchStack.copy(); + aNewHatchStack.amount = 0; + // Copy existing Hatch Stack again + FluidStack aNewOutputStack = aHatchStack.copy(); + aNewOutputStack.amount = 0; + // How much fluid do we have left after we fill the hatch? + int aFluidLeftAfterInsert = aFluidToPutIntoHatch - aSpaceLeftInHatch; + // Set new stacks to appropriate values + aNewHatchStack.amount = aHatch.getCapacity(); + aNewOutputStack.amount = aFluidLeftAfterInsert; + // Remove fluid from output list, merge success + aOutputFluids.remove(aOutputStack); + // Remove hatch from hatch list, data is now invalid. + aOutputHatches.remove(aHatchData); + // Add remaining Fluid to Output list + aOutputFluids.add(aNewOutputStack); + // Re-add hatch to hatch list, with new data. + Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); + aOutputHatches.add(aNewHatchData); + continue aHatchIterator; + } + // We can fill this hatch perfectly (rare case), may as well add it directly to the full list. + else if (aSpaceLeftInHatch == aFluidToPutIntoHatch) { + // Copy Old Stack + FluidStack aNewHatchStack = aHatchStack.copy(); + // Add in amount from output stack + aNewHatchStack.amount += aOutputStack.amount; + // Remove fluid from output list, merge success + aOutputFluids.remove(aOutputStack); + // Remove hatch from hatch list, data is now invalid. + aOutputHatches.remove(aHatchData); + // Re-add hatch to hatch list, with new data. + Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); + aOutputHatches.add(aNewHatchData); + continue aHatchIterator; + } + // We have more space than we need to merge, so we remove the stack from the output list and update the hatch list. + else { + // Copy Old Stack + FluidStack aNewHatchStack = aHatchStack.copy(); + // Add in amount from output stack + aNewHatchStack.amount += aOutputStack.amount; + // Remove fluid from output list, merge success + aOutputFluids.remove(aOutputStack); + // Remove hatch from hatch list, data is now invalid. + aOutputHatches.remove(aHatchData); + // Re-add hatch to hatch list, with new data. + Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); + aOutputHatches.add(aNewHatchData); + // Check next fluid + continue aFluidMatch; + } + + } + else { + continue aFluidMatch; + } + } } } - if (!tCanBufferFluid) return false; + + for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aFreeHatchCheck : aOutputHatches) { + // Free Hatch + if (aFreeHatchCheck.getValue_2() == null || aFreeHatchCheck.getValue_3() == 0 || aFreeHatchCheck.getValue_1().getFluid() == null) { + aEmptyFluidHatches++; + } + } + + // We have Fluid Stacks we did not merge. Do we have space? + if (aOutputFluids.size() > 0) { + // Not enough space to add fluids. + if (aOutputFluids.size() < aEmptyFluidHatches) { + Logger.INFO("Failed to find enough space for all fluid outputs."); + return false; + } + } + + /* + * End Fluid Management + */ } + return true; } @@ -484,21 +790,26 @@ GT_MetaTileEntity_MultiBlockBase { public static Method aLogger = null; public void log(String s) { - - boolean isDebugLogging = CORE.DEBUG; boolean reset = true; - - if (aLogger == null || reset) { - if (isDebugLogging) { - aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class); + if (reset || aLogger == null) { + if (!AsmConfig.disableAllLogging) { + aLogger = ReflectionUtils.getMethod( + Logger.class, "INFO", String.class + ); } else { - aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); + aLogger = ReflectionUtils.getMethod( + Logger.class, "MACHINE_INFO", String.class + ); } } try { aLogger.invoke(null, s); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {} + } + catch (IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { + e.printStackTrace(); + } } @@ -682,8 +993,7 @@ GT_MetaTileEntity_MultiBlockBase { ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { - // Based on the Processing Array. A bit overkill, but very flexible. - + // Based on the Processing Array. A bit overkill, but very flexible. // Reset outputs and progress stats this.mEUt = 0; @@ -694,12 +1004,11 @@ GT_MetaTileEntity_MultiBlockBase { long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); log("Running checkRecipeGeneric(0)"); - - + GT_Recipe tRecipe = findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, - gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); - + gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + log("Running checkRecipeGeneric(1)"); // Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; @@ -708,6 +1017,50 @@ GT_MetaTileEntity_MultiBlockBase { log("BAD RETURN - 1"); return false; } + + + /* + * Check for Special Behaviours + */ + + // First populate the map if we need to. + if (mCustomBehviours == null || mCustomBehviours.isEmpty()) { + mCustomBehviours.putAll(Multiblock_API.getSpecialBehaviourItemMap()); + } + + // We have a special slot object in the recipe + if (tRecipe.mSpecialItems != null) { + // The special slot is an item + if (tRecipe.mSpecialItems instanceof ItemStack) { + // Make an Itemstack instance of this. + ItemStack aSpecialStack = (ItemStack) tRecipe.mSpecialItems; + // Check if this item is in an input bus. + boolean aDidFindMatch = false; + for (ItemStack aInputItemsToCheck : aItemInputs) { + // If we find a matching stack, continue. + if (GT_Utility.areStacksEqual(aSpecialStack, aInputItemsToCheck, false)) { + // Iterate all special behaviour items, to see if we need to utilise one. + aDidFindMatch = true; + break; + } + } + // Try prevent needless iteration loops if we don't have the required inputs at all. + if (aDidFindMatch) { + // Iterate all special behaviour items, to see if we need to utilise one. + for (SpecialMultiBehaviour aBehaviours : mCustomBehviours.values()) { + // Found a match, let's adjust this recipe now. + if (aBehaviours.isTriggerItem(aSpecialStack)) { + // Adjust this recipe to suit special item + aMaxParallelRecipes = aBehaviours.getMaxParallelRecipes(); + aEUPercent = aBehaviours.getEUPercent(); + aSpeedBonusPercent = aBehaviours.getSpeedBonusPercent(); + aOutputChanceRoll = aBehaviours.getOutputChanceRoll(); + break; + } + } + } + } + } if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { log("BAD RETURN - 2"); @@ -743,6 +1096,7 @@ GT_MetaTileEntity_MultiBlockBase { // -- Try not to fail after this point - inputs have already been consumed! -- + // Convert speed bonus to duration multiplier // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); @@ -835,7 +1189,7 @@ GT_MetaTileEntity_MultiBlockBase { log("GOOD RETURN - 1"); return true; -} + } @@ -932,10 +1286,10 @@ GT_MetaTileEntity_MultiBlockBase { ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { - + long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - + log("Running checkRecipeGeneric(0)"); GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( @@ -943,12 +1297,12 @@ GT_MetaTileEntity_MultiBlockBase { gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); log("Running checkRecipeGeneric(1)"); - + //First we check whether or not we have an input cached for boosting. //If not, we set it to the current recipe. //If we do, we compare it against the current recipe, if thy are the same, we try return a boosted recipe, if not, we boost a new recipe. boolean isRecipeInputTheSame = false; - + //No cached recipe inputs, assume first run. if (mInputVerificationForBoosting == null) { mInputVerificationForBoosting = tRecipe.mInputs; @@ -963,7 +1317,7 @@ GT_MetaTileEntity_MultiBlockBase { isRecipeInputTheSame = false; } } - + //Inputs are the same, let's see if there's a boosted version. if (isRecipeInputTheSame) { //Yes, let's just set that as the recipe @@ -999,14 +1353,14 @@ GT_MetaTileEntity_MultiBlockBase { mHasBoostedCurrentRecipe = false; } } - + //Bad modify, let's just use the original recipe. if (!mHasBoostedCurrentRecipe || mBoostedRecipe == null) { tRecipe = aRecipe != null ? aRecipe : findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); } - + // Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; @@ -1188,6 +1542,7 @@ GT_MetaTileEntity_MultiBlockBase { this.mChargeHatches.clear(); this.mDischargeHatches.clear(); this.mControlCoreBus.clear(); + this.mAirIntakes.clear(); this.mMultiDynamoHatches.clear(); } } @@ -1252,22 +1607,22 @@ GT_MetaTileEntity_MultiBlockBase { ItemStack guiSlot = this.mInventory[1]; return guiSlot; } - + protected boolean setGUIItemStack(ItemStack aNewGuiSlotContents) { boolean result = false; if (this.mInventory[1] == null) { this.mInventory[1] = aNewGuiSlotContents != null ? aNewGuiSlotContents.copy() : null; - aNewGuiSlotContents = null; + this.depleteInput(aNewGuiSlotContents); this.updateSlots(); result = true; } return result; } - + protected boolean clearGUIItemSlot() { return setGUIItemStack(null); } - + public ItemStack findItemInInventory(Item aSearchStack) { return findItemInInventory(aSearchStack, 0); @@ -1276,7 +1631,7 @@ GT_MetaTileEntity_MultiBlockBase { public ItemStack findItemInInventory(Item aSearchStack, int aMeta) { return findItemInInventory(ItemUtils.simpleMetaStack(aSearchStack, aMeta, 1)); } - + public ItemStack findItemInInventory(ItemStack aSearchStack) { if (aSearchStack != null && this.mInputBusses.size() > 0) { for (GT_MetaTileEntity_Hatch_InputBus bus : this.mInputBusses) { @@ -1325,54 +1680,63 @@ GT_MetaTileEntity_MultiBlockBase { public boolean causeMaintenanceIssue() { boolean b = false; switch (this.getBaseMetaTileEntity().getRandomNumber(6)) { - case 0 : { - this.mWrench = false; - b = true; - break; - } - case 1 : { - this.mScrewdriver = false; - b = true; - break; - } - case 2 : { - this.mSoftHammer = false; - b = true; - break; - } - case 3 : { - this.mHardHammer = false; - b = true; - break; - } - case 4 : { - this.mSolderingTool = false; - b = true; - break; - } - case 5 : { - this.mCrowbar = false; - b = true; - break; - } + case 0 : { + this.mWrench = false; + b = true; + break; + } + case 1 : { + this.mScrewdriver = false; + b = true; + break; + } + case 2 : { + this.mSoftHammer = false; + b = true; + break; + } + case 3 : { + this.mHardHammer = false; + b = true; + break; + } + case 4 : { + this.mSolderingTool = false; + b = true; + break; + } + case 5 : { + this.mCrowbar = false; + b = true; + break; + } } return b; } + public void fixAllMaintenanceIssue() { + this.mCrowbar = true; + this.mWrench = true; + this.mHardHammer = true; + this.mSoftHammer = true; + this.mSolderingTool = true; + this.mScrewdriver = true; + } + public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IMetaTileEntity aTileEntity, final int aBaseCasingIndex) { if (aTileEntity == null) { return false; } - + //Check type /* * Class <?> aHatchType = ReflectionUtils.getTypeOfGenericObject(aList); if * (!aHatchType.isInstance(aTileEntity)) { return false; } */ - - + + if (aList.isEmpty()) { if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { @@ -1387,13 +1751,15 @@ GT_MetaTileEntity_MultiBlockBase { boolean aExists = false; for (E m : aList) { IGregTechTileEntity b = ((IMetaTileEntity) m).getBaseMetaTileEntity(); - BlockPos aPos = new BlockPos(b); - if (b != null && aPos != null) { - if (aCurPos.equals(aPos)) { - if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { - log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); + if (b != null) { + BlockPos aPos = new BlockPos(b); + if (aPos != null) { + if (aCurPos.equals(aPos)) { + if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { + log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); + } + return false; } - return false; } } } @@ -1546,6 +1912,20 @@ GT_MetaTileEntity_MultiBlockBase { return addToMachineList(aTileEntity, aBaseCasingIndex); } + public boolean addAirIntakeToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_AirIntake) { + this.mAirIntakes.add((GT_MetaTileEntity_Hatch_AirIntake)aMetaTileEntity); + } + return addToMachineList(aTileEntity, aBaseCasingIndex); + } + public boolean addFluidInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) { if (aTileEntity == null) { return false; @@ -1569,6 +1949,10 @@ GT_MetaTileEntity_MultiBlockBase { return false; } + public boolean clearRecipeMapForAllInputHatches() { + return resetRecipeMapForAllInputHatches(null); + } + public boolean resetRecipeMapForAllInputHatches() { return resetRecipeMapForAllInputHatches(this.getRecipeMap()); } @@ -1588,17 +1972,22 @@ GT_MetaTileEntity_MultiBlockBase { return cleared > 0; } public boolean resetRecipeMapForHatch(IGregTechTileEntity aTileEntity, GT_Recipe_Map aMap) { - if (aTileEntity == null) { - return false; - } - final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();; - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { - return resetRecipeMapForHatch((GT_MetaTileEntity_Hatch)aMetaTileEntity, aMap); + try { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + return resetRecipeMapForHatch((GT_MetaTileEntity_Hatch)aMetaTileEntity, aMap); + } + else { + return false; + } } - else { + catch (Throwable t) { return false; } } @@ -1611,12 +2000,23 @@ GT_MetaTileEntity_MultiBlockBase { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input || aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input){ ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = null; - ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = aMap; - log("Remapped Input Hatch to "+aMap.mNEIName); + ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = aMap; + if (aMap != null && aMap.mNEIName != null) { + log("Remapped Input Hatch to "+aMap.mNEIName+"."); + } + else { + log("Cleared Input Hatch."); + } } else { ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = null; - ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = aMap; + ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = aMap; + if (aMap != null && aMap.mNEIName != null) { + log("Remapped Input Bus to "+aMap.mNEIName+"."); + } + else { + log("Cleared Input Bus."); + } } return true; } @@ -1628,8 +2028,9 @@ GT_MetaTileEntity_MultiBlockBase { @Override public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); - resetRecipeMapForAllInputHatches(); + clearRecipeMapForAllInputHatches(); onModeChangeByScrewdriver(aSide, aPlayer, aX, aY, aZ); + resetRecipeMapForAllInputHatches(); } public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { @@ -1745,7 +2146,7 @@ GT_MetaTileEntity_MultiBlockBase { @SuppressWarnings("rawtypes") public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ - Class mDynamoClass; + Class<?> mDynamoClass; mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); if (mDynamoClass != null){ if (mDynamoClass.isInstance(aMetaTileEntity)){ @@ -1784,20 +2185,16 @@ GT_MetaTileEntity_MultiBlockBase { } } - private static Method calculatePollutionReduction; + private static Method calculatePollutionReduction = null; public int calculatePollutionReductionForHatch(GT_MetaTileEntity_Hatch_Muffler i , int g) { - if (calculatePollutionReduction == null) { + if (calculatePollutionReduction != null) { try { - calculatePollutionReduction = i.getClass().getDeclaredMethod("calculatePollutionReduction", int.class); - } catch (NoSuchMethodException | SecurityException e) { - calculatePollutionReduction = null; + return (int) calculatePollutionReduction.invoke(i, g); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } - } - try { - return (int) calculatePollutionReduction.invoke(i, g); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - return 0; } + return 0; } @Override @@ -2104,6 +2501,59 @@ GT_MetaTileEntity_MultiBlockBase { return false; } + @Override + public boolean depleteInput(final FluidStack aLiquid) { + if (aLiquid == null) { + return false; + } + for (final GT_MetaTileEntity_Hatch_Input tHatch : this.mInputHatches) { + tHatch.mRecipeMap = this.getRecipeMap(); + if (isValidMetaTileEntity(tHatch)) { + FluidStack tLiquid = tHatch.getFluid(); + if (tLiquid == null || !tLiquid.isFluidEqual(aLiquid) || tLiquid.amount < aLiquid.amount) { + continue; + } + tLiquid = tHatch.drain(aLiquid.amount, false); + if (tLiquid != null && tLiquid.amount >= aLiquid.amount) { + tLiquid = tHatch.drain(aLiquid.amount, true); + return tLiquid != null && tLiquid.amount >= aLiquid.amount; + } + continue; + } + } + return false; + } + + @Override + public void onServerStart() { + super.onServerStart(); + tryTickWaitTimerDown(); + } + + @Override + public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { + super.onFirstTick(aBaseMetaTileEntity); + tryTickWaitTimerDown(); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + tryTickWaitTimerDown(); + } + + @Override + public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { + super.onCreated(aStack, aWorld, aPlayer); + tryTickWaitTimerDown(); + } + + private final void tryTickWaitTimerDown() { + /*if (mStartUpCheck > 10) { + mStartUpCheck = 10; + }*/ + } + diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java index afdf36f930..10909081d1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockRequirements.java @@ -2,35 +2,22 @@ package gtPlusPlus.xmod.gregtech.api.objects; public class MultiblockRequirements { - public final int mInputBusMinimum; - public final int mInputHatchMinimum; + public int mInputBusMinimum = 0; + public int mInputHatchMinimum = 0; - public final int mOutputBusMinimum; - public final int mOutputHatchMinimum; + public int mOutputBusMinimum = 0; + public int mOutputHatchMinimum = 0; - public final int mMaintMinimum; + public int mMaintMinimum = 1; - public final int mEnergyHatchMinimum; - public final int mDynamoHatchMinimum; + public int mEnergyHatchMinimum = 1; + public int mDynamoHatchMinimum = 0; - public final MultiblockBlueprint mBlueprint; - - public static final int mControlCoreMinimum = 1; + public final int mMinimumCasingCount; - /** - * - * @param aInputBusses - * @param aOutputBusses - * @param aInputHatches - * @param aOutputHatches - * @param aEnergyHatches - * @param aDynamoHatches - * @param aBlueprint - A data object containing the structural data for this Multiblock - */ - public MultiblockRequirements(final int aInputBusses, final int aOutputBusses, final int aInputHatches, final int aOutputHatches, final int aEnergyHatches, final int aDynamoHatches, final MultiblockBlueprint aBlueprint) { - this(aInputBusses, aOutputBusses, aInputHatches, aOutputHatches, aEnergyHatches, aDynamoHatches, 1, aBlueprint); - } + public final MultiblockBlueprint mBlueprint; + //public static final int mControlCoreMinimum = 1; /** * * @param aInputBusses @@ -42,15 +29,80 @@ public class MultiblockRequirements { * @param aMaintHatches * @param aBlueprint - A data object containing the structural data for this Multiblock */ - public MultiblockRequirements(final int aInputBusses, final int aOutputBusses, final int aInputHatches, final int aOutputHatches, final int aEnergyHatches, final int aDynamoHatches, final int aMaintHatches, final MultiblockBlueprint aBlueprint) { - mInputBusMinimum = aInputBusses; - mOutputBusMinimum = aOutputBusses; - mInputHatchMinimum = aInputHatches; - mOutputHatchMinimum = aOutputHatches; - mEnergyHatchMinimum = aEnergyHatches; - mDynamoHatchMinimum = aDynamoHatches; - mMaintMinimum = aMaintHatches; + public MultiblockRequirements(int aCasingCount, MultiblockBlueprint aBlueprint) { + mMinimumCasingCount = aCasingCount; mBlueprint = aBlueprint; + } + + public final int getInputBusMinimum() { + return this.mInputBusMinimum; + } + + public final MultiblockRequirements setInputBusMinimum(int mInputBusMinimum) { + this.mInputBusMinimum = mInputBusMinimum; + return this; + } + + public final int getInputHatchMinimum() { + return this.mInputHatchMinimum; + } + + public final MultiblockRequirements setInputHatchMinimum(int mInputHatchMinimum) { + this.mInputHatchMinimum = mInputHatchMinimum; + return this; + } + + public final int getOutputBusMinimum() { + return this.mOutputBusMinimum; + } + + public final MultiblockRequirements setOutputBusMinimum(int mOutputBusMinimum) { + this.mOutputBusMinimum = mOutputBusMinimum; + return this; + } + + public final int getOutputHatchMinimum() { + return this.mOutputHatchMinimum; + } + + public final MultiblockRequirements setOutputHatchMinimum(int mOutputHatchMinimum) { + this.mOutputHatchMinimum = mOutputHatchMinimum; + return this; + } + + public final int getMaintMinimum() { + return this.mMaintMinimum; + } + + public final MultiblockRequirements setMaintMinimum(int mMaintMinimum) { + this.mMaintMinimum = mMaintMinimum; + return this; + } + + public final int getEnergyHatchMinimum() { + return this.mEnergyHatchMinimum; + } + + public final MultiblockRequirements setEnergyHatchMinimum(int mEnergyHatchMinimum) { + this.mEnergyHatchMinimum = mEnergyHatchMinimum; + return this; + } + + public final int getDynamoHatchMinimum() { + return this.mDynamoHatchMinimum; + } + + public final MultiblockRequirements setDynamoHatchMinimum(int mDynamoHatchMinimum) { + this.mDynamoHatchMinimum = mDynamoHatchMinimum; + return this; + } + + public final MultiblockBlueprint getBlueprint() { + return this.mBlueprint; + } + + public final int getMinimumCasingCount() { + return this.mMinimumCasingCount; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java new file mode 100644 index 0000000000..74655fb744 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/util/SpecialBehaviourTooltipHandler.java @@ -0,0 +1,35 @@ +package gtPlusPlus.xmod.gregtech.api.util; + +import java.util.HashMap; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gregtech.api.util.GT_Utility; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +public class SpecialBehaviourTooltipHandler { + + private static final HashMap<ItemStack, String> mTooltipCache = new HashMap<ItemStack, String>(); + + public static void addTooltipForItem(ItemStack aStack, String aTooltip) { + mTooltipCache.put(aStack, aTooltip); + } + + @SubscribeEvent + public void onItemTooltip(ItemTooltipEvent event){ + if (event != null) { + if (event.itemStack != null) { + for (ItemStack aKey : mTooltipCache.keySet()) { + if (GT_Utility.areStacksEqual(aKey, event.itemStack, false)) { + String s = mTooltipCache.get(aKey); + if (s != null && s.length() > 0) { + event.toolTip.add(EnumChatFormatting.RED+s); + } + } + } + } + } + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java index c8a7b5119d..ca78a72e04 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Boulder.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.world; import java.util.Collection; import java.util.Random; +import gtPlusPlus.core.lib.CORE; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.util.MathHelper; @@ -21,7 +22,7 @@ public class GTPP_Worldgen_Boulder extends GTPP_Worldgen_Ore { int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); Block tBlock = aWorld.getBlock(tX, tY - 7, tZ); if (tBlock != null && tBlock.isOpaqueCube() && aWorld.getBlock(tX, tY - 6, tZ).isAir(aWorld, tX, tY - 6, tZ)) { - float math_pi = 3.141593F; + float math_pi = CORE.PI; float var6 = aRandom.nextFloat() * math_pi; float var1b = mSize / 8.0F; float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java index 9d7eb5a020..e66106ad4a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/world/GTPP_Worldgen_Ore_Normal.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.api.world; import java.util.Collection; import java.util.Random; +import gtPlusPlus.core.lib.CORE; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; @@ -20,7 +21,7 @@ public class GTPP_Worldgen_Ore_Normal extends GTPP_Worldgen_Ore { for (int i = 0; i < mAmount; i++) { int tX = aChunkX + aRandom.nextInt(16), tY = mMinY + aRandom.nextInt(mMaxY - mMinY), tZ = aChunkZ + aRandom.nextInt(16); if (mAllowToGenerateinVoid || aWorld.getBlock(tX, tY, tZ).isAir(aWorld, tX, tY, tZ)) { - float math_pi = 3.141593F;float var1b = mSize / 8.0F; + float math_pi = CORE.PI;float var1b = mSize / 8.0F; float var6 = aRandom.nextFloat() * math_pi; float var3b = MathHelper.sin(var6) * var1b; float var4b = MathHelper.cos(var6) * var1b; float var8b = -2*var3b;float var9b = -2*var4b; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 77f3a31020..430ae44d64 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -13,10 +13,12 @@ import java.util.Timer; import java.util.TimerTask; import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; @@ -32,11 +34,17 @@ import gtPlusPlus.api.objects.minecraft.FormattedTooltipString; import gtPlusPlus.core.handler.AchievementHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.LangUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE; +import gtPlusPlus.xmod.gregtech.common.covers.CoverManager; +import ic2.core.init.BlocksItems; +import ic2.core.init.InternalName; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -44,78 +52,172 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; public class Meta_GT_Proxy { static { - instance = new Meta_GT_Proxy(); Logger.INFO("GT_PROXY - initialized."); } - - public static final Meta_GT_Proxy instance; - + public static List<Runnable> GT_BlockIconload = new ArrayList<>(); public static List<Runnable> GT_ItemIconload = new ArrayList<>(); - + public static AutoMap<Integer> GT_ValidHeatingCoilMetas = new AutoMap<Integer>(); - private static Class sBaseMetaTileEntityClass; - private static Class sBaseMetaTileEntityClass2; - + private static Class<BaseCustomTileEntity> sBaseMetaTileEntityClass; + private static Class<BaseCustomPower_MTE> sBaseMetaTileEntityClass2; + public static AchievementHandler mAssemblyAchievements; - + public static final Map<String, FormattedTooltipString> mCustomGregtechMetaTooltips = new LinkedHashMap<String, FormattedTooltipString>(); - + @SideOnly(Side.CLIENT) public static IIconRegister sBlockIcons, sItemIcons; public Meta_GT_Proxy() { - + } - + public static Block sBlockMachines; - - public void preInit() { - + + public static void preInit() { + //New GT++ Block, yay! (Progress) //sBlockMachines = new GTPP_Block_Machines(); - - GT_Log.out.println("GT++ Mod: Register TileEntities."); - BaseMetaTileEntity tBaseMetaTileEntity = constructBaseMetaTileEntity(); - BaseMetaTileEntity tBaseMetaTileEntity2 = constructBaseMetaTileEntityCustomPower(); - - GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity."); - if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) { - GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); - throw new RuntimeException(""); - } - - //Gotta set it here so that we don't try call gregtech too early. - //Must set on the correct side - StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe"); - - - GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity."); - GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); - GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2"); + fixIC2FluidNames(); + + GT_Log.out.println("GT++ Mod: Register TileEntities."); + BaseMetaTileEntity tBaseMetaTileEntity = constructBaseMetaTileEntity(); + BaseMetaTileEntity tBaseMetaTileEntity2 = constructBaseMetaTileEntityCustomPower(); + + GT_Log.out.println("GT++ Mod: Testing BaseMetaTileEntity."); + if (tBaseMetaTileEntity == null || tBaseMetaTileEntity2 == null) { + GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + throw new RuntimeException(""); + } + + //Gotta set it here so that we don't try call gregtech too early. + //Must set on the correct side + + if (ReflectionUtils.doesFieldExist(GT_Proxy.class, "gt6Pipe")) { + StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy("gt6Pipe"); + } + else { + StaticFields59.mGT6StylePipes = false; + } + + GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity."); + GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); + GameRegistry.registerTileEntity(tBaseMetaTileEntity2.getClass(), "BaseMetaTileEntity_GTPP2"); + CoverManager.generateCustomCovers(); } - - public void init() { + + public static void init() { scheduleCoverMapCleaner(); setValidHeatingCoilMetas(); + PollutionUtils.setPollutionFluids(); + fixIC2FluidNames(); + } + + public static void postInit() { + mAssemblyAchievements = new AchievementHandler(); + fixIC2FluidNames(); } - - public void postInit() { - mAssemblyAchievements = new AchievementHandler(); + + @SuppressWarnings("deprecation") + public static void fixIC2FluidNames() { + //Fix IC2 Hot Water name + try { + String aNewHeatedWaterName = "Heated Water"; + Logger.INFO("Renaming [IC2 Hotspring Water] --> ["+aNewHeatedWaterName+"].");LanguageRegistry.instance().addStringLocalization("fluidHotWater", "Heated Water"); + LanguageRegistry.instance().addStringLocalization("fluidHotWater", aNewHeatedWaterName); + LanguageRegistry.instance().addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName); + + Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater); + if (b != null) { + LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName); + LanguageRegistry.instance().addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName); + } + Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater); + if (f != null) { + LanguageRegistry.instance().addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); + GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName); + int aDam = FluidRegistry.getFluidID(f); + ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam); + if (s != null) { + LanguageRegistry.addName(s, aNewHeatedWaterName); + } + } + + String[] aLangs = new String[] { + "de_DE", + "en_US", + "en_GB", + "en_IC", + "es_AR", + "es_ES", + "es_MX", + "es_UY", + "es_VE", + "fr_CA", + "fr_FR", + "it_IT", + "ko_KR", + "pt_BR", + "pt_PT", + "ru_RU", + "sv_SE", + "tr_TR", + "zh_CN", + "zh_TW", + }; + String[] aLangValues = new String[] { + "Erhitztes Wasser", + "Heated Water", + "Heated Water", + "Heated Water", + "Agua caliente", + "Agua caliente", + "Agua caliente", + "Agua caliente", + "Agua caliente", + "Eau chauffée", + "Eau chauffée", + "Acqua riscaldata", + "온수", + "Água aquecida", + "Água aquecida", + "Вода с подогревом", + "Uppvärmt vatten", + "Isıtılmış Su", + "热水", + "热水", + + }; + for (int i=0;i<aLangs.length;i++) { + Logger.REFLECTION("Trying to inject new lang data for "+aLangs[i]+", using value: "+aLangValues[i]); + LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "fluidHotWater", aLangValues[i]); + LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "ic2.fluidHotWater", aLangValues[i]); + } + } + + catch (Throwable t) { + + } } - + public static boolean generatePlasmaRecipesForAdvVacFreezer() { - + AutoMap<Recipe_GT> aFreezerMapRebaked = new AutoMap<Recipe_GT>(); AutoMap<Recipe_GT> aRemovedRecipes = new AutoMap<Recipe_GT>(); - + //Find recipes containing Plasma and map them for (Recipe_GT y : Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList) { if (y.mFluidInputs.length > 0) { @@ -128,20 +230,20 @@ public class Meta_GT_Proxy { aFreezerMapRebaked.put(y); } } - + AutoMap<Recipe_GT> aNewRecipes = new AutoMap<Recipe_GT>(); int aAtomicMass = 0; int aAtomicTier = 0; - + final FluidStack NULL_PLASMA = Materials._NULL.getPlasma(1); - + for (String s : ELEMENT.NAMES) { - + aAtomicMass++; aAtomicTier = (aAtomicMass/30)+1; FluidStack aMoltenFluid = null; FluidStack aPlasma = null; - + //Try Get Material via Gregtech Materials aGregMaterial = MaterialUtils.getMaterial(s); if (aGregMaterial != null) { @@ -157,7 +259,7 @@ public class Meta_GT_Proxy { } aPlasma = aGregMaterial.getPlasma(100); } - + //Just wildcard values if (aMoltenFluid == null || aPlasma == null) { if (aMoltenFluid == null) { @@ -167,7 +269,7 @@ public class Meta_GT_Proxy { aPlasma = FluidUtils.getFluidStack("plasma."+s.toLowerCase(), 1); } } - + //Skip this material if (aMoltenFluid == null || aPlasma == null || aPlasma.isFluidEqual(NULL_PLASMA)) { Logger.INFO("Could not generate Advanced Vacuum Freezer recipe. Cooling "+s+" plasma. Molten Form Exists? "+(aMoltenFluid != null)+" | Plasma Exists? "+(aPlasma != null)); @@ -182,49 +284,49 @@ public class Meta_GT_Proxy { null, new int[] {10000}, new FluidStack[] { - aPlasma, - FluidUtils.getFluidStack("cryotheum", aTotalTickTime) - }, + aPlasma, + FluidUtils.getFluidStack("cryotheum", aTotalTickTime) + }, new FluidStack[] { - aMoltenFluid - }, + aMoltenFluid + }, aTotalTickTime, (int) GT_Values.V[4+aAtomicTier], aAtomicMass); - + //Add it to the map if it's valid if (aTempRecipe != null) { aNewRecipes.put(aTempRecipe); } } - + } - + //Add the new recipes to the map we will rebake over the original for (Recipe_GT w : aNewRecipes) { aFreezerMapRebaked.put(w); } - + //Best not touch the original map if we don't have a valid map to override it with. if (aFreezerMapRebaked.size() > 0) { - + int aOriginalCount = Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList.size(); - + //Empty the original map Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList.clear(); - + //Rebake the real map for (Recipe_GT w : aFreezerMapRebaked) { Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList.add(w); } - + return Recipe_GT.Gregtech_Recipe_Map.sAdvFreezerRecipes.mRecipeList.size() >= aOriginalCount; } - + return false; } - + public static TileEntity constructCustomGregtechMetaTileEntityByMeta(int aMeta) { if (aMeta == 12) { return Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower(); @@ -233,7 +335,7 @@ public class Meta_GT_Proxy { return Meta_GT_Proxy.constructBaseMetaTileEntity(); } } - + public static BaseCustomTileEntity constructBaseMetaTileEntity() { if (sBaseMetaTileEntityClass == null) { try { @@ -260,7 +362,7 @@ public class Meta_GT_Proxy { } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException e) { GT_Log.err - .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); e.printStackTrace(GT_Log.err); throw new RuntimeException(e); } @@ -295,21 +397,21 @@ public class Meta_GT_Proxy { } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException e) { GT_Log.err - .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); + .println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); e.printStackTrace(GT_Log.err); throw new RuntimeException(e); } } } - - - - - - - - - public void setValidHeatingCoilMetas() { + + + + + + + + + public static void setValidHeatingCoilMetas() { for (int i = 0; i <= 6; i++ ) { GT_ValidHeatingCoilMetas.put(i); } @@ -332,26 +434,27 @@ public class Meta_GT_Proxy { return false; } } - - - public void scheduleCoverMapCleaner(){ - TimerTask repeatedTask = new TimerTask() { - public void run() { - cleanupOverFlowCoverCache(); - } - }; - Timer timer = new Timer("CoverCleanupManager"); - long delay = 120000L; - long period = 300000L; - timer.scheduleAtFixedRate(repeatedTask, delay, period); + + + public static void scheduleCoverMapCleaner(){ + TimerTask repeatedTask = new TimerTask() { + public void run() { + cleanupOverFlowCoverCache(); + } + }; + Timer timer = new Timer("CoverCleanupManager"); + long delay = 120000L; + long period = 300000L; + timer.scheduleAtFixedRate(repeatedTask, delay, period); } - + public static int cleanupOverFlowCoverCache() { ObjMap<String, ?> cache = mOverflowCache; int aRemoved = 0; long aCurrentTime = System.currentTimeMillis()/1000; for (Object o : cache.values()) { if (o != null && o instanceof HashMap) { + @SuppressWarnings("unchecked") HashMap<String, Object> m = (HashMap<String, Object>) o; if (m != null) { String s = (String) m.get("aCoverKey"); @@ -371,57 +474,57 @@ public class Meta_GT_Proxy { } return aRemoved; } - - + + static GT_Proxy[] mProxies = new GT_Proxy[2]; /** * @deprecated Use {@link StaticFields59#getFieldFromGregtechProxy(boolean,String)} instead */ public static Object getFieldFromGregtechProxy(boolean client, String fieldName) { - return StaticFields59.getFieldFromGregtechProxy(fieldName); + return StaticFields59.getFieldFromGregtechProxy(client, fieldName); } - - public void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { + + public static void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { mCustomGregtechMetaTooltips.put(aNbtTagName, aData); } - - public static void conStructGtTileBlockTooltip(ItemStack aStack, EntityPlayer aPlayer, List<Object> aList, boolean par4) { - try { - int tDamage = aStack.getItemDamage(); - if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) { - return; - } - - if (GregTech_API.METATILEENTITIES[tDamage] != null) { - IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity(); - if (tTileEntity.getDescription() != null) { - int i = 0; - for (String tDescription : tTileEntity.getDescription()) { - if (GT_Utility.isStringValid(tDescription)) { - if(tDescription.contains("%%%")){ - String[] tString = tDescription.split("%%%"); - if(tString.length>=2){ - StringBuffer tBuffer = new StringBuffer(); - Object tRep[] = new String[tString.length / 2]; - for (int j = 0; j < tString.length; j++) - if (j % 2 == 0) tBuffer.append(tString[j]); - else {tBuffer.append(" %s"); tRep[j / 2] = tString[j];} - aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished), tRep)); - } - }else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished ); - aList.add(tTranslated.equals("") ? tDescription : tTranslated);} - }else i++; - } - } - + + public static void conStructGtTileBlockTooltip(ItemStack aStack, EntityPlayer aPlayer, List<Object> aList, boolean par4) { + try { + int tDamage = aStack.getItemDamage(); + if ((tDamage <= 0) || (tDamage >= GregTech_API.METATILEENTITIES.length)) { + return; + } + + if (GregTech_API.METATILEENTITIES[tDamage] != null) { + IGregTechTileEntity tTileEntity = GregTech_API.METATILEENTITIES[tDamage].getBaseMetaTileEntity(); + if (tTileEntity.getDescription() != null) { + int i = 0; + for (String tDescription : tTileEntity.getDescription()) { + if (GT_Utility.isStringValid(tDescription)) { + if(tDescription.contains("%%%")){ + String[] tString = tDescription.split("%%%"); + if(tString.length>=2){ + StringBuffer tBuffer = new StringBuffer(); + Object tRep[] = new String[tString.length / 2]; + for (int j = 0; j < tString.length; j++) + if (j % 2 == 0) tBuffer.append(tString[j]); + else {tBuffer.append(" %s"); tRep[j / 2] = tString[j];} + aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished), tRep)); + } + }else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished ); + aList.add(tTranslated.equals("") ? tDescription : tTranslated);} + }else i++; + } + } + if (tTileEntity.getEUCapacity() > 0L) { final long tVoltage = tTileEntity.getInputVoltage(); byte tTier = (byte) ((byte) Math.max(1, GT_Utility.getTier(tVoltage))); - + //Custom handling if (tDamage < 30500 && tDamage >= 30400) { int aOffset = tDamage - 30400; @@ -434,13 +537,13 @@ public class Meta_GT_Proxy { aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Breaker_Loss", "Breaker Loss: "+EnumChatFormatting.RED+""+(GT_Values.V[Math.max(tTier-1, 0)]/10)+EnumChatFormatting.GRAY+" EU/t", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); } - + aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Special_Power_1", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_2", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); //aList.add(GT_LanguageManager.addStringLocalization("TileEntity_BreakerBox_3", EnumChatFormatting.RED+"Special Power Handling, please read manual", !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); } - - + + if (tTileEntity.getInputVoltage() > 0L) { String inA = "0"; if (tTileEntity.getInputAmperage() >= 1L) { @@ -468,20 +571,20 @@ public class Meta_GT_Proxy { + EnumChatFormatting.GRAY + outA; aList.add(a1); } - + if (tTileEntity.getOutputVoltage() > 0L) { aList.add(GT_LanguageManager.addStringLocalization("TileEntity_Lossess_EU", "Transmission Loss: "+EnumChatFormatting.DARK_BLUE+""+(tDamage < 30500 && tDamage >= 30400 ? 0 : 1), !GregTech_API.sPostloadFinished) + EnumChatFormatting.GRAY); } - + if (tTileEntity.getEUCapacity() > 0) { aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE2", "Internal Capacity: ", !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY + " EU"); } } - - /*if (tTileEntity.getEUCapacity() > 0L) { + + /*if (tTileEntity.getEUCapacity() > 0L) { if (tTileEntity.getInputVoltage() > 0L) { aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_IN", "Voltage IN: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.GREEN + tTileEntity.getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(tTileEntity.getInputVoltage())] + ")" + EnumChatFormatting.GRAY); } @@ -493,42 +596,42 @@ public class Meta_GT_Proxy { } aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished ) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY); }*/ - - } - NBTTagCompound aNBT = aStack.getTagCompound(); - if (aNBT != null) { - if (aNBT.getBoolean("mMuffler")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished )); - } - if (aNBT.getBoolean("mSteamConverter")) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished )); - } - int tAmount = 0; - if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { - aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished )); - } - - FluidStack afluid = net.minecraftforge.fluids.FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); - if (afluid != null) { - int tFluidAmount = afluid.amount; - if (tFluidAmount > 0) { - aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_FLUIDTANK", "Tank Fluid: "+tFluidAmount+"L "+afluid.getLocalizedName()+"", !GregTech_API.sPostloadFinished )); - } - } - - } - - //Add Custom Here - - //Add Custom Tooltips - for (String s : mCustomGregtechMetaTooltips.keySet()) { - if (aNBT.hasKey(s)) { - String aTip = mCustomGregtechMetaTooltips.get(s).getTooltip(aNBT.getString(s)); - aList.add(aTip); - } - } - - //Add GT++ Stuff + + } + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + if (aNBT.getBoolean("mMuffler")) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_MUFFLER", "has Muffler Upgrade", !GregTech_API.sPostloadFinished )); + } + if (aNBT.getBoolean("mSteamConverter")) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMCONVERTER", "has Steam Upgrade", !GregTech_API.sPostloadFinished )); + } + int tAmount = 0; + if ((tAmount = aNBT.getByte("mSteamTanks")) > 0) { + aList.add(tAmount + " " + GT_LanguageManager.addStringLocalization("GT_TileEntity_STEAMTANKS", "Steam Tank Upgrades", !GregTech_API.sPostloadFinished )); + } + + FluidStack afluid = net.minecraftforge.fluids.FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); + if (afluid != null) { + int tFluidAmount = afluid.amount; + if (tFluidAmount > 0) { + aList.add(GT_LanguageManager.addStringLocalization("GT_TileEntity_FLUIDTANK", "Tank Fluid: "+tFluidAmount+"L "+afluid.getLocalizedName()+"", !GregTech_API.sPostloadFinished )); + } + } + + } + + //Add Custom Here + + //Add Custom Tooltips + for (String s : mCustomGregtechMetaTooltips.keySet()) { + if (aNBT.hasKey(s)) { + String aTip = mCustomGregtechMetaTooltips.get(s).getTooltip(aNBT.getString(s)); + aList.add(aTip); + } + } + + //Add GT++ Stuff if (tDamage >= 30400 && tDamage < 30500) { aList.add(EnumChatFormatting.UNDERLINE+"Special GT++ Machine"); @@ -536,11 +639,11 @@ public class Meta_GT_Proxy { if ((tDamage >= 750 && tDamage < 1000) || (tDamage >= 30000 && tDamage < 31000)) { aList.add(CORE.GT_Tooltip); } - - - } catch (Throwable e) { - e.printStackTrace(GT_Log.err); - } - } + + + } catch (Throwable e) { + e.printStackTrace(GT_Log.err); + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 9c552db3ad..814ed589f0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -18,6 +18,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; @@ -37,6 +38,7 @@ public class StaticFields59 { public static final Field mPreventableComponents; public static final Field mDisabledItems; public static final Field mMultiblockChemicalRecipes; + public static final Field mPyrolyseRecipes; public static final Field mDescriptionArray; public static final Field mCasingTexturePages; public static final Field mAssLineVisualMapNEI; @@ -79,8 +81,16 @@ public class StaticFields59 { } sAssemblylineVisualRecipes = aTemp; + mMultiblockChemicalRecipes = getField(GT_Recipe_Map.class, "sMultiblockChemicalRecipes"); - Logger.INFO("[SH] Got Field: sMultiblockChemicalRecipes"); + Logger.INFO("[SH] Got Field: sMultiblockChemicalRecipes"); + if (ReflectionUtils.doesFieldExist(GT_Recipe.GT_Recipe_Map.class, "sPyrolyseRecipes")) { + mPyrolyseRecipes = getField(GT_Recipe_Map.class, "sPyrolyseRecipes"); + Logger.INFO("[SH] Got Field: sPyrolyseRecipes"); + } + else { + mPyrolyseRecipes = null; + } mCalculatePollutionReduction = getMethod(GT_MetaTileEntity_Hatch_Muffler.class, "calculatePollutionReduction", int.class); @@ -148,6 +158,14 @@ public class StaticFields59 { } } + public static synchronized final GT_Recipe_Map getPyrolyseRecipeMap() { + try { + return mPyrolyseRecipes != null ? (GT_Recipe_Map) mPyrolyseRecipes.get(null) : null; + } catch (IllegalArgumentException | IllegalAccessException e) { + return null; + } + } + public static Materials getMaterial(String aMaterialName) { Materials m = mMaterialCache.get(aMaterialName); if (m != null) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java index c62d47e904..01f655c355 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GTPP_Block_Machines.java @@ -15,13 +15,13 @@ import gregtech.api.items.GT_Generic_Block; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.BaseTileEntity; -import gregtech.api.objects.XSTR; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Item_Machines; import gregtech.common.blocks.GT_Material_Machines; import gregtech.common.render.GT_Renderer_Block; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.render.GTPP_Render_MachineBlock; import net.minecraft.block.Block; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java index 4c534eb7bb..8e6a55c9c5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java @@ -66,6 +66,7 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Volcanus Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", "Fusion Machine Casing MK III"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", "Advanced Fusion Coil"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", "Unnamed"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Containment Casing"); GregtechItemList.Casing_FishPond.set(new ItemStack(this, 1, 0)); GregtechItemList.Casing_Extruder.set(new ItemStack(this, 1, 1)); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java index 5116632cf1..b624649789 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java @@ -35,7 +35,7 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Low Pressure Turbine Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "High Pressure Turbine Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Vacuum Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Turbodyne Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); @@ -51,8 +51,8 @@ extends GregtechMetaCasingBlocksAbstract { GregtechItemList.Casing_Turbine_LP.set(new ItemStack(this, 1, 8)); GregtechItemList.Casing_Turbine_HP.set(new ItemStack(this, 1, 9)); GregtechItemList.Casing_Vacuum_Furnace.set(new ItemStack(this, 1, 10)); - /*GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11)); - GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12)); + GregtechItemList.Casing_RocketEngine.set(new ItemStack(this, 1, 11)); + /*GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12)); GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13)); GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14)); GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.set(new ItemStack(this, 1, 15));*/ @@ -122,7 +122,7 @@ extends GregtechMetaCasingBlocksAbstract { //Multitank Exterior Casing case 11: - return TexturesGtBlock.Casing_Material_Tantalloy61.getIcon(); + return TexturesGtBlock.TEXTURE_CASING_ROCKETDYNE.getIcon(); //Reactor Casing I case 12: return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); @@ -138,7 +138,7 @@ extends GregtechMetaCasingBlocksAbstract { return TexturesGtBlock.Casing_Material_RedSteel.getIcon(); case 15: default: - return TexturesGtBlock.Overlay_UU_Matter.getIcon(); + return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index aaacbcd3a0..6cac1fddea 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -30,9 +30,15 @@ public class TexturesGtBlock { public static class CustomIcon implements IIconContainer, Runnable { protected IIcon mIcon; protected String mIconName; + protected String mModID; public CustomIcon(final String aIconName) { + this(CORE.MODID, aIconName); + } + + public CustomIcon(final String aModID, final String aIconName) { this.mIconName = aIconName; + this.mModID = aModID; mCustomiconMap.put(this); Logger.WARNING("Constructing a Custom Texture. " + this.mIconName); GregTech_API.sGTBlockIconload.add(this); @@ -50,7 +56,7 @@ public class TexturesGtBlock { @Override public void run() { - this.mIcon = GregTech_API.sBlockIcons.registerIcon(CORE.MODID + ":" + this.mIconName); + this.mIcon = GregTech_API.sBlockIcons.registerIcon(this.mModID + ":" + this.mIconName); Logger.WARNING("FIND ME _ Processing texture: "+this.getTextureFile().getResourcePath()); } @@ -273,6 +279,8 @@ public class TexturesGtBlock { public static final CustomIcon TEXTURE_CASING_AMAZON = new CustomIcon("TileEntities/CASING_AMAZON"); public static final CustomIcon TEXTURE_CASING_ADVANCED_CRYOGENIC = new CustomIcon("TileEntities/MACHINE_CASING_ADVANCED_CRYOGENIC"); public static final CustomIcon TEXTURE_CASING_ADVANCED_VOLCNUS = new CustomIcon("TileEntities/MACHINE_CASING_ADVANCED_VOLCANUS"); + public static final CustomIcon TEXTURE_CASING_ROCKETDYNE = new CustomIcon("TileEntities/MACHINE_CASING_ROCKETDYNE"); + public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II = new CustomIcon("iconsets/MACHINE_CASING_FUSION_3"); public static final CustomIcon TEXTURE_CASING_FUSION_COIL_II_INNER = new CustomIcon("iconsets/MACHINE_CASING_FUSION_COIL_II"); @@ -342,8 +350,13 @@ public class TexturesGtBlock { private static final CustomIcon Internal_Overlay_Machine_Controller_Advanced_Active = new CustomIcon("iconsets/OVERLAY_FRONT_ADVANCED_MULTIBLOCK_ANIMATED_ACTIVE"); public static final CustomIcon Overlay_Machine_Controller_Advanced_Active = Internal_Overlay_Machine_Controller_Advanced_Active; - - + //Fluid Reactor Overlays + public static final CustomIcon Overlay_FluidReactor_Front = new CustomIcon("TileEntities/FluidReactor/OVERLAY_FRONT"); + public static final CustomIcon Overlay_FluidReactor_Side = new CustomIcon("TileEntities/FluidReactor/OVERLAY_SIDE"); + public static final CustomIcon Overlay_FluidReactor_Top = new CustomIcon("TileEntities/FluidReactor/OVERLAY_TOP"); + public static final CustomIcon Overlay_FluidReactor_Front_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE"); + public static final CustomIcon Overlay_FluidReactor_Side_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE"); + public static final CustomIcon Overlay_FluidReactor_Top_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE"); //Crafting Overlays private static final CustomIcon Internal_Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting"); @@ -555,10 +568,7 @@ public class TexturesGtBlock { - public static Object Casing_Material_Turbine; - - - + public static Object Casing_Material_Turbine; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtCutomCovers.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtCutomCovers.java new file mode 100644 index 0000000000..cc5cf3d55e --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtCutomCovers.java @@ -0,0 +1,32 @@ +package gtPlusPlus.xmod.gregtech.common.blocks.textures; + +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; + +public class TexturesGtCutomCovers { + + public static final CustomIcon[] TEXTURE_ZTONES_AGON = new CustomIcon[16]; + public static final CustomIcon[] TEXTURE_ZTONES_ISZM = new CustomIcon[16]; + public static final CustomIcon[] TEXTURE_ZTONES_KORP = new CustomIcon[16]; + public static final CustomIcon[] TEXTURE_ZTONES_JELT = new CustomIcon[16]; + public static final CustomIcon[] TEXTURE_ZTONES_BITT = new CustomIcon[16]; + + public static void init() { + generateZTones(); + } + + private static void generateZTones() { + // ZTONES + String[] aZtoneCoverTextureNames = new String[] { "agon", "iszm", "korp", "jelt", "bitt" }; + int aArrayIndex = 0; + CustomIcon[][] aArrays = new CustomIcon[][] { TEXTURE_ZTONES_AGON, TEXTURE_ZTONES_ISZM, TEXTURE_ZTONES_KORP, + TEXTURE_ZTONES_JELT, TEXTURE_ZTONES_BITT }; + + for (CustomIcon[] t : aArrays) { + for (int s = 0; s < 16; s++) { + t[s] = new CustomIcon("Ztones", "sets/" + aZtoneCoverTextureNames[aArrayIndex] + "/"+aZtoneCoverTextureNames[aArrayIndex]+"_ (" + s + ")"); + } + aArrayIndex++; + } + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java new file mode 100644 index 0000000000..2fba1b0448 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/CoverManager.java @@ -0,0 +1,102 @@ +package gtPlusPlus.xmod.gregtech.common.covers; + +import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_AGON; +import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_BITT; +import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_ISZM; +import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_JELT; +import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers.TEXTURE_ZTONES_KORP; + +import cpw.mods.fml.common.Loader; +import gtPlusPlus.core.lib.VanillaColours; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtCutomCovers; +import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; +import gtPlusPlus.xmod.gregtech.common.items.covers.MetaItemCoverCasings; + +public class CoverManager { + + // ZTones + public static MetaCustomCoverItem Cover_Agon; + public static MetaCustomCoverItem Cover_Iszm; + public static MetaCustomCoverItem Cover_Korp; + public static MetaCustomCoverItem Cover_Jelt; + public static MetaCustomCoverItem Cover_Bitt; + + // GT + public static MetaItemCoverCasings Cover_Gt_Machine_Casing; + + public static void generateCustomCovers() { + + // init textures + TexturesGtCutomCovers.init(); + + // GT Machine Casings + Cover_Gt_Machine_Casing = new MetaItemCoverCasings(); + + if (Loader.isModLoaded("Ztones")) { + String[] aZtoneCoverTextureNames = new String[] { "agon", "iszm", "korp", "jelt", "bitt" }; + MetaCustomCoverItem[] aZtoneCoverItems = new MetaCustomCoverItem[] { Cover_Agon, Cover_Iszm, Cover_Korp, + Cover_Jelt, Cover_Bitt }; + CustomIcon[][] aArrays = new CustomIcon[][] { TEXTURE_ZTONES_AGON, TEXTURE_ZTONES_ISZM, TEXTURE_ZTONES_KORP, + TEXTURE_ZTONES_JELT, TEXTURE_ZTONES_BITT }; + short[][][] aRGB = new short[][][] { ZTONES.RGB_AGON, ZTONES.RGB_ISZM, ZTONES.RGB_KORP, ZTONES.RGB_JELT, + ZTONES.RGB_BITT }; + for (int y = 0; y < aZtoneCoverTextureNames.length; y++) { + aZtoneCoverItems[y] = new MetaCustomCoverItem("Ztones", 16, aZtoneCoverTextureNames[y], aArrays[y], + aRGB[y]); + } + } + + } + + final static class ZTONES { + + private static final short[][] RGB_AGON = new short[][] { VanillaColours.DYE_WHITE.getAsShort(), + VanillaColours.DYE_YELLOW.getAsShort(), VanillaColours.DYE_LIME.getAsShort(), + VanillaColours.DYE_GREEN.getAsShort(), VanillaColours.DYE_CYAN.getAsShort(), + VanillaColours.DYE_LIGHT_BLUE.getAsShort(), VanillaColours.DYE_DARK_BLUE.getAsShort(), + VanillaColours.DYE_DARK_PURPLE.getAsShort(), VanillaColours.DYE_LIGHT_PURPLE.getAsShort(), + VanillaColours.DYE_PINK.getAsShort(), VanillaColours.DYE_RED.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_BROWN.getAsShort(), + VanillaColours.DYE_BLACK.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(), + VanillaColours.DYE_LIGHT_GRAY.getAsShort(), }; + private static final short[][] RGB_ISZM = new short[][] { VanillaColours.DYE_LIGHT_GRAY.getAsShort(), + VanillaColours.DYE_WHITE.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(), + VanillaColours.DYE_DARK_BLUE.getAsShort(), VanillaColours.DYE_YELLOW.getAsShort(), + VanillaColours.DYE_DARK_BLUE.getAsShort(), VanillaColours.DYE_RED.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_CYAN.getAsShort(), + VanillaColours.DYE_YELLOW.getAsShort(), VanillaColours.DYE_RED.getAsShort(), + VanillaColours.DYE_CYAN.getAsShort(), VanillaColours.DYE_GREEN.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_LIGHT_BLUE.getAsShort(), + VanillaColours.DYE_DARK_PURPLE.getAsShort(), + }; + private static final short[][] RGB_KORP = new short[][] { new short[] { 125, 125, 125 }, + VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(), + VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(), + VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(), + VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(), + VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(), + VanillaColours.DYE_DARK_GRAY.getAsShort(), new short[] { 22, 156, 156 }, new short[] { 22, 156, 156 }, + VanillaColours.DYE_DARK_GRAY.getAsShort(), VanillaColours.DYE_DARK_GRAY.getAsShort(), }; + private static final short[][] RGB_JELT = new short[][] { VanillaColours.DYE_ORANGE.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(), + VanillaColours.DYE_ORANGE.getAsShort(), }; + private static final short[][] RGB_BITT = new short[][] { VanillaColours.DYE_BLACK.getAsShort(), + VanillaColours.DYE_WHITE.getAsShort(), VanillaColours.DYE_YELLOW.getAsShort(), + VanillaColours.DYE_LIME.getAsShort(), VanillaColours.DYE_GREEN.getAsShort(), + VanillaColours.DYE_CYAN.getAsShort(), VanillaColours.DYE_LIGHT_BLUE.getAsShort(), + VanillaColours.DYE_LIGHT_BLUE.getAsShort(), VanillaColours.DYE_DARK_BLUE.getAsShort(), + VanillaColours.DYE_DARK_PURPLE.getAsShort(), VanillaColours.DYE_LIGHT_PURPLE.getAsShort(), + VanillaColours.DYE_PINK.getAsShort(), VanillaColours.DYE_RED.getAsShort(), + VanillaColours.DYE_RED.getAsShort(), VanillaColours.DYE_ORANGE.getAsShort(), + VanillaColours.DYE_BROWN.getAsShort(), }; + + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java new file mode 100644 index 0000000000..65b59ce151 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_ToggleVisual.java @@ -0,0 +1,186 @@ +package gtPlusPlus.xmod.gregtech.common.covers; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_CoverBehavior; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.api.objects.random.XSTR; +import gtPlusPlus.core.util.minecraft.LangUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; + +public class GTPP_Cover_ToggleVisual extends GT_CoverBehavior { + + private static final Map<String, Integer> sConnectionStateForEntityMap = new ConcurrentHashMap<String, Integer>(); + private static final Map<String, String> sPrefixMap = new ConcurrentHashMap<String, String>(); + private static final int VALUE_OFF = 0; + private static final int VALUE_ON = 1; + + public static String generateUniqueKey(byte aSide, ICoverable aEntity) { + try { + BlockPos aPos = new BlockPos(aEntity.getIGregTechTileEntity(aEntity.getXCoord(), aEntity.getYCoord(), aEntity.getZCoord())); + ForgeDirection aDir = ForgeDirection.getOrientation(aSide); + String s = aEntity.getInventoryName()+"."+aPos.getUniqueIdentifier()+aDir.name(); + return s; + } + catch (Throwable t) {} + XSTR x = new XSTR(); + return "ERROR."+x.getSeed()+x.hashCode()+x.nextDouble()+".ID"; + } + + public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + EntityPlayer aPlayer, float aX, float aY, float aZ) { + PlayerUtils.messagePlayer(aPlayer, LangUtils.trans("756", "Connectable: ") + getConnectionState(aCoverVariable)); + return super.onCoverRightclick(aSide, aCoverID, aCoverVariable, aTileEntity, aPlayer, aX, aY, aZ); + } + + public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + EntityPlayer aPlayer, float aX, float aY, float aZ) { + return super.onCoverScrewdriverclick(aSide, aCoverID, aCoverVariable, aTileEntity, aPlayer, aX, aY, aZ); + } + + public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return getConnectionState(aCoverVariable); + } + + public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return getConnectionState(aCoverVariable); + } + + public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return getConnectionState(aCoverVariable); + } + + public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { + return getConnectionState(aCoverVariable); + } + + public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + return getConnectionState(aCoverVariable); + } + + public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { + return getConnectionState(aCoverVariable); + } + + public String getDescription(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return LangUtils.trans("756", "Connectable: ") + getConnectionState(aCoverVariable); + } + + public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return 1; + } + + @Override + public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + long aTimer) { + try { + String aKey = generateUniqueKey(aSide, aTileEntity); + Integer b = sConnectionStateForEntityMap.get(aKey); + //Logger.INFO("Val: "+aCoverVariable); + if (b != null && aCoverVariable != b) { + aCoverVariable = b; + } + if (b == null) { + b = aCoverVariable; + sConnectionStateForEntityMap.put(aKey, b); + trySetState(aSide, b == VALUE_ON ? VALUE_ON : VALUE_OFF, aTileEntity); + } + } + catch (Throwable t) { + + } + return aCoverVariable; + } + + @Override + public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return getConnectionState(aCoverVariable); + } + + @Override + public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return getConnectionState(aCoverVariable); + } + + @Override + public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { + return super.alwaysLookConnected(aSide, aCoverID, aCoverVariable, aTileEntity); + } + + @Override + public byte getRedstoneInput(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, + ICoverable aTileEntity) { + if (!getConnectionState(aCoverVariable)) { + return 0; + } + return super.getRedstoneInput(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity); + } + + @Override + public void placeCover(byte aSide, ItemStack aCover, ICoverable aTileEntity) { + String aKey = generateUniqueKey(aSide, aTileEntity); + boolean state = getCoverConnections(aCover); + sPrefixMap.put(aKey, aCover.getUnlocalizedName()); + Logger.INFO("Mapping key "+aKey+" to "+state); + sConnectionStateForEntityMap.put(aKey, state ? VALUE_ON : VALUE_OFF); + Logger.INFO("Key Value: "+(state ? VALUE_ON : VALUE_OFF)); + //Try set cover state directly + //trySetState(aSide, state ? VALUE_ON : VALUE_OFF, aTileEntity); + super.placeCover(aSide, aCover, aTileEntity); + } + + @Override + public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, + boolean aForced) { + String aKey = generateUniqueKey(aSide, aTileEntity); + sConnectionStateForEntityMap.remove(aKey); + //Logger.INFO("Unmapping key "+aKey+"."); + return true; + } + + public static boolean getConnectionState(int aCoverVar) { + return aCoverVar == VALUE_ON; + } + + private static final void trySetState(byte aSide, int aState, ICoverable aTile) { + //Try set cover state directly + if (aTile instanceof IGregTechTileEntity) { + IGregTechTileEntity gTileEntity = (IGregTechTileEntity) aTile; + if (gTileEntity != null) { + gTileEntity.setCoverDataAtSide(aSide, aState); + } + } + } + + + public static boolean getConnectionState(byte aSide, ICoverable aTile) { + String aKey = generateUniqueKey(aSide, aTile); + return getConnectionState(aKey); + } + + public static boolean getConnectionState(String aKey) { + Integer b = sConnectionStateForEntityMap.get(aKey); + //Logger.INFO("Get State: "+b+" | "+aKey); + return b != null ? b == VALUE_ON : false; + } + + public static final boolean getCoverConnections(final ItemStack aStack) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("CustomCoverMeta"); + if (aNBT != null) { + return aNBT.getBoolean("AllowConnections"); + } + } + return false; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_VisualPlate.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_VisualPlate.java deleted file mode 100644 index 7d2ed2c21a..0000000000 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_VisualPlate.java +++ /dev/null @@ -1,67 +0,0 @@ -package gtPlusPlus.xmod.gregtech.common.covers; - -import gregtech.api.interfaces.tileentity.ICoverable; -import gregtech.api.util.GT_CoverBehavior; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fluids.Fluid; - -public class GTPP_Cover_VisualPlate extends GT_CoverBehavior { - - public GTPP_Cover_VisualPlate() { - } - - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - long aTimer) { - return aCoverVariable; - } - - public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer, float aX, float aY, float aZ) { - return aCoverVariable; - } - - public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, - EntityPlayer aPlayer, float aX, float aY, float aZ) { - return true; - } - - public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return false; - } - - public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return false; - } - - public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return false; - } - - public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return false; - } - - public boolean letsFluidIn(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return false; - } - - public boolean letsFluidOut(byte aSide, int aCoverID, int aCoverVariable, Fluid aFluid, ICoverable aTileEntity) { - return false; - } - - public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return false; - } - - public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) { - return false; - } - - public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return false; - } - - public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - return 0; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java index bda75be793..70c7b2da23 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java @@ -420,8 +420,10 @@ public class ChargingHelper { if (stack == null) { return false; } - return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) - || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); + else { + return false; + } + //return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java new file mode 100644 index 0000000000..d51107bbf0 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/GT_MethodHelper.java @@ -0,0 +1,80 @@ +package gtPlusPlus.xmod.gregtech.common.helpers; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.ITexture; +import gregtech.api.metatileentity.BaseMetaTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; + +public class GT_MethodHelper { + + private static final Method mGetTexture; + private static final Class mITexturedTileEntity; + + static { + Class clazz = null; + Method aMeth = null; + if (ReflectionUtils.doesClassExist("gregtech.api.interfaces.tileentity.ITexturedTileEntity")) { + clazz = ReflectionUtils.getClass("gregtech.api.interfaces.tileentity.ITexturedTileEntity"); + aMeth = ReflectionUtils.getMethod(clazz, "getTexture", Block.class, byte.class); + } + mITexturedTileEntity = clazz; + mGetTexture = aMeth; + } + + + public static ITexture[] getTexture(TileEntity tTileEntity, Block aBlock, byte aSide) { + + if (mITexturedTileEntity.isInstance(tTileEntity)) { + + if (mGetTexture != null) { + try { + mGetTexture.invoke(tTileEntity, aBlock, aSide); + } + catch (IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { + e.printStackTrace(); + } + } + else { + if (tTileEntity instanceof BaseMetaTileEntity) { + try { + BaseMetaTileEntity aTile = (BaseMetaTileEntity) tTileEntity; + ITexture rIcon = aTile.getCoverTexture(aSide); + Field aFacing = ReflectionUtils.getField(BaseMetaTileEntity.class, "mFacing"); + Field aColor = ReflectionUtils.getField(BaseMetaTileEntity.class, "mColor"); + Field aActive = ReflectionUtils.getField(BaseMetaTileEntity.class, "mActive"); + Field aMetaTile = ReflectionUtils.getField(BaseMetaTileEntity.class, "mMetaTileEntity"); + Method aHasValidTile = ReflectionUtils.getMethod(BaseMetaTileEntity.class, "hasValidMetaTileEntity", new Class[] {}); + + boolean hasValidTileObj = (boolean) aHasValidTile.invoke(aTile, new Object[] {}); + boolean aActiveObj = aActive.getBoolean(aTile); + byte aFacingObj = aFacing.getByte(aTile); + byte aColorObj = aColor.getByte(aTile);; + MetaTileEntity aMetaTileObj = (MetaTileEntity) aMetaTile.get(aTile); + + if (rIcon != null) { + return new ITexture[]{rIcon}; + } else { + return hasValidTileObj + ? aMetaTileObj.getTexture(aTile, aSide, aFacingObj, (byte) (aColorObj - 1), aActiveObj, + aTile.getOutputRedstoneSignal(aSide) > 0) + : BlockIcons.ERROR_RENDERING; + } + } + catch (Throwable t) { + t.printStackTrace(); + } + } + } + } + return BlockIcons.ERROR_RENDERING; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java index 4038d5bdf4..8b3fb9a42f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/TreeFarmHelper.java @@ -297,7 +297,7 @@ public class TreeFarmHelper { return true; } else if (aStack.getUnlocalizedName().toLowerCase().contains("mu-metaitem")) { - String[] aData = aStack.getUnlocalizedName().toLowerCase().split("."); + String[] aData = aStack.getUnlocalizedName().toLowerCase().split("//."); if (aData != null && aData.length > 0) { for (String s : aData) { if (s.contains("32120")) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java new file mode 100644 index 0000000000..7c3f764794 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaCustomCoverItem.java @@ -0,0 +1,225 @@ +package gtPlusPlus.xmod.gregtech.common.items; + +import java.util.List; + +import org.apache.commons.lang3.StringUtils; + +import cofh.core.render.IconRegistry; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.objects.GT_MultiTexture; +import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.client.renderer.CustomItemBlockRenderer; +import gtPlusPlus.core.common.CommonProxy; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; +import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_ToggleVisual; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class MetaCustomCoverItem extends Item { + + protected final IIcon[] icons; + private final String mModID; + private final String mTextureSetName; + protected final IIconContainer[] mTextures; + private final short[][] mRGB; + + public MetaCustomCoverItem(String aModId, int aTextureCount, String aTextureSetName, IIconContainer[] aTextures, short[][] aRGB) { + super(); + icons = new IIcon[aTextureCount]; + mModID = aModId; + mTextureSetName = Utils.sanitizeString(aTextureSetName); + mTextures = aTextures; + mRGB = aRGB; + this.setTextureName(CORE.MODID + ":" + "itemPlate"); + this.setHasSubtypes(true); + String unlocalizedName = "itemCustomMetaCover." + mModID + "." + mTextureSetName; + this.setUnlocalizedName(unlocalizedName); + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setMaxStackSize(1); + GameRegistry.registerItem(this, unlocalizedName); + registerCover(); + Logger.INFO("[Covers] Generated Custom covers for "+mModID+" using "+aTextureCount+" textures from "+mTextureSetName+"."); + } + + public boolean hide() { + return true; + } + + private final void registerCover() { + //CommonProxy.registerItemRendererGlobal(this, new CustomItemBlockRenderer()); + for (int i=0;i<icons.length;i++) { + ItemStack thisStack = ItemUtils.simpleMetaStack(this, i, 1); + if (i > 0 && hide()) { + ItemUtils.hideItemFromNEI(thisStack); + } + GregTech_API.registerCover( + thisStack, + new GT_MultiTexture( + new ITexture[]{ + new GT_RenderedTexture(mTextures[i]) + }), + new GTPP_Cover_ToggleVisual()); + } + } + + /* + * @Override public void registerIcons(IIconRegister reg) { for (int i = 0; i < + * icons.length; i++) { this.icons[i] = mTextures[i].getIcon(); } } + * + * @Override public IIcon getIconFromDamage(int meta) { return this.icons[meta]; + * } + */ + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < icons.length; i++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return this.getUnlocalizedName() + "_" + stack.getItemDamage(); + } + + @Override + public String getItemStackDisplayName(final ItemStack tItem) { + return StringUtils.capitalize(mTextureSetName) + " (" + tItem.getItemDamage() + ")"; //super.getItemStackDisplayName(tItem); + } + + private static boolean createNBT(ItemStack rStack) { + final NBTTagCompound tagMain = new NBTTagCompound(); + final NBTTagCompound tagNBT = new NBTTagCompound(); + tagNBT.setLong("Damage", 0); + tagNBT.setBoolean("AllowConnections", false); + tagMain.setTag("CustomCoverMeta", tagNBT); + rStack.setTagCompound(tagMain); + return true; + } + + public static final long getCoverDamage(final ItemStack aStack) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("CustomCoverMeta"); + if (aNBT != null) { + return aNBT.getLong("Damage"); + } + } else { + createNBT(aStack); + } + return 0L; + } + + public static final boolean setCoverDamage(final ItemStack aStack, final long aDamage) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("CustomCoverMeta"); + if (aNBT != null) { + aNBT.setLong("Damage", aDamage); + return true; + } + } + return false; + } + + public static final boolean getCoverConnections(final ItemStack aStack) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("CustomCoverMeta"); + if (aNBT != null) { + return aNBT.getBoolean("AllowConnections"); + } + } else { + createNBT(aStack); + } + return false; + } + + public static final boolean setCoverConnections(final ItemStack aStack, final boolean aConnections) { + NBTTagCompound aNBT = aStack.getTagCompound(); + if (aNBT != null) { + aNBT = aNBT.getCompoundTag("CustomCoverMeta"); + if (aNBT != null) { + aNBT.setBoolean("AllowConnections", aConnections); + return true; + } + } + return false; + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + if (stack.getTagCompound() == null) { + createNBT(stack); + } + double currentDamage = getCoverDamage(stack); + double meta = stack.getItemDamage() == 0 ? 50 : 2500; + double durabilitypercent = currentDamage / meta; + return durabilitypercent; + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + if (KeyboardUtils.isShiftKeyDown()) { + boolean con = getCoverConnections(stack); + if (con) { + setCoverConnections(stack, false); + } else { + setCoverConnections(stack, true); + } + } + return stack; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + boolean cons = getCoverConnections(stack); + list.add(EnumChatFormatting.GRAY + "Allows Connections: "+cons); + list.add(EnumChatFormatting.GRAY + "Shift Rmb to change state before applying"); + super.addInformation(stack, player, list, bool); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + + @Override + public Item setFull3D() { + // TODO Auto-generated method stub + return super.setFull3D(); + } + + @Override + public boolean isFull3D() { + // TODO Auto-generated method stub + return super.isFull3D(); + } + + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.mRGB == null){ + return super.getColorFromItemStack(stack, HEX_OxFFFFFF); + } + int aMeta = stack.getItemDamage(); + return Utils.rgbtoHexValue(mRGB[aMeta][0], mRGB[aMeta][1], mRGB[aMeta][2]); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java index c9f4dd9ae2..db691cefc7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java @@ -29,7 +29,7 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_X32; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow; -import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_VisualPlate; +import gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_ToggleVisual; public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { @@ -333,10 +333,12 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 { } else { aTierName = GT_Values.VN[i]; - mMachineCasingCovers[i].set(this.addItem(aFirstMachineCasingID++, aTierName+" Machine Plate Cover", "Looks visually like an "+aTierName+" machine casing, apply to pipe/cable as cover", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, 1L), getTcAspectStack(TC_Aspects.MACHINA, 1L)})); - GregTech_API.registerCover(mMachineCasingCovers[i].get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[i][0]}), new GTPP_Cover_VisualPlate()); + mMachineCasingCovers[i].set(this.addItem(aFirstMachineCasingID++, aTierName+" Machine Plate Cover", "Deprecated - Shapeless Craft to new version", new Object[]{})); + GregTech_API.registerCover(mMachineCasingCovers[i].get(1L, new Object[0]), new GT_MultiTexture(new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[i][0]}), new GTPP_Cover_ToggleVisual()); } } + GregtechItemList.Laser_Lens_WoodsGlass.set(this.addItem(140, "Wood's Glass Lens", "Allows UV & IF to pass through, blocks visible light spectrums", new Object[0])); + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java index dbae4fe194..bc11cb6a11 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java @@ -1,9 +1,14 @@ package gtPlusPlus.xmod.gregtech.common.items; +import java.lang.reflect.Field; + import gregtech.api.GregTech_API; import gregtech.api.enums.TC_Aspects; import gregtech.api.enums.ToolDictNames; import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.objects.GT_HashSet; +import gregtech.api.objects.GT_ItemStack; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_AngelGrinder; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_Choocher; @@ -19,10 +24,18 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { public static final short ANGLE_GRINDER = 7834; public static final short ELECTRIC_SNIPS = 7934; public static GT_MetaGenerated_Tool INSTANCE; + + static { + INSTANCE = new MetaGeneratedGregtechTools(); + } + + public static GT_MetaGenerated_Tool getInstance() { + return INSTANCE; + } + - public MetaGeneratedGregtechTools() { + private MetaGeneratedGregtechTools() { super("plusplus.metatool.01"); - INSTANCE = this; // Skookum Choocher GregTech_API.registerTool(this.addTool(SKOOKUM_CHOOCHER, "Skookum Choocher", "Can Really Chooch. Does a Skookum job at Hammering and Wrenching stuff.", new TOOL_Gregtech_Choocher(), @@ -40,13 +53,33 @@ public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); + GT_HashSet<GT_ItemStack> aWireCutterList = new GT_HashSet<GT_ItemStack>(); + //Does not exist prior to 5.09.32, use an empty field if we can't find the existing one. + if (ReflectionUtils.doesFieldExist(GregTech_API.class, "sWireCutterList")) { + Field sWireCutterList = ReflectionUtils.getField(GregTech_API.class, "sWireCutterList"); + try { + if (sWireCutterList != null) { + Object val = sWireCutterList.get(null); + if (val != null && val instanceof GT_HashSet) { + aWireCutterList = (GT_HashSet<GT_ItemStack>) val; + } + } + + } + catch (IllegalArgumentException | IllegalAccessException e) { + // Not found, so it's GT 5.09.31 or earlier. + } + } + // Electric Wire Cutter - this.addTool(ELECTRIC_SNIPS, "Automatic Snips", "Hand-held electric wire cutter", - new TOOL_Gregtech_ElectricSnips(), - new Object[] { GregtechToolDictNames.craftingToolElectricSnips, ToolDictNames.craftingToolWireCutter, - new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); + GregTech_API.registerTool( + this.addTool(ELECTRIC_SNIPS, "Automatic Snips", "Hand-held electric wire cutter", + new TOOL_Gregtech_ElectricSnips(), + new Object[] { GregtechToolDictNames.craftingToolElectricSnips, ToolDictNames.craftingToolWireCutter, + new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 4L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 4L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 4L) }), aWireCutterList); + // Electric Lighter this.addTool(ELECTRIC_LIGHTER, "Pyromatic 9k", "Electric Fire!", diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java new file mode 100644 index 0000000000..7af057bc59 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/covers/MetaItemCoverCasings.java @@ -0,0 +1,40 @@ +package gtPlusPlus.xmod.gregtech.common.items.covers; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Textures; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.items.MetaCustomCoverItem; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; + +public class MetaItemCoverCasings extends MetaCustomCoverItem { + + public MetaItemCoverCasings() { + super(CORE.MODID, Textures.BlockIcons.MACHINECASINGS_SIDE.length, "Gt Machine Casings", Textures.BlockIcons.MACHINECASINGS_SIDE, null); + } + + @Override + public void registerIcons(IIconRegister reg) { + for (int i = 0; i < icons.length; i++) { + this.icons[i] = reg.registerIcon(CORE.MODID+":"+"covers/"+i); + } + } + + public boolean hide() { + return false; + } + + @Override + public IIcon getIconFromDamage(int meta) { + return this.icons[MathUtils.balance(meta, 0, 15)]; + } + + @Override + public String getItemStackDisplayName(final ItemStack tItem) { + return EnumChatFormatting.LIGHT_PURPLE + GT_Values.VOLTAGE_NAMES[MathUtils.balance(tItem.getItemDamage(), 0, GT_Values.VOLTAGE_NAMES.length-1)]+" Machine Plate Cover"; //super.getItemStackDisplayName(tItem); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java index 763a4a129d..6201a782de 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java @@ -63,7 +63,6 @@ public class GTPP_CapeRenderer extends RenderPlayer { private final ArrayList<String> mData; public GTPP_CapeRenderer() { - setRenderManager(RenderManager.instance); downloadCapeList(); ArrayList<String> aTemp = new ArrayList<String>(); try { @@ -76,10 +75,19 @@ public class GTPP_CapeRenderer extends RenderPlayer { } private static boolean hasResourceChecked = false; + private static boolean hasSetRenderer = false; private boolean hasCape = false; private ResourceLocation tResource = null; public synchronized void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) { + if (this.renderManager == null) { + hasSetRenderer = false; + } + if (!hasSetRenderer) { + if (RenderManager.instance != null) { + setRenderManager(RenderManager.instance); + } + } AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer; if (!ConfigSwitches.enableCustomCapes) { aEvent.setCanceled(true); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java index c884114b79..35d78008c5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_Render_MachineBlock.java @@ -10,10 +10,9 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity; import gregtech.api.interfaces.tileentity.ITexturedTileEntity; import gregtech.common.blocks.GT_Block_Machines; -import gregtech.common.blocks.GT_Block_Ores_Abstract; -import gregtech.common.blocks.GT_TileEntity_Ores; import gregtech.common.render.GT_Renderer_Block; import gtPlusPlus.xmod.gregtech.common.blocks.GTPP_Block_Machines; +import gtPlusPlus.xmod.gregtech.common.helpers.GT_MethodHelper; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; @@ -134,14 +133,15 @@ public class GTPP_Render_MachineBlock extends GT_Renderer_Block { public static boolean renderStandardBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) { TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + return tTileEntity instanceof ITexturedTileEntity ? renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer, - new ITexture[][]{((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 0), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 1), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 2), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 3), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 4), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) 5)}) + new ITexture[][]{GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 0), + GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 1), + GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 2), + GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 3), + GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 4), + GT_MethodHelper.getTexture(tTileEntity, aBlock, (byte) 5)}) : false; } @@ -190,7 +190,7 @@ public class GTPP_Render_MachineBlock extends GT_Renderer_Block { ITexture[][] tCovers = new ITexture[6][]; for (byte i = 0; i < 6; ++i) { - tCovers[i] = aTileEntity.getTexture(aBlock, i); + tCovers[i] = GT_MethodHelper.getTexture((TileEntity) aTileEntity, aBlock, i); arg15[i] = aTileEntity.getTextureUncovered(i); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java b/src/Java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java index ba44acdcb5..e53a7e4738 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java @@ -5,7 +5,7 @@ import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements; public class RequirementsBasicCubic extends MultiblockRequirements { public RequirementsBasicCubic( ) { - super(-1, -1, -1, -1, 1, 0, 1, null); + super(0, null); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java index 1ee27afbf0..2f00600af6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java @@ -22,6 +22,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer; @@ -48,7 +49,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { @Override public String[] getDescription() { - return new String[] {this.mDescription, "Use Screwdriver to change voltage", EnumChatFormatting.GREEN+"CREATIVE MACHINE"}; + return new String[] {this.mDescription, "Use Screwdriver to change voltage", "Hold Shift while using Screwdriver to change amperage", EnumChatFormatting.GREEN+"CREATIVE MACHINE"}; } /* @@ -177,43 +178,48 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer { } @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (this.mTier < 9) { - this.mTier++; + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (KeyboardUtils.isShiftKeyDown()) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); } else { - this.mTier = 0; - } - this.markDirty(); - try { - Field field = ReflectionUtils.getField(this.getClass(), "mTextures"); - field.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); - ITexture[][][] V = getTextureSet(null); - if (V != null) { - Logger.REFLECTION("Got Valid Textures."); - if (this.getBaseMetaTileEntity().isClientSide()) { - Logger.REFLECTION("Clientside Call."); - Logger.REFLECTION("Refreshing Textures on buffer."); - field.set(this, V); - Logger.REFLECTION("Refreshed Textures on buffer."); + if (this.mTier < (CORE.GTNH ? GT_Values.V.length : 9)) { + this.mTier++; + } + else { + this.mTier = 0; + } + this.markDirty(); + try { + Field field = ReflectionUtils.getField(this.getClass(), "mTextures"); + field.setAccessible(true); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); + ITexture[][][] V = getTextureSet(null); + if (V != null) { + Logger.REFLECTION("Got Valid Textures."); + if (this.getBaseMetaTileEntity().isClientSide()) { + Logger.REFLECTION("Clientside Call."); + Logger.REFLECTION("Refreshing Textures on buffer."); + field.set(this, V); + Logger.REFLECTION("Refreshed Textures on buffer."); + } + else { + Logger.REFLECTION("Serverside Call."); + } } else { - Logger.REFLECTION("Serverside Call."); - } + Logger.REFLECTION("Bad mTextures setter."); + } } - else { - Logger.REFLECTION("Bad mTextures setter."); - } - } - catch (Throwable t) { - //Bad refresh. - t.printStackTrace(); - Logger.REFLECTION("Bad mTextures setter."); - } - PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+". ["+MathUtils.isNumberEven(this.mTier)+"]"); - super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + catch (Throwable t) { + //Bad refresh. + t.printStackTrace(); + Logger.REFLECTION("Bad mTextures setter."); + } + PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+"."); + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java index e277b671c6..10a1f96be7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java @@ -1,6 +1,9 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; import static gregtech.api.enums.GT_Values.V; +import static gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils.mPollution; + +import org.apache.commons.lang3.ArrayUtils; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; @@ -40,6 +43,7 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi protected boolean mHasPollution = false; protected int SLOT_ROTOR = 4; protected int SLOT_FILTER = 5; + protected static boolean mPollutionEnabled = true; protected boolean mSaveRotor = false; @@ -55,10 +59,12 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB) }); + mPollutionEnabled = PollutionUtils.mPollution(); } public GregtechMetaAtmosphericReconditioner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { super(aName, aTier, 2, aDescription, aTextures, 2, 0, aGUIName, aNEIName); + mPollutionEnabled = PollutionUtils.mPollution(); } /*public GregtechMetaAtmosphericReconditioner(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -75,10 +81,9 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi @Override public String[] getDescription() { - boolean highTier = this.mTier >= 7; - + boolean highTier = this.mTier >= 7; - return new String[]{ + String[] A = new String[]{ this.mDescription, highTier ? "Will attempt to remove 1/4 pollution from 8 surrounding chunks" : "", highTier ? "If these chunks are not loaded, they will be ignored" : "", @@ -87,9 +92,19 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi "Can be configured with a soldering iron to change modes", "Low Efficiency: Removes half pollution, Turbine takes 50% dmg", "High Efficiency: Removes full pollution, Turbine takes 100% dmg", - "Turbine Rotor will not break in LE mode", - + "Turbine Rotor will not break in LE mode", }; + if (!mPollutionEnabled) { + String[] B = new String[] { + "===============================================", + "Pollution is disabled, scrubbers will now have a bonus use", + "They are now able to remove ALL lingering pollution as GT ignores it", + "and it will linger forever!", + "===============================================", + }; + A = ArrayUtils.addAll(A, B); + } + return A; } @Override @@ -187,7 +202,19 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi if (aBaseMetaTileEntity.isActive()){ //Do nothing if there is no pollution. - if(this.mHasPollution && mCurrentPollution > 0){ + if(this.mHasPollution && mCurrentPollution > 0){ + + //Only check every 30s. + if (!isIdle && aTick % (20L * 30) == 0L){ + mPollutionEnabled = PollutionUtils.mPollution(); + //Clear out pollution if it's disabled, because I am a nice gal. + if (!mPollution()) { + PollutionUtils.nullifyPollution(this.getBaseMetaTileEntity()); + } + } + + + //Use a Turbine if(hasRotor(stackRotor) && hasAirFilter(stackFilter)){ @@ -683,8 +710,17 @@ public class GregtechMetaAtmosphericReconditioner extends GT_MetaTileEntity_Basi catch (Throwable t) { aTooltipSuper.put("Maximum pollution removed per second: "+mPollutionReduction); } - aTooltipSuper.put("Air Sides: "+mAirSides); - return aTooltipSuper.toArray(); + aTooltipSuper.put("Air Sides: "+mAirSides); + + String[] mBuiltOutput = new String[aTooltipSuper.size()]; + int aIndex = 0; + for (String i : aTooltipSuper) { + mBuiltOutput[aIndex++] = i; + } + + + + return mBuiltOutput; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java new file mode 100644 index 0000000000..b7e4618e07 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java @@ -0,0 +1,688 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; + +import static gregtech.api.enums.GT_Values.E; + +import java.util.HashSet; +import java.util.List; + +import cpw.mods.fml.common.registry.LanguageRegistry; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.random.XSTR; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.slots.SlotChemicalPlantInput; +import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.Container_FluidReactor; +import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.GUI_FluidReactor; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidHandler; + +public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_BasicMachine { + + public boolean mFluidTransfer_1 = false; + public boolean mFluidTransfer_2 = false; + + public FluidStack[] mInputFluids = new FluidStack[4]; + public FluidStack[] mOutputFluids = new FluidStack[2]; + + private static final GT_Recipe_Map mFluidChemicalReactorRecipes = new GT_Recipe_Map( + new HashSet<GT_Recipe>(100), + "gt.recipe.fluidchemicaleactor", + "Chemical Plant", + null, + CORE.MODID+":textures/gui/FluidReactor", + 0, + 0, + 0, + 2, + 1, + "Tier: ", + 1, + E, + true, + false); + + public GregtechMetaTileEntity_ChemicalReactor(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 1, + "For mixing fluids", 4, 4, "ChemicalReactor.png", "", + new ITexture[]{ + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Side_Active), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Side), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Front_Active), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Front), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top_Active), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top_Active), + new GT_RenderedTexture(TexturesGtBlock.Overlay_FluidReactor_Top) + } + ); + } + + public GregtechMetaTileEntity_ChemicalReactor(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); + } + + /*public GregtechMetaTileEntity_BasicWasher(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { + super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); + }*/ + + @Override + public String[] getDescription() { + return new String[]{this.mDescription, "Because why not?", }; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + try { + GregtechMetaTileEntity_ChemicalReactor y = new GregtechMetaTileEntity_ChemicalReactor(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName); + return y; + } + catch(Throwable t) { + t.printStackTrace(); + } + return null; + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + try { + Container_FluidReactor y = new Container_FluidReactor(aPlayerInventory, aBaseMetaTileEntity); + return y; + } + catch(Throwable t) { + t.printStackTrace(); + } + return null; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_FluidReactor(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), + this.mGUIName, + GT_Utility.isStringValid(this.mNEIName) + ? this.mNEIName + : (this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "")); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeList() { + if (mFluidChemicalReactorRecipes.mRecipeList.isEmpty()) { + for (Recipe_GT i :Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) { + mFluidChemicalReactorRecipes.add(i); + } + } + return mFluidChemicalReactorRecipes; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack)); + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return (super.isFluidInputAllowed(aFluid)); + } + + @Override + public int getCapacity() { + return 32000 * Math.max(1, this.mTier) / 4; + } + + @Override + public int getInputSlot() { + return 3; + } + + @Override + public boolean isLiquidInput(byte aSide) { + return aSide > 1; + } + + @Override + public boolean isLiquidOutput(byte aSide) { + return aSide < 2; + } + + @Override + public int getOutputSlot() { + return super.getOutputSlot(); + } + + @Override + public int getStackDisplaySlot() { + return super.getStackDisplaySlot(); + } + + @Override + public boolean doesEmptyContainers() { + return true; + } + + @Override + public boolean canTankBeFilled() { + return super.canTankBeFilled(); + } + + @Override + public boolean canTankBeEmptied() { + return super.canTankBeEmptied(); + } + + @Override + public FluidStack getDisplayedFluid() { + return super.getDisplayedFluid(); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("mFluidTransfer_1", mFluidTransfer_1); + aNBT.setBoolean("mFluidTransfer_2", mFluidTransfer_2); + for (int i=0;i<4;i++) { + if (this.mInputFluids[i] != null) { + aNBT.setTag("mInputFluid"+i, this.mInputFluids[i].writeToNBT(new NBTTagCompound())); + } + } + for (int i=0;i<2;i++) { + if (this.mOutputFluids[i] != null) { + aNBT.setTag("mOutputFluid"+i, this.mOutputFluids[i].writeToNBT(new NBTTagCompound())); + } + } + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mFluidTransfer_1 = aNBT.getBoolean("mFluidTransfer_1"); + mFluidTransfer_2 = aNBT.getBoolean("mFluidTransfer_2"); + for (int i=0;i<4;i++) { + if (this.mInputFluids[i] == null) { + this.mInputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mInputFluid"+i)); + } + } + for (int i=0;i<2;i++) { + if (this.mOutputFluids[i] == null) { + this.mOutputFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mOutputFluid"+i)); + } + } + } + + /* + * Custom Fluid Handling - TODO + */ + + public FluidStack getFillableStack() { + return this.mFluid; + } + + public FluidStack setFillableStack(FluidStack aFluid) { + this.mFluid = aFluid; + return this.mFluid; + } + + public FluidStack getDrainableStack() { + return this.mFluid; + } + + public FluidStack setDrainableStack(FluidStack aFluid) { + this.mFluid = aFluid; + return this.mFluid; + } + + + + + + + + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + // Re-implement basic machine logic from the ground up.= + + if (aBaseMetaTileEntity.isServerSide()) { + this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; + this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; + this.doDisplayThings(); + boolean tSucceeded = false; + int i; + if (this.mMaxProgresstime > 0 && (this.mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) { + aBaseMetaTileEntity.setActive(true); + if (this.mProgresstime >= 0 && !this.drainEnergyForProcess((long) this.mEUt)) { + if (!this.mStuttering) { + this.stutterProcess(); + if (this.canHaveInsufficientEnergy()) { + this.mProgresstime = -100; + } + + this.mStuttering = true; + } + } else { + if (++this.mProgresstime >= this.mMaxProgresstime) { + for (i = 0; i < this.mOutputItems.length; ++i) { + for (i = 0; i < this.mOutputItems.length && !aBaseMetaTileEntity.addStackToSlot( + this.getOutputSlot() + (i + i) % this.mOutputItems.length, + this.mOutputItems[i]); ++i) { + ; + } + } + + if (this.mOutputFluid != null) { + if (this.getDrainableStack() == null) { + this.setDrainableStack(this.mOutputFluid.copy()); + } else if (this.mOutputFluid.isFluidEqual(this.getDrainableStack())) { + FluidStack var10000 = this.getDrainableStack(); + var10000.amount += this.mOutputFluid.amount; + } + } + + for (i = 0; i < this.mOutputItems.length; ++i) { + this.mOutputItems[i] = null; + } + + this.mOutputFluid = null; + this.mEUt = 0; + this.mProgresstime = 0; + this.mMaxProgresstime = 0; + this.mStuttering = false; + tSucceeded = true; + this.endProcess(); + } + + if (this.mProgresstime > 5) { + this.mStuttering = false; + } + } + } else { + aBaseMetaTileEntity.setActive(false); + } + + boolean tRemovedOutputFluid = false; + if (this.doesAutoOutputFluids() && this.getDrainableStack() != null + && aBaseMetaTileEntity.getFrontFacing() != this.mMainFacing && (tSucceeded || aTick % 20L == 0L)) { + IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); + if (tTank != null) { + FluidStack tDrained = this.drain(1000, false); + if (tDrained != null) { + int tFilledAmount = tTank.fill( + ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false); + if (tFilledAmount > 0) { + tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), + this.drain(tFilledAmount, true), true); + } + } + } + + if (this.getDrainableStack() == null) { + tRemovedOutputFluid = true; + } + } + + int j; + if (this.doesAutoOutput() && !this.isOutputEmpty() + && aBaseMetaTileEntity.getFrontFacing() != this.mMainFacing + && (tSucceeded || this.mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTick % 600L == 0L)) { + TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing()); + j = 0; + + for (byte tCosts = 1; j < this.mOutputItems.length && tCosts > 0 + && aBaseMetaTileEntity.isUniversalEnergyStored(128L); ++j) { + tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, + aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), (List) null, + false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + if (tCosts > 0) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits((long) tCosts, true); + } + } + } + + if (this.mOutputBlocked != 0) { + if (this.isOutputEmpty()) { + this.mOutputBlocked = 0; + } else { + ++this.mOutputBlocked; + } + } + + if (this.allowToCheckRecipe()) { + if (this.mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() + && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() + || aTick % 600L == 0L || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) + && this.hasEnoughEnergyToCheckRecipe()) { + if (this.checkRecipe() == 2) { + if (this.mInventory[3] != null && this.mInventory[3].stackSize <= 0) { + this.mInventory[3] = null; + } + + i = this.getInputSlot(); + + for (j = i + this.mInputSlotCount; i < j; ++i) { + if (this.mInventory[i] != null && this.mInventory[i].stackSize <= 0) { + this.mInventory[i] = null; + } + } + + for (i = 0; i < this.mOutputItems.length; ++i) { + this.mOutputItems[i] = GT_Utility.copy(new Object[]{this.mOutputItems[i]}); + if (this.mOutputItems[i] != null && this.mOutputItems[i].stackSize > 64) { + this.mOutputItems[i].stackSize = 64; + } + + this.mOutputItems[i] = GT_OreDictUnificator.get(true, this.mOutputItems[i]); + } + + if (this.mFluid != null && this.mFluid.amount <= 0) { + this.mFluid = null; + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + if (GT_Utility.isDebugItem(this.mInventory[this.dechargerSlotStartIndex()])) { + this.mEUt = this.mMaxProgresstime = 1; + } + + this.startProcess(); + } else { + this.mMaxProgresstime = 0; + + for (i = 0; i < this.mOutputItems.length; ++i) { + this.mOutputItems[i] = null; + } + + this.mOutputFluid = null; + } + } + } else if (!this.mStuttering) { + this.stutterProcess(); + this.mStuttering = true; + } + } + + + + } + + @Override + protected void doDisplayThings() { + // TODO Auto-generated method stub + super.doDisplayThings(); + } + + @Override + protected ItemStack getSpecialSlot() { + // TODO Auto-generated method stub + return super.getSpecialSlot(); + } + + @Override + protected ItemStack getOutputAt(int aIndex) { + // TODO Auto-generated method stub + return super.getOutputAt(aIndex); + } + + @Override + protected ItemStack[] getAllOutputs() { + // TODO Auto-generated method stub + return super.getAllOutputs(); + } + + @Override + protected ItemStack getInputAt(int aIndex) { + // TODO Auto-generated method stub + return super.getInputAt(aIndex); + } + + @Override + protected ItemStack[] getAllInputs() { + // TODO Auto-generated method stub + return super.getAllInputs(); + } + + @Override + protected boolean displaysInputFluid() { + return true; + } + + @Override + protected boolean displaysOutputFluid() { + return true; + } + + @Override + public boolean doesAutoOutput() { + return super.doesAutoOutput(); + } + + @Override + public boolean doesAutoOutputFluids() { + return this.mFluidTransfer_1 && this.mFluidTransfer_2; + } + + @Override + public void startProcess() { + super.startProcess(); + } + + @Override + public void endProcess() { + super.endProcess(); + } + + @Override + public String[] getInfoData() { + return super.getInfoData(); + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPullStack(aBaseMetaTileEntity, aIndex, aSide, aStack); + } + + @Override + public int checkRecipe() { + return super.checkRecipe(); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + + /* if (aBaseMetaTileEntity != null) { + if (!aBaseMetaTileEntity.getWorld().isRemote) { + itemslots : for (int i=3;i<7;i++) { + ItemStack aStack = aBaseMetaTileEntity.getStackInSlot(i); + if (aStack != null) { + if (FluidContainerRegistry.isContainer(aStack)) { + if (this.isItemValidForSlot(i, aStack)) { + // Add Fluid + FluidStack aContainerFluid = FluidContainerRegistry.getFluidForFilledItem(aStack); + if (aContainerFluid != null) { + fluidslots : for (FluidStack u : mInputFluids) { + if (u != null && u.isFluidEqual(aContainerFluid)) { + if (u.amount <= (this.getCapacity() - aContainerFluid.amount)) { + + // Matching, not full, let's fill, then continue + u.amount += aContainerFluid.amount; + + // Update stack size + if (aStack.stackSize > 1) { + aStack.stackSize--; + } + else { + aStack = null; + } + + // Add Output container + // TODO + + continue itemslots; + } + else { + // Too full + break fluidslots; + } + } + else { + if (u == null ) { + + // Empty, let's fill, then continue + u = aContainerFluid.copy(); + + // Update stack size + if (aStack.stackSize > 1) { + aStack.stackSize--; + } + else { + aStack = null; + } + + // Add Output container + // TODO + + continue itemslots; + + } + else { + // Not empty, doesn't match, check next slot. + continue fluidslots; + } + } + } + + + + } + // Eat Input + + // Add Container to Output + } + } + } + } + } + }*/ + + } + + @Override + public FluidStack getFluid() { + return super.getFluid(); + } + + @Override + public int getFluidAmount() { + return super.getFluidAmount(); + } + + @Override + public int fill(FluidStack aFluid, boolean doFill) { + return super.fill(aFluid, doFill); + } + + @Override + public FluidStack drain(int maxDrain, boolean doDrain) { + return super.drain(maxDrain, doDrain); + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + super.setItemNBT(aNBT); + } + + @Override + public boolean isItemValidForSlot(int aIndex, ItemStack aStack) { + if (aIndex >= 3 && aIndex <= 6) { + return SlotChemicalPlantInput.isItemValidForChemicalPlantSlot(aStack); + } + return false; + } + + @Override + public int[] getAccessibleSlotsFromSide(int aSide) { + return super.getAccessibleSlotsFromSide(aSide); + } + + @Override + public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { + if (aIndex >= 3 && aIndex <= 6) { + return super.canInsertItem(aIndex, aStack, aSide); + } + return false; + } + + @Override + public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) { + if (aIndex >= 7 && aIndex <= 11) { + return super.canExtractItem(aIndex, aStack, aSide); + } + return false; + } + + @Override + public boolean canFill(ForgeDirection aSide, Fluid aFluid) { + // TODO Auto-generated method stub + return super.canFill(aSide, aFluid); + } + + @Override + public boolean canDrain(ForgeDirection aSide, Fluid aFluid) { + // TODO Auto-generated method stub + return super.canDrain(aSide, aFluid); + } + + @Override + public FluidTankInfo[] getTankInfo(ForgeDirection aSide) { + // TODO Auto-generated method stub + return super.getTankInfo(aSide); + } + + @Override + public int fill_default( + ForgeDirection aSide, FluidStack aFluid, boolean doFill + ) { + // TODO Auto-generated method stub + return super.fill_default(aSide, aFluid, doFill); + } + + @Override + public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { + // TODO Auto-generated method stub + return super.fill(aSide, aFluid, doFill); + } + + @Override + public FluidStack drain( + ForgeDirection aSide, FluidStack aFluid, boolean doDrain + ) { + // TODO Auto-generated method stub + return super.drain(aSide, aFluid, doDrain); + } + + @Override + public FluidStack drain( + ForgeDirection aSide, int maxDrain, boolean doDrain + ) { + // TODO Auto-generated method stub + return super.drain(aSide, maxDrain, doDrain); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java index 611cb4da71..b8517533e6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -55,7 +55,7 @@ extends GregtechMeta_MultiBlockBase { "1x Input Bus", "1x Output Bus", "1x Energy Hatch" - }; + }; } @Override @@ -101,7 +101,7 @@ extends GregtechMeta_MultiBlockBase { public boolean checkRecipe(final ItemStack aStack) { return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0); } - + @Override public int getMaxParallelRecipes() { return this.mLevel * 12; @@ -118,19 +118,21 @@ extends GregtechMeta_MultiBlockBase { final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; this.mLevel = 0; if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { + Logger.INFO("No air? "+xDir+", 1, "+zDir); return false; } final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); switch (tUsedMeta) { - case 2: - this.mLevel = 1; - break; - case 3: - this.mLevel = 2; - break; - default: - return false; + case 2: + this.mLevel = 1; + break; + case 3: + this.mLevel = 2; + break; + default: + Logger.INFO("Bad Heating Coils."); + return false; } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { @@ -140,7 +142,7 @@ extends GregtechMeta_MultiBlockBase { Logger.INFO("Heating Coils missing."); return false; } - + if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(1), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), ModBlocks.blockCasingsMisc, 1)) { Logger.INFO("Casings missing from top layer of coke oven."); return false; @@ -158,7 +160,7 @@ extends GregtechMeta_MultiBlockBase { } } } - } + } return true; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java index 5e852b5f76..6a154051d5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java @@ -100,6 +100,7 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { final byte tSide = this.getBaseMetaTileEntity().getBackFacing(); + int aCasingCount = 0; if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) { for (byte i = 2; i < 6; i = (byte) (i + 1)) { IGregTechTileEntity tTileEntity; @@ -141,7 +142,12 @@ extends GregtechMeta_MultiBlockBase { if (!isValidBlockForStructure(aTile, getCasingTextureIndex(), true, aBlock, aMeta, getCasingBlock(), getCasingMeta())) { log("Bad Casing on Cutting Machine."); return false; - } + } + else { + if (aTile == null) { + aCasingCount++; + } + } } } } @@ -159,7 +165,7 @@ extends GregtechMeta_MultiBlockBase { return false; } log("True"); - return true; + return aCasingCount >= 26; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java index f4f8a5fe78..9885db20d6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialExtruder.java @@ -58,7 +58,7 @@ extends GregtechMeta_MultiBlockBase { "1x Output Bus", "1x Input Hatch", "1x Energy Hatch", - "Maintenance Hatch must be at the back, centered", + //"Maintenance Hatch must be at the back, centered", }; } @@ -142,6 +142,7 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { final byte tSide = this.getBaseMetaTileEntity().getBackFacing(); + int aCasingCount = 0; if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) { for (byte i = 2; i < 6; i = (byte) (i + 1)) { IGregTechTileEntity tTileEntity; @@ -183,7 +184,11 @@ extends GregtechMeta_MultiBlockBase { log("Bad Casing on Extruder."); return false; } - + else { + if (aTile == null) { + aCasingCount++; + } + } } } } @@ -200,8 +205,11 @@ extends GregtechMeta_MultiBlockBase { log("False 5"); return false; } + + + log("True"); - return true; + return aCasingCount >= 28; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java index 3087bf4703..b92e370a0b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMacerator.java @@ -47,7 +47,7 @@ extends GregtechMeta_MultiBlockBase { return new String[]{ "Controller Block for the Industrial Maceration Stack", "60% faster than using single block machines of the same voltage", - "Increased output chances on % outputs", + //"Increased output chances on % outputs", "Processes 8*tier materials at a time", "ULV = Tier 0, LV = Tier 1, etc.", "-------------------------------------------------------", diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index 2e0eeea844..8b07117596 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -609,8 +609,13 @@ extends GregtechMeta_MultiBlockBase { } // -- Try not to fail after this point - inputs have already been consumed! -- - ItemStack[] mBuiltOutput = this.mReplicatorOutputMap.toArray(); - + ItemStack[] mBuiltOutput = new ItemStack[this.mReplicatorOutputMap.size()]; + int aIndex = 0; + for (ItemStack i : this.mReplicatorOutputMap) { + mBuiltOutput[aIndex++] = i; + } + + // Convert speed bonus to duration multiplier // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java index 38306d914d..8c62937bae 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java @@ -48,7 +48,7 @@ extends GregtechMeta_MultiBlockBase { "400% faster than single-block machines of the same voltage", "Only uses 75% of the eu/t normally required", "Processes four items per voltage tier", - "Increased output chances on % outputs", + //"Increased output chances on % outputs", "Size[WxHxL]: 5x3x5", "Controller (Center Bottom)", "1x Input Bus (Any top or bottom edge casing)", diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java index d798691d04..1b92d30705 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialWireMill.java @@ -1,24 +1,19 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; - import gregtech.api.GregTech_API; import gregtech.api.enums.TAE; 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.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; public class GregtechMetaTileEntity_IndustrialWireMill extends GregtechMeta_MultiBlockBase { @@ -53,7 +48,7 @@ extends GregtechMeta_MultiBlockBase { "1x Input Bus", "1x Output Bus", "1x Energy Hatch", - "Maintenance Hatch must be at the back, centered", + //"Maintenance Hatch must be at the back, centered", }; } @@ -108,6 +103,7 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { final byte tSide = this.getBaseMetaTileEntity().getBackFacing(); + int aCasingCount = 0; if ((this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 1)) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 2) && (this.getBaseMetaTileEntity().getAirAtSideAndDistance(this.getBaseMetaTileEntity().getBackFacing(), 3)))) { for (byte i = 2; i < 6; i = (byte) (i + 1)) { IGregTechTileEntity tTileEntity; @@ -147,6 +143,11 @@ extends GregtechMeta_MultiBlockBase { log("Bad Casing on Wiremill."); return false; } + else { + if (aTile == null) { + aCasingCount++; + } + } } } } @@ -168,7 +169,7 @@ extends GregtechMeta_MultiBlockBase { return false; } log("True"); - return true; + return aCasingCount >= 32; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index dd00c9731d..71cb15474b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -20,11 +20,10 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; @@ -44,34 +43,13 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase private int controllerY; private static boolean mUsingPollutionOutputs = false; - private static AutoMap<FluidStack> mPollutionFluidStacks = new AutoMap<FluidStack>(); - - private static boolean setPollutionFluids() { - FluidStack CD, CM, SD; - CD = FluidUtils.getFluidStack("carbondioxide", 1000); - CM = FluidUtils.getFluidStack("carbonmonoxide", 1000); - SD = FluidUtils.getFluidStack("sulfuredioxide", 1000); - if (mPollutionFluidStacks.size() == 0) { - if (CD != null) - mPollutionFluidStacks.put(CD); - if (CM != null) - mPollutionFluidStacks.put(CM); - if (SD != null) - mPollutionFluidStacks.put(SD); - } - if (mPollutionFluidStacks.size() > 0) { - return true; - } - return false; - } - + public GregtechMetaTileEntity_Adv_EBF(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); CASING_TEXTURE_ID = TAE.getIndexFromPage(2, 11); mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName(); mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11); mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968); - mUsingPollutionOutputs = setPollutionFluids(); } public GregtechMetaTileEntity_Adv_EBF(String aName) { @@ -80,7 +58,6 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase mHotFuelName = FluidUtils.getFluidStack("pyrotheum", 1).getLocalizedName(); mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 11); mHatchName = ItemUtils.getLocalizedNameOfBlock(GregTech_API.sBlockMachines, 968); - mUsingPollutionOutputs = setPollutionFluids(); } @Override @@ -211,6 +188,8 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } } } + + // TODO - Fix Casing Count return true; } @@ -237,8 +216,9 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase int targetHeight; FluidStack tLiquid = aLiquid.copy(); boolean isOutputPollution = false; + mUsingPollutionOutputs = PollutionUtils.setPollutionFluids(); if (mUsingPollutionOutputs) { - for (FluidStack pollutionFluidStack : mPollutionFluidStacks) { + for (FluidStack pollutionFluidStack : PollutionUtils.mPollutionFluidStacks) { if (tLiquid.isFluidEqual(pollutionFluidStack)) { isOutputPollution = true; break; @@ -429,23 +409,25 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } - private volatile int mGraceTimer = 100; + private volatile int mGraceTimer = 2; - @SuppressWarnings("unused") @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (this.mMaxProgresstime > 0 && this.mProgresstime != 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) { - if (aTick % 10 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) { - if (!this.depleteInput(FluidUtils.getFluidStack("pyrotheum", 5))) { - this.causeMaintenanceIssue(); - this.stopMachine(); - } - if (false) { // To be replaced with a config option or something - this.explodeMultiblock(); - } - } + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + //Try dry Pyrotheum after all other logic + if (this.mStartUpCheck < 0) { + if (this.mMaxProgresstime > 0 && this.mProgresstime != 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) { + if (aTick % 10 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) { + if (!this.depleteInput(FluidUtils.getFluidStack("pyrotheum", 5))) { + if (mGraceTimer-- == 0) { + this.causeMaintenanceIssue(); + this.stopMachine(); + } + } + } + } } - super.onPostTick(aBaseMetaTileEntity, aTick); + } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java index c55fe10829..6e7039f8ca 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java @@ -292,7 +292,19 @@ extends GregtechMeta_MultiBlockBase @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()){ - //Utils.LOG_INFO("tick: "+aTick); + // Reload Lava Filter + if (this.getGUIItemStack() == null) { + if (this.mInputBusses.size() > 0) { + for (GT_MetaTileEntity_Hatch_InputBus aBus : this.mInputBusses) { + for (ItemStack aStack : aBus.mInventory) { + if (aStack.getItem() instanceof ItemLavaFilter) { + this.setGUIItemStack(aStack); + } + } + } + } + } + if (this.mEUt > 0){ if (aTick % 600L == 0L){ damageFilter(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java index 8925caf480..cb8b7590ee 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java @@ -207,7 +207,7 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { FluidStack[] arg5 = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); GT_Recipe arg6 = getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, this.getMaxInputVoltage(), arg5, new ItemStack[0]); - if (arg6 == null && !this.mRunningOnLoad || this.maxEUStore() < (long) arg6.mSpecialValue) { + if (arg6 == null && !this.mRunningOnLoad || (arg6 != null && this.maxEUStore() < (long) arg6.mSpecialValue)) { //Logger.INFO("Bad Step "+aStep++); //this.turnCasingActive(false); this.mLastRecipe = null; @@ -215,7 +215,7 @@ public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { } //Logger.INFO("Step "+aStep++); - if (this.mRunningOnLoad || arg6.isRecipeInputEqual(true, arg5, new ItemStack[0])) { + if (this.mRunningOnLoad || (arg6 != null && arg6.isRecipeInputEqual(true, arg5, new ItemStack[0]))) { //Logger.INFO("Step "+aStep++); this.mLastRecipe = arg6; this.mEUt = this.mLastRecipe.mEUt * 1; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java index 23ca94e54d..6f9080673f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityGeneratorArray.java @@ -17,16 +17,11 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; -import gregtech.common.GT_Pollution; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java index 33555c8f51..f3fefdf789 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java @@ -34,6 +34,10 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase public static int CASING_TEXTURE_ID; public static String mCasingName = "Advanced Cryogenic Casing"; public static TreeGenerator mTreeData; + + static { + mTreeData = new TreeGenerator(); + } public GregtechMetaTileEntityTreeFarm(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -76,10 +80,6 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase } }*/ - if (mTreeData == null) { - mTreeData = new TreeGenerator(); - } - diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java index de5d731dd5..ed6c913e6b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java @@ -6,7 +6,6 @@ import gregtech.GT_Mod; import gregtech.api.enums.Dyes; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; -import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -22,13 +21,11 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; -import gregtech.common.gui.GT_GUIContainer_FusionReactor; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.chemistry.IonParticles; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_Cyclotron; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; @@ -71,18 +68,19 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas @Override public String getCustomGUIResourceName() { - return "FusionComputer"; + return null; } @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new CONTAINER_Cyclotron(aPlayerInventory, aBaseMetaTileEntity); + return super.getServerGUI(aID, aPlayerInventory, aBaseMetaTileEntity); + //return new CONTAINER_Cyclotron(aPlayerInventory, aBaseMetaTileEntity); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_FusionReactor(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "FusionComputer.png", Recipe_GT.Gregtech_Recipe_Map.sCyclotronRecipes.mNEIName); - //return null; + return super.getClientGUI(aID, aPlayerInventory, aBaseMetaTileEntity); + //return new GUI_Cyclotron(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), Recipe_GT.Gregtech_Recipe_Map.sCyclotronRecipes.mNEIName); } @Override @@ -171,12 +169,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas return false; } } - mWrench = true; - mScrewdriver = true; - mSoftHammer = true; - mHardHammer = true; - mSolderingTool = true; - mCrowbar = true; + this.fixAllMaintenanceIssue(); log("Built Cyclotron."); turnCasingActive(true); return true; @@ -318,7 +311,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas /*if (CORE.DEVENV) { return this.checkRecipeGeneric(); }*/ - + this.fixAllMaintenanceIssue(); //log("Recipe Check."); ArrayList<ItemStack> tItemList = getStoredInputs(); @@ -409,6 +402,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas //Time Counter this.mTotalRunTime++; + this.fixAllMaintenanceIssue(); onRunningTick(null); @@ -432,6 +426,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas mChargeHatches.clear(); mDischargeHatches.clear(); mControlCoreBus.clear(); + mAirIntakes.clear(); mMultiDynamoHatches.clear(); mMachine = aFormCheck; } @@ -499,7 +494,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas stopMachine(); } } - doRandomMaintenanceDamage(); + //doRandomMaintenanceDamage(); aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java new file mode 100644 index 0000000000..bc36cb32a1 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java @@ -0,0 +1,502 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; + +import java.util.ArrayList; +import java.util.Collection; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.item.chemistry.RocketFuels; +import gtPlusPlus.core.material.MISC_MATERIALS; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_MultiBlockBase +{ + protected int fuelConsumption; + protected int fuelValue; + protected int fuelRemaining; + protected int freeFuelTicks = 0; + protected boolean boostEu; + + public static String mLubricantName = "Carbon Dioxide"; + public static String mCoolantName = "Liquid Hydrogen"; + + public static String mCasingName = "Turbodyne Casing"; + public static String mIntakeHatchName = "Tungstensteel Turbine Casing"; + public static String mGearboxName = "Inconel Reinforced Casing"; + + + private final static int CASING_ID = TAE.getIndexFromPage(3, 11); + + public GregtechMetaTileEntity_LargeRocketEngine(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + this.fuelConsumption = 0; + this.fuelValue = 0; + this.fuelRemaining = 0; + this.boostEu = false; + } + + public GregtechMetaTileEntity_LargeRocketEngine(final String aName) { + super(aName); + this.fuelConsumption = 0; + this.fuelValue = 0; + this.fuelRemaining = 0; + this.boostEu = false; + } + + @Override + public String[] getTooltip() { + if (mCasingName.toLowerCase().contains(".name")) { + mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 11); + } + if (mIntakeHatchName.toLowerCase().contains(".name")) { + mIntakeHatchName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 11); + } + if (mGearboxName.toLowerCase().contains(".name")) { + mGearboxName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings3Misc, 1); + } + if (mLubricantName.toLowerCase().contains(".")) { + mLubricantName = FluidUtils.getFluidStack("carbondioxide", 1).getLocalizedName(); + } + if (mCoolantName.toLowerCase().contains(".")) { + mCoolantName = FluidUtils.getFluidStack("liquidhydrogen", 1).getLocalizedName(); + } + return new String[] { + "Controller Block for the Large Combustion Engine", + "Supply Rocket Fuels and 1000L of "+mLubricantName+" per hour to run", + "Supply 40L of "+mCoolantName+" per second to boost output (optional)", + "Consumes upto 5000L of Air per second", + "Default: Produces "+GT_Values.V[5]+"EU/t at 100% efficiency", + "Boosted: Produces "+(GT_Values.V[5]*3)+"EU/t at 150% efficiency", + "Size(WxHxD): 3x3x10, Controller (front centered)", + "3x3x10 of Stable "+mCasingName+" (hollow, Min 64!)", + "8x "+mGearboxName+" inside the Hollow Casing", + "1x Dynamo Hatch (Top Middle, Max 8)", + "8x Air Intake Hatch (one of the Casings next to a Gear Box, top row allowed)", + "2x Input Hatch (Rocket Fuel/Booster) (one of the Casings next to a Gear Box, top row not allowed)", + "1x Maintenance Hatch (one of the Casings next to a Gear Box)", + "1x Muffler Hatch (Back Centre)", + }; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[CASING_ID], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced) }; + } + return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[CASING_ID] }; + } + + @Override + public boolean isCorrectMachinePart(final ItemStack aStack) { + return this.getMaxEfficiency(aStack) > 0; + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return super.getClientGUI(aID, aPlayerInventory, aBaseMetaTileEntity); + } + + public int getAir() { + if (this.mAirIntakes.isEmpty() || this.mAirIntakes.size() <= 0) { + return 0; + } + else { + int totalAir = 0; + FluidStack airstack = FluidUtils.getFluidStack("air", 1); + for (GT_MetaTileEntity_Hatch_AirIntake u : this.mAirIntakes) { + if (u != null) { + FluidStack f = u.mFluid; + if (f.isFluidEqual(airstack)) { + totalAir += f.amount; + } + } + } + return totalAir; + } + } + + @Override + public boolean checkRecipe(final ItemStack aStack) { + final ArrayList<FluidStack> tFluids = this.getStoredFluids(); + FluidStack air = FluidUtils.getFluidStack("air", 1); + + int aircount = getAir() ; + if (aircount < (boostEu ? 500 : 200)) { + //Logger.INFO("Not Enough Air to Run "+aircount); + return false; + } + else { + boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, boostEu ? 500 : 200)); + if (!hasIntakeAir) { + //Logger.INFO("Could not consume Air to run "+aircount); + return false; + } + } + //Logger.INFO("Running "+aircount); + + final Collection<GT_Recipe> tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sRocketFuels.mRecipeList; + if (tFluids.size() > 0 && tRecipeList != null) { + for (final FluidStack hatchFluid1 : tFluids) { + if (hatchFluid1.isFluidEqual(air)) { + continue; + } + for (final GT_Recipe aFuel : tRecipeList) { + final FluidStack tLiquid; + tLiquid = aFuel.mFluidInputs[0]; + if (hatchFluid1.isFluidEqual(tLiquid)) { + + final int n = (int) (this.boostEu ? ((GT_Values.V[5]*2) / aFuel.mSpecialValue) : (GT_Values.V[5] / aFuel.mSpecialValue)); + + if (!consumeFuel(aFuel)) { + continue; + } + + //Logger.INFO("Consumed some input fuel"); + this.boostEu = consumeLOH(); + //Logger.INFO("Did we consume LOH? "+boostEu); + + if (tFluids.contains(MISC_MATERIALS.CARBON_DIOXIDE.getFluid(this.boostEu ? 2 : 1)) || tFluids.contains(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 2 : 1)))) { + //Logger.INFO("Found CO2"); + if (this.mRuntime % 72 == 0 || this.mRuntime == 0) { + if (!consumeCO2()) { + return false; + } + } + this.fuelValue = aFuel.mSpecialValue; + this.fuelRemaining = hatchFluid1.amount; + this.mEUt = (int) ((this.mEfficiency < 2000) ? 0 : GT_Values.V[5]); + this.mProgresstime = 1; + this.mMaxProgresstime = 1; + this.mEfficiencyIncrease = 5; + return true; + } + return false; + } + } + } + } + this.mEUt = 0; + this.mEfficiency = 0; + return false; + } + + /** + * Consumes Fuel if required. Free Fuel Ticks are handled here. + * @param aFuel + * @return + */ + public boolean consumeFuel(GT_Recipe aFuel) { + if (freeFuelTicks > 0) { + freeFuelTicks--; + return true; + } + else { + Logger.INFO("Consuming fuel."); + freeFuelTicks = 0; + int value = aFuel.mSpecialValue * 3000; + Logger.INFO("Value: "+value); + value /= GT_Values.V[4]; + value /= 10; + Logger.INFO("Value: "+value); + FluidStack tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], value); + if (!this.depleteInput(tLiquid)) { + return false; + } + else { + this.fuelConsumption = value; + this.freeFuelTicks = value*2; + Logger.INFO("Consumed "+value+"L. Waiting "+freeFuelTicks+" ticks to consume more."); + return true; + } + } + } + + public boolean consumeCO2() { + if (this.depleteInput(MISC_MATERIALS.CARBON_DIOXIDE.getFluid(this.boostEu ? 2 : 1)) || this.depleteInput(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 2 : 1)))) { + return true; + } + else { + return false; + } + } + + public boolean consumeLOH() { + return this.depleteInput(FluidUtils.getFluidStack(RocketFuels.Liquid_Hydrogen, 2)); + } + + @Override + public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + byte tSide = getBaseMetaTileEntity().getBackFacing(); + int tX = getBaseMetaTileEntity().getXCoord(); + int tY = getBaseMetaTileEntity().getYCoord(); + int tZ = getBaseMetaTileEntity().getZCoord(); + final int MAX_LENGTH = 8; + for (int length=0;length<MAX_LENGTH;length++) { + if(getBaseMetaTileEntity().getBlockAtSideAndDistance(tSide, length+1) != getGearboxBlock()) { + Logger.INFO("Bad Gearbox Block"); + return false; + } + if(getBaseMetaTileEntity().getMetaIDAtSideAndDistance(tSide, length+1) != getGearboxMeta()) { + Logger.INFO("Bad Gearbox Meta"); + return false; + } + } + Logger.INFO("Found "+MAX_LENGTH+" "+mGearboxName+"s."); + for (byte i = -1; i < 2; i = (byte) (i + 1)) { + for (byte j = -1; j < 2; j = (byte) (j + 1)) { + if ((i != 0) || (j != 0)) { + for (byte aLength = 0; aLength < (MAX_LENGTH+2); aLength = (byte) (aLength + 1)) { // Length + + + final int fX = tX - (tSide == 5 ? 1 : tSide == 4 ? -1 : i), + fZ = tZ - (tSide == 2 ? -1 : tSide == 3 ? 1 : i), + aY = tY + j, + aX = tX + (tSide == 5 ? aLength : tSide == 4 ? -aLength : i), + aZ = tZ + (tSide == 2 ? -aLength : tSide == 3 ? aLength : i); + + + //Why check for air in world when each intake requires 1 air block? + //final Block frontAir = getBaseMetaTileEntity().getBlock(fX, aY, fZ); + //final String frontAirName = frontAir.getUnlocalizedName(); + //if(!(getBaseMetaTileEntity().getAir(fX, aY, fZ) || frontAirName.equalsIgnoreCase("tile.air") || frontAirName.equalsIgnoreCase("tile.railcraft.residual.heat"))) { + //Logger.INFO("Bad Air Check"); + //return false; //Fail if vent blocks are obstructed + //} + + if (((i == 0) || (j == 0)) && ((aLength > 0) && (aLength <= MAX_LENGTH))) { + Logger.INFO("Checking for Hatches. "+aLength); + //Top Row + if (j == 1) { + if (addDynamoToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ), getCasingTextureIndex())) { + // Do Nothing + } + else if (addAirIntakeToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ), getCasingTextureIndex())) { + // Do Nothing + } + else if (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta()) { + // Do nothing + } + else { + Logger.INFO("Top Row - "+aLength+" | Did not find casing or Dynamo"); + return false; + } + } + else { + IGregTechTileEntity aCheck = getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ); + if (aCheck != null) { + final IMetaTileEntity bCheck = aCheck.getMetaTileEntity(); + // Only allow Dynamos on Top + if (bCheck instanceof GT_MetaTileEntity_Hatch_Dynamo) { + Logger.INFO("Found dynamo in disallowed location | "+aX+", "+aY+", "+aZ+" | "+i+", "+j+", "+aLength); + return false; + } + } + if (addAirIntakeToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ), getCasingTextureIndex())) { + // Do Nothing + } + else if (addInputToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ), getCasingTextureIndex())) { + // Do Nothing + } + else if (addOutputToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ), getCasingTextureIndex())) { + // Do Nothing + } + else if (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta()) { + // Do nothing + } + else {Logger.INFO("Bad block."); + return false; + } + + } + Logger.INFO("Passed check. "+aLength); + + } else if (aLength == 0) { + Logger.INFO("Searching for Gearbox"); + if (addMaintenanceToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ), getCasingTextureIndex())) { + // Do Nothing + } + else if(!(getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta())) { + Logger.INFO("Bad Missing Casing || Bad Meta"); + return false; + } + else { + Logger.INFO("Found "+mCasingName+"."); + } + } else if (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta()) { + Logger.INFO("Found Casing."); + // Do nothing + } else { + Logger.INFO("Bad XXX"); + return false; + } + } + } + } + } + + this.mMufflerHatches.clear(); + IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), MAX_LENGTH+1); + if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { + if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Muffler)) { + this.mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) tTileEntity.getMetaTileEntity()); + this.updateTexture(tTileEntity, getCasingTextureIndex()); + } + } + + if (this.mDynamoHatches.size() <= 0 || this.mDynamoHatches.isEmpty()) { + Logger.INFO("Wrong count for Dynamos"); + return false; + } + if (this.mMufflerHatches.size() != 1 || this.mMufflerHatches.isEmpty()) { + Logger.INFO("Wrong count for Mufflers"); + return false; + } + if (this.mAirIntakes.size() < 8 || this.mAirIntakes.isEmpty()) { + Logger.INFO("Wrong count for Air Intakes | "+this.mAirIntakes.size()); + return false; + } + if (this.mMaintenanceHatches.size() < 1 || this.mMaintenanceHatches.isEmpty()) { + Logger.INFO("Wrong count for Maint. Hatches"); + return false; + } + + + Logger.INFO("Formed Rocket Engine."); + return true; + } + + public Block getCasingBlock() { + return ModBlocks.blockCasings4Misc; + } + + public byte getCasingMeta() { + return 11; + } + + public Block getIntakeBlock() { + return GregTech_API.sBlockCasings4; + } + + public byte getIntakeMeta() { + return 12; + } + + public Block getGearboxBlock() { + return ModBlocks.blockCasings3Misc; + } + + public byte getGearboxMeta() { + return 1; + } + + public byte getCasingTextureIndex() { + return (byte) CASING_ID; + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_LargeRocketEngine(this.mName); + } + + @Override + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setInteger("freeFuelTicks", freeFuelTicks); + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + freeFuelTicks = aNBT.getInteger("freeFuelTicks"); + } + + @Override + public int getDamageToComponent(final ItemStack aStack) { + return 1; + } + + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return this.boostEu ? 30000 : 10000; + } + + @Override + public int getPollutionPerTick(final ItemStack aStack) { + return this.boostEu ? 150 : 75; + } + + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return true; + } + + @Override + public String[] getExtraInfoData() { + return new String[] { + "Rocket Engine", + "Current Air: "+getAir(), + "Current Pollution: " + getPollutionPerTick(null), + "Time until next fuel consumption: "+freeFuelTicks, + "Current Output: " + this.mEUt * this.mEfficiency / 10000 + " EU/t", + "Fuel Consumption: " + this.fuelConsumption + "L/t", + "Fuel Value: " + this.fuelValue + " EU/L", + "Fuel Remaining: " + this.fuelRemaining + " Litres", + "Current Efficiency: " + this.mEfficiency / 100 + "%", + (this.getIdealStatus() == this.getRepairStatus()) ? "No Maintainance issues" : "Needs Maintainance" }; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public String getMachineType() { + return "Rocket Engine"; + } + + @Override + public int getMaxParallelRecipes() { + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java index 07c8a4a7ac..24db72fbe0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java @@ -22,8 +22,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntity_Refinery extends GregtechMeta_MultiBlockBase { - - public GT_Recipe mLastRecipe; public GregtechMetaTileEntity_Refinery(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java new file mode 100644 index 0000000000..fda79876f6 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java @@ -0,0 +1,502 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.algae; + +import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.ArrayUtils; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +import gregtech.api.enums.TAE; +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.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_AlgaeFarm; +import ic2.core.init.BlocksItems; +import ic2.core.init.InternalName; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { + + private int mLevel = -1; + + public GregtechMTE_AlgaePondBase(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMTE_AlgaePondBase(final String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMTE_AlgaePondBase(this.mName); + } + + @Override + public String getMachineType() { + return "Algae Pond"; + } + + @Override + public String[] getTooltip() { + return new String[] { + "Grows Algae!", + "Controller Block for the Algae Farm", + "Size: 9x3x9 [WxHxL] (open)", + "X X", + "X X", + "XXXXXXXXX", + "Machine Hulls (all bottom layer)", + "Sterile Farm Casings (rest)", + "Controller (front centered)", + "All hatches must be on the bottom layer", + "All hulls must be the same tier, this dictates machine speed", + "Does not require power or maintenance", + "1x Output Bus", + "1x Input Bus (optional)", + "1x Input Hatch (fill with water)", + }; + } + + @Override + public String getSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(207)); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + + int aID = TAE.getIndexFromPage(1, 15); + if (mLevel > -1) { + aID = mLevel; + } + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[aID], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[aID]}; + } + + @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } + + @Override + public int getMaxParallelRecipes() { + return 2; + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } + + @Override + public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + + this.mLevel = 0; + + + // Get Facing direction + int mCurrentDirectionX; + int mCurrentDirectionZ; + + int mOffsetX_Lower = 0; + int mOffsetX_Upper = 0; + int mOffsetZ_Lower = 0; + int mOffsetZ_Upper = 0; + + mCurrentDirectionX = 4; + mCurrentDirectionZ = 4; + + mOffsetX_Lower = -4; + mOffsetX_Upper = 4; + mOffsetZ_Lower = -4; + mOffsetZ_Upper = 4; + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX + * mCurrentDirectionX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ + * mCurrentDirectionZ; + + // Get Expected Tier + Block aCasingBlock = aBaseMetaTileEntity.getBlockAtSide((byte) 0); + int aCasingMeta = aBaseMetaTileEntity.getMetaIDAtSide((byte) 0); + + // Bad Casings + if ((aCasingBlock != GregTech_API.sBlockCasings1) || aCasingMeta > 9) { + return false; + } + else { + mLevel = this.getCasingTierOnClientSide(); + } + int aID = TAE.getIndexFromPage(1, 15); + int tAmount = 0; + check : for (int i = mOffsetX_Lower; i <= mOffsetX_Upper; ++i) { + for (int j = mOffsetZ_Lower; j <= mOffsetZ_Upper; ++j) { + for (int h = -1; h < 2; ++h) { + if ((h != 0) || ((((xDir + i != 0) || (zDir + j != 0))) && (((i != 0) || (j != 0))))) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + + Logger.INFO("X: " + i + " | Z: " + j+" | Tier: "+aID); + if (h == -1 && tTileEntity != null && addToMachineList(tTileEntity, aID)) { + continue; + } + else if (h != -1 && tTileEntity != null) { + Logger.INFO("Found hatch in wrong place, expected casing."); + return false; + } + + Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + + if ((tBlock == ModBlocks.blockCasings2Misc) && (tMeta == 15) && (h >= 0)) { + ++tAmount; + } + else if ((tBlock == GregTech_API.sBlockCasings1) && (tMeta == mLevel) && (h == -1)) { + ++tAmount; + } + else if ((tBlock == GregTech_API.sBlockCasings1) && (tMeta != mLevel) && (h == -1)) { + Logger.INFO("Found wrong tiered casing."); + return false; + } + else { + if ((i != mOffsetX_Lower && j != mOffsetZ_Lower && i != mOffsetX_Upper + && j != mOffsetZ_Upper) && (h == 0 || h == 1)) { + continue; + } else { + if (tBlock.getLocalizedName().contains("gt.blockmachines") || tBlock == Blocks.water + || tBlock == Blocks.flowing_water + || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) { + continue; + + } else { + Logger.INFO("[x] Did not form - Found: " + tBlock.getLocalizedName() + " | " + + tBlock.getDamageValue(aBaseMetaTileEntity.getWorld(), + aBaseMetaTileEntity.getXCoord() + i, + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord() + j) + + " | Special Meta: " + + (tTileEntity == null ? "0" : tTileEntity.getMetaTileID())); + Logger.INFO("[x] Did not form - Found: " + + (aBaseMetaTileEntity.getXCoord() + xDir + i) + " | " + + aBaseMetaTileEntity.getYCoord() + " | " + + (aBaseMetaTileEntity.getZCoord() + zDir + j)); + break check; + } + } + + } + + } + } + } + } + if ((tAmount >= 64)) { + Logger.INFO("Made structure."); + this.getBaseMetaTileEntity().getWorld().markBlockForUpdate(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()); + } else { + Logger.INFO("Did not make structure."); + } + return (tAmount >= 64); + } + + public boolean checkForWater() { + + // Get Facing direction + IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); + int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int mCurrentDirectionX; + int mCurrentDirectionZ; + int mOffsetX_Lower = 0; + int mOffsetX_Upper = 0; + int mOffsetZ_Lower = 0; + int mOffsetZ_Upper = 0; + + mCurrentDirectionX = 4; + mCurrentDirectionZ = 4; + + mOffsetX_Lower = -4; + mOffsetX_Upper = 4; + mOffsetZ_Lower = -4; + mOffsetZ_Upper = 4; + + // if (aBaseMetaTileEntity.fac) + + final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX + * mCurrentDirectionX; + final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ + * mCurrentDirectionZ; + + int tAmount = 0; + for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) { + for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) { + for (int h = 0; h < 2; h++) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + // byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (tBlock == Blocks.air || tBlock == Blocks.flowing_water || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) { + if (this.getStoredFluids() != null) { + for (FluidStack stored : this.getStoredFluids()) { + if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) { + if (stored.amount >= 1000) { + // Utils.LOG_WARNING("Going to try swap an air block for water from inut bus."); + stored.amount -= 1000; + Block fluidUsed = Blocks.water; + aBaseMetaTileEntity.getWorld().setBlock( + aBaseMetaTileEntity.getXCoord() + xDir + i, + aBaseMetaTileEntity.getYCoord() + h, + aBaseMetaTileEntity.getZCoord() + zDir + j, fluidUsed); + + } + } + } + } + } + tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + if (tBlock == Blocks.water || tBlock == Blocks.flowing_water) { + ++tAmount; + // Logger.INFO("Found Water"); + } + } + } + } + + boolean isValidWater = tAmount >= 60; + + if (isValidWater) { + Logger.INFO("Filled structure."); + return true; + } + else { + return false; + } + } + + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(final ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + this.fixAllMaintenanceIssue(); + // Silly Client Syncing + if (aBaseMetaTileEntity.isClientSide()) { + this.mLevel = getCasingTierOnClientSide(); + } + + } + + @Override + public boolean checkRecipe(final ItemStack aStack) { + return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0); + } + + public boolean checkRecipeGeneric( + ItemStack[] aItemInputs, FluidStack[] aFluidInputs, + int aMaxParallelRecipes, int aEUPercent, + int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { + + if (this.mLevel < 0) { + Logger.INFO("Bad Tier."); + return false; + } + + if (!checkForWater()) { + Logger.INFO("Not enough Water."); + return false; + } + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[]{}; + this.mOutputFluids = new FluidStack[]{}; + + Logger.INFO("Running checkRecipeGeneric(0)"); + + GT_Recipe tRecipe = RecipeLoader_AlgaeFarm.getTieredRecipeFromCache(this.mLevel, isUsingCompost(aItemInputs)); + + this.mLastRecipe = tRecipe; + + if (tRecipe == null) { + return false; + } + + if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes, false)) { + return false; + } + + + // -- Try not to fail after this point - inputs have already been consumed! -- + + + this.mMaxProgresstime = (int)(tRecipe.mDuration); + this.mEUt = 0; + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + Logger.INFO("Recipe time: "+this.mMaxProgresstime); + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= aMaxParallelRecipes; + } + } + + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < aMaxParallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + + tOutputItems = removeNulls(tOutputItems); + + // Sanitize item stack size, splitting any stacks greater than max stack size + List<ItemStack> splitStacks = new ArrayList<ItemStack>(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); + } + } + + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } + + // Strip empty stacks + List<ItemStack> tSList = new ArrayList<ItemStack>(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) tSList.add(tS); + } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + Logger.INFO("GOOD RETURN - 1"); + return true; + + } + + private boolean isUsingCompost(ItemStack[] aItemInputs) { + ItemStack aCompost = ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1); + for (ItemStack i : aItemInputs) { + if (GT_Utility.areStacksEqual(aCompost, i)) { + if (i.stackSize >= 8) { + return true; + } + else { + continue; + } + } + } + return false; + } + + @SideOnly(Side.CLIENT) + private final int getCasingTierOnClientSide() { + if (this == null || this.getBaseMetaTileEntity().getWorld() == null) { + return 0; + } + try { + Block aInitStructureCheck; + int aInitStructureCheckMeta; + IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, -1, 0); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, -1, 0); + if (aInitStructureCheck == GregTech_API.sBlockCasings1) { + return aInitStructureCheckMeta; + } + return 0; + } + catch (Throwable t) { + t.printStackTrace(); + return 0; + } + } + + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java index 736d0bc389..c499de0fa5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/bedrock/GregtechMetaTileEntity_BedrockMiningPlatformBase.java @@ -23,6 +23,7 @@ import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MiningUtils; +import gtPlusPlus.core.util.minecraft.OreDictUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.block.Block; @@ -509,23 +510,23 @@ public abstract class GregtechMetaTileEntity_BedrockMiningPlatformBase extends G mMixedOreData.put(new Pair<String, Integer>("oreLapis", 40)); mMixedOreData.put(new Pair<String, Integer>("oreRedstone", 40)); - if (LoadedMods.Thaumcraft || (OreDictionary.doesOreNameExist("oreAmber") && OreDictionary.doesOreNameExist("oreCinnabar"))) { + if (LoadedMods.Thaumcraft || (OreDictUtils.containsValidEntries("oreAmber") && OreDictUtils.containsValidEntries("oreCinnabar"))) { mMixedOreData.put(new Pair<String, Integer>("oreAmber", 20)); mMixedOreData.put(new Pair<String, Integer>("oreCinnabar", 20)); } - if (LoadedMods.Railcraft || OreDictionary.doesOreNameExist("oreSaltpeter")) { + if (LoadedMods.Railcraft || OreDictUtils.containsValidEntries("oreSaltpeter")) { mMixedOreData.put(new Pair<String, Integer>("oreSaltpeter", 10)); } - if (LoadedMods.IndustrialCraft2 || OreDictionary.doesOreNameExist("oreUranium")) { + if (LoadedMods.IndustrialCraft2 || OreDictUtils.containsValidEntries("oreUranium")) { mMixedOreData.put(new Pair<String, Integer>("oreUranium", 10)); } - if (OreDictionary.doesOreNameExist("oreSulfur")) { + if (OreDictUtils.containsValidEntries("oreSulfur")) { mMixedOreData.put(new Pair<String, Integer>("oreSulfur", 15)); } - if (OreDictionary.doesOreNameExist("oreSilicon")) { + if (OreDictUtils.containsValidEntries("oreSilicon")) { mMixedOreData.put(new Pair<String, Integer>("oreSilicon", 15)); } - if (OreDictionary.doesOreNameExist("oreApatite")) { + if (OreDictUtils.containsValidEntries("oreApatite")) { mMixedOreData.put(new Pair<String, Integer>("oreApatite", 25)); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java new file mode 100644 index 0000000000..654d036bf8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java @@ -0,0 +1,823 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant; + +import static gregtech.api.enums.GT_Values.E; + +import java.util.HashSet; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTech_API; +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.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { + + private int mSolidCasingTier = 0; + private int mMachineCasingTier = 0; + private int mPipeCasingTier = 0; + private int mCoilTier = 0; + + /** + * Internal Recipe Map which holds the actual recipes, backed by the real map, shown by NEI. + */ + private static final GT_Recipe_Map mFluidChemicalReactorRecipes = new GT_Recipe_Map( + new HashSet<GT_Recipe>(100), + "gt.recipe.fluidchemicaleactor", + "Chemical Plant", + null, + CORE.MODID+":textures/gui/FluidReactor", + 0, + 0, + 0, + 2, + 1, + "Tier: ", + 1, + E, + true, + false); + + + public GregtechMTE_ChemicalPlant(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMTE_ChemicalPlant(final String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GregtechMTE_ChemicalPlant(this.mName); + } + + @Override + public String getMachineType() { + return "Chemical Plant"; + } + + @Override + public String[] getTooltip() { + return new String[] { + "Heavy Industry, now right at your doorstep!", + "Controller Block for the Chemical Plant", + "27 Coils", + "18 Pipe Casings", + "57 Tiered Machine Casings", + "80+ Solid Casings", + "Hatch tier is limited to Machine Casing tier", + }; + } + + @Override + public String getSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(207)); + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + + ITexture aOriginalTexture; + + // Check things exist client side (The worst code ever) + if (aBaseMetaTileEntity.getWorld() != null) { + + } + // Check the Tier Client Side + int aTier = mSolidCasingTier; + + if (aTier == 1) { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[16]; + } + else if (aTier == 2) { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[49]; + } + else if (aTier == 3) { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[50]; + } + else if (aTier == 4) { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[48]; + } + else { + aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[11]; + } + + + if (aSide == aFacing) { + return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Advanced_Active : TexturesGtBlock.Overlay_Machine_Controller_Advanced)}; + } + return new ITexture[]{aOriginalTexture}; + } + + @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + if (mFluidChemicalReactorRecipes.mRecipeList.isEmpty() || mFluidChemicalReactorRecipes.mRecipeList.size() != Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList.size()) { + if (!mFluidChemicalReactorRecipes.mRecipeList.isEmpty()) { + mFluidChemicalReactorRecipes.mRecipeList.clear(); + } + for (Recipe_GT i : Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList) { + mFluidChemicalReactorRecipes.add(i); + } + } + return mFluidChemicalReactorRecipes; + } + + @Override + public boolean isFacingValid(final byte aFacing) { + return aFacing > 1; + } + + @Override + public int getMaxParallelRecipes() { + return 2 * getPipeCasingTier(); + } + + @Override + public int getEuDiscountForParallelism() { + return 0; + } + + private int getSolidCasingTier() { + return mSolidCasingTier; + } + + private int getMachineCasingTier() { + return mMachineCasingTier; + } + private int getPipeCasingTier() { + return mPipeCasingTier; + } + private int getCoilTier() { + return mCoilTier; + } + + private int getCasingTextureID() { + // Check the Tier Client Side + int aTier = mSolidCasingTier; + + if (aTier == 1) { + return 16; + } + else if (aTier == 2) { + return 49; + } + else if (aTier == 3) { + return 50; + } + else if (aTier == 4) { + return 48; + } + else { + return 11; + } + } + + public boolean addToMachineList(IGregTechTileEntity aTileEntity) { + int aMaxTier = getMachineCasingTier(); + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) { + GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity; + int aTileTier = aMachineBlock.mTier; + if (aTileTier > aMaxTier) { + Logger.INFO("Hatch tier too high."); + return false; + } + else { + return addToMachineList(aTileEntity, getCasingTextureID()); + } + } + else { + Logger.INFO("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know.. + return false; + } + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setInteger("mSolidCasingTier", this.mSolidCasingTier); + aNBT.setInteger("mMachineCasingTier", this.mMachineCasingTier); + aNBT.setInteger("mPipeCasingTier", this.mPipeCasingTier); + aNBT.setInteger("mCoilTier", this.mCoilTier); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mSolidCasingTier = aNBT.getInteger("mSolidCasingTier"); + mMachineCasingTier = aNBT.getInteger("mMachineCasingTier"); + mPipeCasingTier = aNBT.getInteger("mPipeCasingTier"); + mCoilTier = aNBT.getInteger("mCoilTier"); + } + + private static boolean isBlockSolidCasing(Block aBlock, int aMeta) { + if (aBlock == null) { + return false; + } + if (aBlock == GregTech_API.sBlockCasings2 && aMeta == 0) { + return true; + } + if (aBlock == GregTech_API.sBlockCasings4) { + int aMetaStainlessCasing = 1; + int aMetaTitaniumCasing = 2; + int aMetaTungstenCasing = 0; + if (aMeta == aMetaStainlessCasing || aMeta == aMetaTitaniumCasing || aMeta == aMetaTungstenCasing) { + return true; + } + } + return false; + } + private static boolean isBlockMachineCasing(Block aBlock, int aMeta) { + Block aCasingBlock1 = GregTech_API.sBlockCasings1; + if (aBlock == aCasingBlock1) { + if (aMeta > 9 || aMeta < 0) { + return false; + } + else { + return true; + } + } + else { + return false; + } + } + private static boolean isBlockPipeCasing(Block aBlock, int aMeta) { + Block aCasingBlock2 = GregTech_API.sBlockCasings2; + if (aBlock == aCasingBlock2) { + int aMetaBronzePipeCasing = 12; + int aMetaSteelPipeCasing = 13; + int aMetaTitaniumPipeCasing = 14; + int aMetaTungstenPipeCasing = 15; + if (aMeta > aMetaTungstenPipeCasing || aMeta < aMetaBronzePipeCasing) { + return false; + } + else { + return true; + } + } + else { + return false; + } + } + + private static AutoMap<Integer> mValidCoilMetaCache; + + private static boolean isBlockCoil(Block aBlock, int aMeta) { + Block aCasingBlock; + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + aCasingBlock = StaticFields59.getBlockCasings5(); + } + else { + aCasingBlock = GregTech_API.sBlockCasings1; + } + // Cache the meta values for later + if (mValidCoilMetaCache == null || mValidCoilMetaCache.isEmpty()) { + AutoMap<Integer> aValidCoilMeta = new AutoMap<Integer>(); + // Only use the right meta values available. + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + aValidCoilMeta = Meta_GT_Proxy.GT_ValidHeatingCoilMetas; + } + else { + aValidCoilMeta.put(12); + aValidCoilMeta.put(13); + aValidCoilMeta.put(14); + } + mValidCoilMetaCache = aValidCoilMeta; + } + if (aBlock == aCasingBlock) { + for (int i: mValidCoilMetaCache.values()) { + if (i == aMeta) { + return true; + } + } + } + return false; + } + + + @Override + public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; + + int tAmount = 0; + Logger.INFO("Checking ChemPlant Structure"); + + // Require Air above controller + boolean aAirCheck = aBaseMetaTileEntity.getAirOffset(0, 1, 0); + + if (!aAirCheck) { + Logger.INFO("No Air Above Controller"); + return false; + } else { + + //String aName = aInitStructureCheck != null ? ItemUtils.getLocalizedNameOfBlock(aInitStructureCheck, aInitStructureCheckMeta) : "Air"; + + mSolidCasingTier = getSolidCasingTierCheck(aBaseMetaTileEntity, xDir, zDir); + mMachineCasingTier = getMachineCasingTierCheck(aBaseMetaTileEntity, xDir, zDir); + + Logger.INFO("Initial Casing Check Complete, Solid Casing Tier: "+mSolidCasingTier+", Machine Casing Tier: "+mMachineCasingTier); + + int aSolidCasingCount = 0; + int aMachineCasingCount = 0; + int aPipeCount = 0; + int aCoilCount = 0; + + aSolidCasingCount = checkSolidCasings(aBaseMetaTileEntity, aStack, xDir, zDir); + aMachineCasingCount = checkMachineCasings(aBaseMetaTileEntity, aStack, xDir, zDir); + aPipeCount = checkPipes(aBaseMetaTileEntity, aStack, xDir, zDir); + aCoilCount = checkCoils(aBaseMetaTileEntity, aStack, xDir, zDir); + + Logger.INFO("Casing Counts: "); + Logger.INFO("Solid: "+aSolidCasingCount+", Machine: "+aMachineCasingCount); + Logger.INFO("Pipe: "+aPipeCount+", Coil: "+aCoilCount); + + + Logger.INFO("Casing Tiers: "); + Logger.INFO("Solid: "+getSolidCasingTier()+", Machine: "+getMachineCasingTier()); + Logger.INFO("Pipe: "+getPipeCasingTier()+", Coil: "+getCoilTier()); + + // Attempt to sync fields here, so that it updates client side values. + aBaseMetaTileEntity.getWorld().markBlockForUpdate(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()); + + + + // Minimum 80/93 Solid Casings + if (aSolidCasingCount < 80) { + Logger.INFO("Not enough solid casings. Found "+aSolidCasingCount+", require: 80."); + return false; + } + if (aMachineCasingCount != 57) { + Logger.INFO("Not enough machine casings. Found "+aMachineCasingCount+", require: 57."); + return false; + } + if (aPipeCount != 18) { + Logger.INFO("Not enough pipe casings. Found "+aPipeCount+", require: 18."); + return false; + } + if (aCoilCount != 27) { + Logger.INFO("Not enough coils. Found "+aCoilCount+", require: 27."); + return false; + } + + Logger.INFO("Structure Check Complete!"); + + return true; + } + } + + + public int checkCoils(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack, int aOffsetX, int aOffsetZ) { + int tAmount = 0; + int aCurrentCoilMeta = -1; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = 0; h < 8; h++) { + if (h == 1 || h == 3 || h == 5) { + Block aBlock = aBaseMetaTileEntity.getBlockOffset(aOffsetX + i, h, aOffsetZ + j); + int aMeta = aBaseMetaTileEntity.getMetaIDOffset(aOffsetX + i, h, aOffsetZ + j); + if (isBlockCoil(aBlock, aMeta)) { + if (aCurrentCoilMeta < 0) { + aCurrentCoilMeta = aMeta; + } + if (aCurrentCoilMeta != aMeta) { + return tAmount; + } + else { + tAmount++; + } + } + } + } + } + } + + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + this.mCoilTier = (aCurrentCoilMeta+1); + } + else { + if (aCurrentCoilMeta == 12) { + this.mCoilTier = 1; + } + else if (aCurrentCoilMeta == 13) { + this.mCoilTier = 2; + } + else if (aCurrentCoilMeta == 14) { + this.mCoilTier = 3; + } + else { + this.mCoilTier = 0; + } + } + + return tAmount; + } + + + public int checkPipes(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack, int aOffsetX, int aOffsetZ) { + int tAmount = 0; + int aCurrentPipeMeta = -1; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = 0; h < 8; h++) { + if (h == 2 || h == 4) { + Block aBlock = aBaseMetaTileEntity.getBlockOffset(aOffsetX + i, h, aOffsetZ + j); + int aMeta = aBaseMetaTileEntity.getMetaIDOffset(aOffsetX + i, h, aOffsetZ + j); + if (isBlockPipeCasing(aBlock, aMeta)) { + if (aCurrentPipeMeta < 0) { + aCurrentPipeMeta = aMeta; + } + if (aCurrentPipeMeta != aMeta) { + return tAmount; + } + else { + tAmount++; + } + } + } + } + } + } + + if (aCurrentPipeMeta == 12) { + this.mPipeCasingTier = 1; + } + else if (aCurrentPipeMeta == 13) { + this.mPipeCasingTier = 2; + } + else if (aCurrentPipeMeta == 14) { + this.mPipeCasingTier = 3; + } + else if (aCurrentPipeMeta == 15) { + this.mPipeCasingTier = 4; + } + else { + this.mPipeCasingTier = 0; + } + + return tAmount; + } + + + public int checkSolidCasings(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack, int aOffsetX, int aOffsetZ) { + + int tAmount = 0; + + // Only check a 7x7 ring + for (int i = -3; i < 4; i++) { + for (int j = -3; j < 4; j++) { + // If we are on the 7x7 ring, proceed + if (i == -3 || i == 3 || j == -3 || j == 3) { + IGregTechTileEntity aTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(aOffsetX + i, 0, aOffsetZ + j); + Block aBlock = aBaseMetaTileEntity.getBlockOffset(aOffsetX + i, 0, aOffsetZ + j); + int aMeta = aBaseMetaTileEntity.getMetaIDOffset(aOffsetX + i, 0, aOffsetZ + j); + + if (aTileEntity != null) { + + if (this.addToMachineList(aTileEntity)) { + tAmount++; + } + else { + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + Logger.INFO("Error counting Bottom Layer Casing Ring. Bad Tile Entity. Found "+aTileEntity.getInventoryName()); + return tAmount; + } + //Handle controller + if (aMetaTileEntity instanceof GregtechMTE_ChemicalPlant) { + continue; + } + else { + Logger.INFO("Error counting Bottom Layer Casing Ring. Bad Tile Entity. Found "+aMetaTileEntity.getInventoryName()); + return tAmount; + } + } + } + else { + if (isBlockSolidCasing(aBlock, aMeta)) { + tAmount++; + } + else { + Logger.INFO("Error counting Bottom Layer Casing Ring. Found "+aBlock.getLocalizedName()+":"+aMeta); + return tAmount; + } + } + } + } + } + + // Check 5 layers Pillars + for (int r=1;r<6;r++) { + // Check Each Pillar/Corner + for (int aPillar=0;aPillar<4;aPillar++) { + int i = 0; + int j = 0; + if (aPillar == 0) { + i = -3; + j = -3; + } + else if (aPillar == 1) { + i = 3; + j = 3; + } + else if (aPillar == 2) { + i = -3; + j = 3; + } + else if (aPillar == 3) { + i = 3; + j = -3; + } + Block aBlock = aBaseMetaTileEntity.getBlockOffset(aOffsetX + i, r, aOffsetZ + j); + int aMeta = aBaseMetaTileEntity.getMetaIDOffset(aOffsetX + i, r, aOffsetZ + j); + if (isBlockSolidCasing(aBlock, aMeta)) { + tAmount++; + } + else { + Logger.INFO("Error counting Pillars. Found "+ItemUtils.getLocalizedNameOfBlock(aBlock, aMeta)); + return tAmount; + } + } + } + + + // Check top layer 7x7 + for (int i = -3; i < 4; i++) { + for (int j = -3; j < 4; j++) { + Block aBlock = aBaseMetaTileEntity.getBlockOffset(aOffsetX + i, 6, aOffsetZ + j); + int aMeta = aBaseMetaTileEntity.getMetaIDOffset(aOffsetX + i, 6, aOffsetZ + j); + if (isBlockSolidCasing(aBlock, aMeta)) { + tAmount++; + } + else { + Logger.INFO("Error counting Top Layer casings. Found "+ItemUtils.getLocalizedNameOfBlock(aBlock, aMeta)); + return tAmount; + } + } + } + + return tAmount; + } + + + public int checkMachineCasings(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack, int aOffsetX, int aOffsetZ) { + int tAmount = 0; + int aHeight = 0; + // Iterate once for each layer + for (int aIteration=0;aIteration<3;aIteration++) { + // Dynamically set height + aHeight = (aIteration == 0 ? 0 : aIteration == 1 ? 1 : 5); + // Only check a 5x5 area + for (int i = -2; i < 3; i++) { + for (int j = -2; j < 3; j++) { + // If we are on the 5x5 ring, proceed + if (i == -2 || i == 2 || j == -2 || j == 2) { + // If the second axis is on the outer ring, continue + if (i < -2 || i > 2 || j < -2 || j > 2) { + continue; + } + Block aBlock = aBaseMetaTileEntity.getBlockOffset(aOffsetX + i, aHeight, aOffsetZ + j); + int aMeta = aBaseMetaTileEntity.getMetaIDOffset(aOffsetX + i, aHeight, aOffsetZ + j); + if (isBlockMachineCasing(aBlock, aMeta)) { + tAmount++; + } + else { + return tAmount; + } + } + } + } + } + + // Check bottom layer inner 3x3 + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + Block aBlock = aBaseMetaTileEntity.getBlockOffset(aOffsetX + i, 0, aOffsetZ + j); + int aMeta = aBaseMetaTileEntity.getMetaIDOffset(aOffsetX + i, 0, aOffsetZ + j); + if (isBlockMachineCasing(aBlock, aMeta)) { + tAmount++; + } + else { + return tAmount; + } + } + } + + return tAmount; + } + + public int getSolidCasingTierCheck(IGregTechTileEntity aBaseMetaTileEntity, int xDir, int zDir) { + Block aInitStructureCheck; + int aInitStructureCheckMeta; + if (xDir == 0) { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(zDir, 1, 0); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(zDir, 1, 0); + } + else { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, 1, xDir); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, 1, xDir); + } + if (aInitStructureCheck == GregTech_API.sBlockCasings2) { + int aMetaSteelCasing = 0; + if (aInitStructureCheckMeta == aMetaSteelCasing) { + return 1; + } + } + else if (aInitStructureCheck == GregTech_API.sBlockCasings4) { + int aMetaStainlessCasing = 1; + int aMetaTitaniumCasing = 2; + int aMetaTungstenCasing = 0; + if (aInitStructureCheckMeta == aMetaStainlessCasing) { + return 2; + } + else if (aInitStructureCheckMeta == aMetaTitaniumCasing) { + return 3; + } + else if (aInitStructureCheckMeta == aMetaTungstenCasing) { + return 4; + } + } + return 0; + } + + public int getMachineCasingTierCheck(IGregTechTileEntity aBaseMetaTileEntity, int xDir, int zDir) { + Block aInitStructureCheck; + int aInitStructureCheckMeta; + Logger.INFO(""+xDir+", "+zDir); + if (xDir == 0) { + if (zDir > 0) { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, 0, 1); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, 0, 1); + } + else { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, 0, -1); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, 0, -1); + } + + } + else { + if (xDir > 0) { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(1, 0, 0); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(1, 0, 0); + } + else { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(-1, 0, 0); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(-1, 0, 0); + } + } + + if (isBlockMachineCasing(aInitStructureCheck, aInitStructureCheckMeta)) { + Logger.INFO("Using Meta "+aInitStructureCheckMeta); + return aInitStructureCheckMeta; + } + return 0; + } + + + + + + + + + + + + + + + + + + + + + @Override + public int getMaxEfficiency(final ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(final ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(final ItemStack aStack) { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + // Silly Client Syncing + if (aBaseMetaTileEntity.isClientSide()) { + this.mSolidCasingTier = getCasingTierOnClientSide(); + } + + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + } + + @Override + public boolean checkRecipe(final ItemStack aStack) { + return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0); + } + + + + @SideOnly(Side.CLIENT) + private final int getCasingTierOnClientSide() { + + if (this == null || this.getBaseMetaTileEntity().getWorld() == null) { + return 0; + } + try { + Block aInitStructureCheck; + int aInitStructureCheckMeta; + IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; + if (xDir == 0) { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(zDir, 1, 0); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(zDir, 1, 0); + } + else { + aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, 1, xDir); + aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, 1, xDir); + } + if (aInitStructureCheck == GregTech_API.sBlockCasings2) { + int aMetaSteelCasing = 0; + if (aInitStructureCheckMeta == aMetaSteelCasing) { + return 1; + } + } + else if (aInitStructureCheck == GregTech_API.sBlockCasings4) { + int aMetaStainlessCasing = 1; + int aMetaTitaniumCasing = 2; + int aMetaTungstenCasing = 0; + if (aInitStructureCheckMeta == aMetaStainlessCasing) { + return 2; + } + else if (aInitStructureCheckMeta == aMetaTitaniumCasing) { + return 3; + } + else if (aInitStructureCheckMeta == aMetaTungstenCasing) { + return 4; + } + } + return 0; + } + catch (Throwable t) { + t.printStackTrace(); + return 0; + } + + } + + + + + + + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index b23d34019e..7300b3507b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage; import java.util.ArrayList; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -15,10 +16,12 @@ import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.handler.BookHandler; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.preloader.asm.AsmConfig; import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_PowerSubStation; import gtPlusPlus.xmod.gregtech.api.gui.GUI_PowerSubStation; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; @@ -64,14 +67,16 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe return new String[]{ "[BUG] GUI does not work until structure is assembled correctly. (Do Not Report issue)", "Consumes " + this.ENERGY_TAX + "% of the average voltage of all energy type hatches", + "Does not require maintenance", "Can be built with variable height between " + (CELL_HEIGHT_MIN + 2) + "-" + (CELL_HEIGHT_MAX + 2) + "", "Hatches can be placed nearly anywhere", "HV Energy/Dynamo Hatches are the lowest tier you can use", - "Controller (Bottom, Centre)", - "Size(WxHxD): External 5xHx5, Sub-Station External Casings", - "Size(WxHxD): Internal 3x(H-2)x3, Vanadium Redox Power Cells", - "Read '"+BookHandler.ItemBookWritten_MultiPowerStorage.getDisplayName()+"' for more info.", - }; + CORE.GTNH ? "Supports voltages >= UHV using MAX tier components." : "Supports upto "+GT_Values.VOLTAGE_NAMES[GT_Values.VOLTAGE_NAMES.length-1], + "Controller (Bottom, Centre)", + "Size(WxHxD): External 5xHx5, Sub-Station External Casings", + "Size(WxHxD): Internal 3x(H-2)x3, Vanadium Redox Power Cells", + "Read '"+BookHandler.ItemBookWritten_MultiPowerStorage.getDisplayName()+"' for more info.", + }; } @Override @@ -116,7 +121,9 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe checkMachineProblem(problem); } private void checkMachineProblem(String msg) { - Logger.INFO("Power Sub-Station problem: " + msg); + if (!AsmConfig.disableAllLogging) { + Logger.INFO("Power Sub-Station problem: " + msg); + } } public static int getCellTier(Block aBlock, int aMeta) { @@ -124,14 +131,14 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe return 4; } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 4) { return 5; - } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 5) { + } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 5) { return 6; } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 6) { return 7; } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 7) { return 8; } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 8) { - return 9; + return CORE.GTNH ? GT_Values.V.length : 9; } else { return -1; } @@ -299,7 +306,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe } // Only set this here, after the machine check is 100% passed. - + this.fixAllMaintenanceIssue(); this.mBatteryCapacity = getCapacityFromCellTier(tOverallCellTier) * tCellCount; return true; } @@ -373,9 +380,10 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe this.mMaxProgresstime = 1; this.mEUt = 0; this.mEfficiencyIncrease = 10000; + this.fixAllMaintenanceIssue(); return true; } - + @Override public int getMaxParallelRecipes() { return 1; @@ -493,7 +501,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe } else { storedEnergyText = EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET; } - + int errorCode = this.getBaseMetaTileEntity().getErrorDisplayID(); boolean mMaint = (errorCode != 0); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java index bc0c821478..3da1763634 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java @@ -1,41 +1,22 @@ package gtPlusPlus.xmod.gregtech.common.tools; -import java.util.Arrays; -import java.util.List; - import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; import gregtech.api.enums.Textures.ItemIcons; import gregtech.api.interfaces.IIconContainer; import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.common.items.behaviors.Behaviour_None; -import gregtech.common.tools.GT_Tool; +import gregtech.common.tools.GT_Tool_WireCutter; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.stats.AchievementList; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; -import net.minecraftforge.event.world.BlockEvent; public class TOOL_Gregtech_ElectricSnips -extends GT_Tool { - - public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"}); - +extends GT_Tool_WireCutter { - @Override - public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { - String tName = aEntity.getClass().getName(); - tName = tName.substring(tName.lastIndexOf(".") + 1); - return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; - } @Override public int getToolDamagePerBlockBreak() { @@ -78,77 +59,6 @@ extends GT_Tool { } @Override - public String getCraftingSound() { - return GregTech_API.sSoundList.get(Integer.valueOf(1)); - } - - @Override - public String getEntityHitSound() { - return GregTech_API.sSoundList.get(Integer.valueOf(2)); - } - - @Override - public String getBreakingSound() { - return GregTech_API.sSoundList.get(Integer.valueOf(0)); - } - - @Override - public String getMiningSound() { - return null; - } - - @Override - public boolean canBlock() { - return false; - } - - public boolean isWrench(){ - return false; - } - - @Override - public boolean isCrowbar() { - return false; - } - - @Override - public boolean isWeapon() { - return true; - } - - @Override - public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { - final String tTool = aBlock.getHarvestTool(aMetaData); - return (tTool != null) && (tTool.equals("sword") || tTool.equals("cutter")); - } - - - @Override - public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { - int rConversions = 0; - /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); - if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { - for (final ItemStack tDrop : aDrops) { - tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); - if (tRecipe != null) { - final ItemStack tHammeringOutput = tRecipe.getOutput(0); - if (tHammeringOutput != null) { - rConversions += tDrop.stackSize; - tDrop.stackSize *= tHammeringOutput.stackSize; - tHammeringOutput.stackSize = tDrop.stackSize; - GT_Utility.setStack(tDrop, tHammeringOutput); - } - } - } - } else { - aDrops.clear(); - aDrops.add(tRecipe.getOutput(0)); - rConversions++; - }*/ - return rConversions; - } - - @Override public ItemStack getBrokenItem(final ItemStack aStack) { return null; } @@ -163,8 +73,7 @@ extends GT_Tool { return !aIsToolHead ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa : GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa; - } - + } @@ -183,15 +92,5 @@ extends GT_Tool { public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Snipped out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); } - - @Override - public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { - aItem.addItemBehavior(aID, new Behaviour_None()); - } - - @Override - public boolean isGrafter() { - return false; - } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngelGrinder.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngleGrinder.java index 1d20b56551..bf4e9b1390 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngelGrinder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngleGrinder.java @@ -19,8 +19,8 @@ import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegis import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import net.minecraft.item.ItemStack; -public class ProcessingAngelGrinder implements Interface_OreRecipeRegistrator, Runnable { - public ProcessingAngelGrinder() { +public class ProcessingAngleGrinder implements Interface_OreRecipeRegistrator, Runnable { + public ProcessingAngleGrinder() { GregtechOrePrefixes.toolAngleGrinder.add(this); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index d8a5617b2e..d4a25e03dd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -266,7 +266,7 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { //Get us four ItemStacks to input into the mixer ItemStack input1, input2, input3, input4; - input1 = (inputStacks.length >= 1) ? (input1 = (inputStacks[0] == null) ? null : inputStacks[0]) : null; + input1 = inputStacks[0]; input2 = (inputStacks.length >= 2) ? (input2 = (inputStacks[1] == null) ? null : inputStacks[1]) : null; input3 = (inputStacks.length >= 3) ? (input3 = (inputStacks[2] == null) ? null : inputStacks[2]) : null; input4 = (inputStacks.length >= 4) ? (input4 = (inputStacks[3] == null) ? null : inputStacks[3]) : null; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java index 7bc0eacd4f..40994040bd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_FluidCanning.java @@ -1,61 +1,230 @@ package gtPlusPlus.xmod.gregtech.loaders; import java.util.HashSet; -import java.util.Set; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Recipe; - +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.interfaces.RunnableWithInfo; -import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.material.MaterialGenerator; - -public class RecipeGen_FluidCanning extends RecipeGen_Base { +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; - public final static Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<RunnableWithInfo<Material>>(); - static { - MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); +public class RecipeGen_FluidCanning implements Runnable { + + public static void init() { + FluidCanningRunnableHandler x = new FluidCanningRunnableHandler(); + x.run(); } + private static class FluidCanningRunnableHandler implements RunnableWithInfo<String> { + + @Override + public void run() { + mHasRun = true; + for (RecipeGen_FluidCanning aRecipe : mCache) { + aRecipe.run(); + } + } + + @Override + public String getInfoData() { + return "Fluid Canning Recipes"; + } + } + + private static boolean mHasRun = false; + + private static HashSet<RecipeGen_FluidCanning> mCache = new HashSet<RecipeGen_FluidCanning>(); + + private static void addRunnableToRecipeCache(RecipeGen_FluidCanning r) { + if (mHasRun) { + CORE.crash(); + } + mCache.add(r); + } + + protected boolean disableOptional; + private final GT_Recipe recipe; - public RecipeGen_FluidCanning(GT_Recipe g) { - this(g, true); + private final boolean isValid; + + public boolean valid() { + return isValid; + } + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluid) { + this(aExtracting, aEmpty, aFull, aFluid, GT_Values.NF, null, null); + } + + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluidIn, FluidStack aFluidOut) { + this(aExtracting, aEmpty, aFull, aFluidIn, aFluidOut, null, null); } - public RecipeGen_FluidCanning(GT_Recipe g, boolean extracting) { - recipe = g; - mRecipeGenMap.add(this); - disableOptional = extracting; + + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluid, Integer aDuration, Integer aEUt) { + this(aExtracting, aEmpty, aFull, aFluid, GT_Values.NF, aDuration, aEUt); + } + + // Alternative Constructor + public RecipeGen_FluidCanning(boolean aExtracting, ItemStack aEmpty, ItemStack aFull, FluidStack aFluidIn, FluidStack aFluidOut, Integer aDuration, Integer aEUt) { + ItemStack aInput; + ItemStack aOutput; + FluidStack aFluidInput; + FluidStack aFluidOutput; + + // Safety check on the duration + if (aDuration == null || aDuration <= 0) { + aDuration = (aFluidIn != null) ? (aFluidIn.amount / 62) : ((aFluidOut != null) ? (aFluidOut.amount / 62) : 10); + } + + // Safety check on the EU + if (aEUt == null || aEUt <= 0) { + if (aExtracting) { + aEUt = 2; + } + else { + aEUt = 1; + } + } + + // Set Item stacks correctly, invert if extraction recipe. + if (aExtracting) { + aInput = aFull; + aOutput = aEmpty; + aFluidInput = GT_Values.NF; + aFluidOutput = aFluidIn; + } + else { + aInput = aEmpty; + aOutput = aFull; + aFluidInput = aFluidIn; + aFluidOutput = aFluidOut != null ? aFluidOut : GT_Values.NF; + } + + //Check validity + + Recipe_GT aRecipe = new Recipe_GT( + true, + new ItemStack[] { aInput }, + new ItemStack[] { aOutput }, + null, + new int[] {10000}, + new FluidStack[] { aFluidInput }, + new FluidStack[] { aFluidOutput }, + aDuration, + aEUt, + 0); + + + // Check Valid + boolean aTempValidityCheck = false; + //Logger.INFO("Validity Check."); + if (aExtracting) { + Logger.INFO("Extracting."); + if (aInput != null && aFluidOutput != null) { + //Logger.INFO("Pass."); + aTempValidityCheck = true; + } + } + else { + //Logger.INFO("Canning."); + if (aInput != null && aOutput != null && (aFluidInput != null || aFluidOutput != null)) { + //Logger.INFO("Pass."); + aTempValidityCheck = true; + } + } + + + if (aTempValidityCheck) { + // Valid Recipe + recipe = aRecipe; + disableOptional = aExtracting; + isValid = true; + //Logger.INFO("Passed Validity Check. Hash: "+recipe.hashCode()); + //Logger.INFO("Mapped as: "+(disableOptional ? "Extracting" : "Canning")); + addRunnableToRecipeCache(this); + } + else { + //Logger.INFO("Failed Validity Check."); + isValid = false; + disableOptional = aExtracting; + aRecipe.mEnabled = false; + aRecipe.mHidden = true; + recipe = null; + } } @Override public void run() { + Logger.INFO("Processing Recipe with Hash: "+recipe.hashCode()); generateRecipes(); } private void generateRecipes() { - if (recipe != null) { - //Used to store Fluid extraction state + if (isValid && recipe != null) { + //Logger.INFO("Processing "+(disableOptional ? "Extracting" : "Canning")+" Recipe."); if (this.disableOptional) { - GT_Values.RA.addFluidExtractionRecipe( - recipe.mInputs.length >= 1 ? recipe.mInputs[0] : null, //Input - recipe.mInputs.length == 2 ? recipe.mInputs[1] : null, //Input 2 - recipe.mFluidOutputs.length == 1 ? recipe.mFluidOutputs[0] : null, //Fluid Output - recipe.mSpecialValue, //Chance - recipe.mDuration, //Duration - recipe.mEUt //Eu Tick - ); + addFluidExtractionRecipe(recipe); } else { - GT_Values.RA.addFluidCannerRecipe( - recipe.mInputs.length == 1 ? recipe.mInputs[0] : null, //Input - recipe.mOutputs.length == 1 ? recipe.mOutputs[0] : null, //Input 2 - recipe.mFluidInputs.length == 1 ? recipe.mFluidInputs[0] : null, //Fluid Input - recipe.mFluidOutputs.length == 1 ? recipe.mFluidOutputs[0] : null //Fluid Output - ); - + addFluidCannerRecipe(recipe); } + } + } - } + private final boolean addFluidExtractionRecipe(GT_Recipe aRecipe) { + boolean result = false; + int aCount1 = GT_Recipe_Map.sFluidExtractionRecipes.mRecipeList.size(); + int aCount2 = aCount1; + GT_Recipe_Map.sFluidExtractionRecipes.addRecipe(aRecipe); + aCount1 = GT_Recipe_Map.sFluidExtractionRecipes.mRecipeList.size(); + result = aCount1 > aCount2; + if (result) { + //Logger.INFO("[FIND] Added Extraction recipe for "+ItemUtils.getArrayStackNames(aRecipe.mInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mOutputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidOutputs)); + } + else { + Logger.INFO("[ERROR] Failed adding Extraction recipe for "+ItemUtils.getArrayStackNames(aRecipe.mInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mOutputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidOutputs)); + //dumpStack(); + } + return result; + } + + private final boolean addFluidCannerRecipe(GT_Recipe aRecipe) { + boolean result = false; + int aCount1 = GT_Recipe_Map.sFluidCannerRecipes.mRecipeList.size(); + int aCount2 = aCount1; + GT_Recipe_Map.sFluidCannerRecipes.addRecipe(aRecipe); + aCount1 = GT_Recipe_Map.sFluidCannerRecipes.mRecipeList.size(); + result = aCount1 > aCount2; + if (result) { + //Logger.INFO("[FIND] Added Canning recipe for "+ItemUtils.getArrayStackNames(aRecipe.mInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mOutputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidOutputs)); + } + else { + Logger.INFO("[ERROR] Failed adding Canning recipe for "+ItemUtils.getArrayStackNames(aRecipe.mInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mOutputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidInputs)+", "+ItemUtils.getArrayStackNames(aRecipe.mFluidOutputs)); + //dumpStack(); + } + return result; + } + + private void dumpStack() { + int parents = 2; + for (int i=0;i<6;i++) { + Logger.INFO((disableOptional ? "EXTRACTING" : "CANNING")+" DEBUG | "+(i == 0 ? "Called from: " : "Parent: ")+ReflectionUtils.getMethodName(i+parents)); + } + + } + + private String buildLogString() { + int solidSize = getMapSize(GT_Recipe_Map.sCannerRecipes); + int fluidSize = getMapSize(GT_Recipe_Map.sFluidCannerRecipes); + return (disableOptional ? "EXTRACTING" : "CANNING")+" DEBUG | Solids: "+solidSize+" | Liquids: "+fluidSize+" | "; + } + + private final int getMapSize(GT_Recipe_Map aMap) { + return aMap.mRecipeList.size(); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index b2236fdd6c..2b4e52abb9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -48,10 +48,9 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Ingot if (ItemUtils.checkForInvalidItems(material.getIngot(1))) - if (GT_Values.RA.addFluidExtractionRecipe(material.getIngot(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getIngot(1), // Input material.getFluid(144), // Fluid Output - 0, // Chance 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -64,10 +63,9 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Plate if (ItemUtils.checkForInvalidItems(material.getPlate(1))) - if (GT_Values.RA.addFluidExtractionRecipe(material.getPlate(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getPlate(1), // Input material.getFluid(144), // Fluid Output - 0, // Chance 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -80,10 +78,9 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Double Plate if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1))) - if (GT_Values.RA.addFluidExtractionRecipe(material.getPlateDouble(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getPlateDouble(1), // Input material.getFluid(288), // Fluid Output - 0, // Chance 1 * 20, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -96,10 +93,9 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Nugget if (ItemUtils.checkForInvalidItems(material.getNugget(1))) - if (GT_Values.RA.addFluidExtractionRecipe(material.getNugget(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getNugget(1), // Input material.getFluid(16), // Fluid Output - 0, // Chance 16, // Duration material.vVoltageMultiplier // Eu Tick )) { @@ -112,10 +108,9 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Block if (ItemUtils.checkForInvalidItems(material.getBlock(1))) - if (GT_Values.RA.addFluidExtractionRecipe(material.getBlock(1), // Input - null, // Input 2 + if (CORE.RA.addFluidExtractionRecipe( + material.getBlock(1), // Input material.getFluid(144 * 9), // Fluid Output - 0, // Chance 288, // Duration material.vVoltageMultiplier // Eu Tick )) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java index 1cb999241a..9b7e1d708d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java @@ -55,9 +55,6 @@ public class RecipeGen_Ore extends RecipeGen_Base { //if (material.getMaterialComposites().length > 1){ Logger.MATERIALS("[Recipe Generator Debug] ["+material.getLocalizedName()+"]"); int tVoltageMultiplier = MaterialUtils.getVoltageForTier(material.vTier); - if (tVoltageMultiplier < 120) { - tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 480 : 120; - } final ItemStack dustStone = ItemUtils.getItemStackOfAmountFromOreDict("dustStone", 1); Material bonusA = null; //Ni @@ -222,9 +219,10 @@ public class RecipeGen_Ore extends RecipeGen_Base { Logger.MATERIALS("material.getCrushed(1): "+(material.getCrushed(1) != null)); Logger.MATERIALS("material.getCrushedPurified(1): "+(material.getCrushedPurified(1) != null)); - Logger.MATERIALS("bonusA.getTinyDust(1): "+(tinyDustA != null)+" | Material: "+(bonusA != null) + " | Material name: "+(bonusA != null ? bonusA.getLocalizedName() : "invalid material")); - Logger.MATERIALS("bonusB.getTinyDust(1): "+(tinyDustB != null)+" | Material: "+(bonusB != null) + " | Material name: "+(bonusB != null ? bonusB.getLocalizedName() : "invalid material")); + Logger.MATERIALS("material.getTinyDust(1): "+(ItemUtils.getItemName(bonusA.getCrushed(1)))); + Logger.MATERIALS("material.getTinyDust(1): "+(ItemUtils.getItemName(bonusB.getCrushed(1)))); + try { //.08 compat if (GT_ModHandler.addThermalCentrifugeRecipe(material.getCrushed(1), 200, material.getCrushedCentrifuged(1), tinyDustB, dustStone)){ @@ -362,7 +360,7 @@ public class RecipeGen_Ore extends RecipeGen_Base { mInternalOutputs[4], mInternalOutputs[5], mChances, - 20*1*(tVoltageMultiplier/10), + (int) Math.max(material.getMass() * 3L * 1, 1), tVoltageMultiplier)){ Logger.MATERIALS("[Electrolyzer] Generated Electrolyzer recipe for "+matDust.getDisplayName()); } @@ -445,7 +443,7 @@ public class RecipeGen_Ore extends RecipeGen_Base { null, mInternalOutputs, mChances, - 20*1*(tVoltageMultiplier/10), + (int) Math.max(material.getMass() * 4L * 1, 1), tVoltageMultiplier)){ Logger.MATERIALS("[Dehydrator] Generated Dehydrator recipe for "+matDust.getDisplayName()); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java index f0c2785e1b..84188a44aa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java @@ -7,16 +7,11 @@ import java.util.Map; import org.apache.commons.lang3.reflect.FieldUtils; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; @@ -26,6 +21,8 @@ import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; public class RecipeGen_Recycling implements Runnable { @@ -60,6 +57,7 @@ public class RecipeGen_Recycling implements Runnable { public static void generateRecipes(final Material material) { + if (material != null) Logger.WARNING("Generating Recycling recipes for " + material.getLocalizedName()); final OrePrefixes[] mValidPrefixesAsString = { OrePrefixes.ingot, OrePrefixes.ingotHot, OrePrefixes.nugget, @@ -139,7 +137,7 @@ public class RecipeGen_Recycling implements Runnable { //Fluid Extractor if (ItemUtils.checkForInvalidItems(tempStack)) { // mValidItems[mSlotIndex++] = tempStack; - if ((mDust != null) && GT_Values.RA.addFluidExtractionRecipe(tempStack, null, material.getFluid(mFluidAmount), 0, 30, material.vVoltageMultiplier)) { + if ((mDust != null) && CORE.RA.addFluidExtractionRecipe(tempStack, material.getFluid(mFluidAmount), 30, material.vVoltageMultiplier)) { Logger.WARNING("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle " + tempStack.getDisplayName() + " and obtain " + mFluidAmount+"mb of "+material.getFluid(1).getLocalizedName()+"."); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java new file mode 100644 index 0000000000..8a4ae1344a --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java @@ -0,0 +1,202 @@ +package gtPlusPlus.xmod.gregtech.loaders.recipe; + +import java.util.HashMap; + +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.data.WeightedCollection; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class RecipeLoader_AlgaeFarm { + + private static final HashMap<Integer, AutoMap<GT_Recipe>> mRecipeCache = new HashMap<Integer, AutoMap<GT_Recipe>>(); + private static final HashMap<Integer, AutoMap<GT_Recipe>> mRecipeCompostCache = new HashMap<Integer, AutoMap<GT_Recipe>>(); + + public static final void generateRecipes() { + for (int i=0;i<10;i++) { + getTieredRecipeFromCache(i, false); + } + for (int i=0;i<10;i++) { + getTieredRecipeFromCache(i, true); + } + } + + public static GT_Recipe getTieredRecipeFromCache(int aTier, boolean aCompost) { + HashMap<Integer, AutoMap<GT_Recipe>> aMap = aCompost ? mRecipeCompostCache : mRecipeCache; + String aComp = aCompost ? "(Compost)" : ""; + + AutoMap<GT_Recipe> aTemp = aMap.get(aTier); + if (aTemp == null || aTemp.isEmpty()) { + aTemp = new AutoMap<GT_Recipe>(); + aMap.put(aTier, aTemp); + Logger.INFO("Tier "+aTier+aComp+" had no recipes, initialising new map."); + } + if (aTemp.size() < 500) { + Logger.INFO("Tier "+aTier+aComp+" has less than 500 recipes, generating "+(500 - aTemp.size())+"."); + for (int i=aTemp.size();i<500;i++) { + aTemp.put(generateBaseRecipe(aCompost, aTier)); + } + } + int aIndex = MathUtils.randInt(0, aTemp.isEmpty() ? 1 : aTemp.size()); + Logger.INFO("Using recipe with index of "+aIndex+". "+aComp); + return aTemp.get(aIndex); + } + + private static GT_Recipe generateBaseRecipe(boolean aUsingCompost, int aTier) { + + // Type Safety + if (aTier < 0) { + return null; + } + + WeightedCollection<Float> aOutputTimeMulti = new WeightedCollection<Float>(); + for (int i=100;i> 0;i--) { + float aValue = 0; + if (i < 10) { + aValue = 3f; + } + else if (i < 20) { + aValue = 2f; + } + else { + aValue = 1f; + } + aOutputTimeMulti.put(i, aValue); + } + + final int[] aDurations = new int[] { + 432000, + 378000, + 216000, + 162000, + 108000, + 81000, + 54000, + 40500, + 27000, + 20250, + 13500, + 6750, + 3375, + 1686, + 843, + 421 + }; + + ItemStack[] aInputs = new ItemStack[] {}; + + if (aUsingCompost) { + // Make it use 4 compost per tier if we have some available + ItemStack aCompost = ItemUtils.getSimpleStack(AgriculturalChem.mCompost, aTier * 4); + aInputs = new ItemStack[] {aCompost}; + // Boost Tier by one if using compost so it gets a speed boost + aTier++; + } + + // We set these elsewhere + ItemStack[] aOutputs = getOutputsForTier(aTier); + + GT_Recipe tRecipe = new Recipe_GT( + false, + aInputs, + aOutputs, + (Object) null, + new int[] {}, + new FluidStack[] {GT_Values.NF}, + new FluidStack[] {GT_Values.NF}, + (int) (aDurations[aTier] * aOutputTimeMulti.get()), // Time + 0, + 0); + + tRecipe.mSpecialValue = tRecipe.hashCode(); + + return tRecipe; + } + + private static ItemStack[] getOutputsForTier(int aTier) { + + // Create an Automap to dump contents into + AutoMap<ItemStack> aOutputMap = new AutoMap<ItemStack>(); + + // Add loot relevant to tier and also add any from lower tiers. + if (aTier >= 0) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(32, 64))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(8, 16))); + } + } + if (aTier >= 1) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(16, 32))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(4, 8))); + } + } + if (aTier >= 2) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(8, 16))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(16, 32))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(4, 8))); + } + } + if (aTier >= 3) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(2, 8))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(8, 16))); + } + } + if (aTier >= 4) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(32, 64))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(4, 8))); + } + } + if (aTier >= 5) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(1, 2))); + } + } + // Tier 6 is Highest for outputs + if (aTier >= 6) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(16, 32))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(8, 16))); + if (MathUtils.randInt(0, 10) > 9) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(8, 16))); + } + } + + // Iterate a special loop at higher tiers to provide more Red/Gold Algae. + for (int i=0;i<(9-aTier);i++) { + if (aTier >= (6+i)) { + int aMulti = i + 1; + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mGoldenBrownAlgaeBiosmass, MathUtils.randInt(4, 8*aMulti))); + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(4, 8*aMulti))); + if (MathUtils.randInt(0, 10) > 8) { + aOutputMap.put(ItemUtils.getSimpleStack(AgriculturalChem.mRedAlgaeBiosmass, MathUtils.randInt(8, 16*aMulti))); + } + } + } + + // Map the AutoMap contents to an Itemstack Array. + ItemStack[] aOutputs = new ItemStack[aOutputMap.size()]; + for (int i=0;i<aOutputMap.size();i++) { + aOutputs[i] = aOutputMap.get(i); + } + + // Return filled ItemStack Array. + return aOutputs; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 7ef3b0b6dd..efac0222af 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -7,11 +7,15 @@ import java.lang.reflect.Method; import java.util.List; import gregtech.api.GregTech_API; +import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.interfaces.internal.IGT_RecipeAdder; import gregtech.api.util.CustomRecipeMap; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; import gregtech.api.util.SemiFluidFuelHandler; @@ -24,6 +28,7 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.data.ArrayUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.recipes.machines.RECIPEHANDLER_MatterFabricator; @@ -679,6 +684,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { private static final Method mScannerTT; private static final Method[] mChemicalRecipe = new Method[3]; private static final Method mLargeChemReactor; + private static final Method mPyroOven; static { @@ -705,6 +711,17 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { if (ttTest != null) { T = ttTest; } + else { + Method[] aDump = TTRecipeAdder.getDeclaredMethods(); + for (Method m : aDump) { + if (m != null) { + Logger.INFO("Found "+m.getName()+" | "+m.getModifiers()+" | "+ArrayUtils.toString(m.getParameters(), "EMPTY")+""); + if (m.getName().toLowerCase().equals("addresearchableassemblylinerecipe")){ + Logger.INFO("Types: "+ArrayUtils.toString(m.getParameterTypes())); + } + } + } + } } } else { @@ -717,6 +734,8 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { mLargeChemReactor = ReflectionUtils.getMethod(clazz, "addMultiblockChemicalRecipe", ItemStack[].class, FluidStack[].class, FluidStack[].class, ItemStack[].class, int.class, int.class); + mPyroOven = ReflectionUtils.getMethod(clazz, "addPyrolyseRecipe", ItemStack.class, FluidStack.class, int.class, ItemStack.class, FluidStack.class, int.class, int.class); + } @@ -725,6 +744,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { mAssemblyLine = null; mLargeChemReactor = null; mScannerTT = null; + mPyroOven = null; } @@ -786,7 +806,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { Logger.INFO("Failed to generate TecTech recipe for "+ItemUtils.getItemName(aResearchItem)+", please report this to Alkalus."); } catch (Throwable t) { - + t.printStackTrace(); } } return (boolean) mAssemblyLine.invoke(GT_Values.RA, aResearchItem, aResearchTime, aInputs, @@ -874,6 +894,25 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } @Override + public boolean addChemicalRecipe(ItemStack input1, ItemStack input2, int aCircuit, FluidStack inputFluid, FluidStack outputFluid, ItemStack output, ItemStack output2, int time, int eu) { + if (aCircuit < 0 || aCircuit > 24) { + aCircuit = 22; + } + GT_Recipe aSpecialRecipe = new Recipe_GT( + false, + new ItemStack[] {input1, input2}, + new ItemStack[] {output, output2}, + CI.getNumberedCircuit(aCircuit), + new int[] {}, + new FluidStack[] {inputFluid}, + new FluidStack[] {outputFluid}, + time, + eu, + 0); + return GT_Recipe.GT_Recipe_Map.sChemicalRecipes.mRecipeList.add(aSpecialRecipe); + } + + @Override public boolean addMultiblockChemicalRecipe(ItemStack[] itemStacks, FluidStack[] fluidStacks, FluidStack[] fluidStacks2, ItemStack[] outputs, int time, int eu) { if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || mLargeChemReactor == null) { return false; @@ -970,14 +1009,30 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } @Override - public void addFluidExtractionRecipe(ItemStack input, Object input2, FluidStack output, int aTime, int aEu, int aSpecial) { - MaterialGenerator.addFluidExtractionRecipe(input, input2, output, aSpecial, aTime, aEu); - + public boolean addFluidExtractionRecipe(ItemStack input, FluidStack output, int aTime, int aEu) { + return MaterialGenerator.addFluidExtractionRecipe(GT_Values.NI, input, output, aTime, aEu); } + @Override + public boolean addFluidExtractionRecipe(ItemStack aEmpty, ItemStack aRemains, FluidStack aFluid, int aDuration, int aEU) { + return MaterialGenerator.addFluidExtractionRecipe(aEmpty, aRemains, aFluid, aDuration, aEU); + } + @Override + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn) { + return MaterialGenerator.addFluidCannerRecipe(aContainer, aFullContainer, rFluidIn, null); + } + @Override + public boolean addFluidCannerRecipe(ItemStack aContainer, ItemStack aFullContainer, FluidStack rFluidIn, FluidStack rFluidOut) { + return MaterialGenerator.addFluidCannerRecipe(aContainer, aFullContainer, rFluidIn, rFluidOut); + } + + @Override + public boolean addFluidCannerRecipe(ItemStack aFullContainer, ItemStack container, FluidStack rFluidIn, FluidStack rFluidOut, int aTime, int aEu) { + return MaterialGenerator.addFluidCannerRecipe(container, aFullContainer, rFluidIn, rFluidOut, aTime, aEu); + } /** * Adds a Fusion reactor Recipe @@ -1096,7 +1151,158 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } } - + @Override + public boolean addUvLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu) { + // Generate Special Laser Recipe + GT_Recipe u = new Recipe_GT( + false, + new ItemStack[] { + aInput1, + aInput2, + }, + new ItemStack[] { + aOutput + }, + GregtechItemList.Laser_Lens_WoodsGlass.get(1), + new int[] { + 10000 + }, + new FluidStack[] {}, + new FluidStack[] {}, + time, + (int) eu, + 0); + return GT_Recipe.GT_Recipe_Map.sLaserEngraverRecipes.mRecipeList.add(u); + } + + @Override + public boolean addIrLaserRecipe(ItemStack aInput1, ItemStack aInput2, ItemStack aOutput, int time, long eu) { + return addUvLaserRecipe(aInput1, aInput2, aOutput, time, eu); + } + + + @Override + public boolean addFluidReactorRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aTier) { + + if (aInputs.length > 4 || aInputFluids.length > 4 || aOutputs.length > 4 || aFluidOutputs.length > 2) { + Logger.INFO("Inputs: "+ItemUtils.getArrayStackNames(aInputs)); + Logger.INFO("Fluid Inputs: "+ItemUtils.getArrayStackNames(aInputFluids)); + Logger.INFO("Outputs: "+ItemUtils.getArrayStackNames(aOutputs)); + Logger.INFO("Fluid Outputs: "+ItemUtils.getArrayStackNames(aFluidOutputs)); + CORE.crash(); + } + + + Recipe_GT aSpecialRecipe = new Recipe_GT( + false, + aInputs, + aOutputs, + null, + new int[] {}, + aInputFluids, + aFluidOutputs, + time, + (int) eu, + aTier); + + int aSize = Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList.size(); + int aSize2 = aSize; + Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.add(aSpecialRecipe); + aSize = Recipe_GT.Gregtech_Recipe_Map.sFluidChemicalReactorRecipes.mRecipeList.size(); + return aSize > aSize2; + } + + @Override + public boolean addBlastRecipe(ItemStack[] aInputs, FluidStack[] aInputFluids, ItemStack[] aOutputs, FluidStack[] aFluidOutputs, int time, long eu, int aHeat) { + Recipe_GT aSpecialRecipe = new Recipe_GT( + false, + aInputs, + aOutputs, + null, + new int[] {}, + aInputFluids, + aFluidOutputs, + time, + (int) eu, + aHeat); + + int aSize = GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeList.size(); + int aSize2 = aSize; + GT_Recipe.GT_Recipe_Map.sBlastRecipes.add(aSpecialRecipe); + aSize = GT_Recipe.GT_Recipe_Map.sBlastRecipes.mRecipeList.size(); + return aSize > aSize2; + + } + + @Override + public boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, FluidStack aFluidOutput, int aDuration, int aEUt) { + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || mPyroOven == null) { + return false; + } + try { + return (boolean) mPyroOven.invoke(GT_Values.RA, aInput, aFluidInput, intCircuit, aOutput, aFluidOutput, aDuration, aEUt); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + return false; + } + } + + @Override + public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden) { + if (aInput != null && aOutput != null) { + if ((aDuration = GregTech_API.sRecipeFile.get("distillery", aOutput.getFluid().getUnlocalizedName(), + aDuration)) <= 0) { + return false; + } else { + GT_Recipe tRecipe = GT_Recipe_Map.sDistilleryRecipes.addRecipe(true, new ItemStack[]{aCircuit}, + new ItemStack[] {aSolidOutput}, (Object) null, new FluidStack[]{aInput}, new FluidStack[]{aOutput}, + aDuration, aEUt, 0); + if (aHidden && tRecipe != null) { + tRecipe.mHidden = true; + } + return true; + } + } else { + return false; + } + } + + @Override + public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt) { + if (aInput != null && aOutput != null) { + if ((aDuration = GregTech_API.sRecipeFile.get("extractor", aInput, aDuration)) <= 0) { + return false; + } else { + GT_Recipe_Map.sExtractorRecipes.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput}, + (Object) null, (FluidStack[]) null, (FluidStack[]) null, aDuration, aEUt, 0); + return true; + } + } else { + return false; + } + } + + @Override + public boolean addPulverisationRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, ItemStack aOutput3) { + //return GT_Values.RA.addPulveriserRecipe(arg0, arg1, arg2, arg3, arg4) + + aOutput1 = GT_OreDictUnificator.get(true, aOutput1); + aOutput2 = GT_OreDictUnificator.get(true, aOutput2); + aOutput3 = GT_OreDictUnificator.get(true, aOutput3); + if ((GT_Utility.isStackInvalid(aInput)) || (GT_Utility.isStackInvalid(aOutput1))) { + return false; + } + if (GT_Utility.getContainerItem(aInput, false) == null) { + + if (GregTech_API.sRecipeFile.get(ConfigCategories.Machines.maceration, aInput, true)) { + GT_Utility.addSimpleIC2MachineRecipe(aInput, GT_ModHandler.getMaceratorRecipeList(), null, + new Object[] { aOutput1 }); + } + GT_Values.RA.addPulveriserRecipe(aInput, new ItemStack[] { aOutput1, aOutput2, aOutput3 }, + new int[] { 10000, 10000, 10000 }, 400, 2); + } + return true; + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/RecipesToRemove.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/RecipesToRemove.java index 06373c9e1d..35714aee26 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/RecipesToRemove.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/RecipesToRemove.java @@ -1,10 +1,10 @@ package gtPlusPlus.xmod.gregtech.recipes; -import gregtech.api.enums.Materials; import gregtech.api.util.GT_Recipe; import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.ORES; import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -28,7 +28,7 @@ public class RecipesToRemove { Logger.INFO("Removed vanilla GT Rare Earth processing."); //Set the Chemical Symbol for Rare Earth now that we are giving it custom outputs //Best not to set this unless the original recipe is removed. - Materials.RareEarth.mChemicalFormula = "(" + /*Materials.RareEarth.mChemicalFormula = "(" +ELEMENT.getInstance().YTTRIUM.vChemicalSymbol +ELEMENT.getInstance().NEODYMIUM.vChemicalSymbol +ELEMENT.getInstance().LANTHANUM.vChemicalSymbol @@ -38,7 +38,18 @@ public class RecipesToRemove { +ELEMENT.getInstance().YTTERBIUM.vChemicalSymbol +ELEMENT.getInstance().SAMARIUM.vChemicalSymbol +ELEMENT.getInstance().GADOLINIUM.vChemicalSymbol+ - ")"; + ")";*/ + + Material[] aLowTierOutputMaterials = new Material[] { + ORES.GREENOCKITE + }; + + + + + + + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAlgaeContent.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAlgaeContent.java new file mode 100644 index 0000000000..2c9f1d1943 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechAlgaeContent.java @@ -0,0 +1,28 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.algae.GregtechMTE_AlgaePondBase; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.chemplant.GregtechMTE_ChemicalPlant; + +public class GregtechAlgaeContent { + + public static void run() { + if (LoadedMods.Gregtech) { + Logger.INFO("Gregtech5u Content | Registering Algae Content."); + run1(); + } + } + + private static void run1() { + + // Algae Pond + GregtechItemList.AlgaeFarm_Controller.set(new GregtechMTE_AlgaePondBase(997, "algaefarm.controller.tier.single", "Algae Farm").getStackForm(1L)); + + // Chemical Plant + GregtechItemList.ChemicalPlant_Controller.set(new GregtechMTE_ChemicalPlant(998, "chemicalplant.controller.tier.single", "ExxonMobil Chemical Plant").getStackForm(1L)); + + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java index 38589eaac1..abc5558444 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java @@ -7,23 +7,28 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.*; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.material.Material; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.*; -import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Heat; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntityFluid; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntity_Cable; -import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityGeothermalGenerator; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -101,9 +106,9 @@ public class GregtechConduits { //Generate Heat Pipes - GregtechItemList.HeatPipe_Tier_1.set(new GT_MetaPipeEntity_Heat(31021, "gtpp.pipe.heat.basic.01", "Lead Heat Pipe (500C)", Materials.Lead, 500).getStackForm(1L)); - GregtechItemList.HeatPipe_Tier_2.set(new GT_MetaPipeEntity_Heat(31022, "gtpp.pipe.heat.basic.02", "Iron Heat Pipe (500C)", Materials.Iron, 500).getStackForm(1L)); - GregtechItemList.HeatPipe_Tier_3.set(new GT_MetaPipeEntity_Heat(31023, "gtpp.pipe.heat.basic.03", "Silver Heat Pipe (1500C)", Materials.Silver, 1500).getStackForm(1L)); + //GregtechItemList.HeatPipe_Tier_1.set(new GT_MetaPipeEntity_Heat(31021, "gtpp.pipe.heat.basic.01", "Lead Heat Pipe (500C)", Materials.Lead, 500).getStackForm(1L)); + //GregtechItemList.HeatPipe_Tier_2.set(new GT_MetaPipeEntity_Heat(31022, "gtpp.pipe.heat.basic.02", "Iron Heat Pipe (500C)", Materials.Iron, 500).getStackForm(1L)); + //GregtechItemList.HeatPipe_Tier_3.set(new GT_MetaPipeEntity_Heat(31023, "gtpp.pipe.heat.basic.03", "Silver Heat Pipe (1500C)", Materials.Silver, 1500).getStackForm(1L)); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index 45a23fb184..54e4fbf024 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -8,9 +8,11 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_TurbineProvider; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Input; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_SuperBus_Output; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase; @@ -62,6 +64,25 @@ public class GregtechCustomHatches { "Naquadah Reactor Input hatch" // Local name ).getStackForm(1L)); + + GregtechItemList.Hatch_Input_TurbineHousing.set(new GT_MetaTileEntity_Hatch_TurbineProvider(31025, // ID + "hatch.turbine.input.tier.00", // unlocal name + "Turbine Housing", // Local name + 8 + ).getStackForm(1L)); + + // Multiblock Control Core Bus + GregtechItemList.Hatch_Control_Core.set((new GT_MetaTileEntity_Hatch_ControlCore(30020, "hatch.control.adv", "Control Core Module", 1)).getStackForm(1L)); + + // Multiblock Air Intake Hatch + GregtechItemList.Hatch_Air_Intake.set(new GT_MetaTileEntity_Hatch_AirIntake(861, "hatch.air.intake.tier.00", "Air Intake Hatch", 5).getStackForm(1L)); + + + + + + + } private static void run2() { @@ -91,12 +112,7 @@ public class GregtechCustomHatches { .getStackForm(1L)); GregtechItemList.Hatch_Muffler_Adv_MAX .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30009, "hatch.muffler.adv.tier.09", "Advanced Muffler Hatch (MAX)", 9)) - .getStackForm(1L)); - - //GT++ multiblock Control Core Bus - GregtechItemList.Hatch_Control_Core - .set((new GT_MetaTileEntity_Hatch_ControlCore(30020, "hatch.control.adv", "Control Core Module", 1)) - .getStackForm(1L)); + .getStackForm(1L)); } private static void run3() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java new file mode 100644 index 0000000000..bd0edd9002 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java @@ -0,0 +1,24 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntity_ChemicalReactor; + +public class GregtechFluidReactor { + + public static void run() { + + GregtechItemList.FluidReactor_LV + .set(new GregtechMetaTileEntity_ChemicalReactor(31021, "chemicalplant.01.tier.01", "Chemical Plant I", 1) + .getStackForm(1L)); + GregtechItemList.FluidReactor_HV + .set(new GregtechMetaTileEntity_ChemicalReactor(31022, "chemicalplant.01.tier.02", "Chemical Plant II", 3) + .getStackForm(1L)); + GregtechItemList.FluidReactor_IV + .set(new GregtechMetaTileEntity_ChemicalReactor(31023, "chemicalplant.01.tier.03", "Chemical Plant III", 5) + .getStackForm(1L)); + GregtechItemList.FluidReactor_ZPM + .set(new GregtechMetaTileEntity_ChemicalReactor(31024, "chemicalplant.01.tier.04", "Chemical Plant IV", 7) + .getStackForm(1L)); + + } +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java index bbe2d10273..c470243822 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java @@ -2,8 +2,8 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaAtmosphericReconditioner; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaPollutionCreator; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaPollutionDetector; @@ -12,8 +12,8 @@ public class GregtechPollutionDevices { public static void run() { if (gtPlusPlus.core.lib.LoadedMods.Gregtech) { - Logger.INFO("Gregtech5u Content | Registering Anti-Pollution Devices."); - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + if (PollutionUtils.isPollutionEnabled()) { + Logger.INFO("Gregtech5u Content | Registering Anti-Pollution Devices."); run1(); } } @@ -50,7 +50,6 @@ public class GregtechPollutionDevices { "pollutioncleaner.10.tier.single", "Biosphere Cleanser", 9).getStackForm(1L)); } - GregtechItemList.Hatch_Air_Intake.set(new GT_MetaTileEntity_Hatch_AirIntake(861, "hatch.air.intake.tier.00", "Air Intake Hatch", 5).getStackForm(1L)); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java index 5f5b43e36f..2d548a57b7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java @@ -12,8 +12,10 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityRocketFuelGenerator; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeRocketEngine; public class GregtechRocketFuelGenerator { @@ -28,6 +30,33 @@ public class GregtechRocketFuelGenerator { } private static void run1() { + GregtechItemList.Controller_RocketEngine.set( + new GregtechMetaTileEntity_LargeRocketEngine(996, "gtpp.multimachine.rocketengine", "Rocketdyne F-1A Engine").getStackForm(1L)); + + + ItemList aDieselEngine = Utils.getValueOfItemList("Machine_Multi_DieselEngine", ItemList.Machine_Multi_LargeBoiler_TungstenSteel); + + GT_ModHandler.addCraftingRecipe( + GregtechItemList.Controller_RocketEngine.get(1L), + CI.bitsd, + new Object[]{ + "PCP", "EME", "GWG", + 'M', aDieselEngine, + 'P', ItemList.Electric_Piston_IV, + 'E', ItemList.Field_Generator_EV, + 'C', OrePrefixes.circuit.get(Materials.Master), + 'W', OrePrefixes.cableGt08.get(Materials.Platinum), + 'G', ALLOY.MARAGING350.getGear(1)}); + + GT_ModHandler.addCraftingRecipe( + GregtechItemList.Casing_RocketEngine.get(1L), + CI.bitsd, + new Object[]{ + "PhP", "RFR", "PWP", + 'R', OrePrefixes.pipeLarge.get(Materials.TungstenSteel), + 'F', ItemList.Casing_RobustTungstenSteel, + 'P', ALLOY.NITINOL_60.getGear(1)}); + GregtechItemList.Rocket_Engine_EV.set(new GregtechMetaTileEntityRocketFuelGenerator(793, "advancedgenerator.rocketFuel.tier.01", "Basic Rocket Engine", 4).getStackForm(1L)); GregtechItemList.Rocket_Engine_IV.set(new GregtechMetaTileEntityRocketFuelGenerator(794, @@ -37,7 +66,7 @@ public class GregtechRocketFuelGenerator { if (!CORE.GTNH) { GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_EV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('P'), ItemList.Electric_Piston_EV, Character.valueOf('E'), ItemList.Electric_Motor_EV, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Ultimate), Character.valueOf('W'), @@ -46,7 +75,7 @@ public class GregtechRocketFuelGenerator { GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_IV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('P'), ItemList.Electric_Piston_IV, Character.valueOf('E'), ItemList.Electric_Motor_IV, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Superconductor), @@ -56,7 +85,7 @@ public class GregtechRocketFuelGenerator { if (CORE.GTNH) { GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_EV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('P'), ItemList.Electric_Piston_EV, Character.valueOf('E'), ItemList.Electric_Motor_EV, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('W'), @@ -65,7 +94,7 @@ public class GregtechRocketFuelGenerator { GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_IV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('P'), ItemList.Electric_Piston_IV, Character.valueOf('E'), ItemList.Electric_Motor_IV, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Master), @@ -77,7 +106,7 @@ public class GregtechRocketFuelGenerator { if (!CORE.GTNH) { GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_LuV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('P'), INGREDIENT_1, Character.valueOf('E'), INGREDIENT_2, Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Infinite), Character.valueOf('W'), @@ -86,13 +115,13 @@ public class GregtechRocketFuelGenerator { } if (CORE.GTNH) { GT_ModHandler.addCraftingRecipe(GregtechItemList.Rocket_Engine_LuV.get(1L, new Object[0]), - GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE - | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, - new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('P'), - INGREDIENT_1, Character.valueOf('E'), INGREDIENT_2, Character.valueOf('C'), - OrePrefixes.circuit.get(Materials.Ultimate), Character.valueOf('W'), - OrePrefixes.cableGt02.get(Materials.Tungsten), Character.valueOf('G'), - ALLOY.ZERON_100.getGear(1)}); + GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE + | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_LuV, Character.valueOf('P'), + INGREDIENT_1, Character.valueOf('E'), INGREDIENT_2, Character.valueOf('C'), + OrePrefixes.circuit.get(Materials.Ultimate), Character.valueOf('W'), + OrePrefixes.cableGt02.get(Materials.Tungsten), Character.valueOf('G'), + ALLOY.ZERON_100.getGear(1)}); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperChests.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperChests.java index 84de99a368..dcf52a5008 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperChests.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSuperChests.java @@ -6,7 +6,8 @@ import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; - +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_ConnectableCrate; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; @@ -15,39 +16,54 @@ public class GregtechSuperChests { public static void run() { int mId = 946; - GregtechItemList.Super_Chest_LV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.01", "Super Chest I", 1)).getStackForm(1L)); - GregtechItemList.Super_Chest_MV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.02", "Super Chest II", 2)).getStackForm(1L)); - GregtechItemList.Super_Chest_HV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.03", "Super Chest III", 3)).getStackForm(1L)); - GregtechItemList.Super_Chest_EV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.04", "Super Chest IV", 4)).getStackForm(1L)); - GregtechItemList.Super_Chest_IV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.05", "Super Chest V", 5)).getStackForm(1L)); - - - GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_LV.get(1L, new Object[0]), bitsd, - new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('G'), - ItemList.Automation_ChestBuffer_LV, Character.valueOf('D'), - OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('P'), - OrePrefixes.plate.get(Materials.Invar)}); - - GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_MV.get(1L, new Object[0]), bitsd, - new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('G'), - ItemList.Automation_ChestBuffer_MV, Character.valueOf('D'), OrePrefixes.circuit.get(Materials.Good), - Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium)}); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_HV.get(1L, new Object[0]), bitsd, - new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('G'), - ItemList.Automation_ChestBuffer_HV, Character.valueOf('D'), OrePrefixes.circuit.get(Materials.Advanced), - Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel)}); + String aSuffix = ""; + if (CORE.GTNH) { + aSuffix = " [Disabled]"; + } - GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_EV.get(1L, new Object[0]), bitsd, - new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('G'), - ItemList.Automation_ChestBuffer_EV, Character.valueOf('D'), OrePrefixes.circuit.get(Materials.Data), - Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium)}); + GregtechItemList.Super_Chest_LV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.01", "Super Chest I"+aSuffix, 1)).getStackForm(1L)); + GregtechItemList.Super_Chest_MV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.02", "Super Chest II"+aSuffix, 2)).getStackForm(1L)); + GregtechItemList.Super_Chest_HV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.03", "Super Chest III"+aSuffix, 3)).getStackForm(1L)); + GregtechItemList.Super_Chest_EV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.04", "Super Chest IV"+aSuffix, 4)).getStackForm(1L)); + GregtechItemList.Super_Chest_IV.set((new GT_MetaTileEntity_TieredChest(mId++, "super.chest.tier.05", "Super Chest V"+aSuffix, 5)).getStackForm(1L)); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_IV.get(1L, new Object[0]), bitsd, - new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('G'), - ItemList.Automation_ChestBuffer_IV, Character.valueOf('D'), - OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('P'), - OrePrefixes.plate.get(Materials.Tungsten)}); + // Do not add Recipes for GTNH, hide them from NEI instead. + if (CORE.GTNH) { + ItemUtils.hideItemFromNEI(GregtechItemList.Super_Chest_LV.get(1L)); + ItemUtils.hideItemFromNEI(GregtechItemList.Super_Chest_MV.get(1L)); + ItemUtils.hideItemFromNEI(GregtechItemList.Super_Chest_HV.get(1L)); + ItemUtils.hideItemFromNEI(GregtechItemList.Super_Chest_EV.get(1L)); + ItemUtils.hideItemFromNEI(GregtechItemList.Super_Chest_IV.get(1L)); + } + else { + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_LV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_LV, Character.valueOf('D'), + OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('P'), + OrePrefixes.plate.get(Materials.Invar)}); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_MV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_MV, Character.valueOf('D'), OrePrefixes.circuit.get(Materials.Good), + Character.valueOf('P'), OrePrefixes.plate.get(Materials.Aluminium)}); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_HV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_HV, Character.valueOf('D'), OrePrefixes.circuit.get(Materials.Advanced), + Character.valueOf('P'), OrePrefixes.plate.get(Materials.StainlessSteel)}); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_EV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_EV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_EV, Character.valueOf('D'), OrePrefixes.circuit.get(Materials.Data), + Character.valueOf('P'), OrePrefixes.plate.get(Materials.Titanium)}); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Super_Chest_IV.get(1L, new Object[0]), bitsd, + new Object[]{"DPD", "PMP", "DGD", Character.valueOf('M'), ItemList.Hull_IV, Character.valueOf('G'), + ItemList.Automation_ChestBuffer_IV, Character.valueOf('D'), + OrePrefixes.circuit.get(Materials.Elite), Character.valueOf('P'), + OrePrefixes.plate.get(Materials.Tungsten)}); + } //Test Thing GregtechItemList.CrateStorage.set((new GT_MetaTileEntity_ConnectableCrate(GT_MetaTileEntity_ConnectableCrate.mCrateID, "crate.tier.01", "Interconnecting Storage Crate", 0)).getStackForm(1L)); diff --git a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java index 5a9dc748ca..686910b9aa 100644 --- a/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java +++ b/src/Java/gtPlusPlus/xmod/growthcraft/fishtrap/FishTrapHandler.java @@ -8,7 +8,6 @@ import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -222,10 +221,10 @@ public class FishTrapHandler { private static void addGregtechFluidRecipe(final ItemStack input){ if (LoadedMods.Gregtech){ if (CORE.GTNH) { - MaterialGenerator.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 50), 10000, 16, 4); + CORE.RA.addFluidExtractionRecipe(input, FluidUtils.getFluidStack("fishoil", 50), 16, 4); } else { - MaterialGenerator.addFluidExtractionRecipe(input, null, FluidUtils.getFluidStack("fishoil", 4), 0, 16, 4); //4eu/t total eu used = 64 so time = 64/4 + CORE.RA.addFluidExtractionRecipe(input, FluidUtils.getFluidStack("fishoil", 4), 16, 4); //4eu/t total eu used = 64 so time = 64/4 } } } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/CustomKineticRotor.java b/src/Java/gtPlusPlus/xmod/ic2/item/CustomKineticRotor.java new file mode 100644 index 0000000000..92d711101b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/ic2/item/CustomKineticRotor.java @@ -0,0 +1,276 @@ +package gtPlusPlus.xmod.ic2.item; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.Utils; +import ic2.api.item.IKineticRotor; +import ic2.core.IC2; +import ic2.core.block.kineticgenerator.gui.GuiWaterKineticGenerator; +import ic2.core.block.kineticgenerator.gui.GuiWindKineticGenerator; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.StatCollector; + +public class CustomKineticRotor extends Item implements IKineticRotor { + + private final int mTier; + + @SideOnly(Side.CLIENT) + private IIcon[] mTextures; + + private static final String[] mRegistrationNames = new String[] { + "itemwoodrotor", "itemironrotor", "itemsteelrotor", "itemwcarbonrotor" + }; + + private static final String[] mUnlocalNames = new String[] { + "itemEnergeticRotor", + "itemTungstenSteelRotor", + "itemVibrantRotor", + "itemIridiumRotor", + "itemMagnaliumRotor", + "itemUltimetRotor", + }; + private static final int[] mMaxDurability = new int[] { + 512000, 809600, 1600000, 3200000 + }; + private static final int[] mRadius = new int[] { + 9, 11, 13, 15 + }; + private static final float[] mEfficiency = new float[] { + 0.9f, 1.0f, 1.2f, 1.5f + }; + private static final int[] mMinWindStrength = new int[] { + 12, 14, 16, 18 + }; + private static final int[] mMaxWindStrength = new int[] { + 80, 120, 160, 320 + }; + + private static final ResourceLocation[] mResourceLocations = new ResourceLocation[] { + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorEnergeticModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorTungstenSteelModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorVibrantModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorIridiumModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorMagnaliumModel.png"), + new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorUltimetModel.png"), + }; + + private final int maxWindStrength; + private final int minWindStrength; + private final int radius; + private final float efficiency; + private final ResourceLocation renderTexture; + + public CustomKineticRotor(int aTier) { + mTier = aTier; + this.setMaxStackSize(1); + // Handle Differences if EIO is not loaded + if (!LoadedMods.EnderIO && (aTier == 0 || aTier == 2)) { + this.renderTexture = mResourceLocations[(aTier == 0 ? 4 : 5)]; + this.setUnlocalizedName(mUnlocalNames[(aTier == 0 ? 4 : 5)]); + } + else { + this.renderTexture = mResourceLocations[aTier]; + this.setUnlocalizedName(mUnlocalNames[aTier]); + } + this.setMaxDamage(mMaxDurability[aTier]); + this.radius = mRadius[aTier]; + this.efficiency = mEfficiency[aTier]; + this.minWindStrength = mMinWindStrength[aTier]; + this.maxWindStrength = mMaxWindStrength[aTier]; + this.setNoRepair(); + this.setCreativeTab(IC2.tabIC2); + GameRegistry.registerItem(this, mRegistrationNames[aTier]); + } + + @Override + public void setDamage(final ItemStack stack, final int damage) { + if (mTier < 3) { + super.setDamage(stack, damage); + } + } + + @Override + public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List info, final boolean b) { + + info.add(StatCollector.translateToLocalFormatted("ic2.itemrotor.wind.info", new Object[]{this.minWindStrength, this.maxWindStrength})); + + GearboxType type = null; + if (Minecraft.getMinecraft().currentScreen != null && Minecraft.getMinecraft().currentScreen instanceof GuiWaterKineticGenerator) { + type = GearboxType.WATER; + } + else if (Minecraft.getMinecraft().currentScreen != null && Minecraft.getMinecraft().currentScreen instanceof GuiWindKineticGenerator) { + type = GearboxType.WIND; + } + + if (type != null) { + info.add(StatCollector.translateToLocal("ic2.itemrotor.fitsin." + this.isAcceptedType(itemStack, type))); + } + + } + + @Override + public int getDiameter(final ItemStack stack) + { + return this.radius; + } + + @Override + public ResourceLocation getRotorRenderTexture(final ItemStack stack) + { + return this.renderTexture; + } + + @Override + public float getEfficiency(final ItemStack stack) + { + return this.efficiency; + } + + @Override + public int getMinWindStrength(final ItemStack stack) + { + return this.minWindStrength; + } + + @Override + public int getMaxWindStrength(final ItemStack stack) + { + return this.maxWindStrength; + } + + @Override + public boolean isAcceptedType(final ItemStack stack, final IKineticRotor.GearboxType type){ + return (type == IKineticRotor.GearboxType.WIND) || (type == IKineticRotor.GearboxType.WATER); + } + + public String getUnlocalizedName() { + return "ic2." + super.getUnlocalizedName().substring(5); + } + + public String getUnlocalizedName(ItemStack itemStack) { + return this.getUnlocalizedName(); + } + + public String getItemStackDisplayName(ItemStack itemStack) { + return StatCollector.translateToLocal(this.getUnlocalizedName(itemStack)); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return mTier < 3; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int meta) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconIndex(ItemStack aIndex) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int aDmg, int aPass) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + protected String getIconString() { + return super.getIconString(); + } + + @Override + public int getDisplayDamage(ItemStack stack) { + return super.getDisplayDamage(stack); + } + + @Override + public double getDurabilityForDisplay(ItemStack stack) { + return super.getDurabilityForDisplay(stack); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack stack, int pass) { + if (!LoadedMods.EnderIO && (mTier == 0 || mTier == 2)) { + if (mTier == 0) { + return mTextures[4]; + } + else { + return mTextures[5]; + } + } + else { + return mTextures[mTier]; + } + } + + @Override + public void registerIcons(IIconRegister iconRegister) { + int aIndex = 0; + mTextures = new IIcon[6]; + for (String y : mUnlocalNames) { + mTextures[aIndex++] = iconRegister.registerIcon(IC2.textureDomain + ":" + "rotors/" + y); + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java index 64aa7f99bf..862ba38748 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/IC2_Items.java @@ -1,13 +1,9 @@ package gtPlusPlus.xmod.ic2.item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.item.base.CoreItem; import gtPlusPlus.core.lib.LoadedMods; -import ic2.core.IC2; -import ic2.core.init.InternalName; +import net.minecraft.item.ItemStack; public class IC2_Items { @@ -29,45 +25,33 @@ public class IC2_Items { public static ItemStack blockRTG; public static ItemStack blockKineticGenerator; - public static void register(){ + private static final String[] mData1 = new String[] {"itemEnergeticRotorBlade", "itemMagnaliumRotorBlade"}; + private static final String[] mData2 = new String[] {"itemEnergeticShaft", "itemMagnaliumShaft"}; + private static final String[] mData3 = new String[] {"itemVibrantRotorBlade", "itemUltimetRotorBlade"}; + private static final String[] mData4 = new String[] {"itemVibrantShaft", "itemUltimetShaft"}; + - if(LoadedMods.EnderIO){ - //Tier 1 - rotor_Blade_Material_1 = new ItemStack (new CoreItem("itemEnergeticRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_1 = new ItemStack (new CoreItem("itemEnergeticShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_1 = new ItemStack (new RotorBase(InternalName.itemwoodrotor, 9, 512000, 0.9F, 12, 80, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorEnergeticModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemEnergeticRotor")); - //Tier 2 - rotor_Blade_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_2 = new ItemStack (new RotorBase(InternalName.itemironrotor, 11, 809600, 1.0F, 14, 120, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorTungstenSteelModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemTungstenSteelRotor")); - //Tier 3 - rotor_Blade_Material_3 = new ItemStack (new CoreItem("itemVibrantRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_3 = new ItemStack (new CoreItem("itemVibrantShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_3 = new ItemStack (new RotorBase(InternalName.itemsteelrotor, 13, 1600000, 1.2F, 16, 160, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorVibrantModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemVibrantRotor")); - //Tier 4 - rotor_Blade_Material_4 = new ItemStack (new CoreItem("itemIridiumRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_4 = new ItemStack (new CoreItem("itemIridiumShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_4 = new ItemStack (new RotorIridium(InternalName.itemwcarbonrotor, 15, 3200000, 1.5F, 18, 320, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorIridiumModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemIridiumRotor")); + public static void register(){ - } - else { - //Tier 1 - Magnalium - rotor_Blade_Material_1 = new ItemStack (new CoreItem("itemMagnaliumRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_1 = new ItemStack (new CoreItem("itemMagnaliumShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_1 = new ItemStack (new RotorBase(InternalName.itemwoodrotor, 9, 512000, 0.9F, 12, 80, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorMagnaliumModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemMagnaliumRotor")); - //Tier 2 - rotor_Blade_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_2 = new ItemStack (new RotorBase(InternalName.itemironrotor, 11, 809600, 1.0F, 14, 120, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorTungstenSteelModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemTungstenSteelRotor")); - //Tier 3 - Ultimet - rotor_Blade_Material_3 = new ItemStack (new CoreItem("itemUltimetRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_3 = new ItemStack (new CoreItem("itemUltimetShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_3 = new ItemStack (new RotorBase(InternalName.itemsteelrotor, 13, 1600000, 1.2F, 16, 160, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorUltimetModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemUltimetRotor")); - //Tier 4 - rotor_Blade_Material_4 = new ItemStack (new CoreItem("itemIridiumRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - shaft_Material_4 = new ItemStack (new CoreItem("itemIridiumShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); - rotor_Material_4 = new ItemStack (new RotorIridium(InternalName.itemwcarbonrotor, 15, 3200000, 1.5F, 18, 320, new ResourceLocation(IC2.textureDomain, "textures/items/rotors/rotorIridiumModel.png")).setCreativeTab(AddToCreativeTab.tabMachines).setUnlocalizedName("itemIridiumRotor")); - } + int aIndexEIO = (LoadedMods.EnderIO ? 0 : 1); + + // Rotor Blades + rotor_Blade_Material_1 = new ItemStack (new CoreItem(mData1[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + rotor_Blade_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + rotor_Blade_Material_3 = new ItemStack (new CoreItem(mData3[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + rotor_Blade_Material_4 = new ItemStack (new CoreItem("itemIridiumRotorBlade", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + + // Rotor Shafts + shaft_Material_1 = new ItemStack (new CoreItem(mData2[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + shaft_Material_2 = new ItemStack (new CoreItem("itemTungstenSteelShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + shaft_Material_3 = new ItemStack (new CoreItem(mData4[aIndexEIO], AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + shaft_Material_4 = new ItemStack (new CoreItem("itemIridiumShaft", AddToCreativeTab.tabMachines, 16, "A part for an advanced Kinetic Rotor")); + + // Rotors + rotor_Material_1 = new ItemStack (new CustomKineticRotor(0)); + rotor_Material_2 = new ItemStack (new CustomKineticRotor(1)); + rotor_Material_3 = new ItemStack (new CustomKineticRotor(2)); + rotor_Material_4 = new ItemStack (new CustomKineticRotor(3)); } } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java b/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java index aca1c6a310..b9dffbd371 100644 --- a/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java +++ b/src/Java/gtPlusPlus/xmod/ic2/item/RotorIridium.java @@ -118,5 +118,10 @@ public class RotorIridium extends RotorBase{ this.setCustomDamage(stack, this.getCustomDamage(stack) + damage); return true; } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } } diff --git a/src/Java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java b/src/Java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java new file mode 100644 index 0000000000..a21a759a77 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/railcraft/HANDLER_Railcraft.java @@ -0,0 +1,83 @@ +package gtPlusPlus.xmod.railcraft; + +import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; + +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.item.base.BaseItemBurnable; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.railcraft.utils.RailcraftUtils; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class HANDLER_Railcraft { + + + + public static void preInit() { + if (LoadedMods.Railcraft) { + + } + + //Register Custom Coal Coke + ModItems.itemCoalCoke = new BaseItemBurnable("itemCoalCoke", "Coking Coal", tabMisc, 64, 0, "Used for metallurgy.", "fuelCoke", 3200, 0).setTextureName(CORE.MODID + ":burnables/itemCoalCoke"); + + //Add in things that once existed in 1.5.2 + ModItems.itemCactusCharcoal = new BaseItemBurnable("itemCactusCharcoal", "Cactus Charcoal", tabMisc, 64, 0, "Used for smelting.", "fuelCactusCharcoal", 400, 0).setTextureName(CORE.MODID + ":burnables/itemCactusCharcoal"); + ModItems.itemSugarCharcoal = new BaseItemBurnable("itemSugarCharcoal", "Sugar Charcoal", tabMisc, 64, 0, "Used for smelting.", "fuelSugarCharcoal", 400, 0).setTextureName(CORE.MODID + ":burnables/itemSugarCharcoal"); + ModItems.itemCactusCoke = new BaseItemBurnable("itemCactusCoke", "Cactus Coke", tabMisc, 64, 0, "Used for smelting.", "fuelCactusCoke", 800, 0).setTextureName(CORE.MODID + ":burnables/itemCactusCoke"); + ModItems.itemSugarCoke = new BaseItemBurnable("itemSugarCoke", "Sugar Coke", tabMisc, 64, 0, "Used for smelting.", "fuelSugarCoke", 800, 0).setTextureName(CORE.MODID + ":burnables/itemSugarCoke"); + + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemCactusCharcoal), "itemCharcoalCactus"); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemCactusCoke), "itemCokeCactus"); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemSugarCharcoal), "itemCharcoalSugar"); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(ModItems.itemSugarCoke), "itemCokeSugar"); + + } + + public static void init() { + if (LoadedMods.Railcraft) { + + } + } + + public static void postInit() { + if (LoadedMods.Railcraft) { + + } + generateCokeOvenRecipes(); + } + + + private static void generateCokeOvenRecipes() { + ItemStack[] aInputs1 = new ItemStack[] { + ItemUtils.getSimpleStack(Blocks.cactus), + ItemUtils.getSimpleStack(Items.reeds) + }; + ItemStack[] aInputs2 = new ItemStack[] { + ItemUtils.getSimpleStack(ModItems.itemCactusCharcoal), + ItemUtils.getSimpleStack(ModItems.itemSugarCharcoal) + }; + ItemStack[] aOutputs = new ItemStack[] { + ItemUtils.getSimpleStack(ModItems.itemCactusCoke), + ItemUtils.getSimpleStack(ModItems.itemSugarCoke) + }; + for (int i=0;i<aOutputs.length;i++) { + CORE.RA.addCokeOvenRecipe(aInputs1[i], CI.getNumberedCircuit(3), null, FluidUtils.getFluidStack("creosote", 30), aInputs2[i], 125, 16); + CORE.RA.addCokeOvenRecipe(aInputs2[i], CI.getNumberedCircuit(4), null, FluidUtils.getFluidStack("creosote", 30), aOutputs[i], 125, 16); + } + if (LoadedMods.Railcraft) { + for (int i=0;i<aOutputs.length;i++) { + RailcraftUtils.addCokeOvenRecipe(aInputs1[i], true, true, aInputs2[i], FluidUtils.getFluidStack("creosote", 30), 500); + } + for (int i=0;i<aOutputs.length;i++) { + RailcraftUtils.addCokeOvenRecipe(aInputs2[i], true, true, aOutputs[i], FluidUtils.getFluidStack("creosote", 30), 500); + } + } + } + +} diff --git a/src/Java/gtPlusPlus/xmod/railcraft/utils/RailcraftUtils.java b/src/Java/gtPlusPlus/xmod/railcraft/utils/RailcraftUtils.java new file mode 100644 index 0000000000..eb1456d53e --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/railcraft/utils/RailcraftUtils.java @@ -0,0 +1,13 @@ +package gtPlusPlus.xmod.railcraft.utils; + +import mods.railcraft.common.util.crafting.CokeOvenCraftingManager; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class RailcraftUtils { + + public static void addCokeOvenRecipe(ItemStack input, boolean matchDamage, boolean matchNBT, ItemStack output, FluidStack fluidOutput, int cookTime) { + CokeOvenCraftingManager.getInstance().addRecipe(input, matchDamage, matchNBT, output, fluidOutput, cookTime); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/reliquary/HANDLER_Reliquary.java b/src/Java/gtPlusPlus/xmod/reliquary/HANDLER_Reliquary.java new file mode 100644 index 0000000000..7ebb4c7b1f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/reliquary/HANDLER_Reliquary.java @@ -0,0 +1,26 @@ +package gtPlusPlus.xmod.reliquary; + +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.xmod.reliquary.util.ReliquaryRecipeHandler; + +public class HANDLER_Reliquary { + + public static void preInit() { + if (LoadedMods.Reliquary) { + + } + } + + public static void init() { + if (LoadedMods.Reliquary) { + + } + } + + public static void postInit() { + if (LoadedMods.Reliquary) { + ReliquaryRecipeHandler.gregifyDefaultRecipes(); + } + } + +} diff --git a/src/Java/gtPlusPlus/xmod/reliquary/item/ReliquaryItems.java b/src/Java/gtPlusPlus/xmod/reliquary/item/ReliquaryItems.java new file mode 100644 index 0000000000..d1fb67a7d3 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/reliquary/item/ReliquaryItems.java @@ -0,0 +1,160 @@ +package gtPlusPlus.xmod.reliquary.item; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class ReliquaryItems { + + private static Class<?> CLASS_MAIN = ReflectionUtils.getClass("xreliquary.Reliquary"); + private static Field FIELD_CONTENT = ReflectionUtils.getField(CLASS_MAIN, "CONTENT"); + private static Object OBJECT_CONTENT = ReflectionUtils.getFieldValue(FIELD_CONTENT); + private static Method METHOD_GETITEM = ReflectionUtils.getMethod(OBJECT_CONTENT, "getItem", new Class[] {String.class}); + + public static Item getItem(String name) { + try { + return (Item) METHOD_GETITEM.invoke(OBJECT_CONTENT, name); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + } + return null; + } + + public static ItemStack emptyVoidTear() { + return new ItemStack(getItem("void_tear_empty"), 1, 0); + } + + public static ItemStack glowingWater() { + return new ItemStack(getItem("glowing_water")); + } + + public static ItemStack emptyVial() { + return new ItemStack(getItem("potion"), 1, 0); + } + + public static ItemStack emperorChalice() { + return new ItemStack(getItem("emperor_chalice")); + } + + public static ItemStack infernalChalice() { + return new ItemStack(getItem("infernal_chalice")); + } + + public static ItemStack witherSkull() { + return new ItemStack(Items.skull, 1, 1); + } + + public static ItemStack roseBush() { + return new ItemStack(Blocks.double_plant, 1, 4); + } + + public static ItemStack blackWool() { + return new ItemStack(Blocks.wool, 1, 15); + } + + public static ItemStack lapis() { + return new ItemStack(Items.dye, 1, 4); + } + + public static ItemStack gunPart(int i, int m) { + return new ItemStack(getItem("gun_part"), i, m); + } + + public static ItemStack magazine(int m) { + return magazine(1, m); + } + + public static ItemStack magazine(int i, int m) { + return new ItemStack(getItem("magazine"), i, m); + } + + public static ItemStack bullet(int m) { + return bullet(1, m); + } + + public static ItemStack bullet(int i, int m) { + return new ItemStack(getItem("bullet"), i, m); + } + + public static ItemStack ingredient(int m) { + return new ItemStack(getItem("mob_ingredient"), 1, m); + } + + public static ItemStack enderHeart() { + return ingredient(11); + } + + public static ItemStack creeperGland() { + return ingredient(3); + } + + public static ItemStack slimePearl() { + return ingredient(4); + } + + public static ItemStack batWing() { + return ingredient(5); + } + + public static ItemStack ribBone() { + return ingredient(0); + } + + public static ItemStack witherRib() { + return ingredient(1); + } + + public static ItemStack stormEye() { + return ingredient(8); + } + + public static ItemStack fertileEssence() { + return ingredient(9); + } + + public static ItemStack frozenCore() { + return ingredient(10); + } + + public static ItemStack moltenCore() { + return ingredient(7); + } + + public static ItemStack zombieHeart() { + return ingredient(6); + } + + public static ItemStack infernalClaw() { + return ingredient(13); + } + + public static ItemStack shellFragment() { + return ingredient(14); + } + + public static ItemStack squidBeak() { + return ingredient(12); + } + + public static ItemStack spiderFangs() { + return ingredient(2); + } + + public static ItemStack heartPearl(int m) { + return new ItemStack(getItem("heart_pearl"), 1, m); + } + + public static ItemStack nianZhu(int m) { + return new ItemStack(getItem("heart_zhu"), 1, m); + } + + public static ItemStack emptyVoidSatchel() { + return new ItemStack(getItem("void_tear_empty"), 1, 0); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/reliquary/util/AlkahestRecipeWrapper.java b/src/Java/gtPlusPlus/xmod/reliquary/util/AlkahestRecipeWrapper.java new file mode 100644 index 0000000000..6086b74ec4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/reliquary/util/AlkahestRecipeWrapper.java @@ -0,0 +1,47 @@ +package gtPlusPlus.xmod.reliquary.util; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.item.ItemStack; + +public class AlkahestRecipeWrapper { + public ItemStack item = null; + public int yield = 0; + public int cost = 0; + public String dictionaryName = null; + + public AlkahestRecipeWrapper(ItemStack par1, int par2, int par3) { + this.item = par1; + this.yield = par2; + this.cost = par3; + } + + public AlkahestRecipeWrapper(String par1, int par2, int par3) { + this.dictionaryName = par1; + this.yield = par2; + this.cost = par3; + } + + public Object getOriginalRecipe() { + try { + Constructor<?> o; + if (dictionaryName == null) { + o = ReflectionUtils.getClass("xreliquary.util.alkahestry.AlkahestRecipe").getConstructor(ItemStack.class, int.class, int.class); + } + else { + o = ReflectionUtils.getClass("xreliquary.util.alkahestry.AlkahestRecipe").getConstructor(String.class, int.class, int.class); + } + + Object r = o.newInstance(dictionaryName == null ? item : dictionaryName, yield, cost); + if (r != null) { + return r; + } + + } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + // oops + } + return null; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/reliquary/util/ReliquaryRecipeHandler.java b/src/Java/gtPlusPlus/xmod/reliquary/util/ReliquaryRecipeHandler.java new file mode 100644 index 0000000000..1133e67fe6 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/reliquary/util/ReliquaryRecipeHandler.java @@ -0,0 +1,56 @@ +package gtPlusPlus.xmod.reliquary.util; + +import static gtPlusPlus.core.lib.CORE.GTNH; + +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.reliquary.item.ReliquaryItems; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class ReliquaryRecipeHandler { + + public static boolean removeAlkahestRecipe(ItemStack aOutput) { + return false; + } + + public static boolean addAlkahestRecipe(ItemStack[] aInputs, ItemStack aOutput) { + if (aInputs == null || aInputs.length <= 0 || aInputs.length > 9) { + return false; + } + return false; + } + + public static void gregifyDefaultRecipes() { + Logger.INFO("Gregifying Reliquary recipes."); + if (GT_ModHandler.removeRecipeByOutput(ReliquaryItems.glowingWater())) { + Logger.INFO("Removing recipe for Glowing Water."); + } + if (GT_ModHandler.removeRecipeByOutput(ReliquaryItems.emptyVoidTear())) { + Logger.INFO("Removing recipe for Empty Void Tears."); + } + if (GT_ModHandler.removeRecipeByOutput(ReliquaryItems.emperorChalice())) { + Logger.INFO("Removing recipe for the Emperor Chalice."); + } + if (GT_ModHandler.removeRecipeByOutput(ReliquaryItems.infernalChalice())) { + Logger.INFO("Removing recipe for the Infernal Chalice."); + } + Logger.INFO("Finished removing original recipes."); + + // Add new recipes + if (CORE.RA.addChemicalRecipe(ALLOY.ENERGYCRYSTAL.getDust(4), ReliquaryItems.emptyVial(), FluidUtils.getHotWater(2000), null, ReliquaryItems.glowingWater(), 20 * 30, 500)) { + Logger.INFO("Added new recipe for Glowing Water."); + } + if (CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {ItemUtils.simpleMetaStack(Items.ender_eye, 0, 32), CI.getFieldGenerator(5, GTNH ? 8 : 4), CI.getTieredComponent(OrePrefixes.plate, 5, GTNH ? 16 : 8), CI.getEmitter(3, 20)}, FluidUtils.getUUM(50), ReliquaryItems.emptyVoidTear(), 20 * 2000, 2000)){ + Logger.INFO("Added new recipe for Empty Void Tears."); + } + Logger.INFO("Finished adding new recipes."); + + } +} diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java index 8beaa8df5e..f23a5db6fe 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java @@ -38,8 +38,18 @@ import net.minecraft.world.World; public class ThaumcraftUtils { - private static Class mClass_Aspect; + private static Class<?> mClass_Aspect; private static Field mField_Aspects; + + static { + mClass_Aspect = ReflectionUtils.getClass("thaumcraft.api.aspects.Aspect"); + if (mClass_Aspect != null) { + Field aTagF = ReflectionUtils.getField(mClass_Aspect, "tag"); + if (aTagF != null) { + mField_Aspects = aTagF; + } + } + } public static boolean addAspectToItem(ItemStack item, TC_Aspect_Wrapper aspect, int amount) { return addAspectToItem(item, new TC_Aspect_Wrapper[] {aspect}, new Integer[] {amount}); @@ -212,10 +222,10 @@ public class ThaumcraftUtils { } - private static final Class mClass_ThaumcraftApi; - private static final Class mClass_ThaumcraftApiHelper; - private static final Class mClass_AspectList; - private static final Class mClass_ResearchManager; + private static final Class<?> mClass_ThaumcraftApi; + private static final Class<?> mClass_ThaumcraftApiHelper; + private static final Class<?> mClass_AspectList; + private static final Class<?> mClass_ResearchManager; private static final Method mMethod_registerObjectTag1; private static final Method mMethod_registerObjectTag2; private static final Method mMethod_registerComplexObjectTag; @@ -336,12 +346,11 @@ public class ThaumcraftUtils { public static String getTagFromAspectObject(Object aAspect) { - try { - Field aTagF = ReflectionUtils.getField(mClass_Aspect, "tag"); - if (aTagF == null) { + try { + if (mClass_Aspect == null || mField_Aspects == null) { return null; - } - String aTafB = (String) aTagF.get(aAspect); + } + String aTafB = (String) mField_Aspects.get(aAspect); if (aTafB == null) { return null; } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java index 603789bd23..a628b9c5b6 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java @@ -53,7 +53,8 @@ public class TF_Items { if (ReflectionUtils.doesClassExist("cofh.core.util.energy.FurnaceFuelHandler")){ FurnaceFuelHandler.registerFuel(dustPyrotheum, 2400); //cofh.core.util.energy.FurnaceFuelHandler.registerFuel(ItemStack, int) } - + + ItemUtils.addItemToOreDictionary(rodBlizz, "stickBlizz"); itemRodBlizz = ItemUtils.simpleMetaStack(itemMaterial, 1, 1); itemDustBlizz = ItemUtils.simpleMetaStack(itemMaterial, 2, 1); diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java index e18e0e19f0..85485b5565 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java @@ -11,6 +11,8 @@ import gregtech.api.util.GT_OreDictUnificator; import cofh.lib.util.helpers.ItemHelper; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.thermalfoundation.item.TF_Items; import net.minecraftforge.fluids.FluidRegistry; @@ -24,34 +26,23 @@ public class TF_Gregtech_Recipes { private static void start(){ //Get Items to work with - final ItemStack dust_Cryotheum = TF_Items.itemDustCryotheum.copy(); - final ItemStack dust_Pyrotheum = TF_Items.itemDustPyrotheum.copy(); - final ItemStack dust_Blizz = TF_Items.itemDustBlizz.copy(); - final ItemStack dust_Blizz3 = ItemUtils.simpleMetaStack(TF_Items.itemMaterial, 2, 3); - final ItemStack rod_Blizz = TF_Items.itemRodBlizz.copy(); + final ItemStack dust_Cryotheum = ItemUtils.getItemStackOfAmountFromOreDict("dustCryotheum", 1); + final ItemStack dust_Pyrotheum = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Pyrotheum, 1L); + final ItemStack dust_Blizz = ItemUtils.getItemStackOfAmountFromOreDict("dustBlizz", 1); + final ItemStack dust_Blizz3 = ItemUtils.getItemStackOfAmountFromOreDict("dustBlizz", 3); + final ItemStack rod_Blizz = ItemUtils.getItemStackOfAmountFromOreDict("stickBlizz", 1); + final FluidStack moltenBlaze = getFluidStack("molten.blaze", 1440); //Gelid Cryotheum - Logger.INFO("Adding Recipes for Gelid Cryotheum"); - GT_Values.RA.addFluidExtractionRecipe(dust_Cryotheum, GT_Values.NI, getFluidStack("cryotheum", 250), 10000, 200, 240); GT_Values.RA.addChemicalBathRecipe((GT_OreDictUnificator.get(OrePrefixes.ore, Materials.Cinnabar, 1L)), getFluidStack("cryotheum", 144), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cinnabar, 3L), GT_Values.NI, GT_Values.NI, null, 400, 30); //Blizz Powder - Logger.INFO("Adding Recipes for Blizz Powder"); GT_Values.RA.addChemicalBathRecipe(new ItemStack(Items.snowball, 4), moltenBlaze, dust_Blizz, GT_Values.NI, GT_Values.NI, null, 400, 240); //Blizz Rod - Logger.INFO("Adding Recipes for Blizz Rod"); GT_Values.RA.addVacuumFreezerRecipe(new ItemStack(Items.blaze_rod), rod_Blizz, (int) Math.max((Materials.Blaze.getMass()*4) * 3L, 1L)); - GT_ModHandler.addPulverisationRecipe(rod_Blizz, dust_Blizz3, new ItemStack(Items.snowball, 1), 50, false); - - //Blazing Pyrotheum - Logger.INFO("Adding Recipes for Blazing Pyrotheum"); - GT_Values.RA.addFluidExtractionRecipe(dust_Pyrotheum, GT_Values.NI, getFluidStack("pyrotheum", 250), 10000, 200, 240); - - //Ender Fluid - GT_Values.RA.addFluidExtractionRecipe(ItemUtils.getSimpleStack(Items.ender_pearl), GT_Values.NI, getFluidStack("ender", 250), 10000, 100, 30); - + GT_ModHandler.addPulverisationRecipe(rod_Blizz, dust_Blizz3, new ItemStack(Items.snowball, 1), 50, false); ItemStack dustCoal = ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 1); ItemStack dustSulfur = ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 1); @@ -104,14 +95,7 @@ public class TF_Gregtech_Recipes { } private static FluidStack getFluidStack(final String fluidName, final int amount){ - Logger.WARNING("Trying to get a fluid stack of "+fluidName); - try { - return FluidRegistry.getFluidStack(fluidName, amount); - } - catch (final Throwable e){ - return null; - } - + return FluidUtils.getFluidStack(fluidName, amount); } } diff --git a/src/Java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java b/src/Java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java index 3b2bcba5dd..4a3f9cd504 100644 --- a/src/Java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java +++ b/src/Java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java @@ -7,6 +7,7 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.tinkers.material.BaseTinkersMaterial; +import gtPlusPlus.xmod.tinkers.util.TinkersDryingRecipe; import gtPlusPlus.xmod.tinkers.util.TinkersUtils; import net.minecraft.block.Block; import net.minecraftforge.fluids.Fluid; @@ -15,7 +16,7 @@ import net.minecraftforge.fluids.FluidRegistry; public class HANDLER_Tinkers { public static AutoMap<BaseTinkersMaterial> mTinkerMaterials = new AutoMap<BaseTinkersMaterial>(); - + public static final void preInit() { if (LoadedMods.TiCon) { @@ -24,77 +25,80 @@ public class HANDLER_Tinkers { public static final void init() { if (LoadedMods.TiCon) { - //Migrate TiCon further back in the oreDict so that I never grab items from it. - //TinkersUtils.stopTiconLoadingFirst(); + + } + } + + public static final void postInit() { + if (LoadedMods.TiCon) { + Fluid pyrotheumFluid = FluidRegistry.getFluid("pyrotheum"); if (pyrotheumFluid != null) { //Enable Pyrotheum as Fuel for the Smeltery TinkersUtils.addSmelteryFuel(pyrotheumFluid, 5000, 70); // pyrotheum lasts 3.5 seconds per 15 mb } - } - } - public static final void postInit() { - if (LoadedMods.TiCon) { - - for (BaseTinkersMaterial y : mTinkerMaterials) { - //y.generate(); - } - - Class aTinkersSmeltery = ReflectionUtils.getClass("tconstruct.smeltery.TinkerSmeltery"); - AutoMap<Fluid> aTweakedFluids = new AutoMap<Fluid>(); - if (aTinkersSmeltery != null) { - try { - Logger.INFO("Manipulating the light levels of fluids in TiCon. Molten 'metals' in world are now very luminescent!"); - Field aFluidArrayField = ReflectionUtils.getField(aTinkersSmeltery, "fluids"); - Field aBlockArrayField = ReflectionUtils.getField(aTinkersSmeltery, "fluidBlocks"); - Fluid[] aTiconFluids = (Fluid[]) aFluidArrayField.get(null); - Block[] aTiconFluidBlocks = (Block[]) aBlockArrayField.get(null); - if (aTiconFluids != null && aTiconFluidBlocks != null) { - for (Fluid a : aTiconFluids) { - if (a == null) { - continue; + //Generate Drying Rack recipes + TinkersDryingRecipe.generateAllDryingRecipes(); + + for (BaseTinkersMaterial y : mTinkerMaterials) { + //y.generate(); + } + + Class aTinkersSmeltery = ReflectionUtils.getClass("tconstruct.smeltery.TinkerSmeltery"); + AutoMap<Fluid> aTweakedFluids = new AutoMap<Fluid>(); + if (aTinkersSmeltery != null) { + try { + Logger.INFO("Manipulating the light levels of fluids in TiCon. Molten 'metals' in world are now very luminescent!"); + Field aFluidArrayField = ReflectionUtils.getField(aTinkersSmeltery, "fluids"); + Field aBlockArrayField = ReflectionUtils.getField(aTinkersSmeltery, "fluidBlocks"); + Fluid[] aTiconFluids = (Fluid[]) aFluidArrayField.get(null); + Block[] aTiconFluidBlocks = (Block[]) aBlockArrayField.get(null); + if (aTiconFluids != null && aTiconFluidBlocks != null) { + for (Fluid a : aTiconFluids) { + if (a == null) { + continue; + } else { + if (a.getLuminosity() <= 15) { + //if (a.getTemperature() >= 500) { + a.setLuminosity(16); + aTweakedFluids.put(a); + //} } else { - if (a.getLuminosity() <= 15) { - //if (a.getTemperature() >= 500) { - a.setLuminosity(16); - aTweakedFluids.put(a); - //} - } else { - aTweakedFluids.put(a); - continue; - } + aTweakedFluids.put(a); + continue; } } - for (Block a : aTiconFluidBlocks) { - if (a == null) { - continue; - } else { - Fluid f = FluidRegistry.lookupFluidForBlock(a); - boolean isHot = false; - if (f != null && f.getTemperature() >= 500) { - if (f.getLuminosity() <= 16 && !aTweakedFluids.containsValue(f)) { - f.setLuminosity(16); - } - isHot = true; + } + for (Block a : aTiconFluidBlocks) { + if (a == null) { + continue; + } else { + Fluid f = FluidRegistry.lookupFluidForBlock(a); + boolean isHot = false; + if (f != null && f.getTemperature() >= 500) { + if (f.getLuminosity() <= 16 && !aTweakedFluids.containsValue(f)) { + f.setLuminosity(16); } - if (a.getLightValue() <= 16f) { - if (isHot) { + isHot = true; + } + if (a.getLightValue() <= 16f) { + if (isHot) { + a.setLightLevel(16f); + } else { + if (a.getLightValue() <= 16f) { a.setLightLevel(16f); - } else { - if (a.getLightValue() <= 16f) { - a.setLightLevel(16f); - } } - } else { - continue; } + } else { + continue; } } } - } catch (IllegalArgumentException | IllegalAccessException e) { } + } catch (IllegalArgumentException | IllegalAccessException e) { } + } } } diff --git a/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java b/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java new file mode 100644 index 0000000000..8bc7ffef29 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java @@ -0,0 +1,120 @@ +package gtPlusPlus.xmod.tinkers.util; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class TinkersDryingRecipe { + + public static AutoMap<TinkersDryingRecipe> recipes = new AutoMap<TinkersDryingRecipe>(); + + public final int time; + public final ItemStack input; + public final ItemStack result; + + public static void generateAllDryingRecipes() { + List<?> aRecipes = TinkersUtils.getDryingRecipes(); + if (aRecipes != null && aRecipes.size() > 0) { + for (Object o : aRecipes) { + Logger.INFO("Trying to generate recipe using object of type "+o.getClass().getSimpleName()); + generateFromTinkersRecipeObject(o); + } + } + else { + Logger.INFO("Error generating Drying recipes, map was either null or empty. Null? "+(aRecipes != null)+", Size: "+aRecipes.size()); + } + if (!recipes.isEmpty()) { + Logger.INFO("Adding "+recipes.size()+" drying rack recipes to the dehydrator."); + for (TinkersDryingRecipe r : recipes) { + CORE.RA.addDehydratorRecipe( + new ItemStack[] { + CI.getNumberedCircuit(16), + r.input + }, + GT_Values.NF, + GT_Values.NF, + new ItemStack[] {r.result}, + new int[] {}, + r.time/10, + 30); + } + } + } + + public static TinkersDryingRecipe generateFromTinkersRecipeObject(Object o) { + Field aTime; + Field aInput; + Field aOutput; + Class aTinkerClass = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe");//o.getClass(); + if (aTinkerClass == null || !LoadedMods.TiCon) { + Logger.INFO("Error generating Drying Recipe, could not find class. Exists? "+ReflectionUtils.doesClassExist("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe")); + Class clazz = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes"); + Class[] y = clazz.getDeclaredClasses(); + if (y == null || y.length <= 0) { + Logger.INFO("No hidden inner classes."); + return null; + } + else { + boolean found = false; + for (Class h : y) { + Logger.INFO("Found hidden inner class: "+h.getCanonicalName()); + if (h.getSimpleName().toLowerCase().equals("dryingrecipe")) { + Logger.INFO("Found correct recipe. Caching at correct location."); + ReflectionUtils.mCachedClasses.put("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe", h); + aTinkerClass = h; + found = true; + break; + } + } + if (!found) { + return null; + } + } + } + aTime = ReflectionUtils.getField(aTinkerClass, "time"); + aInput = ReflectionUtils.getField(aTinkerClass, "input"); + aOutput = ReflectionUtils.getField(aTinkerClass, "result"); + try { + int time_internal = aTime.getInt(o); + ItemStack input_internal = (ItemStack) aInput.get(o); + ItemStack result_internal = (ItemStack) aOutput.get(o); + return new TinkersDryingRecipe(input_internal, time_internal, result_internal); + } catch (Throwable b) { + b.printStackTrace(); + } + return null; + } + + public TinkersDryingRecipe(final ItemStack input, final int time, final ItemStack result) { + this.time = time; + this.input = input; + this.result = result; + Logger.INFO("Generating Drying Recipe. Input: "+input.getDisplayName()+", Output: "+result.getDisplayName()); + recipes.add(this); + } + + public boolean matches(ItemStack input) { + if (input.hasTagCompound()) { + input = input.copy(); + input.getTagCompound().removeTag("frypanKill"); + if (input.getTagCompound().hasNoTags()) { + input.setTagCompound((NBTTagCompound) null); + } + } + return ItemStack.areItemStacksEqual(this.input, input); + } + + public ItemStack getResult() { + return this.result.copy(); + } +} diff --git a/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java b/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java index f0c6d76b7c..15ca3b497e 100644 --- a/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java +++ b/src/Java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java @@ -12,6 +12,8 @@ import java.util.LinkedList; import java.util.List; import gregtech.api.enums.Materials; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.minecraft.ItemUtils; @@ -24,14 +26,14 @@ import net.minecraftforge.fluids.FluidStack; public class TinkersUtils { - private static final Class mClass_Smeltery; - private static final Class mClass_TConstructRegistry; - private static final Class mClass_ToolMaterial; - private static final Class mClass_IPattern; - private static final Class mClass_DynamicToolPart; - private static final Class mClass_FluidType; - private static final Class mClass_CastingRecipe; - private static final Class mClass_TinkerSmeltery; + private static final Class<?> mClass_Smeltery; + private static final Class<?> mClass_TConstructRegistry; + private static final Class<?> mClass_ToolMaterial; + private static final Class<?> mClass_IPattern; + private static final Class<?> mClass_DynamicToolPart; + private static final Class<?> mClass_FluidType; + private static final Class<?> mClass_CastingRecipe; + private static final Class<?> mClass_TinkerSmeltery; private static final Field mField_MoltenIronFluid; @@ -313,16 +315,36 @@ public class TinkersUtils { ItemStack ingotCast = new ItemStack(mTinkerMetalPattern, aType, 0); return ingotCast; } - return ItemUtils.getErrorStack(1, "Bad Tinkers Pattern"); - - - - - - - + return ItemUtils.getErrorStack(1, "Bad Tinkers Pattern"); } + private static AutoMap<?> mDryingRackRecipes; + + public static List<?> getDryingRecipes(){ + if (mDryingRackRecipes != null) { + return mDryingRackRecipes; + } + AutoMap<Object> aData = new AutoMap<Object>(); + int aCount = 0; + try { + ArrayList<?> recipes = (ArrayList<?>) ReflectionUtils.getField(ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes"), "recipes").get(null); + if (recipes != null) { + for (Object o : recipes) { + aData.put(o); + aCount++; + } + Logger.INFO("Found "+aCount+" Tinkers drying rack recipes."); + } + else { + Logger.INFO("Failed to find any Tinkers drying rack recipes."); + } + } catch (IllegalArgumentException | IllegalAccessException e) { + Logger.INFO("Failed to find any Tinkers drying rack recipes."); + } + mDryingRackRecipes = aData; + return aData; + } + /** * Generates Tinkers {@link ToolMaterial}'s reflectively. * @param name @@ -340,7 +362,7 @@ public class TinkersUtils { */ public static Object generateToolMaterial(String name, String localizationString, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, int primaryColor) { try { - Constructor constructor = mClass_ToolMaterial.getConstructor(String.class, String.class, int.class, int.class, int.class, int.class, float.class, int.class, float.class, String.class, int.class); + Constructor<?> constructor = mClass_ToolMaterial.getConstructor(String.class, String.class, int.class, int.class, int.class, int.class, float.class, int.class, float.class, String.class, int.class); Object myObject = constructor.newInstance(name, localizationString, level, durability, speed, damage, handle, reinforced, stonebound, style, primaryColor); return myObject; } catch (Throwable t) { @@ -404,24 +426,24 @@ public class TinkersUtils { } } - public static List getTableCastingRecipes(){ + public static List<?> getTableCastingRecipes(){ Object aCastingTableHandlerInstance = getCastingInstance(0); - List aTemp; + List<?> aTemp; try { - aTemp = (List) mMethod_getCastingRecipes.invoke(aCastingTableHandlerInstance, new Object[] {}); + aTemp = (List<?>) mMethod_getCastingRecipes.invoke(aCastingTableHandlerInstance, new Object[] {}); return aTemp; } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } - return new ArrayList(); + return new ArrayList<Object>(); } public static boolean generateCastingRecipes(Material aMaterial, int aID) { - List newRecipies = new LinkedList(); + List<CastingRecipeHandler> newRecipies = new LinkedList<CastingRecipeHandler>(); - Iterator iterator1 = getTableCastingRecipes().iterator(); + Iterator<?> iterator1 = getTableCastingRecipes().iterator(); Fluid aMoltenIron = null; if (aMoltenIron == null) { try { @@ -451,7 +473,7 @@ public class TinkersUtils { Object ft; try { ft = mMethod_getFluidType.invoke(null, aMaterial.getLocalizedName()); - Iterator iterator2 = newRecipies.iterator(); + Iterator<CastingRecipeHandler> iterator2 = newRecipies.iterator(); while (iterator2.hasNext()) { CastingRecipeHandler recipe = new CastingRecipeHandler(iterator2.next()); if (!recipe.valid){ diff --git a/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java b/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java index 9e5efb452c..35f9f4bbe8 100644 --- a/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java +++ b/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java @@ -3,11 +3,10 @@ package gtPlusPlus.xmod.witchery; import java.lang.reflect.Field; import java.util.ArrayList; -import com.emoniph.witchery.Witchery; -import com.emoniph.witchery.entity.ai.EntityAIDigBlocks; import com.mojang.authlib.GameProfile; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -16,57 +15,71 @@ import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.oredict.OreDictionary; public class WitchUtils { - - private static final Field KOBOLDITE_MINER_PROFILE; + private static final GameProfile NORMAL_MINER_PROFILE; + private static final GameProfile KOBOLDITE_MINER_PROFILE; + static { + Field a1 = null, a2 = null; + GameProfile b1 = null, b2 = null; if (LoadedMods.Witchery) { - KOBOLDITE_MINER_PROFILE = getField("com.emoniph.witchery.entity.ai.EntityAIDigBlocks", "KOBOLDITE_MINER_PROFILE"); - } - else { - KOBOLDITE_MINER_PROFILE = null; - } - + try { + a1 = getField("com.emoniph.witchery.entity.ai.EntityAIDigBlocks", "NORMAL_MINER_PROFILE"); + a2 = getField("com.emoniph.witchery.entity.ai.EntityAIDigBlocks", "KOBOLDITE_MINER_PROFILE"); + b1 = (GameProfile) a1.get(null); + b2 = (GameProfile) a2.get(null); + } + catch (Throwable t) { + } + } + NORMAL_MINER_PROFILE = b1; + KOBOLDITE_MINER_PROFILE = b2; } - + //com.emoniph.witchery.entity.ai.EntityAIDigBlocks.onHarvestDrops(EntityPlayer, HarvestDropsEvent) - public static void onHarvestDrops(final EntityPlayer harvester, final BlockEvent.HarvestDropsEvent event) { - if (harvester != null && !harvester.worldObj.isRemote && !event.isCanceled() && (isEqual(harvester.getGameProfile(), EntityAIDigBlocks.KOBOLDITE_MINER_PROFILE) || isEqual(harvester.getGameProfile(), EntityAIDigBlocks.NORMAL_MINER_PROFILE))) { - final boolean hasKobolditePick = isEqual(harvester.getGameProfile(), EntityAIDigBlocks.KOBOLDITE_MINER_PROFILE); - final ArrayList<ItemStack> newDrops = new ArrayList<ItemStack>(); - double kobolditeChance = hasKobolditePick ? 0.02 : 0.01; - for (final ItemStack drop : event.drops) { - final int[] oreIDs = OreDictionary.getOreIDs(drop); - boolean addOriginal = true; - if (oreIDs.length > 0) { - final String oreName = OreDictionary.getOreName(oreIDs[0]); - if (oreName != null && oreName.startsWith("ore")) { - final ItemStack smeltedDrop = FurnaceRecipes.smelting().getSmeltingResult(drop); - if (smeltedDrop != null && hasKobolditePick && harvester.worldObj.rand.nextDouble() < 0.5) { - addOriginal = false; - newDrops.add(smeltedDrop.copy()); - newDrops.add(smeltedDrop.copy()); - if (harvester.worldObj.rand.nextDouble() < 0.25) { - newDrops.add(smeltedDrop.copy()); - } - } - kobolditeChance = (hasKobolditePick ? 0.08 : 0.05); - } - } - if (addOriginal) { - newDrops.add(drop); - } - } - event.drops.clear(); - for (final ItemStack newDrop : newDrops) { - event.drops.add(newDrop); - } - if (kobolditeChance > 0.0 && harvester.worldObj.rand.nextDouble() < kobolditeChance) { - event.drops.add(Witchery.Items.GENERIC.itemKobolditeDust.createStack()); - } - } - } - + public static void onHarvestDrops(final EntityPlayer harvester, final BlockEvent.HarvestDropsEvent event) { + + + if (LoadedMods.Witchery) { + + if (harvester != null && !harvester.worldObj.isRemote && !event.isCanceled() && (isEqual(harvester.getGameProfile(), KOBOLDITE_MINER_PROFILE) || isEqual(harvester.getGameProfile(), NORMAL_MINER_PROFILE))) { + final boolean hasKobolditePick = isEqual(harvester.getGameProfile(), KOBOLDITE_MINER_PROFILE); + final ArrayList<ItemStack> newDrops = new ArrayList<ItemStack>(); + double kobolditeChance = hasKobolditePick ? 0.02 : 0.01; + for (final ItemStack drop : event.drops) { + final int[] oreIDs = OreDictionary.getOreIDs(drop); + boolean addOriginal = true; + if (oreIDs.length > 0) { + final String oreName = OreDictionary.getOreName(oreIDs[0]); + if (oreName != null && oreName.startsWith("ore")) { + final ItemStack smeltedDrop = FurnaceRecipes.smelting().getSmeltingResult(drop); + if (smeltedDrop != null && hasKobolditePick && harvester.worldObj.rand.nextDouble() < 0.5) { + addOriginal = false; + newDrops.add(smeltedDrop.copy()); + newDrops.add(smeltedDrop.copy()); + if (harvester.worldObj.rand.nextDouble() < 0.25) { + newDrops.add(smeltedDrop.copy()); + } + } + kobolditeChance = (hasKobolditePick ? 0.08 : 0.05); + } + } + if (addOriginal) { + newDrops.add(drop); + } + } + event.drops.clear(); + for (final ItemStack newDrop : newDrops) { + event.drops.add(newDrop); + } + if (kobolditeChance > 0.0 && harvester.worldObj.rand.nextDouble() < kobolditeChance) { + event.drops.add(ALLOY.KOBOLDITE.getDust(1)); + } + } + } + + } + public static Field getField(String aClassName, String aFieldName) { Class c; c = ReflectionUtils.getClass(aClassName); @@ -78,9 +91,9 @@ public class WitchUtils { } return null; } - - public static boolean isEqual(final GameProfile a, final GameProfile b) { - return a != null && b != null && a.getId() != null && b.getId() != null && a.getId().equals(b.getId()); - } - + + public static boolean isEqual(final GameProfile a, final GameProfile b) { + return a != null && b != null && a.getId() != null && b.getId() != null && a.getId().equals(b.getId()); + } + } diff --git a/src/Java/speiger/src/crops/api/ICropCardInfo.java b/src/Java/speiger/src/crops/api/ICropCardInfo.java new file mode 100644 index 0000000000..ff67eb06b1 --- /dev/null +++ b/src/Java/speiger/src/crops/api/ICropCardInfo.java @@ -0,0 +1,12 @@ +package speiger.src.crops.api; + +import java.util.List; +import net.minecraft.item.ItemStack; + +public interface ICropCardInfo { + + List<String> getCropInformation(); + + ItemStack getDisplayItem(); + +}
\ No newline at end of file diff --git a/src/resources/assets/gregtech/lang/en_US.lang b/src/resources/assets/gregtech/lang/en_US.lang index caf4f636fb..e2120fdf7b 100644 --- a/src/resources/assets/gregtech/lang/en_US.lang +++ b/src/resources/assets/gregtech/lang/en_US.lang @@ -4,15 +4,19 @@ GTPP.EBF.heat=Heat capacity GTPP.machines.tier=Tier +GTPP.machines.input=Input +GTPP.machines.output=Output GTPP.multiblock.pollutionreduced=Pollution reduced to GTPP.multiblock.pollution=Pollution GTPP.multiblock.energy=Stored Energy -GTPP.multiblock.Progress=Progress +GTPP.multiblock.progress=Progress GTPP.multiblock.efficiency=Efficiency GTPP.multiblock.problems=Problems GTPP.multiblock.mei=Max Energy Income GTPP.multiblock.usage=Probably uses +GTPP.multiblock.specialvalue=Special Value +GTPP.multiblock.duration=Duration @@ -20,18 +24,6 @@ GTPP.CC.machinetier=Control Core Tier GTPP.CC.discount=EU Discount GTPP.CC.parallel=Maximum Parallel Processing - - -//Some Generic Words -GTPP.info.eu=EU -GTPP.info.euInfo=EU Information -GTPP.info.inputLimit=Input Limit -GTPP.info.currentPower=Current Power -GTPP.info.hidden=Hidden - - - - //Tooltips for the Charger Packs GTPP.battpack.tooltip.1=Worn as a Belt within Baubles GTPP.battpack.tooltip.2=Drains @@ -53,6 +45,53 @@ GTPP.monsterkiller.tooltip.2=Drains GTPP.monsterkiller.tooltip.3=per each kill GTPP.monsterkiller.tooltip.4=Target Type: +//17/08/19 +GTPP.container.decaychest.name=Decayables + + + + + + + + + + + + +//NEI INFORMATION +GTPP.nei.info=Information +GTPP.nei.eutick=Eu/t +GTPP.nei.timetaken=Time Taken +GTPP.nei.output=Output +GTPP.nei.input=Input +GTPP.nei.result=Result +GTPP.nei.radioation=Radiation Level + +//Some Generic Words +GTPP.info.eu=EU +GTPP.info.euInfo=EU Information +GTPP.info.inputLimit=Input Limit +GTPP.info.currentPower=Current Power +GTPP.info.hidden=Hidden + +//Some Time Words +GTPP.time.ticks=Ticks +GTPP.time.seconds=Seconds +GTPP.time.minutes=Minutes +GTPP.time.hours=Hours +GTPP.time.days=Days +GTPP.time.weeks=Weeks +GTPP.time.months=Months + + + + + + + + + @@ -173,7 +212,9 @@ achievement.decay.technetium99.desc=Cyclotron Product - +//24/11/19 +achievement.gt.blockmachines.hatch.turbine.input.tier.00=Turbine Housing +achievement.gt.blockmachines.hatch.turbine.input.tier.00.desc=[AL] Pickup this item to see the recipe in NEI diff --git a/src/resources/assets/gregtech/lang/zh_CN.lang b/src/resources/assets/gregtech/lang/zh_CN.lang index d398cfd6b2..6e7d01181c 100644 --- a/src/resources/assets/gregtech/lang/zh_CN.lang +++ b/src/resources/assets/gregtech/lang/zh_CN.lang @@ -8,7 +8,7 @@ GTPP.machines.tier=等级 GTPP.multiblock.pollutionreduced=减少污染至 GTPP.multiblock.pollution=污染 GTPP.multiblock.energy=能量存储 -GTPP.multiblock.Progress=进程 +GTPP.multiblock.progress=进程 GTPP.multiblock.efficiency=效率 GTPP.multiblock.problems=为每桶 GTPP.multiblock.mei=最大能量输入 diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index 38188e838b..d886ce1ed0 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -2956,3 +2956,157 @@ item.GTPP.bauble.fireprotection.0.name=Supreme Pizza Gloves //Added 16/5/19 item.itemCellSeleniumDioxide.name=Selenium Dioxide Cell item.itemCellSeleniousAcid.name=Selenious Acid Cell + +//Added 25/7/19 +container.pestkiller=Pest Killer + +//Added 15/8/19 +gtpp.nei.decayables=Decayables Chest +entity.batKing.name=Bat King +item.itemCellCarbyne.name=Carbyne Cell +item.itemCellHydrogenCyanide.name=Cell of Hydrogen Cyanide +item.itemCactusCharcoal.name=Cactus Charcoal +item.itemCactusCoke.name=Cactus Coke +item.itemSugarCharcoal.name=Sugar Charcoal +item.itemSugarCoke.name=Sugar Coke +item.LiquidHydrogen.name=Liquid Hydrogen Cell [LOH] + + + +//Added 24/8/19 +//Debug Labels +tile.blockDoorAlloy.name=Reinforced Door +tile.blockInhibitorObelisk.name=Inhibitor Obelisk +tile.Battlesign.name=Battlesign +tile.blockMagicBox.name=Magic Box +tile.blockManaPod.name=Mana Pod Stem +tile.buildToolBlock.name=Tool Block +tile.blockRedPlasma.name=Red Plasma Block +tile.pipeBlock.name=Pipe +item.null.name=REPORT ERROR TO ALKALUS + + +//Added 24/8/19 +tile.OreGreenockite.name=Greenockite Ore +item.crushedGreenockite.name=Crushed Greenockite Ore +item.crushedCentrifugedGreenockite.name=Centrifuged Crushed Greenockite Ore +item.crushedPurifiedGreenockite.name=Purified Crushed Greenockite Ore +item.dustImpureGreenockite.name=Impure Greenockite Dust +item.dustPureGreenockite.name=Purified Greenockite Dust +item.itemDustGreenockite.name=Greenockite Dust +item.itemDustTinyGreenockite.name=Tiny Pile of Greenockite Dust +item.itemDustSmallGreenockite.name=Small Pile of Greenockite Dust + +tile.OreRareEarthI.name=Rare Earth (I) Ore +item.crushedRareEarthI.name=Crushed Rare Earth (I) Ore +item.crushedCentrifugedRareEarthI.name=Centrifuged Crushed Rare Earth (I) Ore +item.crushedPurifiedRareEarthI.name=Purified Crushed Rare Earth (I) Ore +item.dustImpureRareEarthI.name=Impure Rare Earth (I) Dust +item.dustPureRareEarthI.name=Purified Rare Earth (I) Dust +item.itemDustRareEarthI.name=Rare Earth (I) Dust +item.itemDustTinyRareEarthI.name=Tiny Pile of Rare Earth (I) Dust +item.itemDustSmallRareEarthI.name=Small Pile of Rare Earth (I) Dust + +tile.OreRareEarthII.name=Rare Earth (II) Ore +item.crushedRareEarthII.name=Crushed Rare Earth (II) Ore +item.crushedCentrifugedRareEarthII.name=Centrifuged Crushed Rare Earth (II) Ore +item.crushedPurifiedRareEarthII.name=Purified Crushed Rare Earth (II) Ore +item.dustImpureRareEarthII.name=Impure Rare Earth (II) Dust +item.dustPureRareEarthII.name=Purified Rare Earth (II) Dust +item.itemDustRareEarthII.name=Rare Earth (II) Dust +item.itemDustTinyRareEarthII.name=Tiny Pile of Rare Earth (II) Dust +item.itemDustSmallRareEarthII.name=Small Pile of Rare Earth (II) Dust + +tile.OreRareEarthIII.name=Rare Earth (III) Ore +item.crushedRareEarthIII.name=Crushed Rare Earth (III) Ore +item.crushedCentrifugedRareEarthIII.name=Centrifuged Crushed Rare Earth (III) Ore +item.crushedPurifiedRareEarthIII.name=Purified Crushed Rare Earth (III) Ore +item.dustImpureRareEarthIII.name=Impure Rare Earth (III) Dust +item.dustPureRareEarthIII.name=Purified Rare Earth (III) Dust +item.itemDustRareEarthIII.name=Rare Earth (III) Dust +item.itemDustTinyRareEarthIII.name=Tiny Pile of Rare Earth (III) Dust +item.itemDustSmallRareEarthIII.name=Small Pile of Rare Earth (III) Dust + + + +//Added 13/10/19 +tile.blockRoundRobinator.0.name=Round Robinator I +tile.blockRoundRobinator.1.name=Round Robinator II +tile.blockRoundRobinator.2.name=Round Robinator III +tile.blockRoundRobinator.3.name=Round Robinator IV +tile.blockRoundRobinator.4.name=Round Robinator V + + +//Added 16/10/19 +item.BioRecipeSelector.name=Programmed Bio Circuit +item.FermentationBase.name=Cell of Fermentation Base +item.ureamix.name=Cell of Urea Mix +item.liquidresin.name=Cell of Liquid Resin +item.propionicacid.name=Propionic Acid Cell +item.aceticacid.name=Acetic Acid Cell +item.BasicAgrichemItem.0.name=Algae Biomass +item.BasicAgrichemItem.1.name=Green Algae Biomass +item.BasicAgrichemItem.2.name=Brown Algae Biomass +item.BasicAgrichemItem.3.name=Golden-Brown Algae Biomass +item.BasicAgrichemItem.4.name=Red Algae Biomass +item.BasicAgrichemItem.5.name=Cellulose Fiber +item.BasicAgrichemItem.6.name=Golden-Brown Cellulose Fiber +item.BasicAgrichemItem.7.name=Red Cellulose Fiber +item.BasicAgrichemItem.8.name=Compost +item.BasicAgrichemItem.9.name=Wood Pellet +item.BasicAgrichemItem.10.name=Wood Brick +item.BasicAgrichemItem.11.name=Cellulose Pulp +item.BasicAgrichemItem.12.name=Raw Bio Resin +item.BasicAgrichemItem.13.name=Catalyst Carrier +item.BasicAgrichemItem.14.name=Green Metal Catalyst +item.BasicAgrichemItem.15.name=Alginic Acid +item.BasicAgrichemItem.16.name=Alumina +item.BasicAgrichemItem.17.name=Aluminium Pellet +item.BasicAgrichemItem.18.name=Sodium Aluminate +item.BasicAgrichemItem.19.name=Sodium Hydroxide +item.BasicAgrichemItem.20.name=Sodium Carbonate +item.BasicAgrichemItem.21.name=Lithium Chloride + +//Added 24/10/19 +item.butanol.name=Butanol Cell + +//Try Fix IC2 Garbage vv +fluidHotWater=Heated Water +fluidHotWater.name=Heated Water +//Try Fix IC2 Garbage ^^ + + +//Added 11/12/19 +item.itemHotIngotTitanium.name=Hot Titanium Ingot +item.OilHeavy.name=Heavy Oil Cell +item.UnsymmetricalDimethylhydrazine.name=Unsymmetrical Dimethylhydrazine Cell +item.benzene.name=Benzene Cell +item.Benzene.name=Benzene Cell +item.phenol.name=Phenol Cell +item.CarbonDioxide.name=Carbon Dioxide Cell +item.itemCellCarbonDioxide.name=Carbon Dioxide Cell +item.CarbonMonoxide.name=Carbon Monoxide Cell +item.itemCellCarbonMonoxide.name=Carbon Monoxide Cell +item.acetone.name=Acetone Cell +item.saltwater.name=Salt Water Cell +item.BasicAgrichemItem.22.name=Mold (Pellet) +item.BasicAgrichemItem.23.name=Clean Aluminium Mix + +//Added 12/12/19 + +item.BasicGenericChemItem.0.name=Red Metal Catalyst +item.BasicGenericChemItem.1.name=Yellow Metal Catalyst +item.BasicGenericChemItem.2.name=Blue Metal Catalyst +item.BasicGenericChemItem.3.name=Orange Metal Catalyst +item.BasicGenericChemItem.4.name=Purple Metal Catalyst +item.BasicGenericChemItem.5.name=Brown Metal Catalyst +item.MudRedSlurry.name=Cell of Red Mud Slurry +item.liquid_toluene.name=Toluene Cell + +item.BasicAlgaeItem.0.name=Algae Spore (I) +item.BasicAlgaeItem.1.name=Algae Spore (II) +item.BasicAlgaeItem.2.name=Algae Spore (III) +item.BasicAlgaeItem.3.name=Algae Spore (IV) +item.BasicAlgaeItem.4.name=Algae Spore (V) +item.BasicAlgaeItem.5.name=Algae Spore (VI) +item.BasicAlgaeItem.6.name=Algae Spore (VII) diff --git a/src/resources/assets/miscutils/lang/ru_RU.lang b/src/resources/assets/miscutils/lang/ru_RU.lang index db50c7a51b..37de35c563 100644 --- a/src/resources/assets/miscutils/lang/ru_RU.lang +++ b/src/resources/assets/miscutils/lang/ru_RU.lang @@ -283,7 +283,7 @@ tile.blockModularity.name=Модульность tile.blockBlackGate.name=Черные Ворота tile.blockTankXpConverter.name=Резервуар Конвертора Опыта tile.blockCompressedObsidian.0.name=Компрессированный Обсидиан -tile.blockNet.name=Нет +tile.blockNet.name=сети tile.blockMiningPipeFake.name=Добыча Полезных Ископаемых tile.blockMiningHeadFake.name=Руководитель По Добыче Полезных Ископаемых tile.miscutils.fluid.pyrotheum.name=Жидкий Пиротеум diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT.png Binary files differnew file mode 100644 index 0000000000..e92b9c9ff8 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png Binary files differnew file mode 100644 index 0000000000..8a47157d2b --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..1367b80758 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_FRONT_ACTIVE.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation":{ + "frametime":2, + "frames": [0, 0, 1, 1, 2, 2, 3, 3, 3, 2, 2, 1, 1, 0] + } +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE.png Binary files differnew file mode 100644 index 0000000000..b926eb1ef2 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png Binary files differnew file mode 100644 index 0000000000..ae63da7746 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png.mcmeta b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png.mcmeta new file mode 100644 index 0000000000..8447c98f9a --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_SIDE_ACTIVE.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation":{ + "frametime":2, + "frames": [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0] + } +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP.png Binary files differnew file mode 100644 index 0000000000..e9b20bd486 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE.png Binary files differnew file mode 100644 index 0000000000..25ea33ce3a --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_ROCKETDYNE.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_ROCKETDYNE.png Binary files differnew file mode 100644 index 0000000000..89fed025b4 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_CASING_ROCKETDYNE.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_PESTKILLER_TOP.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_PESTKILLER_TOP.png Binary files differnew file mode 100644 index 0000000000..2602f44af3 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/MACHINE_PESTKILLER_TOP.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_0.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_0.png Binary files differnew file mode 100644 index 0000000000..cbf604f2b3 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_0.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_1.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_1.png Binary files differnew file mode 100644 index 0000000000..3b7ac3d50e --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_1.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_2.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_2.png Binary files differnew file mode 100644 index 0000000000..a5a5e2c559 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_2.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_3.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_3.png Binary files differnew file mode 100644 index 0000000000..b68c900ddd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_3.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_4.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_4.png Binary files differnew file mode 100644 index 0000000000..df182aeaa5 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Side_4.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_0.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_0.png Binary files differnew file mode 100644 index 0000000000..85bc3f16cd --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_0.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_1.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_1.png Binary files differnew file mode 100644 index 0000000000..f82185ebdb --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_1.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_2.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_2.png Binary files differnew file mode 100644 index 0000000000..345476e03c --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_2.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_3.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_3.png Binary files differnew file mode 100644 index 0000000000..971164eb3e --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_3.png diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_4.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_4.png Binary files differnew file mode 100644 index 0000000000..5b5bac3ad2 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/RoundRobinator/Top_4.png diff --git a/src/resources/assets/miscutils/textures/entity/batKing.png b/src/resources/assets/miscutils/textures/entity/batKing.png Binary files differnew file mode 100644 index 0000000000..ced2722563 --- /dev/null +++ b/src/resources/assets/miscutils/textures/entity/batKing.png diff --git a/src/resources/assets/miscutils/textures/gui/Cyclotron.png b/src/resources/assets/miscutils/textures/gui/Cyclotron.png Binary files differnew file mode 100644 index 0000000000..98c374ace8 --- /dev/null +++ b/src/resources/assets/miscutils/textures/gui/Cyclotron.png diff --git a/src/resources/assets/miscutils/textures/gui/FluidReactor.png b/src/resources/assets/miscutils/textures/gui/FluidReactor.png Binary files differnew file mode 100644 index 0000000000..b8e88bd461 --- /dev/null +++ b/src/resources/assets/miscutils/textures/gui/FluidReactor.png diff --git a/src/resources/assets/miscutils/textures/gui/MultiblockDisplay_Generic.png b/src/resources/assets/miscutils/textures/gui/MultiblockDisplay_Generic.png Binary files differnew file mode 100644 index 0000000000..c1ed0e5f37 --- /dev/null +++ b/src/resources/assets/miscutils/textures/gui/MultiblockDisplay_Generic.png diff --git a/src/resources/assets/miscutils/textures/gui/PestKiller.png b/src/resources/assets/miscutils/textures/gui/PestKiller.png Binary files differnew file mode 100644 index 0000000000..d1978ae04a --- /dev/null +++ b/src/resources/assets/miscutils/textures/gui/PestKiller.png diff --git a/src/resources/assets/miscutils/textures/gui/RoundRobinator.png b/src/resources/assets/miscutils/textures/gui/RoundRobinator.png Binary files differnew file mode 100644 index 0000000000..54c06f22ae --- /dev/null +++ b/src/resources/assets/miscutils/textures/gui/RoundRobinator.png diff --git a/src/resources/assets/miscutils/textures/gui/nei/decayables.png b/src/resources/assets/miscutils/textures/gui/nei/decayables.png Binary files differnew file mode 100644 index 0000000000..d1827433a0 --- /dev/null +++ b/src/resources/assets/miscutils/textures/gui/nei/decayables.png diff --git a/src/resources/assets/miscutils/textures/gui/nei/widgets.png b/src/resources/assets/miscutils/textures/gui/nei/widgets.png Binary files differnew file mode 100644 index 0000000000..0dc26c43e4 --- /dev/null +++ b/src/resources/assets/miscutils/textures/gui/nei/widgets.png diff --git a/src/resources/assets/miscutils/textures/items/MU-metaitem.01/140.png b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/140.png Binary files differnew file mode 100644 index 0000000000..8b38dcd9ce --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/MU-metaitem.01/140.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/BasicAlgae.png b/src/resources/assets/miscutils/textures/items/bioscience/BasicAlgae.png Binary files differnew file mode 100644 index 0000000000..efa1a6e0ca --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/BasicAlgae.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/BasicAlgae_Overlay.png b/src/resources/assets/miscutils/textures/items/bioscience/BasicAlgae_Overlay.png Binary files differnew file mode 100644 index 0000000000..aaea7803b5 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/BasicAlgae_Overlay.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/BioCircuit.png b/src/resources/assets/miscutils/textures/items/bioscience/BioCircuit.png Binary files differnew file mode 100644 index 0000000000..c2736be76c --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/BioCircuit.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/0.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/0.png Binary files differnew file mode 100644 index 0000000000..57d77be16a --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/0.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/1.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/1.png Binary files differnew file mode 100644 index 0000000000..51bb4587d9 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/1.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/10.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/10.png Binary files differnew file mode 100644 index 0000000000..e81bae4aae --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/10.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/11.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/11.png Binary files differnew file mode 100644 index 0000000000..0cc273996e --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/11.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/12.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/12.png Binary files differnew file mode 100644 index 0000000000..dca743acd3 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/12.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/13.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/13.png Binary files differnew file mode 100644 index 0000000000..15257d9efd --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/13.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/14.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/14.png Binary files differnew file mode 100644 index 0000000000..f81fc43aff --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/14.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/15.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/15.png Binary files differnew file mode 100644 index 0000000000..31951671cd --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/15.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/16.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/16.png Binary files differnew file mode 100644 index 0000000000..2c6e0b8cb6 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/16.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/17.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/17.png Binary files differnew file mode 100644 index 0000000000..4309f3a975 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/17.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/18.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/18.png Binary files differnew file mode 100644 index 0000000000..e82660e9f8 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/18.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/19.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/19.png Binary files differnew file mode 100644 index 0000000000..dc2070e635 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/19.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/2.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/2.png Binary files differnew file mode 100644 index 0000000000..2cdf37adad --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/2.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/20.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/20.png Binary files differnew file mode 100644 index 0000000000..9b536f84d0 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/20.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/21.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/21.png Binary files differnew file mode 100644 index 0000000000..1a04c2415c --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/21.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/22.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/22.png Binary files differnew file mode 100644 index 0000000000..77be3ef6a8 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/22.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/23.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/23.png Binary files differnew file mode 100644 index 0000000000..110cd7f8e8 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/23.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/3.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/3.png Binary files differnew file mode 100644 index 0000000000..c98e2d6319 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/3.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/4.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/4.png Binary files differnew file mode 100644 index 0000000000..af0bcc7064 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/4.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/5.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/5.png Binary files differnew file mode 100644 index 0000000000..1b60b7f555 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/5.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/6.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/6.png Binary files differnew file mode 100644 index 0000000000..7f6f045430 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/6.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/7.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/7.png Binary files differnew file mode 100644 index 0000000000..8a2cd2891b --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/7.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/8.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/8.png Binary files differnew file mode 100644 index 0000000000..c8c6299d7b --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/8.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/9.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/9.png Binary files differnew file mode 100644 index 0000000000..df99f3f5e8 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/9.png diff --git a/src/resources/assets/miscutils/textures/items/burnables/itemCactusCharcoal.png b/src/resources/assets/miscutils/textures/items/burnables/itemCactusCharcoal.png Binary files differnew file mode 100644 index 0000000000..3cb0ac7097 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/burnables/itemCactusCharcoal.png diff --git a/src/resources/assets/miscutils/textures/items/burnables/itemCactusCoke.png b/src/resources/assets/miscutils/textures/items/burnables/itemCactusCoke.png Binary files differnew file mode 100644 index 0000000000..9dc98ba18d --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/burnables/itemCactusCoke.png diff --git a/src/resources/assets/miscutils/textures/items/itemCoalCoke.png b/src/resources/assets/miscutils/textures/items/burnables/itemCoalCoke.png Binary files differindex 4f8fd406d4..4f8fd406d4 100644 --- a/src/resources/assets/miscutils/textures/items/itemCoalCoke.png +++ b/src/resources/assets/miscutils/textures/items/burnables/itemCoalCoke.png diff --git a/src/resources/assets/miscutils/textures/items/burnables/itemSugarCharcoal.png b/src/resources/assets/miscutils/textures/items/burnables/itemSugarCharcoal.png Binary files differnew file mode 100644 index 0000000000..f66a217c78 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/burnables/itemSugarCharcoal.png diff --git a/src/resources/assets/miscutils/textures/items/burnables/itemSugarCoke.png b/src/resources/assets/miscutils/textures/items/burnables/itemSugarCoke.png Binary files differnew file mode 100644 index 0000000000..055655ebe1 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/burnables/itemSugarCoke.png diff --git a/src/resources/assets/miscutils/textures/items/covers/0.png b/src/resources/assets/miscutils/textures/items/covers/0.png Binary files differnew file mode 100644 index 0000000000..1938287f27 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/0.png diff --git a/src/resources/assets/miscutils/textures/items/covers/1.png b/src/resources/assets/miscutils/textures/items/covers/1.png Binary files differnew file mode 100644 index 0000000000..327e530f1b --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/1.png diff --git a/src/resources/assets/miscutils/textures/items/covers/10.png b/src/resources/assets/miscutils/textures/items/covers/10.png Binary files differnew file mode 100644 index 0000000000..9e48f50335 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/10.png diff --git a/src/resources/assets/miscutils/textures/items/covers/11.png b/src/resources/assets/miscutils/textures/items/covers/11.png Binary files differnew file mode 100644 index 0000000000..32ffcb8008 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/11.png diff --git a/src/resources/assets/miscutils/textures/items/covers/12.png b/src/resources/assets/miscutils/textures/items/covers/12.png Binary files differnew file mode 100644 index 0000000000..48b1eadf93 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/12.png diff --git a/src/resources/assets/miscutils/textures/items/covers/13.png b/src/resources/assets/miscutils/textures/items/covers/13.png Binary files differnew file mode 100644 index 0000000000..7f6a13cb82 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/13.png diff --git a/src/resources/assets/miscutils/textures/items/covers/14.png b/src/resources/assets/miscutils/textures/items/covers/14.png Binary files differnew file mode 100644 index 0000000000..9f59404337 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/14.png diff --git a/src/resources/assets/miscutils/textures/items/covers/15.png b/src/resources/assets/miscutils/textures/items/covers/15.png Binary files differnew file mode 100644 index 0000000000..ed0f49bd0f --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/15.png diff --git a/src/resources/assets/miscutils/textures/items/covers/2.png b/src/resources/assets/miscutils/textures/items/covers/2.png Binary files differnew file mode 100644 index 0000000000..635be463af --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/2.png diff --git a/src/resources/assets/miscutils/textures/items/covers/3.png b/src/resources/assets/miscutils/textures/items/covers/3.png Binary files differnew file mode 100644 index 0000000000..24afa30c17 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/3.png diff --git a/src/resources/assets/miscutils/textures/items/covers/4.png b/src/resources/assets/miscutils/textures/items/covers/4.png Binary files differnew file mode 100644 index 0000000000..847e54ef60 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/4.png diff --git a/src/resources/assets/miscutils/textures/items/covers/5.png b/src/resources/assets/miscutils/textures/items/covers/5.png Binary files differnew file mode 100644 index 0000000000..ddd9cb7a2f --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/5.png diff --git a/src/resources/assets/miscutils/textures/items/covers/6.png b/src/resources/assets/miscutils/textures/items/covers/6.png Binary files differnew file mode 100644 index 0000000000..e21c4fb78c --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/6.png diff --git a/src/resources/assets/miscutils/textures/items/covers/7.png b/src/resources/assets/miscutils/textures/items/covers/7.png Binary files differnew file mode 100644 index 0000000000..29e270f862 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/7.png diff --git a/src/resources/assets/miscutils/textures/items/covers/8.png b/src/resources/assets/miscutils/textures/items/covers/8.png Binary files differnew file mode 100644 index 0000000000..87a48050fd --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/8.png diff --git a/src/resources/assets/miscutils/textures/items/covers/9.png b/src/resources/assets/miscutils/textures/items/covers/9.png Binary files differnew file mode 100644 index 0000000000..3836414587 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/covers/9.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/0.png b/src/resources/assets/miscutils/textures/items/particle/new/0.png Binary files differnew file mode 100644 index 0000000000..3fe49c3a57 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/0.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/1.png b/src/resources/assets/miscutils/textures/items/particle/new/1.png Binary files differnew file mode 100644 index 0000000000..39ffa85711 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/1.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/10.png b/src/resources/assets/miscutils/textures/items/particle/new/10.png Binary files differnew file mode 100644 index 0000000000..18ded814cf --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/10.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/11.png b/src/resources/assets/miscutils/textures/items/particle/new/11.png Binary files differnew file mode 100644 index 0000000000..b7e191c79f --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/11.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/12.png b/src/resources/assets/miscutils/textures/items/particle/new/12.png Binary files differnew file mode 100644 index 0000000000..49feb199e0 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/12.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/13.png b/src/resources/assets/miscutils/textures/items/particle/new/13.png Binary files differnew file mode 100644 index 0000000000..b70178d315 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/13.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/14.png b/src/resources/assets/miscutils/textures/items/particle/new/14.png Binary files differnew file mode 100644 index 0000000000..77741644ed --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/14.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/15.png b/src/resources/assets/miscutils/textures/items/particle/new/15.png Binary files differnew file mode 100644 index 0000000000..d48096c85c --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/15.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/16.png b/src/resources/assets/miscutils/textures/items/particle/new/16.png Binary files differnew file mode 100644 index 0000000000..cef33d17fd --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/16.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/17.png b/src/resources/assets/miscutils/textures/items/particle/new/17.png Binary files differnew file mode 100644 index 0000000000..4b752e7a9a --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/17.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/18.png b/src/resources/assets/miscutils/textures/items/particle/new/18.png Binary files differnew file mode 100644 index 0000000000..23fdb190c7 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/18.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/19.png b/src/resources/assets/miscutils/textures/items/particle/new/19.png Binary files differnew file mode 100644 index 0000000000..94e2a856c9 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/19.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/2.png b/src/resources/assets/miscutils/textures/items/particle/new/2.png Binary files differnew file mode 100644 index 0000000000..d86b5b357d --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/2.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/20.png b/src/resources/assets/miscutils/textures/items/particle/new/20.png Binary files differnew file mode 100644 index 0000000000..d7cbdb8f45 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/20.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/21.png b/src/resources/assets/miscutils/textures/items/particle/new/21.png Binary files differnew file mode 100644 index 0000000000..2531eaff52 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/21.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/22.png b/src/resources/assets/miscutils/textures/items/particle/new/22.png Binary files differnew file mode 100644 index 0000000000..d594dc4be8 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/22.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/23.png b/src/resources/assets/miscutils/textures/items/particle/new/23.png Binary files differnew file mode 100644 index 0000000000..d96dd2b000 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/23.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/24.png b/src/resources/assets/miscutils/textures/items/particle/new/24.png Binary files differnew file mode 100644 index 0000000000..56067466ad --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/24.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/3.png b/src/resources/assets/miscutils/textures/items/particle/new/3.png Binary files differnew file mode 100644 index 0000000000..43438c4ce5 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/3.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/4.png b/src/resources/assets/miscutils/textures/items/particle/new/4.png Binary files differnew file mode 100644 index 0000000000..8f0db073cd --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/4.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/5.png b/src/resources/assets/miscutils/textures/items/particle/new/5.png Binary files differnew file mode 100644 index 0000000000..40ec84db70 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/5.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/6.png b/src/resources/assets/miscutils/textures/items/particle/new/6.png Binary files differnew file mode 100644 index 0000000000..c63ad0ba19 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/6.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/7.png b/src/resources/assets/miscutils/textures/items/particle/new/7.png Binary files differnew file mode 100644 index 0000000000..aad8c7ca62 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/7.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/8.png b/src/resources/assets/miscutils/textures/items/particle/new/8.png Binary files differnew file mode 100644 index 0000000000..c9b908ec61 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/8.png diff --git a/src/resources/assets/miscutils/textures/items/particle/new/9.png b/src/resources/assets/miscutils/textures/items/particle/new/9.png Binary files differnew file mode 100644 index 0000000000..b8e02c82ea --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/particle/new/9.png diff --git a/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/0.png b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/0.png Binary files differnew file mode 100644 index 0000000000..f4ba0a2f0a --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/0.png diff --git a/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/1.png b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/1.png Binary files differnew file mode 100644 index 0000000000..db59db96e3 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/1.png diff --git a/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/2.png b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/2.png Binary files differnew file mode 100644 index 0000000000..4649393bb2 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/2.png diff --git a/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/3.png b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/3.png Binary files differnew file mode 100644 index 0000000000..5b47d172be --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/3.png diff --git a/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/4.png b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/4.png Binary files differnew file mode 100644 index 0000000000..995b19953c --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/4.png diff --git a/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/5.png b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/5.png Binary files differnew file mode 100644 index 0000000000..3ec2502da2 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/science/general/MetaItem1/5.png |