@@ -51,8 +51,8 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
51
51
private final NBTTagCompound tagCompound ;
52
52
protected final ISaveProvider container ;
53
53
private int maxItemTypes = MAX_ITEM_TYPES ;
54
- private short storedItems = 0 ;
55
- private int storedItemCount = 0 ;
54
+ private short storedItemTypes = 0 ;
55
+ private long storedItemCount = 0 ;
56
56
protected IItemList <T > cellItems ;
57
57
private final ItemStack i ;
58
58
protected final IStorageCell <T > cellType ;
@@ -81,8 +81,8 @@ protected AbstractCellInventory(final IStorageCell<T> cellType, final ItemStack
81
81
82
82
this .container = container ;
83
83
this .tagCompound = Platform .openNbtData (o );
84
- this .storedItems = this .tagCompound .getShort (ITEM_TYPE_TAG );
85
- this .storedItemCount = this .tagCompound .getInteger (ITEM_COUNT_TAG );
84
+ this .storedItemTypes = this .tagCompound .getShort (ITEM_TYPE_TAG );
85
+ this .storedItemCount = this .tagCompound .getLong (ITEM_COUNT_TAG );
86
86
this .cellItems = null ;
87
87
}
88
88
@@ -101,7 +101,7 @@ public void persist() {
101
101
return ;
102
102
}
103
103
104
- int itemCount = 0 ;
104
+ long itemCount = 0 ;
105
105
106
106
// add new pretty stuff...
107
107
int x = 0 ;
@@ -111,25 +111,25 @@ public void persist() {
111
111
final NBTTagCompound g = new NBTTagCompound ();
112
112
v .writeToNBT (g );
113
113
this .tagCompound .setTag (ITEM_SLOT_KEYS [x ], g );
114
- this .tagCompound .setInteger (ITEM_SLOT_COUNT_KEYS [x ], ( int ) v .getStackSize ());
114
+ this .tagCompound .setLong (ITEM_SLOT_COUNT_KEYS [x ], v .getStackSize ());
115
115
116
116
x ++;
117
117
}
118
118
119
- final short oldStoredItems = this .storedItems ;
119
+ final short oldStoredItems = this .storedItemTypes ;
120
120
121
- this .storedItems = (short ) this .cellItems .size ();
121
+ this .storedItemTypes = (short ) this .cellItems .size ();
122
122
if (this .cellItems .isEmpty ()) {
123
123
this .tagCompound .removeTag (ITEM_TYPE_TAG );
124
124
} else {
125
- this .tagCompound .setShort (ITEM_TYPE_TAG , this .storedItems );
125
+ this .tagCompound .setShort (ITEM_TYPE_TAG , this .storedItemTypes );
126
126
}
127
127
128
128
this .storedItemCount = itemCount ;
129
129
if (itemCount == 0 ) {
130
130
this .tagCompound .removeTag (ITEM_COUNT_TAG );
131
131
} else {
132
- this .tagCompound .setInteger (ITEM_COUNT_TAG , itemCount );
132
+ this .tagCompound .setLong (ITEM_COUNT_TAG , itemCount );
133
133
}
134
134
135
135
// clean any old crusty stuff...
@@ -143,7 +143,7 @@ public void persist() {
143
143
144
144
protected void saveChanges () {
145
145
// recalculate values
146
- this .storedItems = (short ) this .cellItems .size ();
146
+ this .storedItemTypes = (short ) this .cellItems .size ();
147
147
this .storedItemCount = 0 ;
148
148
for (final T v : this .cellItems ) {
149
149
this .storedItemCount += v .getStackSize ();
@@ -165,12 +165,12 @@ private void loadCellItems() {
165
165
166
166
this .cellItems .resetStatus (); // clears totals and stuff.
167
167
168
- final int types = ( int ) this .getStoredItemTypes ();
168
+ final long types = this .getStoredItemTypes ();
169
169
boolean needsUpdate = false ;
170
170
171
171
for (int slot = 0 ; slot < types ; slot ++) {
172
172
NBTTagCompound compoundTag = this .tagCompound .getCompoundTag (ITEM_SLOT_KEYS [slot ]);
173
- int stackSize = this .tagCompound .getInteger (ITEM_SLOT_COUNT_KEYS [slot ]);
173
+ long stackSize = this .tagCompound .getLong (ITEM_SLOT_COUNT_KEYS [slot ]);
174
174
needsUpdate |= !this .loadCellItem (compoundTag , stackSize );
175
175
}
176
176
@@ -186,7 +186,7 @@ private void loadCellItems() {
186
186
* @param stackSize
187
187
* @return true when successfully loaded
188
188
*/
189
- protected abstract boolean loadCellItem (NBTTagCompound compoundTag , int stackSize );
189
+ protected abstract boolean loadCellItem (NBTTagCompound compoundTag , long stackSize );
190
190
191
191
@ Override
192
192
public IItemList <T > getAvailableItems (final IItemList <T > out ) {
@@ -256,14 +256,14 @@ public long getStoredItemCount() {
256
256
257
257
@ Override
258
258
public long getStoredItemTypes () {
259
- return this .storedItems ;
259
+ return this .storedItemTypes ;
260
260
}
261
261
262
262
@ Override
263
263
public long getRemainingItemTypes () {
264
264
final long basedOnStorage = this .getFreeBytes () / this .getBytesPerType ();
265
265
final long baseOnTotal = this .getTotalItemTypes () - this .getStoredItemTypes ();
266
- return basedOnStorage > baseOnTotal ? baseOnTotal : basedOnStorage ;
266
+ return Math . min ( basedOnStorage , baseOnTotal ) ;
267
267
}
268
268
269
269
@ Override
0 commit comments