aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
authorPrometheus0000 <prometheus0000000@gmail.com>2021-02-11 14:29:19 -0500
committerGitHub <noreply@github.com>2021-02-11 14:29:19 -0500
commit3a027e939e2c18e165b2f1405637c92f25736582 (patch)
tree1d75209cd6c074313f0e3f15bc989f7b258a57bd /src/main/java/gregtech/api
parentc6324633a4491296c0505e59aa7f8747af0c640a (diff)
parente0c1f654b17d901d018603912bf32c32bd136bad (diff)
downloadGT5-Unofficial-3a027e939e2c18e165b2f1405637c92f25736582.tar.gz
GT5-Unofficial-3a027e939e2c18e165b2f1405637c92f25736582.tar.bz2
GT5-Unofficial-3a027e939e2c18e165b2f1405637c92f25736582.zip
Merge pull request #23 from GTNewHorizons/experimental
update
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/GregTech_API.java4
-rw-r--r--src/main/java/gregtech/api/enums/GT_Values.java2
-rw-r--r--src/main/java/gregtech/api/enums/HeatingCoilLevel.java6
-rw-r--r--src/main/java/gregtech/api/enums/ItemList.java40
-rw-r--r--src/main/java/gregtech/api/enums/Materials.java2
-rw-r--r--src/main/java/gregtech/api/enums/Textures.java8
-rw-r--r--src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java155
-rw-r--r--src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java94
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaTileEntity.java25
-rw-r--r--src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java12
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java18
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java8
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java4
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java36
-rw-r--r--src/main/java/gregtech/api/objects/AE2DigitalChestHandler.java2
-rw-r--r--src/main/java/gregtech/api/threads/GT_Runnable_MachineBlockUpdate.java18
-rw-r--r--src/main/java/gregtech/api/util/GT_LanguageManager.java8
-rw-r--r--src/main/java/gregtech/api/util/GT_ModHandler.java345
-rw-r--r--src/main/java/gregtech/api/util/GT_OreDictUnificator.java50
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java230
24 files changed, 774 insertions, 304 deletions
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java
index 17f171a953..0fbb1cd745 100644
--- a/src/main/java/gregtech/api/GregTech_API.java
+++ b/src/main/java/gregtech/api/GregTech_API.java
@@ -221,7 +221,6 @@ public class GregTech_API {
sRecipeFile = null,
sMachineFile = null,
sWorldgenFile = null,
- sModularArmor = null,
sMaterialProperties = null,
sMaterialComponents = null,
sUnification = null,
@@ -296,7 +295,8 @@ public class GregTech_API {
mGTPlusPlus = false,
mTranslocator = false,
mTConstruct = false,
- mGalacticraft = false;
+ mGalacticraft = false,
+ mAE2 = false;
public static int
mEUtoRF = 360,
mRFtoEU = 20;
diff --git a/src/main/java/gregtech/api/enums/GT_Values.java b/src/main/java/gregtech/api/enums/GT_Values.java
index 8545f42bea..d2b391edcb 100644
--- a/src/main/java/gregtech/api/enums/GT_Values.java
+++ b/src/main/java/gregtech/api/enums/GT_Values.java
@@ -298,4 +298,6 @@ public class GT_Values {
public static boolean debugChunkloaders = false;
public static boolean cls_enabled;
+
+ public static boolean hideAssLineRecipes = false;
}
diff --git a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java
index f4b28ede2b..2388a92cd3 100644
--- a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java
+++ b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java
@@ -50,14 +50,14 @@ public enum HeatingCoilLevel {
* @return the coil Level, used for Parallels in the Multi Furnace for example
*/
public byte getLevel() {
- return (byte) Math.min(16, 2 << (this.ordinal() - 2));
+ return (byte) (1 << Math.min(Math.max(0, this.ordinal() - 2), 4));
}
/**
* @return the coil Discount, used for discount in the Multi Furnace for example
*/
- public byte getCostDiscount() {
- return (byte) Math.max(1, 2 << (this.ordinal() - 1 - 6)); //-1 bcs. of none, -4 = offset
+ public int getCostDiscount() {
+ return 1 << Math.max(0, this.ordinal() - 5);
}
public static HeatingCoilLevel getFromTier(byte tier){
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java
index 94efa0605f..5d6de01493 100644
--- a/src/main/java/gregtech/api/enums/ItemList.java
+++ b/src/main/java/gregtech/api/enums/ItemList.java
@@ -1,6 +1,7 @@
package gregtech.api.enums;
import gregtech.api.interfaces.IItemContainer;
+import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
@@ -9,6 +10,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
+import java.util.Locale;
+
+import static gregtech.api.enums.GT_Values.NI;
import static gregtech.api.enums.GT_Values.W;
/**
@@ -1405,6 +1409,8 @@ public enum ItemList implements IItemContainer {
Long_Distance_Pipeline_Fluid_Pipe,
Long_Distance_Pipeline_Item_Pipe,
+ Hatch_Output_Bus_ME,
+
NULL,
Cover_RedstoneTransmitterExternal,
Cover_RedstoneTransmitterInternal,
@@ -1553,20 +1559,6 @@ public enum ItemList implements IItemContainer {
Moxcell_2,
Moxcell_4,
- ModularBasicHelmet,
- ModularBasicChestplate,
- ModularBasicLeggings,
- ModularBasicBoots,
-
- ModularElectric1Helmet,
- ModularElectric1Chestplate,
- ModularElectric1Leggings,
- ModularElectric1Boots,
-
- ModularElectric2Helmet,
- ModularElectric2Chestplate,
- ModularElectric2Leggings,
- ModularElectric2Boots,
Block_Powderbarrel,
GelledToluene,
@@ -2021,8 +2013,24 @@ public enum ItemList implements IItemContainer {
public ItemStack getWithName(long aAmount, String aDisplayName, Object... aReplacements) {
ItemStack rStack = get(1, aReplacements);
if (GT_Utility.isStackInvalid(rStack))
- return null;
- rStack.setStackDisplayName(aDisplayName);
+ return NI;
+
+ // CamelCase alphanumeric words from aDisplayName
+ StringBuilder tCamelCasedDisplayNameBuilder = new StringBuilder();
+ final String[] tDisplayNameWords = aDisplayName.split("\\W");
+ for (String tWord : tDisplayNameWords){
+ if (tWord.length() > 0) tCamelCasedDisplayNameBuilder.append(tWord.substring(0, 1).toUpperCase(Locale.US));
+ if (tWord.length() > 1) tCamelCasedDisplayNameBuilder.append(tWord.substring(1).toLowerCase(Locale.US));
+ }
+ if (tCamelCasedDisplayNameBuilder.length() == 0) {
+ // CamelCased DisplayName is empty, so use hash of aDisplayName
+ tCamelCasedDisplayNameBuilder.append(((Long) (long)aDisplayName.hashCode()).toString());
+ }
+
+ // Construct a translation key from UnlocalizedName and CamelCased DisplayName
+ final String tKey = rStack.getUnlocalizedName() + ".with." + tCamelCasedDisplayNameBuilder.toString() + ".name";
+
+ rStack.setStackDisplayName(GT_LanguageManager.addStringLocalization(tKey, aDisplayName));
return GT_Utility.copyAmount(aAmount, rStack);
}
diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java
index b46d26e02d..d00c3bd8fc 100644
--- a/src/main/java/gregtech/api/enums/Materials.java
+++ b/src/main/java/gregtech/api/enums/Materials.java
@@ -649,7 +649,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
public static Materials Cryotheum = new Materials( 898, TextureSet.SET_SHINY , 1.0F, 0, 1, 1 , 0, 148, 203, 0, "Cryotheum" , "Cryotheum" , 2, 62, -1, 0, false, false, 2, 3, 1, Dyes.dyeLightBlue , 2, Arrays.asList(new MaterialStack(Saltpeter, 1), new MaterialStack(Redstone, 1), new MaterialStack(Snow, 1), new MaterialStack(Blizz, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.PRAECANTATIO, 2), new TC_AspectStack(TC_Aspects.ELECTRUM, 1), new TC_AspectStack(TC_Aspects.GELUM, 1)));
public static Materials HydratedCoal = new Materials( 818, TextureSet.SET_ROUGH , 1.0F, 0, 1, 1 , 70, 70, 100, 0, "HydratedCoal" , "Hydrated Coal" , 0, 0, -1, 0, false, false, 1, 9, 8, Dyes.dyeBlack , 2, Arrays.asList(new MaterialStack(Coal, 8), new MaterialStack(Water, 1)));
public static Materials Apatite = new Materials( 530, TextureSet.SET_DIAMOND , 1.0F, 0, 1, 1 |4|8 , 200, 200, 255, 0, "Apatite" , "Apatite" , 0, 0, -1, 0, false, false, 2, 1, 1, Dyes.dyeCyan , 1, Arrays.asList(new MaterialStack(Calcium, 5), new MaterialStack(Phosphate, 3), new MaterialStack(Chlorine, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.MESSIS, 2)));
- public static Materials Alumite = new Materials( 400, TextureSet.SET_METALLIC , 5.0F, 768, 2, 1|2 |128 , 255, 105, 180, 0, "Alumite" , "Alumite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink , 2, Arrays.asList(new MaterialStack(Aluminium, 5), new MaterialStack(Steel, 2), new MaterialStack(Obsidian, 2)), Arrays.asList(new TC_AspectStack(TC_Aspects.STRONTIO, 2)));
+ public static Materials Alumite = new Materials( 400, TextureSet.SET_METALLIC , 5.0F, 768, 2, 1|2 |64|128 , 255, 105, 180, 0, "Alumite" , "Alumite" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyePink , 2, Arrays.asList(new MaterialStack(Aluminium, 5), new MaterialStack(Steel, 2), new MaterialStack(Obsidian, 2)), Arrays.asList(new TC_AspectStack(TC_Aspects.STRONTIO, 2)));
public static Materials Manyullyn = new Materials( 386, TextureSet.SET_SHINY , 25.0F, 2048, 5, 1|2 |8 |64|128 , 154, 76, 185, 0, "Manyullyn" , "Manyullyn" , 0, 0, 3600, 3600, true, false, 1, 1, 1, Dyes.dyePurple , 2, Arrays.asList(new MaterialStack(Cobalt, 1), new MaterialStack(Ardite, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.STRONTIO, 2))).disableAutoGeneratedBlastFurnaceRecipes();
public static Materials Steeleaf = new Materials( 339, TextureSet.SET_LEAF , 8.0F, 768, 3, 1|2 |64|128 , 50, 127, 50, 0, "Steeleaf" , "Steeleaf" , 5, 24, -1, 0, false, false, 4, 1, 1, Dyes.dyeGreen , 2, Arrays.asList(new MaterialStack(Steel, 1), new MaterialStack(Magic, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.HERBA, 2), new TC_AspectStack(TC_Aspects.METALLUM, 2), new TC_AspectStack(TC_Aspects.PRAECANTATIO, 1)));
public static Materials Knightmetal = new Materials( 362, TextureSet.SET_METALLIC , 8.0F, 1024, 3, 1|2 |64|128 , 210, 240, 200, 0, "Knightmetal" , "Knightmetal" , 5, 24, -1, 0, false, false, 4, 1, 1, Dyes.dyeLime , 2, Arrays.asList(new MaterialStack(Steel, 2), new MaterialStack(Magic, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.LUCRUM, 1), new TC_AspectStack(TC_Aspects.METALLUM, 2)));
diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java
index de2c0919e7..3a9af71aa2 100644
--- a/src/main/java/gregtech/api/enums/Textures.java
+++ b/src/main/java/gregtech/api/enums/Textures.java
@@ -80,6 +80,7 @@ public class Textures {
BLOCK_STEELEAF,
BLOCK_ICHORIUM,
BLOCK_FIRESTONE,
+ BLOCK_SHADOW,
OVERLAY_ENERGY_IN_POWER,
OVERLAY_ENERGY_OUT_POWER,
@@ -903,7 +904,9 @@ public class Textures {
PIPE_RESTRICTOR_UR,
PIPE_RESTRICTOR_DL,
PIPE_RESTRICTOR_DR,
- PIPE_RESTRICTOR_LR;
+ PIPE_RESTRICTOR_LR,
+
+ OVERLAY_ME_HATCH;
/**
* Icon for Fresh CFoam
@@ -1302,7 +1305,8 @@ public class Textures {
BLOCK_HSSS,
BLOCK_STEELEAF,
BLOCK_ICHORIUM,
- BLOCK_FIRESTONE
+ BLOCK_FIRESTONE,
+ BLOCK_SHADOW
},
STORAGE_BLOCKS9 = new IIconContainer[]{
BLOCK_AERCRYSTAL,
diff --git a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java
index 7e14061d2f..38f8bd3b35 100644
--- a/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java
+++ b/src/main/java/gregtech/api/gui/GT_Container_BasicMachine.java
@@ -4,11 +4,16 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidContainerItem;
+
+import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.OTHER_SLOT_COUNT;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -179,17 +184,159 @@ public class GT_Container_BasicMachine extends GT_Container_BasicTank {
@Override
public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ GT_MetaTileEntity_BasicMachine machine = (GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity();
+ if (machine == null) return null;
+ ItemStack tResultStack;
switch (aSlotIndex) {
case 0:
- if (mTileEntity.getMetaTileEntity() == null) return null;
- ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mFluidTransfer = !((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mFluidTransfer;
+ machine.mFluidTransfer = !machine.mFluidTransfer;
return null;
case 1:
if (mTileEntity.getMetaTileEntity() == null) return null;
- ((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mItemTransfer = !((GT_MetaTileEntity_BasicMachine) mTileEntity.getMetaTileEntity()).mItemTransfer;
+ machine.mItemTransfer = !machine.mItemTransfer;
return null;
+ case 2:
+ if (aMouseclick > 1)
+ return null;
+ tResultStack = pickupFluid(machine.getDrainableStack(), aPlayer, aMouseclick == 0);
+ if (machine.getDrainableStack() != null && machine.getDrainableStack().amount == 0)
+ machine.setDrainableStack(null);
+ return tResultStack;
default:
- return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ if (aSlotIndex == OTHER_SLOT_COUNT + 1 + machine.mInputSlotCount + machine.mOutputItems.length) {
+ if (aMouseclick > 1)
+ return null;
+ // input fluid slot
+ ItemStack tStackHeld = aPlayer.inventory.getItemStack();
+ ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld);
+ if (tStackSizedOne == null || tStackHeld.stackSize == 0) return null;
+ FluidStack tInputFluid = machine.getFillableStack();
+ FluidStack tFluidHeld = GT_Utility.getFluidForFilledItem(tStackSizedOne, true);
+ if (tInputFluid == null) {
+ if (tFluidHeld == null)
+ // both null -> no op
+ return null;
+ return fillFluid(machine, aPlayer, tFluidHeld, aMouseclick == 0);
+ } else {
+ if (tFluidHeld != null) {
+ // both nonnull. actually both pickup and fill is reasonable, but I'll go with fill here
+ return fillFluid(machine, aPlayer, tFluidHeld, aMouseclick == 0);
+ } else {
+ tResultStack = pickupFluid(tInputFluid, aPlayer, aMouseclick == 0);
+ if (tInputFluid.amount == 0)
+ machine.setFillableStack(null);
+ return tResultStack;
+ }
+ }
+ } else {
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+ }
+ }
+
+ private ItemStack pickupFluid(FluidStack aTankStack, EntityPlayer aPlayer, boolean aProcessFullStack) {
+ if (aTankStack == null) return null;
+ ItemStack tStackHeld = aPlayer.inventory.getItemStack();
+ ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld);
+ if (tStackSizedOne == null || tStackHeld.stackSize == 0) return null;
+ int tOriginalFluidAmount = aTankStack.amount;
+ ItemStack tFilled = GT_Utility.fillFluidContainer(aTankStack, tStackSizedOne, true, false);
+ if (tFilled == null && tStackSizedOne.getItem() instanceof IFluidContainerItem) {
+ IFluidContainerItem tContainerItem = (IFluidContainerItem) tStackSizedOne.getItem();
+ int tFilledAmount = tContainerItem.fill(tStackSizedOne, aTankStack, true);
+ if (tFilledAmount > 0) {
+ tFilled = tStackSizedOne;
+ aTankStack.amount -= tFilledAmount;
+ }
+ }
+ if (tFilled != null) {
+ if (aProcessFullStack) {
+ int tFilledAmount = tOriginalFluidAmount - aTankStack.amount;
+ /*
+ work out how many more items we can fill
+ one cell is already used, so account for that
+ the round down behavior will left over a fraction of a cell worth of fluid
+ the user then get to decide what to do with it
+ it will not be too fancy if it spills out partially filled cells
+ */
+ int tAdditionalParallel = Math.min(tStackHeld.stackSize - 1, aTankStack.amount / tFilledAmount);
+ aTankStack.amount -= tFilledAmount * tAdditionalParallel;
+ tFilled.stackSize += tAdditionalParallel;
+ }
+ replaceCursorItemStack(aPlayer, tFilled);
+ }
+ return tFilled;
+ }
+
+ private ItemStack fillFluid(GT_MetaTileEntity_BasicMachine aMachine, EntityPlayer aPlayer, FluidStack aFluidHeld, boolean aProcessFullStack) {
+ // we are not using aMachine.fill() here any more, so we need to check for fluid type here ourselves
+ if (aMachine.getFillableStack() != null && !aMachine.getFillableStack().isFluidEqual(aFluidHeld))
+ return null;
+ ItemStack tStackHeld = aPlayer.inventory.getItemStack();
+ ItemStack tStackSizedOne = GT_Utility.copyAmount(1, tStackHeld);
+ if (tStackSizedOne == null)
+ return null;
+
+ int tFreeSpace = aMachine.getCapacity() - (aMachine.getFillableStack() != null ? aMachine.getFillableStack().amount : 0);
+ if (tFreeSpace <= 0)
+ // no space left
+ return null;
+
+ // find out how much fluid can be taken
+ // some cells cannot be partially filled
+ ItemStack tStackEmptied = null;
+ int tAmountTaken = 0;
+ if (tFreeSpace >= aFluidHeld.amount) {
+ // fully accepted - try take it from item now
+ // IFluidContainerItem is intentionally not checked here. it will be checked later
+ tStackEmptied = GT_Utility.getContainerForFilledItem(tStackSizedOne, false);
+ tAmountTaken = aFluidHeld.amount;
+ }
+ if (tStackEmptied == null && tStackSizedOne.getItem() instanceof IFluidContainerItem) {
+ // either partially accepted, or is IFluidContainerItem
+ IFluidContainerItem container = (IFluidContainerItem) tStackSizedOne.getItem();
+ FluidStack tDrained = container.drain(tStackSizedOne, tFreeSpace, true);
+ if (tDrained != null && tDrained.amount > 0) {
+ // something is actually drained - change the cell and drop it to player
+ tStackEmptied = tStackSizedOne;
+ tAmountTaken = tDrained.amount;
+ }
+ }
+ if (tStackEmptied == null)
+ // somehow the cell refuse to give out that amount of fluid, no op then
+ return null;
+
+ // find out how many fill can we do
+ // same round down behavior as above
+ // however here the fluid stack is not changed at all, so the exact code will slightly differ
+ int tParallel = aProcessFullStack ? Math.min(tFreeSpace / tAmountTaken, tStackHeld.stackSize) : 1;
+ if (aMachine.getFillableStack() == null) {
+ FluidStack tNewFillableStack = aFluidHeld.copy();
+ tNewFillableStack.amount = tAmountTaken * tParallel;
+ aMachine.setFillableStack(tNewFillableStack);
+ } else {
+ aMachine.getFillableStack().amount += tAmountTaken * tParallel;
+ }
+ tStackEmptied.stackSize = tParallel;
+ replaceCursorItemStack(aPlayer, tStackEmptied);
+ return tStackEmptied;
+ }
+
+ private void replaceCursorItemStack(EntityPlayer aPlayer, ItemStack tStackResult) {
+ int tStackResultMaxStackSize = tStackResult.getMaxStackSize();
+ while (tStackResult.stackSize > tStackResultMaxStackSize) {
+ aPlayer.inventory.getItemStack().stackSize -= tStackResultMaxStackSize;
+ GT_Utility.addItemToPlayerInventory(aPlayer, tStackResult.splitStack(tStackResultMaxStackSize));
+ }
+ if (aPlayer.inventory.getItemStack().stackSize == tStackResult.stackSize) {
+ // every cell is mutated. it could just stay on the cursor.
+ aPlayer.inventory.setItemStack(tStackResult);
+ } else {
+ // some cells not mutated. The mutated cells must go into the inventory
+ // or drop into the world if there isn't enough space.
+ ItemStack tStackHeld = aPlayer.inventory.getItemStack();
+ tStackHeld.stackSize -= tStackResult.stackSize;
+ GT_Utility.addItemToPlayerInventory(aPlayer, tStackResult);
}
}
diff --git a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java
index c7288cc26e..a9de87e751 100644
--- a/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java
+++ b/src/main/java/gregtech/api/interfaces/internal/IGT_RecipeAdder.java
@@ -610,10 +610,13 @@ public interface IGT_RecipeAdder {
boolean addAutoclaveRecipe(ItemStack aInput, ItemStack aCircuit, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom);
+ boolean addAutoclaveRecipe(ItemStack aInput, ItemStack aCircuit, FluidStack aFluidIn, FluidStack aFluidOut, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom);
+
boolean addAutoclaveSpaceRecipe(ItemStack aInput, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom);
boolean addAutoclaveSpaceRecipe(ItemStack aInput, ItemStack aCircuit, FluidStack aFluid, ItemStack aOutput, int aChance, int aDuration, int aEUt, boolean aCleanroom);
+
/**
* Adds a Recipe for the Mixer
*/
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index f5bcf8bfbd..9fd8e75754 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -1,5 +1,15 @@
package gregtech.api.metatileentity;
+import appeng.api.networking.IGridNode;
+import appeng.api.networking.security.IActionHost;
+import appeng.api.util.AECableType;
+import appeng.api.util.DimensionalCoord;
+import appeng.me.helpers.AENetworkProxy;
+import appeng.me.helpers.IGridProxyable;
+import appeng.tile.TileEvent;
+import appeng.tile.events.TileEventType;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.Optional;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
@@ -51,7 +61,10 @@ import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
* <p/>
* This is the main TileEntity for EVERYTHING.
*/
-public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileEntity {
+@Optional.InterfaceList(value = {
+ @Optional.Interface(iface = "appeng.api.networking.security.IActionHost", modid = "appliedenergistics2", striprefs = true),
+ @Optional.Interface(iface = "appeng.me.helpers.IGridProxyable", modid = "appliedenergistics2", striprefs = true)})
+public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileEntity, IActionHost, IGridProxyable {
private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[]{GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior};
protected MetaTileEntity mMetaTileEntity;
protected long mStoredEnergy = 0, mStoredSteam = 0;
@@ -918,11 +931,15 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mMetaTileEntity.setBaseMetaTileEntity(null);
}
super.invalidate();
+ if (GregTech_API.mAE2)
+ invalidateAE();
}
@Override
public void onChunkUnload() {
super.onChunkUnload();
+ if (GregTech_API.mAE2)
+ onChunkUnloadAE();
}
@Override
@@ -2210,5 +2227,78 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
return slotIndex + indexShift;
}
-}
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public IGridNode getGridNode(ForgeDirection forgeDirection) {
+ if (mFacing != forgeDirection.ordinal())
+ return null;
+ AENetworkProxy gp = getProxy();
+ return gp != null ? gp.getNode() : null;
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public AECableType getCableConnectionType(ForgeDirection forgeDirection) {
+ return mMetaTileEntity == null ? AECableType.NONE : mMetaTileEntity.getCableConnectionType(forgeDirection);
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public void securityBreak() {}
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public IGridNode getActionableNode() {
+ AENetworkProxy gp = getProxy();
+ return gp != null ? gp.getNode() : null;
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public AENetworkProxy getProxy() {
+ return mMetaTileEntity == null ? null : mMetaTileEntity.getProxy();
+ }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public DimensionalCoord getLocation() { return new DimensionalCoord( this ); }
+
+ @Override
+ @Optional.Method(modid = "appliedenergistics2")
+ public void gridChanged() {
+ if (mMetaTileEntity != null)
+ mMetaTileEntity.gridChanged();
+ }
+
+ @TileEvent( TileEventType.WORLD_NBT_READ )
+ @Optional.Method(modid = "appliedenergistics2")
+ public void readFromNBT_AENetwork( final NBTTagCompound data )
+ {
+ AENetworkProxy gp = getProxy();
+ if (gp != null)
+ getProxy().readFromNBT( data );
+ }
+
+ @TileEvent( TileEventType.WORLD_NBT_WRITE )
+ @Optional.Method(modid = "appliedenergistics2")
+ public void writeToNBT_AENetwork( final NBTTagCompound data )
+ {
+ AENetworkProxy gp = getProxy();
+ if (gp != null)
+ gp.writeToNBT( data );
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ void onChunkUnloadAE() {
+ AENetworkProxy gp = getProxy();
+ if (gp != null)
+ gp.onChunkUnload();
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ void invalidateAE() {
+ AENetworkProxy gp = getProxy();
+ if (gp != null)
+ gp.invalidate();
+ }
+}
diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
index 9fa16b9890..31ec73d04b 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
@@ -130,6 +130,10 @@ public abstract class MetaPipeEntity implements IMetaTileEntity, IConnectable {
*/
public abstract boolean renderInside(byte aSide);
+ public boolean isDisplaySecondaryDescription() {
+ return false;
+ }
+
@Override
public IGregTechTileEntity getBaseMetaTileEntity() {
return mBaseMetaTileEntity;
diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
index d873627e21..79447a96cb 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
@@ -1,5 +1,9 @@
package gregtech.api.metatileentity;
+import appeng.api.util.AECableType;
+import appeng.me.helpers.AENetworkProxy;
+import appeng.me.helpers.IGridProxyable;
+import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
@@ -95,6 +99,14 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
mName = aName;
}
+ /**
+ * This method will only be called on client side
+ * @return whether the secondary description should be display. default is false
+ */
+ public boolean isDisplaySecondaryDescription() {
+ return false;
+ }
+
@Override
public IGregTechTileEntity getBaseMetaTileEntity() {
return mBaseMetaTileEntity;
@@ -935,4 +947,17 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
public boolean shouldJoinIc2Enet() { return false; }
public boolean shouldTriggerBlockUpdate() { return false; }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ public AECableType getCableConnectionType(ForgeDirection forgeDirection) {
+ return AECableType.NONE;
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ public AENetworkProxy getProxy() {
+ return null;
+ }
+
+ @Optional.Method(modid = "appliedenergistics2")
+ public void gridChanged() {}
}
diff --git a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
index 4d54a142cd..d0f3074af1 100644
--- a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
+++ b/