added stuff

- storage proxy block: reads an another inventory into system
- right clicking to push 1 item works
- when take() returns 0, don't give any item stack to the player
- tweaked energy usage
This commit is contained in:
Raoul Van den Berge
2015-12-15 21:58:21 +01:00
parent 62cca754a3
commit b47dc933c8
18 changed files with 326 additions and 121 deletions

View File

@@ -2,7 +2,7 @@ package storagecraft.inventory;
import net.minecraft.entity.player.EntityPlayer;
import storagecraft.SCItems;
import storagecraft.inventory.slot.SlotDrive;
import storagecraft.inventory.slot.SlotItemFilter;
import storagecraft.tile.TileDrive;
public class ContainerDrive extends ContainerSC {
@@ -15,7 +15,7 @@ public class ContainerDrive extends ContainerSC {
int y = 20;
for (int i = 0; i < 8; ++i) {
addSlotToContainer(new SlotDrive(drive, i, x, y, SCItems.STORAGE_CELL, drive));
addSlotToContainer(new SlotItemFilter(drive, i, x, y, SCItems.STORAGE_CELL));
if ((i + 1) % 2 == 0) {
x = 71;

View File

@@ -1,30 +0,0 @@
package storagecraft.inventory.slot;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import storagecraft.tile.TileDrive;
public class SlotDrive extends SlotItemFilter {
private TileDrive drive;
public SlotDrive(IInventory inventory, int id, int x, int y, Item item, TileDrive drive) {
super(inventory, id, x, y, item);
this.drive = drive;
}
@Override
public boolean isItemValid(ItemStack item) {
return drive.isConnected() && super.isItemValid(item);
}
@Override
public void onSlotChanged() {
super.onSlotChanged();
if (drive.isConnected()) {
drive.getController().syncStorage();
}
}
}