mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 15:57:55 +00:00
Merge pull request #13 from GTNewHorizons/overflow
fix int overflow in fluid storage cell
This commit is contained in:
2 files changed
+12
-11
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ dependencies {
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-92-GTNH:dev')
|
||||
compile('curse.maven:cofh-core-69162:2388751')
|
||||
compile('com.github.GTNewHorizons:ExtraCells2:2.5.9:dev') {transitive = false}
|
||||
compile('com.github.GTNewHorizons:ExtraCells2:2.5.20:dev') {transitive = false}
|
||||
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.8.5:dev")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:ForestryMC:4.4.7:dev")
|
||||
|
||||
@@ -31,7 +31,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
private final ItemStack cellItem;
|
||||
private final ISaveProvider container;
|
||||
private final static int MAX_TYPE = 1;
|
||||
private int storedFluidCount;
|
||||
private long storedFluidCount;
|
||||
private short storedFluids;
|
||||
private IItemList<IAEFluidStack> cellItems;
|
||||
private final NBTTagCompound tagCompound;
|
||||
@@ -78,7 +78,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
this.container = container;
|
||||
this.tagCompound = Platform.openNbtData( o );
|
||||
this.storedFluids = this.tagCompound.getShort( FLUID_TYPE_TAG );
|
||||
this.storedFluidCount = this.tagCompound.getInteger( FLUID_COUNT_TAG );
|
||||
this.storedFluidCount = this.tagCompound.getLong( FLUID_COUNT_TAG );
|
||||
this.cellItems = null;
|
||||
}
|
||||
|
||||
@@ -221,14 +221,15 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
for( int x = 0; x < types; x++ )
|
||||
{
|
||||
final FluidStack t = FluidStack.loadFluidStackFromNBT( this.tagCompound.getCompoundTag( fluidSlots[x] ) );
|
||||
final AEFluidStack aet = AEFluidStack.create( t );
|
||||
|
||||
if( t != null )
|
||||
if( aet != null )
|
||||
{
|
||||
t.amount = this.tagCompound.getInteger( fluidSlotCount[x] );
|
||||
aet.setStackSize( this.tagCompound.getLong( fluidSlotCount[x] ) );
|
||||
|
||||
if( t.amount > 0 )
|
||||
if( aet.getStackSize() > 0 )
|
||||
{
|
||||
this.cellItems.add( AEFluidStack.create( t ) );
|
||||
this.cellItems.add( aet );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,12 +248,12 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
private void updateFluidCount( final long delta )
|
||||
{
|
||||
this.storedFluidCount += delta;
|
||||
this.tagCompound.setInteger( FLUID_COUNT_TAG, this.storedFluidCount );
|
||||
this.tagCompound.setLong( FLUID_COUNT_TAG, this.storedFluidCount );
|
||||
}
|
||||
|
||||
private void saveChanges()
|
||||
{
|
||||
int itemCount = 0;
|
||||
long itemCount = 0;
|
||||
|
||||
int x = 0;
|
||||
|
||||
@@ -277,7 +278,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
* NBTBase tagSlotCount = tagCompound.getTag( itemSlotCount[x] ); if ( tagSlotCount instanceof
|
||||
* NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else
|
||||
*/
|
||||
this.tagCompound.setInteger( fluidSlotCount[x], (int) v.getStackSize() );
|
||||
this.tagCompound.setLong( fluidSlotCount[x], v.getStackSize() );
|
||||
|
||||
x++;
|
||||
}
|
||||
@@ -312,7 +313,7 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
}
|
||||
else
|
||||
{
|
||||
this.tagCompound.setInteger( FLUID_COUNT_TAG, itemCount );
|
||||
this.tagCompound.setLong( FLUID_COUNT_TAG, itemCount );
|
||||
}
|
||||
|
||||
// clean any old crusty stuff...
|
||||
|
||||
Reference in new issue
Block a user