Added Ae2 and Logistic pipe support to Quantum Chest

This commit is contained in:
gigabit101 2015-09-07 20:48:35 +01:00
parent e02b1518d2
commit 61120ed30b
3 changed files with 63 additions and 3 deletions

View file

@ -0,0 +1,35 @@
package powercrystals.minefactoryreloaded.api;
import net.minecraft.item.ItemStack;
public interface IDeepStorageUnit {
/**
* @return A populated ItemStack with stackSize for the full amount of
* materials in the DSU. <br>
* May have a stackSize > getMaxStackSize(). May have a stackSize of
* 0 (indicating locked contents).
*/
ItemStack getStoredItemType();
/**
* Sets the total amount of the item currently being stored, or zero if all
* items are to be removed.
*/
void setStoredItemCount(int amount);
/**
* Sets the type of the stored item and initializes the number of stored
* items to amount.
* <p>
* Will overwrite any existing stored items.
*/
void setStoredItemType(ItemStack type, int amount);
/**
* @return The maximum number of items the DSU can hold. <br>
* May change based on the current type stored.
*/
int getMaxStoredCount();
}

View file

@ -39,8 +39,8 @@ public class GuiQuantumChest extends GuiContainer {
I18n.format("container.inventory", new Object[0]), 8,
this.ySize - 96 + 2, 4210752);
this.fontRendererObj.drawString("Amount", 10, 20, 16448255);
if (tile.storedItem != null)
this.fontRendererObj.drawString(tile.storedItem.stackSize + "", 10,
if (tile.storedItem != null && tile.getStackInSlot(1) !=null)
this.fontRendererObj.drawString(tile.storedItem.stackSize + tile.getStackInSlot(1).stackSize + "", 10,
30, 16448255);
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
import techreborn.init.ModBlocks;
import techreborn.util.Inventory;
import techreborn.util.ItemUtils;
@ -15,7 +16,7 @@ import techreborn.util.ItemUtils;
import java.util.List;
public class TileQuantumChest extends TileMachineBase implements IInventory,
IWrenchable {
IWrenchable, IDeepStorageUnit {
// Slot 0 = Input
// Slot 1 = Output
@ -245,4 +246,28 @@ public class TileQuantumChest extends TileMachineBase implements IInventory,
info.add(size + " " + name);
}
@Override
public ItemStack getStoredItemType() {
return this.storedItem;
}
@Override
public void setStoredItemCount(int amount) {
this.storedItem.stackSize = 0;
this.storedItem.stackSize += (amount);
this.markDirty();
}
@Override
public void setStoredItemType(ItemStack type, int amount) {
this.storedItem = type;
this.storedItem.stackSize = amount;
this.markDirty();
}
@Override
public int getMaxStoredCount() {
return this.storage;
}
}