aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/api/objects/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/api/objects/minecraft')
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/AABB.java97
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java353
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java446
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/BlockPos.java473
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/CubicObject.java101
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/DimChunkPos.java78
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/FakeBlockPos.java434
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/FakeWorld.java292
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/FluidGT6.java42
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/FormattedTooltipString.java38
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/GenericStack.java67
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/ItemPackage.java97
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/ItemStackData.java50
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java225
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/SafeTexture.java92
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/ShapedRecipe.java472
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/TexturePackage.java89
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java174
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/multi/NoEUBonusMultiBehaviour.java31
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/multi/NoOutputBonusMultiBehaviour.java31
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/multi/NoSpeedBonusMultiBehaviour.java31
-rw-r--r--src/main/java/gtPlusPlus/api/objects/minecraft/multi/SpecialMultiBehaviour.java57
22 files changed, 1861 insertions, 1909 deletions
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/AABB.java b/src/main/java/gtPlusPlus/api/objects/minecraft/AABB.java
index 722ac00b64..cefc4fce37 100644
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/AABB.java
+++ b/src/main/java/gtPlusPlus/api/objects/minecraft/AABB.java
@@ -11,55 +11,52 @@ import net.minecraft.world.World;
*
*/
public class AABB {
-
- private final AxisAlignedBB mAabb;
- private final World mWorld;
-
- /**
- * Creates a AxisAlignedBB based around an Entity.
- * @param aEntity - The Entity to work with.
- * @param x - Maximum X from origin.
- * @param y - Maximum Y from origin.
- * @param z - Maximum Z from origin.
- */
- public AABB(Entity aEntity, int x, int y, int z) {
- if (aEntity == null) {
- mAabb = null;
- mWorld = null;
- }
- else {
- mWorld = aEntity.worldObj;
- BlockPos aEntityLocation = EntityUtils.findBlockPosUnderEntity(aEntity);
- int xMin, xMax, yMin, yMax, zMin, zMax;
- xMin = aEntityLocation.xPos;
- yMin = aEntityLocation.yPos;
- zMin = aEntityLocation.zPos;
- xMax = aEntityLocation.xPos + x;
- yMax = aEntityLocation.yPos + y;
- zMax = aEntityLocation.zPos + z;
- mAabb = AxisAlignedBB.getBoundingBox(xMin, yMin, zMin, xMax, yMax, zMax);
- }
- }
-
- /**
- * Used to get the AxisAlignedBB from this class.
- * @return
- */
- public AxisAlignedBB get() {
- return mAabb;
- }
-
- /**
- * Used to determine if this object is valid or not.
- * @return
- */
- public boolean valid() {
- return mAabb != null && mWorld != null;
- }
-
- public World world() {
- return mWorld;
- }
-
+ private final AxisAlignedBB mAabb;
+ private final World mWorld;
+
+ /**
+ * Creates a AxisAlignedBB based around an Entity.
+ * @param aEntity - The Entity to work with.
+ * @param x - Maximum X from origin.
+ * @param y - Maximum Y from origin.
+ * @param z - Maximum Z from origin.
+ */
+ public AABB(Entity aEntity, int x, int y, int z) {
+ if (aEntity == null) {
+ mAabb = null;
+ mWorld = null;
+ } else {
+ mWorld = aEntity.worldObj;
+ BlockPos aEntityLocation = EntityUtils.findBlockPosUnderEntity(aEntity);
+ int xMin, xMax, yMin, yMax, zMin, zMax;
+ xMin = aEntityLocation.xPos;
+ yMin = aEntityLocation.yPos;
+ zMin = aEntityLocation.zPos;
+ xMax = aEntityLocation.xPos + x;
+ yMax = aEntityLocation.yPos + y;
+ zMax = aEntityLocation.zPos + z;
+ mAabb = AxisAlignedBB.getBoundingBox(xMin, yMin, zMin, xMax, yMax, zMax);
+ }
+ }
+
+ /**
+ * Used to get the AxisAlignedBB from this class.
+ * @return
+ */
+ public AxisAlignedBB get() {
+ return mAabb;
+ }
+
+ /**
+ * Used to determine if this object is valid or not.
+ * @return
+ */
+ public boolean valid() {
+ return mAabb != null && mWorld != null;
+ }
+
+ public World world() {
+ return mWorld;
+ }
}
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java b/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
index 0b8f97b378..f7d29e1200 100644
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
+++ b/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
@@ -1,6 +1,5 @@
package gtPlusPlus.api.objects.minecraft;
-import gtPlusPlus.core.util.minecraft.FluidUtils;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
@@ -8,181 +7,179 @@ import net.minecraftforge.fluids.FluidTankInfo;
public class BTF_FluidTank extends FluidTank {
- public FluidStack mFluid;
-
- public BTF_FluidTank(int capacity) {
- super(capacity);
- }
-
- /**
- * Let's replace the Default handling with GT's own handling code, because it's probably better, right?
- * @author Alkalus/GregoriusT
- */
-
-
- public FluidStack getFluid() {
- return this.getDrainableStack();
- }
-
- public int getFluidAmount() {
- return this.getDrainableStack() != null ? this.getDrainableStack().amount : 0;
- }
-
- public NBTTagCompound writeToNBT(NBTTagCompound aNBT) {
- super.writeToNBT(aNBT);
- if (this.mFluid != null) {
- aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound()));
- }
- return aNBT;
- }
-
- public FluidTank readFromNBT(NBTTagCompound aNBT) {
- this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- return this;
- }
-
-/* public abstract boolean isLiquidInput(byte arg0);
-
- public abstract boolean isLiquidOutput(byte arg0);
-
- public abstract boolean doesFillContainers();
-
- public abstract boolean doesEmptyContainers();*/
-
- public boolean canTankBeFilled() {
- return true;
- }
-
- public boolean canTankBeEmptied() {
- return true;
- }
-
-
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return true;
- }
-
- 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;
- }
-
- public FluidStack getDisplayedFluid() {
- return this.getDrainableStack();
- }
-
- public boolean isFluidChangingAllowed() {
- return true;
- }
-
- public int fill(FluidStack aFluid, boolean doFill) {
- if (aFluid != null && aFluid.getFluid().getID() > 0 && aFluid.amount > 0 && this.canTankBeFilled()
- && this.isFluidInputAllowed(aFluid)) {
- if (this.getFillableStack() != null && this.getFillableStack().getFluid().getID() > 0) {
- if (!this.getFillableStack().isFluidEqual(aFluid)) {
- return 0;
- } else {
- int space = this.getCapacity() - this.getFillableStack().amount;
- if (aFluid.amount <= space) {
- if (doFill) {
- FluidStack arg9999 = this.getFillableStack();
- arg9999.amount += aFluid.amount;
- }
-
- return aFluid.amount;
- } else {
- if (doFill) {
- this.getFillableStack().amount = this.getCapacity();
- }
-
- return space;
- }
- }
- } else if (aFluid.amount <= this.getCapacity()) {
- if (doFill) {
- this.setFillableStack(aFluid.copy());
- }
-
- return aFluid.amount;
- } else {
- if (doFill) {
- this.setFillableStack(aFluid.copy());
- this.getFillableStack().amount = this.getCapacity();
- }
-
- return this.getCapacity();
- }
- } else {
- return 0;
- }
- }
-
- public FluidStack drain(int maxDrain, boolean doDrain) {
- if (this.getDrainableStack() != null && this.canTankBeEmptied()) {
- if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
- this.setDrainableStack((FluidStack) null);
- return null;
- } else {
- int used = maxDrain;
- if (this.getDrainableStack().amount < maxDrain) {
- used = this.getDrainableStack().amount;
- }
-
- if (doDrain) {
- FluidStack arg9999 = this.getDrainableStack();
- arg9999.amount -= used;
- }
-
- FluidStack drained = this.getDrainableStack().copy();
- drained.amount = used;
- if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
- this.setDrainableStack((FluidStack) null);
- }
-
- return drained;
- }
- } else {
- return null;
- }
- }
-
- @Override
- public int getCapacity() {
- return super.getCapacity();
- }
-
- @Override
- public FluidTankInfo getInfo() {
- return new FluidTankInfo(this);
- }
-
- @Override
- public void setFluid(FluidStack fluid) {
- setFillableStack(fluid);
- }
-
- @Override
- public void setCapacity(int capacity) {
- super.setCapacity(capacity);
- }
-
- public FluidStack drain(FluidStack aFluid, boolean doDrain) {
- return drain(aFluid.amount, doDrain);
- }
-
-
-
+ public FluidStack mFluid;
+
+ public BTF_FluidTank(int capacity) {
+ super(capacity);
+ }
+
+ /**
+ * Let's replace the Default handling with GT's own handling code, because it's probably better, right?
+ * @author Alkalus/GregoriusT
+ */
+ public FluidStack getFluid() {
+ return this.getDrainableStack();
+ }
+
+ public int getFluidAmount() {
+ return this.getDrainableStack() != null ? this.getDrainableStack().amount : 0;
+ }
+
+ public NBTTagCompound writeToNBT(NBTTagCompound aNBT) {
+ super.writeToNBT(aNBT);
+ if (this.mFluid != null) {
+ aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound()));
+ }
+ return aNBT;
+ }
+
+ public FluidTank readFromNBT(NBTTagCompound aNBT) {
+ this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
+ return this;
+ }
+
+ /* public abstract boolean isLiquidInput(byte arg0);
+
+ public abstract boolean isLiquidOutput(byte arg0);
+
+ public abstract boolean doesFillContainers();
+
+ public abstract boolean doesEmptyContainers();*/
+
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return true;
+ }
+
+ 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;
+ }
+
+ public FluidStack getDisplayedFluid() {
+ return this.getDrainableStack();
+ }
+
+ public boolean isFluidChangingAllowed() {
+ return true;
+ }
+
+ public int fill(FluidStack aFluid, boolean doFill) {
+ if (aFluid != null
+ && aFluid.getFluid().getID() > 0
+ && aFluid.amount > 0
+ && this.canTankBeFilled()
+ && this.isFluidInputAllowed(aFluid)) {
+ if (this.getFillableStack() != null
+ && this.getFillableStack().getFluid().getID() > 0) {
+ if (!this.getFillableStack().isFluidEqual(aFluid)) {
+ return 0;
+ } else {
+ int space = this.getCapacity() - this.getFillableStack().amount;
+ if (aFluid.amount <= space) {
+ if (doFill) {
+ FluidStack arg9999 = this.getFillableStack();
+ arg9999.amount += aFluid.amount;
+ }
+
+ return aFluid.amount;
+ } else {
+ if (doFill) {
+ this.getFillableStack().amount = this.getCapacity();
+ }
+
+ return space;
+ }
+ }
+ } else if (aFluid.amount <= this.getCapacity()) {
+ if (doFill) {
+ this.setFillableStack(aFluid.copy());
+ }
+
+ return aFluid.amount;
+ } else {
+ if (doFill) {
+ this.setFillableStack(aFluid.copy());
+ this.getFillableStack().amount = this.getCapacity();
+ }
+
+ return this.getCapacity();
+ }
+ } else {
+ return 0;
+ }
+ }
+
+ public FluidStack drain(int maxDrain, boolean doDrain) {
+ if (this.getDrainableStack() != null && this.canTankBeEmptied()) {
+ if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
+ this.setDrainableStack((FluidStack) null);
+ return null;
+ } else {
+ int used = maxDrain;
+ if (this.getDrainableStack().amount < maxDrain) {
+ used = this.getDrainableStack().amount;
+ }
+
+ if (doDrain) {
+ FluidStack arg9999 = this.getDrainableStack();
+ arg9999.amount -= used;
+ }
+
+ FluidStack drained = this.getDrainableStack().copy();
+ drained.amount = used;
+ if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
+ this.setDrainableStack((FluidStack) null);
+ }
+
+ return drained;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public int getCapacity() {
+ return super.getCapacity();
+ }
+
+ @Override
+ public FluidTankInfo getInfo() {
+ return new FluidTankInfo(this);
+ }
+
+ @Override
+ public void setFluid(FluidStack fluid) {
+ setFillableStack(fluid);
+ }
+
+ @Override
+ public void setCapacity(int capacity) {
+ super.setCapacity(capacity);
+ }
+
+ public FluidStack drain(FluidStack aFluid, boolean doDrain) {
+ return drain(aFluid.amount, doDrain);
+ }
}
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java b/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java
index 04ce0dff19..d23ea97072 100644
--- a/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java
+++ b/src/main/java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java
@@ -1,228 +1,244 @@
package gtPlusPlus.api.objects.minecraft;
-import java.util.ArrayList;
-
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.tileentities.base.TileEntityBase;
import gtPlusPlus.core.util.data.ArrayUtils;
+import java.util.ArrayList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
-public class BTF_Inventory implements ISidedInventory{
-
- public final ItemStack[] mInventory;
- public final TileEntityBase mTile;
-
- public BTF_Inventory(int aSlots, TileEntityBase tile) {
- this.mInventory = new ItemStack[aSlots];
- this.mTile = tile;
- }
-
- public ItemStack[] getRealInventory() {
- purgeNulls();
- return this.mInventory;
- }
-
- public int getSizeInventory() {
- return this.mInventory.length;
- }
-
- public ItemStack getStackInSlot(int aIndex) {
- return aIndex >= 0 && aIndex < this.mInventory.length ? this.mInventory[aIndex] : null;
- }
-
- public void setInventorySlotContents(int aIndex, ItemStack aStack) {
- if (aIndex >= 0 && aIndex < this.mInventory.length) {
- this.mInventory[aIndex] = aStack;
- }
- }
-
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
- return true;
- }
-
- public boolean isValidSlot(int aIndex) {
- return true;
- }
-
- public int getInventoryStackLimit() {
- return 64;
- }
-
-
- public boolean setStackToZeroInsteadOfNull(int aIndex) {
- return false;
-}
+public class BTF_Inventory implements ISidedInventory {
+
+ public final ItemStack[] mInventory;
+ public final TileEntityBase mTile;
+
+ public BTF_Inventory(int aSlots, TileEntityBase tile) {
+ this.mInventory = new ItemStack[aSlots];
+ this.mTile = tile;
+ }
- public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
- return isValidSlot(aIndex);
- }
-
- public ItemStack decrStackSize(int aIndex, int aAmount) {
- ItemStack tStack = this.getStackInSlot(aIndex);
- ItemStack rStack = GT_Utility.copy(new Object[]{tStack});
- if (tStack != null) {
- if (tStack.stackSize <= aAmount) {
- if (this.setStackToZeroInsteadOfNull(aIndex)) {
- tStack.stackSize = 0;
- } else {
- this.setInventorySlotContents(aIndex, (ItemStack) null);
- }
- } else {
- rStack = tStack.splitStack(aAmount);
- if (tStack.stackSize == 0 && !this.setStackToZeroInsteadOfNull(aIndex)) {
- this.setInventorySlotContents(aIndex, (ItemStack) null);
- }
- }
- }
-
- return rStack;
- }
-
- public int[] getAccessibleSlotsFromSide(int aSide) {
- ArrayList<Integer> tList = new ArrayList<Integer>();
- TileEntityBase tTileEntity = this.mTile;
- boolean tSkip = tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide,
- tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2,
- tTileEntity)
- || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide,
- tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2,
- tTileEntity);
-
- for (int rArray = 0; rArray < this.getSizeInventory(); ++rArray) {
- if (this.isValidSlot(rArray) && (tSkip
- || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide,
- tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide),
- rArray, tTileEntity)
- || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide,
- tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide),
- rArray, tTileEntity))) {
- tList.add(Integer.valueOf(rArray));
- }
- }
-
- int[] arg6 = new int[tList.size()];
-
- for (int i = 0; i < arg6.length; ++i) {
- arg6[i] = ((Integer) tList.get(i)).intValue();
- }
-
- return arg6;
- }
-
- public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
- return this.isValidSlot(aIndex) && aStack != null && aIndex < this.mInventory.length
- && (this.mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, this.mInventory[aIndex]))
- && this.allowPutStack(this.mTile, aIndex, (byte) aSide, aStack);
- }
-
- public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
- return this.isValidSlot(aIndex) && aStack != null && aIndex < this.mInventory.length
- && this.allowPullStack(this.mTile, aIndex, (byte) aSide, aStack);
- }
-
- public boolean allowPullStack(TileEntityBase mTile2, int aIndex, byte aSide, ItemStack aStack) {
- return aIndex >= 0 && aIndex < this.getSizeInventory();
- }
-
- public boolean allowPutStack(TileEntityBase aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return (aIndex >= 0 && aIndex < this.getSizeInventory()) && (this.mInventory[aIndex] == null || GT_Utility.areStacksEqual(this.mInventory[aIndex], aStack));
- }
-
- public ItemStack getStackInSlotOnClosing(int i) {
- return null;
- }
-
- public final boolean hasCustomInventoryName() {
- return mTile != null ? mTile.hasCustomInventoryName() : false;
- }
-
-
- public void markDirty() {
- if (mTile != null) {
- purgeNulls();
- mTile.markDirty();
- }
- }
-
- public boolean isUseableByPlayer(EntityPlayer entityplayer) {
- return true;
- }
-
- public void openInventory() {
-
- }
-
- public void closeInventory() {
-
- }
-
- @Override
- public final String getInventoryName() {
- return this.mTile != null ? mTile.getInventoryName() : "";
- }
-
- public boolean isFull() {
- for (int s=0;s<this.getSizeInventory();s++) {
- ItemStack slot = mInventory[s];
- if (slot == null || slot.stackSize != slot.getMaxStackSize()) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isEmpty() {
- for (int s=0;s<this.getSizeInventory();s++) {
- ItemStack slot = mInventory[s];
- if (slot == null) {
- continue;
- }
- else {
- return false;
- }
- }
- return true;
- }
-
- public boolean addItemStack(ItemStack aInput) {
- if (aInput != null & (isEmpty() || !isFull())) {
- for (int s = 0; s < this.getSizeInventory(); s++) {
- if (mInventory != null && mInventory[s] != null) {
- ItemStack slot = mInventory[s];
- if (slot == null || (slot != null && GT_Utility.areStacksEqual(aInput, slot) && slot.stackSize != slot.getItem().getItemStackLimit(slot))) {
- if (slot == null) {
- slot = aInput.copy();
- } else {
- slot.stackSize++;
- }
- this.setInventorySlotContents(s, slot);
- return true;
- }
- }
- }
- }
- return false;
- }
-
- public final void purgeNulls() {
- ItemStack[] aTemp = ArrayUtils.removeNulls(this.mInventory);
- for (int g=0;g<this.getSizeInventory();g++) {
- if (aTemp.length < this.getSizeInventory()) {
- if (g <= aTemp.length-1) {
- this.mInventory[g] = aTemp[g];
- }
- else {
- this.mInventory[g] = null;
- }
- }
- else {
- this.mInventory[g] = aTemp[g];
- }
- }
-
- }
+ public ItemStack[] getRealInventory() {
+ purgeNulls();
+ return this.mInventory;
+ }
+ public int getSizeInventory() {
+ return this.mInventory.length;
+ }
+ public ItemStack getStackInSlot(int aIndex) {
+ return aIndex >= 0 && aIndex < this.mInventory.length ? this.mInventory[aIndex] : null;
+ }
+
+ public void setInventorySlotContents(int aIndex, ItemStack aStack) {
+ if (aIndex >= 0 && aIndex < this.mInventory.length) {
+ this.mInventory[aIndex] = aStack;
+ }
+ }
+
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return true;
+ }
+
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+ public boolean setStackToZeroInsteadOfNull(int aIndex) {
+ return false;
+ }
+
+ public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
+ return isValidSlot(aIndex);
+ }
+
+ public ItemStack decrStackSize(int aIndex, int aAmount) {
+ ItemStack tStack = this.getStackInSlot(aIndex);
+ ItemStack rStack = GT_Utility.copy(new Object[] {tStack});
+ if (tStack != null) {
+ if (tStack.stackSize <= aAmount) {
+ if (this.setStackToZeroInsteadOfNull(aIndex)) {
+ tStack.stackSize = 0;
+ } else {
+ this.setInventorySlotContents(aIndex, (ItemStack) null);
+ }
+ } else {
+ rStack = tStack.splitStack(aAmount);
+ if (tStack.stackSize == 0 && !this.setStackToZeroInsteadOfNull(aIndex)) {
+ this.setInventorySlotContents(aIndex, (ItemStack) null);
+ }
+ }
+ }
+
+ return rStack;
+ }
+
+ public int[] getAccessibleSlotsFromSide(int aSide) {
+ ArrayList<Integer> tList = new ArrayList<Integer>();
+ TileEntityBase tTileEntity = this.mTile;
+ boolean tSkip = tTileEntity
+ .getCoverBehaviorAtSide((byte) aSide)
+ .letsItemsIn(
+ (byte) aSide,
+ tTileEntity.getCoverIDAtSide((byte) aSide),
+ tTileEntity.getCoverDataAtSide((byte) aSide),
+ -2,
+ tTileEntity)
+ || tTileEntity
+ .getCoverBehaviorAtSide((byte) aSide)
+ .letsItemsOut(
+ (byte) aSide,
+ tTileEntity.getCoverIDAtSide((byte) aSide),
+ tTileEntity.getCoverDataAtSide((byte) aSide),
+ -2,
+ tTileEntity);
+
+ for (int rArray = 0; rArray < this.getSizeInventory(); ++rArray) {
+ if (this.isValidSlot(rArray)
+ && (tSkip
+ || tTileEntity
+ .getCoverBehaviorAtSide((byte) aSide)
+ .letsItemsOut(
+ (byte) aSide,
+ tTileEntity.getCoverIDAtSide((byte) aSide),
+ tTileEntity.getCoverDataAtSide((byte) aSide),
+ rArray,
+ tTileEntity)
+ || tTileEntity
+ .getCoverBehaviorAtSide((byte) aSide)
+ .letsItemsIn(
+ (byte) aSide,
+ tTileEntity.getCoverIDAtSide((byte) aSide),
+ tTileEntity.getCoverDataAtSide((byte) aSide),
+ rArray,
+ tTileEntity))) {
+ tList.add(Integer.valueOf(rArray));
+ }
+ }
+
+ int[] arg6 = new int[tList.size()];
+
+ for (int i = 0; i < arg6.length; ++i) {
+ arg6[i] = ((Integer) tList.get(i)).intValue();
+ }
+
+ return arg6;
+ }
+
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ return this.isValidSlot(aIndex)
+ && aStack != null
+ && aIndex < this.mInventory.length
+ && (this.mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, this.mInventory[aIndex]))
+ && this.allowPutStack(this.mTile, aIndex, (byte) aSide, aStack);
+ }
+
+ public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
+ return this.isValidSlot(aIndex)
+ && aStack != null
+ && aIndex < this.mInventory.length
+ && this.allowPullStack(this.mTile, aIndex, (byte) aSide, aStack);
+ }
+
+ public boolean allowPullStack(TileEntityBase mTile2, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex >= 0 && aIndex < this.getSizeInventory();
+ }
+
+ public boolean allowPutStack(TileEntityBase aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (aIndex >= 0 && aIndex < this.getSizeInventory())
+ && (this.mInventory[aIndex] == null || GT_Utility.areStacksEqual(this.mInventory[aIndex], aStack));
+ }
+
+ public ItemStack getStackInSlotOnClosing(int i) {
+ return null;
+ }
+
+ public final boolean hasCustomInventoryName() {
+ return mTile != null ? mTile.hasCustomInventoryName() : false;
+ }
+
+ public void markDirty() {
+ if (mTile != null) {
+ purgeNulls();
+ mTile.markDirty();
+ }
+ }
+
+ public boolean isUseableByPlayer(EntityPlayer entityplayer) {
+ return true;
+ }
+
+ public void openInventory() {}
+
+ public void closeInventory() {}
+
+ @Override
+ public final String getInventoryName() {
+ return this.mTile != null ? mTile.getInventoryName() : "";
+ }
+
+ public boolean isFull() {
+ for (int s = 0; s < this.getSizeInventory(); s++) {
+ ItemStack slot = mInventory[s];
+ if (slot == null || slot.stackSize != slot.getMaxStackSize()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean isEmpty() {
+ for (int s = 0; s < this.getSizeInventory(); s++) {
+ ItemStack slot = mInventory[s];
+ if (slot == null) {
+ continue;
+ } else {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean addItemStack(ItemStack aInput) {
+ if (aInput != null & (isEmpty() || !isFull())) {
+