Fixes #103 "Can't shift-click patterns into the last 3 slots of Crafters"
This commit is contained in:
@@ -50,6 +50,7 @@ public abstract class NBTStorage implements IStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT() {
|
public void readFromNBT() {
|
||||||
|
System.out.println("[REFINED STORAGE DEBUG] Reading from storage, protocol " + tag.getInteger(NBT_PROTOCOL) + ".");
|
||||||
NBTTagList list = (NBTTagList) tag.getTag(NBT_ITEMS);
|
NBTTagList list = (NBTTagList) tag.getTag(NBT_ITEMS);
|
||||||
|
|
||||||
for (int i = 0; i < list.tagCount(); ++i) {
|
for (int i = 0; i < list.tagCount(); ++i) {
|
||||||
@@ -65,6 +66,7 @@ public abstract class NBTStorage implements IStorage {
|
|||||||
stack.setTagCompound(tag.hasKey(NBT_ITEM_NBT) ? tag.getCompoundTag(NBT_ITEM_NBT) : null);
|
stack.setTagCompound(tag.hasKey(NBT_ITEM_NBT) ? tag.getCompoundTag(NBT_ITEM_NBT) : null);
|
||||||
|
|
||||||
if (stack.getItem() != null) {
|
if (stack.getItem() != null) {
|
||||||
|
System.out.println("[REFINED STORAGE DEBUG] Read " + stack);
|
||||||
stacks.add(stack);
|
stacks.add(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,6 +236,7 @@ public abstract class NBTStorage implements IStorage {
|
|||||||
|
|
||||||
tag.setTag(NBT_ITEMS, new NBTTagList());
|
tag.setTag(NBT_ITEMS, new NBTTagList());
|
||||||
tag.setInteger(NBT_STORED, 0);
|
tag.setInteger(NBT_STORED, 0);
|
||||||
|
tag.setInteger(NBT_PROTOCOL, PROTOCOL);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ public class ContainerCrafter extends ContainerStorage {
|
|||||||
stack = slot.getStack().copy();
|
stack = slot.getStack().copy();
|
||||||
|
|
||||||
if (index < 8) {
|
if (index < 8) {
|
||||||
if (!mergeItemStack(stack, 6, inventorySlots.size(), true)) {
|
if (!mergeItemStack(stack, 9, inventorySlots.size(), true)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else if (!mergeItemStack(stack, 0, 6, false)) {
|
} else if (!mergeItemStack(stack, 0, 9, false)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public abstract class TileBase extends TileEntity implements ITickable {
|
|||||||
|
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
if (this instanceof ISynchronizedContainer) {
|
if (this instanceof ISynchronizedContainer) {
|
||||||
for (EntityPlayer player : worldObj.playerEntities) {
|
for (EntityPlayer player : worldObj.getMinecraftServer().getPlayerList().getPlayerList()) {
|
||||||
if (((ISynchronizedContainer) this).getContainer() == player.openContainer.getClass()) {
|
if (((ISynchronizedContainer) this).getContainer() == player.openContainer.getClass()) {
|
||||||
RefinedStorage.NETWORK.sendTo(new MessageTileContainerUpdate(this), (EntityPlayerMP) player);
|
RefinedStorage.NETWORK.sendTo(new MessageTileContainerUpdate(this), (EntityPlayerMP) player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public class TileDiskDrive extends TileMachine implements IStorageProvider, ISto
|
|||||||
if (disks.getStackInSlot(slot) == null) {
|
if (disks.getStackInSlot(slot) == null) {
|
||||||
storages[slot] = null;
|
storages[slot] = null;
|
||||||
} else if (storages[slot] == null) {
|
} else if (storages[slot] == null) {
|
||||||
|
System.out.println("[REFINED STORAGE DEBUG] Initialized storage " + slot + " in disk drive, this should only happen ONCE when loading world/ entering a unloaded chunk. If it happens while you're in the same chunk, something is wrong !!!");
|
||||||
storages[slot] = new Storage(disks.getStackInSlot(slot));
|
storages[slot] = new Storage(disks.getStackInSlot(slot));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,14 +90,18 @@ public class TileDiskDrive extends TileMachine implements IStorageProvider, ISto
|
|||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
|
||||||
for (int i = 0; i < disks.getSlots(); ++i) {
|
if (!worldObj.isRemote) {
|
||||||
Storage storage = getStorage(i);
|
for (int i = 0; i < disks.getSlots(); ++i) {
|
||||||
|
Storage storage = getStorage(i);
|
||||||
|
|
||||||
if (storage != null && storage.isDirty()) {
|
if (storage != null && storage.isDirty()) {
|
||||||
storage.writeToNBT(disks.getStackInSlot(i).getTagCompound());
|
storage.writeToNBT(disks.getStackInSlot(i).getTagCompound());
|
||||||
storage.markClean();
|
storage.markClean();
|
||||||
|
|
||||||
markDirty();
|
System.out.println("[REFINED STORAGE DEBUG] Disk Drive slot " + i + " is MARKED DIRTY, thus it should save when you leave the area.");
|
||||||
|
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,6 +121,7 @@ public class TileDiskDrive extends TileMachine implements IStorageProvider, ISto
|
|||||||
public void read(NBTTagCompound nbt) {
|
public void read(NBTTagCompound nbt) {
|
||||||
super.read(nbt);
|
super.read(nbt);
|
||||||
|
|
||||||
|
System.out.println("[REFINED STORAGE DEBUG] Reading from storage now.");
|
||||||
RefinedStorageUtils.readItems(disks, 0, nbt);
|
RefinedStorageUtils.readItems(disks, 0, nbt);
|
||||||
RefinedStorageUtils.readItems(filters, 1, nbt);
|
RefinedStorageUtils.readItems(filters, 1, nbt);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user