Fixed disconnecting when Storage Disk or Storage Block is too big, fixes #493

This commit is contained in:
Raoul Van den Berge
2016-10-30 20:51:49 +01:00
parent b583f505bc
commit 1a44f10fcc
7 changed files with 37 additions and 0 deletions

View File

@@ -39,6 +39,7 @@
- Fixed Destructor being able to break bedrock (InusualZ)
- Fixed External Storage thinking that items are inserted in Extra Utilities Trash Cans (InusualZ)
- Fixed Grid quantities being unreadable when using unicode font (raoulvdberge)
- Fixed disconnecting when Storage Disk or Storage Block is too big (raoulvdberge)
- Updated Storage Drawers API (raoulvdberge)
### 1.1.3

View File

@@ -193,6 +193,14 @@ public abstract class FluidStorageNBT implements IFluidStorage {
return tag.getInteger(NBT_STORED);
}
public static NBTTagCompound getNBTShareTag(NBTTagCompound tag) {
NBTTagCompound otherTag = new NBTTagCompound();
otherTag.setInteger(NBT_STORED, getStoredFromNBT(tag));
return otherTag;
}
/*
* @return A NBT tag initialized with the fields that {@link NBTStorage} uses
*/

View File

@@ -236,6 +236,14 @@ public abstract class ItemStorageNBT implements IItemStorage {
return tag.getInteger(NBT_STORED);
}
public static NBTTagCompound getNBTShareTag(NBTTagCompound tag) {
NBTTagCompound otherTag = new NBTTagCompound();
otherTag.setInteger(NBT_STORED, getStoredFromNBT(tag));
return otherTag;
}
/*
* @return A NBT tag initialized with the fields that {@link NBTStorage} uses
*/

View File

@@ -86,6 +86,11 @@ public class ItemBlockFluidStorage extends ItemBlockBase {
return Integer.MAX_VALUE;
}
@Override
public NBTTagCompound getNBTShareTag(ItemStack stack) {
return !isValid(stack) ? super.getNBTShareTag(stack) : FluidStorageNBT.getNBTShareTag(stack.getTagCompound().getCompoundTag(TileFluidStorage.NBT_STORAGE));
}
public static ItemStack initNBT(ItemStack stack) {
NBTTagCompound tag = new NBTTagCompound();
tag.setTag(TileFluidStorage.NBT_STORAGE, FluidStorageNBT.createNBT());

View File

@@ -86,6 +86,11 @@ public class ItemBlockStorage extends ItemBlockBase {
return Integer.MAX_VALUE;
}
@Override
public NBTTagCompound getNBTShareTag(ItemStack stack) {
return !isValid(stack) ? super.getNBTShareTag(stack) : ItemStorageNBT.getNBTShareTag(stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE));
}
public static ItemStack initNBT(ItemStack stack) {
NBTTagCompound tag = new NBTTagCompound();
tag.setTag(TileStorage.NBT_STORAGE, ItemStorageNBT.createNBT());

View File

@@ -119,4 +119,9 @@ public class ItemFluidStorageDisk extends ItemBase {
public int getEntityLifespan(ItemStack stack, World world) {
return Integer.MAX_VALUE;
}
@Override
public NBTTagCompound getNBTShareTag(ItemStack stack) {
return FluidStorageNBT.getNBTShareTag(stack.getTagCompound());
}
}

View File

@@ -130,4 +130,9 @@ public class ItemStorageDisk extends ItemBase {
public int getEntityLifespan(ItemStack stack, World world) {
return Integer.MAX_VALUE;
}
@Override
public NBTTagCompound getNBTShareTag(ItemStack stack) {
return ItemStorageNBT.getNBTShareTag(stack.getTagCompound());
}
}