more markDirty
This commit is contained in:
@@ -3,10 +3,12 @@ package storagecraft.inventory;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IChatComponent;
|
import net.minecraft.util.IChatComponent;
|
||||||
|
|
||||||
public class InventorySimple implements IInventory
|
public class InventorySimple implements IInventory
|
||||||
{
|
{
|
||||||
|
private TileEntity tile;
|
||||||
private ItemStack[] inventory;
|
private ItemStack[] inventory;
|
||||||
private int size;
|
private int size;
|
||||||
private String name;
|
private String name;
|
||||||
@@ -18,6 +20,13 @@ public class InventorySimple implements IInventory
|
|||||||
this.inventory = new ItemStack[size];
|
this.inventory = new ItemStack[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventorySimple(String name, int size, TileEntity tile)
|
||||||
|
{
|
||||||
|
this(name, size);
|
||||||
|
|
||||||
|
this.tile = tile;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory()
|
public int getSizeInventory()
|
||||||
{
|
{
|
||||||
@@ -112,6 +121,10 @@ public class InventorySimple implements IInventory
|
|||||||
@Override
|
@Override
|
||||||
public void markDirty()
|
public void markDirty()
|
||||||
{
|
{
|
||||||
|
if (tile != null)
|
||||||
|
{
|
||||||
|
tile.markDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class TileConstructor extends TileMachine implements ICompareSetting
|
|||||||
{
|
{
|
||||||
public static final String NBT_COMPARE = "Compare";
|
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;
|
private int compare = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class TileDetector extends TileMachine implements ICompareSetting
|
|||||||
public static final String NBT_MODE = "Mode";
|
public static final String NBT_MODE = "Mode";
|
||||||
public static final String NBT_AMOUNT = "Amount";
|
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 compare = 0;
|
||||||
private int mode = MODE_EQUAL;
|
private int mode = MODE_EQUAL;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package storagecraft.tile;
|
package storagecraft.tile;
|
||||||
|
|
||||||
import storagecraft.tile.settings.ICompareSetting;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
@@ -8,13 +7,14 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import storagecraft.inventory.InventorySimple;
|
import storagecraft.inventory.InventorySimple;
|
||||||
|
import storagecraft.tile.settings.ICompareSetting;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
|
|
||||||
public class TileExporter extends TileMachine implements ICompareSetting
|
public class TileExporter extends TileMachine implements ICompareSetting
|
||||||
{
|
{
|
||||||
public static final String NBT_COMPARE = "Compare";
|
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;
|
private int compare = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class TileExternalStorage extends TileMachine implements IStorageProvider
|
|||||||
public static final String NBT_COMPARE = "Compare";
|
public static final String NBT_COMPARE = "Compare";
|
||||||
public static final String NBT_MODE = "Mode";
|
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 priority = 0;
|
||||||
private int compare = 0;
|
private int compare = 0;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class TileImporter extends TileMachine implements ICompareSetting, IModeS
|
|||||||
public static final String NBT_COMPARE = "Compare";
|
public static final String NBT_COMPARE = "Compare";
|
||||||
public static final String NBT_MODE = "Mode";
|
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 compare = 0;
|
||||||
private int mode = 0;
|
private int mode = 0;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class TileStorage extends TileMachine implements IStorageProvider, IStora
|
|||||||
public static final String NBT_COMPARE = "Compare";
|
public static final String NBT_COMPARE = "Compare";
|
||||||
public static final String NBT_MODE = "Mode";
|
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();
|
private NBTTagCompound tag = NBTStorage.getBaseNBT();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user