aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java52
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java29
2 files changed, 75 insertions, 6 deletions
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 e352712138..e0f768830d 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
@@ -1,10 +1,10 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base;
-import static gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores;
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.Iterator;
@@ -48,6 +48,7 @@ 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.xmod.gregtech.api.gui.CONTAINER_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
@@ -1136,6 +1137,47 @@ 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.updateSlots();
+ result = true;
+ }
+ return result;
+ }
+
+ protected boolean clearGUIItemSlot() {
+ return setGUIItemStack(null);
+ }
+
+
+ public ItemStack findItemInInventory(Item aSearchStack) {
+ return findItemInInventory(aSearchStack, 0);
+ }
+
+ 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) {
+ if (bus != null) {
+ for (ItemStack uStack : bus.mInventory) {
+ if (uStack != null) {
+ if (aSearchStack.getClass().isInstance(uStack.getItem())) {
+ return uStack;
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
@Override
public void updateSlots() {
@@ -1208,6 +1250,14 @@ GT_MetaTileEntity_MultiBlockBase {
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) {
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 5ab9cd9795..c55fe10829 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
@@ -7,6 +7,7 @@ import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
@@ -19,6 +20,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.Gregtech
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
@@ -68,13 +70,29 @@ extends GregtechMeta_MultiBlockBase
@Override
public int getDamageToComponent(ItemStack aStack){
- Logger.INFO("Trying to damage component.");
+ //log("Trying to damage component.");
return ItemList.Component_LavaFilter.get(1L).getClass().isInstance(aStack) ? 1 : 0;
}
+
+ private static Item mLavaFilter;
@Override
- public boolean checkRecipe(final ItemStack aStack) {
+ public boolean checkRecipe(ItemStack aStack) {
this.mSuperEfficencyIncrease=0;
+
+ if (mLavaFilter == null) {
+ mLavaFilter = ItemList.Component_LavaFilter.getItem();
+ }
+
+ //Try reload new Lava Filter
+ if (aStack == null) {
+ ItemStack uStack = this.findItemInInventory(mLavaFilter);
+ if (uStack != null) {
+ this.setGUIItemStack(uStack);
+ aStack = this.getGUIItemStack();
+ }
+ }
+
for (GT_Recipe tRecipe : Recipe_GT.Gregtech_Recipe_Map.sThermalFuels.mRecipeList) {
FluidStack tFluid = tRecipe.mFluidInputs[0];
@@ -85,7 +103,7 @@ extends GregtechMeta_MultiBlockBase
this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease());
int loot_MAXCHANCE = 100000;
- if (ItemList.Component_LavaFilter.get(1L).getClass().isInstance(aStack)) {
+ if (mLavaFilter.getClass().isInstance(aStack.getItem())) {
if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) {
this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) };
@@ -199,8 +217,9 @@ extends GregtechMeta_MultiBlockBase
"Size: 3x3x3 (Hollow)",
"Thermal Containment Casings (10 at least!)",
"Controller (front middle)",
- "2x Input Hatch",
+ "2x Input Hatch (Water/Thermal Fluid)",
"1x Output Hatch (Steam)",
+ "1x Input Bus (Supplies controller with Lava Filters, optional)",
"1x Output Bus (Filter results, optional)",
};
}
@@ -234,7 +253,7 @@ extends GregtechMeta_MultiBlockBase
if (!isValidBlockForStructure(tTileEntity, 1, true, aBlock, aMeta,
ModBlocks.blockCasings2Misc, 11)) {
- Logger.INFO("Bad Thermal Boiler casing");
+ log("Bad Thermal Boiler casing");
return false;
}
++tAmount;