Fixes 1481: Not using the right itemcount in a few cases

This commit is contained in:
yueh 2015-08-16 15:32:58 +02:00
parent 6a18102ea0
commit 7dd283cf9f

View file

@ -395,6 +395,7 @@ public class CellInventory implements ICellInventory
* if ( tagType instanceof NBTTagShort ) ((NBTTagShort) tagType).data = storedItems = (short) cellItems.size(); * if ( tagType instanceof NBTTagShort ) ((NBTTagShort) tagType).data = storedItems = (short) cellItems.size();
* else * else
*/ */
this.storedItems = (short) this.cellItems.size();
if( this.cellItems.isEmpty() ) if( this.cellItems.isEmpty() )
{ {
this.tagCompound.removeTag( ITEM_TYPE_TAG ); this.tagCompound.removeTag( ITEM_TYPE_TAG );
@ -403,11 +404,11 @@ public class CellInventory implements ICellInventory
{ {
this.tagCompound.setShort( ITEM_TYPE_TAG, this.storedItems ); this.tagCompound.setShort( ITEM_TYPE_TAG, this.storedItems );
} }
this.storedItems = (short) this.cellItems.size();
/* /*
* if ( tagCount instanceof NBTTagInt ) ((NBTTagInt) tagCount).data = storedItemCount = itemCount; else * if ( tagCount instanceof NBTTagInt ) ((NBTTagInt) tagCount).data = storedItemCount = itemCount; else
*/ */
this.storedItemCount = itemCount;
if( itemCount == 0 ) if( itemCount == 0 )
{ {
this.tagCompound.removeTag( ITEM_COUNT_TAG ); this.tagCompound.removeTag( ITEM_COUNT_TAG );
@ -416,7 +417,6 @@ public class CellInventory implements ICellInventory
{ {
this.tagCompound.setInteger( ITEM_COUNT_TAG, itemCount ); this.tagCompound.setInteger( ITEM_COUNT_TAG, itemCount );
} }
this.storedItemCount = itemCount;
// clean any old crusty stuff... // clean any old crusty stuff...
for( ; x < oldStoredItems && x < this.maxItemTypes; x++ ) for( ; x < oldStoredItems && x < this.maxItemTypes; x++ )