aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2021-05-20 23:07:24 +0000
committerAlkalus <draknyte1@hotmail.com>2021-05-20 23:07:24 +0000
commit7881c840421c191e8c4249fc303e184fa1cbf9a8 (patch)
tree0e1f8d8d19ca14e14dfb16c1ed49750935612dfa /src/Java/gtPlusPlus/xmod/gregtech/common
parentde40c882cb16535deae1c29b22f1a535747db536 (diff)
parent5316a0ffcbc403e17a06d4c9e28d57e202f0aafe (diff)
downloadGT5-Unofficial-7881c840421c191e8c4249fc303e184fa1cbf9a8.tar.gz
GT5-Unofficial-7881c840421c191e8c4249fc303e184fa1cbf9a8.tar.bz2
GT5-Unofficial-7881c840421c191e8c4249fc303e184fa1cbf9a8.zip
Merged in MultiFixes (pull request #11)
MultiFixes
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java44
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java10
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java81
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java15
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow_Item.java182
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java42
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java168
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java68
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_FlaskRenderer.java94
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java192
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java7
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java7
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialVacuumFreezer.java12
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamMacerator.java135
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_ElementalDuplicator.java989
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Refinery.java19
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java465
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java23
19 files changed, 2200 insertions, 356 deletions
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 63f5043954..091ee734e6 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -3,10 +3,7 @@ package gtPlusPlus.xmod.gregtech.common;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.apache.commons.lang3.ArrayUtils;
@@ -15,16 +12,10 @@ 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.enums.TAE;
+import gregtech.api.enums.*;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseMetaTileEntity;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_Utility;
-import gregtech.api.util.GTPP_Recipe;
+import gregtech.api.util.*;
import gregtech.common.GT_Proxy;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
@@ -32,15 +23,14 @@ 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.minecraft.FluidUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.minecraft.LangUtils;
-import gtPlusPlus.core.util.minecraft.MaterialUtils;
+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.xmod.gregtech.api.metatileentity.BaseCustomTileEntity;
import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE;
import gtPlusPlus.xmod.gregtech.common.covers.CoverManager;
+import gtPlusPlus.xmod.gregtech.common.helpers.MachineUpdateHandler;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_WorldAccelerator;
import ic2.core.init.BlocksItems;
import ic2.core.init.InternalName;
@@ -59,6 +49,7 @@ public class Meta_GT_Proxy {
static {
Logger.INFO("GT_PROXY - initialized.");
+ sDoesVolumetricFlaskExist = ReflectionUtils.doesClassExist("gregtech.common.items.GT_VolumetricFlask");
}
public static List<Runnable> GT_BlockIconload = new ArrayList<>();
@@ -73,6 +64,10 @@ public class Meta_GT_Proxy {
public static final Map<String, FormattedTooltipString> mCustomGregtechMetaTooltips = new LinkedHashMap<String, FormattedTooltipString>();
+ /**
+ * Does this feature exist within GT? Saves loading useless content if not.
+ */
+ public static final boolean sDoesVolumetricFlaskExist;
@SideOnly(Side.CLIENT)
public static IIconRegister sBlockIcons, sItemIcons;
@@ -119,6 +114,7 @@ public class Meta_GT_Proxy {
setValidHeatingCoilMetas();
PollutionUtils.setPollutionFluids();
fixIC2FluidNames();
+ Utils.registerEvent(new MachineUpdateHandler());
}
public static void postInit() {
@@ -216,11 +212,11 @@ public class Meta_GT_Proxy {
public static boolean generatePlasmaRecipesForAdvVacFreezer() {
- AutoMap<GTPP_Recipe> aFreezerMapRebaked = new AutoMap<GTPP_Recipe>();
- AutoMap<GTPP_Recipe> aRemovedRecipes = new AutoMap<GTPP_Recipe>();
+ AutoMap<GT_Recipe> aFreezerMapRebaked = new AutoMap<GT_Recipe>();
+ AutoMap<GT_Recipe> aRemovedRecipes = new AutoMap<GT_Recipe>();
//Find recipes containing Plasma and map them
- for (GTPP_Recipe y : GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes.mRecipeList) {
+ for (GT_Recipe y : GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList) {
if (y.mFluidInputs.length > 0) {
for (FluidStack r : y.mFluidInputs) {
if (r.getUnlocalizedName().toLowerCase().contains("plasma")) {
@@ -312,17 +308,17 @@ public class Meta_GT_Proxy {
//Best not touch the original map if we don't have a valid map to override it with.
if (aFreezerMapRebaked.size() > 0) {
- int aOriginalCount = GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes.mRecipeList.size();
+ int aOriginalCount = GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.size();
//Empty the original map
- GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes.mRecipeList.clear();
+ GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.clear();
//Rebake the real map
- for (GTPP_Recipe w : aFreezerMapRebaked) {
- GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes.mRecipeList.add(w);
+ for (GT_Recipe w : aFreezerMapRebaked) {
+ GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.add(w);
}
- return GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes.mRecipeList.size() >= aOriginalCount;
+ return GTPP_Recipe.GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mRecipeList.size() >= aOriginalCount;
}
return false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
index f3ad1de188..832ee2b56e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java
@@ -26,10 +26,9 @@ extends GregtechMetaCasingBlocksAbstract {
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "IsaMill Exterior Casing"); // IsaMill Casing
TAE.registerTexture(0, 2, new GT_CopiedBlockTexture(this, 6, 0));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "IsaMill Piping"); // IsaMill Pipe
- TAE.registerTexture(0, 3, new GT_CopiedBlockTexture(this, 6, 0));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "IsaMill Gearbox"); // IsaMill Gearbox
- TAE.registerTexture(0, 4, new GT_CopiedBlockTexture(this, 6, 0));
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Elemental Confinement Shell"); // Duplicator Casing
+ TAE.registerTexture(0, 3, new GT_CopiedBlockTexture(this, 6, 3));
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", ""); // Unused
@@ -42,9 +41,11 @@ extends GregtechMetaCasingBlocksAbstract {
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
+
GregtechItemList.Casing_IsaMill_Casing.set(new ItemStack(this, 1, 0));
GregtechItemList.Casing_IsaMill_Pipe.set(new ItemStack(this, 1, 1));
GregtechItemList.Casing_IsaMill_Gearbox.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_ElementalDuplicator.set(new ItemStack(this, 1, 2));
}
@Override
@@ -62,7 +63,8 @@ extends GregtechMetaCasingBlocksAbstract {
return TexturesGtBlock.TEXTURE_PIPE_GRINDING_MILL.getIcon();
case 2:
return TexturesGtBlock.TEXTURE_GEARBOX_GRINDING_MILL.getIcon();
-
+ case 3:
+ return TexturesGtBlock.TEXTURE_TECH_PANEL_D.getIcon();
}
}
return Textures.BlockIcons.RENDERING_ERROR.getIcon();
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java
new file mode 100644
index 0000000000..8f5dff592a
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaSpecialMachineCasings.java
@@ -0,0 +1,81 @@
+package gtPlusPlus.xmod.gregtech.common.blocks;
+
+import java.util.List;
+
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.objects.GT_CopiedBlockTexture;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.common.blocks.GT_Material_Casings;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+
+public class GregtechMetaSpecialMachineCasings extends GregtechMetaCasingBlocksAbstract {
+
+
+ public static class SpecialCasingItemBlock extends GregtechMetaCasingItems {
+
+ public SpecialCasingItemBlock(Block par1) {
+ super(par1);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ int aMeta = aStack.getItemDamage();
+ if (aMeta < 10) {
+ //aList.add("Tier: "+GT_Values.VN[aMeta]);
+ }
+ super.addInformation(aStack, aPlayer, aList, aF3_H);
+ }
+ }
+
+ public GregtechMetaSpecialMachineCasings() {
+ super(SpecialCasingItemBlock.class, "gtplusplus.blockspecialcasings.2", GT_Material_Casings.INSTANCE);
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ //TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i));
+ // Don't register these Textures, They already exist within vanilla GT. (May not exist in 5.08)
+ }
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Strong Bronze Machine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Sturdy Aluminium Machine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Vigorous Laurenium Machine Casing");
+ TAE.registerTexture(84, new GT_CopiedBlockTexture(this, 6, 2));
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Rugged Botmium Machine Casing");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "");
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); // Unused
+ GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", ""); // Unused
+
+ GregtechItemList.Casing_Machine_Custom_1.set(new ItemStack(this, 1, 0));
+ GregtechItemList.Casing_Machine_Custom_2.set(new ItemStack(this, 1, 1));
+ GregtechItemList.Casing_Machine_Custom_3.set(new ItemStack(this, 1, 2));
+ GregtechItemList.Casing_Machine_Custom_4.set(new ItemStack(this, 1, 3));
+ }
+
+ public IIcon getIcon(int aSide, int aMeta) {
+ switch (aMeta) {
+ case 0:
+ return Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon();
+ case 1:
+ return Textures.BlockIcons.MACHINE_CASING_FROST_PROOF.getIcon();
+ case 2:
+ return TexturesGtBlock.Casing_Material_Laurenium.getIcon();
+ case 3:
+ return Textures.BlockIcons.MACHINE_HEATPROOFCASING.getIcon();
+ }
+ return Textures.BlockIcons.RENDERING_ERROR.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 93322d2ef1..8b181a05f4 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java
@@ -99,6 +99,10 @@ public class TexturesGtBlock {
}
}
+ public static GT_RenderedTexture getTextureFromIcon(CustomIcon aIcon, short[] aRGB) {
+ return new GT_RenderedTexture(aIcon, aRGB);
+ }
+
/*
* Add Some Custom Textures below.
* I am not sure whether or not I need to declare them as such, but better to be safe than sorry.
@@ -214,7 +218,9 @@ public class TexturesGtBlock {
public static final CustomIcon Casing_Material_HastelloyN = Internal_Casing_HastelloyN;
private static final CustomIcon Internal_Casing_Fluid_IncoloyDS = new CustomIcon("TileEntities/MACHINE_CASING_FLUID_INCOLOY_DS");
public static final CustomIcon Casing_Material_Fluid_IncoloyDS = Internal_Casing_Fluid_IncoloyDS;
-
+
+ private static final CustomIcon Internal_Casing_Laurenium = new CustomIcon("TileEntities/MACHINE_CASING_LAURENIUM");
+ public static final CustomIcon Casing_Material_Laurenium = Internal_Casing_Laurenium;
//Trinium Alloys
public static final CustomIcon Casing_Trinium_Titanium = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TRINIUM_TITANIUM");
@@ -395,7 +401,11 @@ public class TexturesGtBlock {
// Catalyst Bus
private static final CustomIcon Internal_Overlay_Bus_Catalyst = new CustomIcon("iconsets/OVERLAY_CATALYSTS");
public static final CustomIcon Overlay_Bus_Catalyst = Internal_Overlay_Bus_Catalyst;
-
+ // RTG Hatch
+ private static final CustomIcon Internal_Overlay_Hatch_RTG_Off = new CustomIcon("iconsets/OVERLAY_ENERGY_RTG_OFF");
+ public static final CustomIcon Overlay_Hatch_RTG_Off = Internal_Overlay_Hatch_RTG_Off;
+ private static final CustomIcon Internal_Overlay_Hatch_RTG_On = new CustomIcon("iconsets/OVERLAY_ENERGY_RTG_ON");
+ public static final CustomIcon Overlay_Hatch_RTG_On = Internal_Overlay_Hatch_RTG_On;
//Dimensional
private static final CustomIcon Internal_Overlay_Machine_Dimensional_Blue = new CustomIcon("TileEntities/adv_machine_dimensional_cover_blue");
@@ -467,6 +477,7 @@ public class TexturesGtBlock {
public static final CustomIcon TEXTURE_TECH_PANEL_A = new CustomIcon("metro/TEXTURE_TECH_PANEL_A");
public static final CustomIcon TEXTURE_TECH_PANEL_B = new CustomIcon("metro/TEXTURE_TECH_PANEL_B");
public static final CustomIcon TEXTURE_TECH_PANEL_C = new CustomIcon("metro/TEXTURE_TECH_PANEL_C");
+ public static final CustomIcon TEXTURE_TECH_PANEL_D = new CustomIcon("metro/TEXTURE_TECH_PANEL_D");
public static final CustomIcon TEXTURE_TECH_PANEL_RADIOACTIVE = new CustomIcon("TileEntities/DecayablesChest_bottom");
public static final CustomIcon TEXTURE_TECH_PANEL_RADIOACTIVE_ALT = new CustomIcon("TileEntities/DecayablesChest_top");
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow_Item.java b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow_Item.java
new file mode 100644
index 0000000000..0299447694
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow_Item.java
@@ -0,0 +1,182 @@
+package gtPlusPlus.xmod.gregtech.common.covers;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_CoverBehavior;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.LangUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+
+public class GTPP_Cover_Overflow_Item extends GT_CoverBehavior {
+
+ public final int mInitialCapacity;
+ public final int mMaxItemCapacity;
+
+ public static final Class sQuantumChest;
+ public static final Class sSuperChestGTPP;
+ public static final Class sSuperChestGTNH;
+ public static HashMap<Integer, Field> mItemAmountFields = new HashMap<Integer, Field>();
+ public static HashMap<Integer, Field> mItemTypeFields = new HashMap<Integer, Field>();
+
+ static {
+ sQuantumChest = ReflectionUtils.getClass("gregtech.common.tileentities.storage.GT_MetaTileEntity_QuantumChest");
+ sSuperChestGTPP = ReflectionUtils.getClass("gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest");
+ if (CORE.GTNH) {
+ sSuperChestGTNH = ReflectionUtils.getClass("gregtech.common.tileentities.storage.GT_MetaTileEntity_SuperChest");
+ }
+ else {
+ sSuperChestGTNH = null;
+ }
+ if (sQuantumChest != null) {
+ mItemAmountFields.put(0, ReflectionUtils.getField(sQuantumChest, "mItemCount"));
+ mItemTypeFields.put(0, ReflectionUtils.getField(sQuantumChest, "mItemStack"));
+ }
+ if (sSuperChestGTPP != null) {
+ mItemAmountFields.put(1, ReflectionUtils.getField(sSuperChestGTPP, "mItemCount"));
+ mItemTypeFields.put(1, ReflectionUtils.getField(sSuperChestGTPP, "mItemStack"));
+ }
+ if (sSuperChestGTNH != null) {
+ mItemAmountFields.put(2, ReflectionUtils.getField(sSuperChestGTNH, "mItemCount"));
+ mItemTypeFields.put(2, ReflectionUtils.getField(sSuperChestGTNH, "mItemStack"));
+ }
+ }
+
+ public GTPP_Cover_Overflow_Item(int aCapacity) {
+ this.mInitialCapacity = aCapacity;
+ this.mMaxItemCapacity = aCapacity * 1000;
+ }
+
+ public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ long aTimer) {
+ if (aCoverVariable == 0) {
+ return aCoverVariable;
+ }
+
+ // Get the IGTTile
+ IGregTechTileEntity aGtTileEntity = aTileEntity.getIGregTechTileEntity(aTileEntity.getXCoord(), aTileEntity.getYCoord(), aTileEntity.getZCoord());
+ if (aGtTileEntity == null) {
+ return aCoverVariable;
+ }
+
+ // Get the MetaTile
+ final IMetaTileEntity aMetaTileEntity = aGtTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return aCoverVariable;
+ }
+ boolean didHandle = false;
+ // Special Case for everything I want to support. /facepalm
+ if (sQuantumChest != null && sQuantumChest.isInstance(aMetaTileEntity)) {
+ didHandle = handleDigitalChest(aMetaTileEntity, 0);
+ }
+ else if (sSuperChestGTPP.isInstance(aMetaTileEntity)) {
+ didHandle = handleDigitalChest(aMetaTileEntity, 1);
+
+ }
+ else if (CORE.GTNH && sSuperChestGTNH != null && sSuperChestGTNH.isInstance(aMetaTileEntity)) {
+ didHandle = handleDigitalChest(aMetaTileEntity, 2);
+ }
+
+ return aCoverVariable;
+ }
+
+ private boolean handleDigitalChest(IMetaTileEntity aTile, int aType) {
+ int aItemAmount = (int) ReflectionUtils.getFieldValue(mItemAmountFields.get(aType), aTile);
+ ItemStack aItemType = (ItemStack) ReflectionUtils.getFieldValue(mItemTypeFields.get(aType), aTile);
+
+ if (aItemType == null || aItemAmount <= 0) {
+ return false;
+ }
+ else {
+ if (aItemAmount > mInitialCapacity) {
+ int aNewItemAmount = mInitialCapacity;
+ ReflectionUtils.setField(aTile, mItemAmountFields.get(aType), aNewItemAmount);
+ }
+ }
+ return true;
+ }
+
+ public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
+ aCoverVariable += (mMaxItemCapacity * (aPlayer.isSneaking() ? 0.1f : 0.01f));
+ } else {
+ aCoverVariable -= (mMaxItemCapacity * (aPlayer.isSneaking() ? 0.1f : 0.01f));
+ }
+ if (aCoverVariable > mMaxItemCapacity) {
+ aCoverVariable = mInitialCapacity;
+ }
+ if (aCoverVariable <= 0) {
+ aCoverVariable = mMaxItemCapacity;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
+ return aCoverVariable;
+ }
+
+ public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity,
+ EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ boolean aShift = aPlayer.isSneaking();
+ int aAmount = aShift ? 128 : 8;
+ if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
+ aCoverVariable += aAmount;
+ } else {
+ aCoverVariable -= aAmount;
+ }
+ if (aCoverVariable > mMaxItemCapacity) {
+ aCoverVariable = mInitialCapacity;
+ }
+ if (aCoverVariable <= 0) {
+ aCoverVariable = mMaxItemCapacity;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, LangUtils.trans("009", "Overflow point: ") + aCoverVariable + trans("010", "L"));
+ aTileEntity.setCoverDataAtSide(aSide, aCoverVariable);
+ return true;
+ }
+
+ public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsRedstoneGoOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsEnergyOut(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsItemsIn(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public boolean letsItemsOut(byte aSide, int aCoverID, int aCoverVariable, int aSlot, ICoverable aTileEntity) {
+ return true;
+ }
+
+ 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 true;
+ }
+
+ public boolean alwaysLookConnected(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return true;
+ }
+
+ public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ return 5;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java
new file mode 100644
index 0000000000..0b52560e0d
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/MachineUpdateHandler.java
@@ -0,0 +1,42 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import java.util.HashMap;
+
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.api.GregTech_API;
+import net.minecraft.block.Block;
+import net.minecraftforge.event.world.BlockEvent;
+
+public class MachineUpdateHandler {
+
+ private static final HashMap<String, Block> mBlockCache = new HashMap<String, Block>();
+
+ public static void registerBlockToCauseMachineUpdate(String aUnlocalName, Block aBlock) {
+ mBlockCache.put(aUnlocalName, aBlock);
+ }
+
+ @SubscribeEvent
+ public void onBlockEvent(BlockEvent event) {
+ Block aBlock = event.block;
+ String aUnlocalName = aBlock != null ? aBlock.getUnlocalizedName() : "NULL";
+ boolean aDoUpdate = false;
+ if (aBlock != null && aUnlocalName != null && !aUnlocalName.equals("NULL")) {
+ for (String aCachedName : mBlockCache.keySet()) {
+ if (aCachedName.equals(aUnlocalName)) {
+ aDoUpdate = true;
+ break;
+ }
+ else {
+ if (aBlock == mBlockCache.get(aCachedName)) {
+ aDoUpdate = true;
+ break;
+ }
+ }
+ }
+ if (aDoUpdate) {
+ GregTech_API.causeMachineUpdate(event.world, event.x, event.y, event.z);
+ }
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java
new file mode 100644
index 0000000000..84bb52d064
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/VolumetricFlaskHelper.java
@@ -0,0 +1,168 @@
+package gtPlusPlus.xmod.gregtech.common.helpers;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class VolumetricFlaskHelper {
+
+ private static final Class sClassVolumetricFlask;
+ private static final Method sMethodGetFlaskMaxCapacity;
+ private static Item mFlask;
+
+ static {
+ if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) {
+ sClassVolumetricFlask = ReflectionUtils.getClass("gregtech.common.items.GT_VolumetricFlask");
+ Method aMaxCapacity = null;
+ try {
+ aMaxCapacity = sClassVolumetricFlask.getDeclaredMethod("getMaxCapacity", new Class[] {});
+ }
+ catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ CORE.crash("Secondary Error Obtaining instance of 'getMaxCapacity' from 'GT_VolumetricFlask'. Crashing.");
+ }
+ sMethodGetFlaskMaxCapacity = aMaxCapacity;
+ }
+ else {
+ sClassVolumetricFlask = null;
+ sMethodGetFlaskMaxCapacity = null;
+ }
+ }
+
+ public static ItemStack getVolumetricFlask(int aAmount) {
+ ItemStack aFlask = ItemUtils.getValueOfItemList("VOLUMETRIC_FLASK", aAmount, (ItemStack) null);
+ return aFlask;
+ }
+
+ public static ItemStack getLargeVolumetricFlask(int aAmount) {
+ ItemStack aFlask = GregtechItemList.VOLUMETRIC_FLASK_8k.get(aAmount);
+ return aFlask;
+ }
+
+ public static ItemStack getGiganticVolumetricFlask(int aAmount) {
+ ItemStack aFlask = GregtechItemList.VOLUMETRIC_FLASK_32k.get(aAmount);
+ return aFlask;
+ }
+
+ public static boolean isVolumetricFlask(ItemStack aStack) {
+ if (isNormalVolumetricFlask(aStack) || isLargeVolumetricFlask(aStack) || isGiganticVolumetricFlask(aStack)) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isNormalVolumetricFlask(ItemStack aStack) {
+ if (mFlask == null) {
+ ItemStack aFlask = ItemUtils.getValueOfItemList("VOLUMETRIC_FLASK", 1, (ItemStack) null);
+ if (aFlask != null) {
+ mFlask = aFlask.getItem();
+ }
+ }
+ if (aStack.getItem() == mFlask) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isLargeVolumetricFlask(ItemStack aStack) {
+ if (GregtechItemList.VOLUMETRIC_FLASK_8k.getItem() == aStack.getItem()) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isGiganticVolumetricFlask(ItemStack aStack) {
+ if (GregtechItemList.VOLUMETRIC_FLASK_32k.getItem() == aStack.getItem()) {
+ return true;
+ }
+ return false;
+ }
+
+ public static int getMaxFlaskCapacity(ItemStack aStack) {
+ if (aStack != null && sMethodGetFlaskMaxCapacity != null) {
+ Item aItem = aStack.getItem();
+ if (sClassVolumetricFlask.isInstance(aItem)) {
+ int aMaxCapacity = (int) ReflectionUtils.invokeNonBool(aItem, sMethodGetFlaskMaxCapacity, new Object[] {});
+ return aMaxCapacity;
+ }
+ }
+ return 0;
+ }
+
+ public static boolean isFlaskEmpty(ItemStack aStack) {
+ return getFlaskFluid(aStack) == null;
+ }
+
+ public static FluidStack getFlaskFluid(ItemStack aStack) {
+ if (aStack.hasTagCompound()) {
+ NBTTagCompound nbt = aStack.getTagCompound();
+ if (nbt.hasKey("Fluid", 10))
+ return FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("Fluid"));
+ }
+ return null;
+ }
+
+ public static void setFluid(ItemStack stack, FluidStack fluidStack) {
+ boolean removeFluid = (fluidStack == null) || (fluidStack.amount <= 0);
+ NBTTagCompound nbt = stack.getTagCompound();
+ if (nbt == null) {
+ if (removeFluid)
+ return;
+ stack.setTagCompound(nbt = new NBTTagCompound());
+ }
+ if (removeFluid) {
+ nbt.removeTag("Fluid");
+ if (nbt.hasNoTags()) {
+ stack.setTagCompound(null);
+ }
+ } else {
+ nbt.setTag("Fluid", fluidStack.writeToNBT(new NBTTagCompound()));
+ }
+ }
+
+ public static int getFlaskCapacity(ItemStack aStack) {
+ int capacity = 1000;
+ if (aStack.hasTagCompound()) {
+ NBTTagCompound nbt = aStack.getTagCompound();
+ if (nbt.hasKey("Capacity", 3))
+ capacity = nbt.getInteger("Capacity");
+ }
+ return Math.min(getMaxFlaskCapacity(aStack), capacity);
+ }
+
+ public static boolean setNewFlaskCapacity(ItemStack aStack, int aCapacity) {
+ if (aStack == null || aCapacity <= 0) {
+ return false;
+ }
+ aCapacity = Math.min(aCapacity, getMaxFlaskCapacity(aStack));
+ NBTTagCompound nbt = aStack.getTagCompound();
+ if (nbt == null) {
+ aStack.setTagCompound(nbt = new NBTTagCompound());
+ }
+ nbt.setInteger("Capacity", aCapacity);
+ return true;
+ }
+
+ public static Item generateNewFlask(String unlocalized, String english, int maxCapacity) {
+ Constructor aFlask = ReflectionUtils.getConstructor(sClassVolumetricFlask, new Class[] {String.class, String.class, int.class});
+ if (aFlask != null) {
+ Object aInstance = ReflectionUtils.createNewInstanceFromConstructor(aFlask, new Object[] {unlocalized, english, maxCapacity});
+ if (aInstance != null && aInstance instanceof Item) {
+ Item aNewFlaskItem = (Item) aInstance;
+ return aNewFlaskItem;
+ }
+ }
+ return null;