more markDirty

This commit is contained in:
Raoul Van den Berge
2016-01-31 22:20:44 +01:00
parent 4116ea869a
commit 4b9d520632
7 changed files with 20 additions and 7 deletions

View File

@@ -3,10 +3,12 @@ package storagecraft.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IChatComponent;
public class InventorySimple implements IInventory
{
private TileEntity tile;
private ItemStack[] inventory;
private int size;
private String name;
@@ -18,6 +20,13 @@ public class InventorySimple implements IInventory
this.inventory = new ItemStack[size];
}
public InventorySimple(String name, int size, TileEntity tile)
{
this(name, size);
this.tile = tile;
}
@Override
public int getSizeInventory()
{
@@ -112,6 +121,10 @@ public class InventorySimple implements IInventory
@Override
public void markDirty()
{
if (tile != null)
{
tile.markDirty();
}
}
@Override

View File

@@ -14,7 +14,7 @@ public class TileConstructor extends TileMachine implements ICompareSetting
{
public static final String NBT_COMPARE = "Compare";
private InventorySimple inventory = new InventorySimple("constructor", 1);
private InventorySimple inventory = new InventorySimple("constructor", 1, this);
private int compare = 0;

View File

@@ -20,7 +20,7 @@ public class TileDetector extends TileMachine implements ICompareSetting
public static final String NBT_MODE = "Mode";
public static final String NBT_AMOUNT = "Amount";
private InventorySimple inventory = new InventorySimple("detector", 1);
private InventorySimple inventory = new InventorySimple("detector", 1, this);
private int compare = 0;
private int mode = MODE_EQUAL;

View File

@@ -1,6 +1,5 @@
package storagecraft.tile;
import storagecraft.tile.settings.ICompareSetting;
import io.netty.buffer.ByteBuf;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
@@ -8,13 +7,14 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import storagecraft.inventory.InventorySimple;
import storagecraft.tile.settings.ICompareSetting;
import storagecraft.util.InventoryUtils;
public class TileExporter extends TileMachine implements ICompareSetting
{
public static final String NBT_COMPARE = "Compare";
private InventorySimple inventory = new InventorySimple("exporter", 9);
private InventorySimple inventory = new InventorySimple("exporter", 9, this);
private int compare = 0;

View File

@@ -26,7 +26,7 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider
public static final String NBT_COMPARE = "Compare";
public static final String NBT_MODE = "Mode";
private InventorySimple inventory = new InventorySimple("external_storage", 9);
private InventorySimple inventory = new InventorySimple("external_storage", 9, this);
private int priority = 0;
private int compare = 0;

View File

@@ -16,7 +16,7 @@ public class TileImporter extends TileMachine implements ICompareSetting, IModeS
public static final String NBT_COMPARE = "Compare";
public static final String NBT_MODE = "Mode";
private InventorySimple inventory = new InventorySimple("importer", 9);
private InventorySimple inventory = new InventorySimple("importer", 9, this);
private int compare = 0;
private int mode = 0;

View File

@@ -29,7 +29,7 @@ public class TileStorage extends TileMachine implements IStorageProvider, IStora
public static final String NBT_COMPARE = "Compare";
public static final String NBT_MODE = "Mode";
private InventorySimple inventory = new InventorySimple("storage", 9);
private InventorySimple inventory = new InventorySimple("storage", 9, this);
private NBTTagCompound tag = NBTStorage.getBaseNBT();