API Sync, save drive and chests when modifications are made.

This commit is contained in:
AlgorithmX2
2014-07-28 00:11:34 -05:00
parent 4790ab51e0
commit ea5f49b80b
16 changed files with 68 additions and 32 deletions
+10 -4
View File
@@ -387,8 +387,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
double power = 1.0;
IMEInventoryHandler<IAEItemStack> itemCell = cellHandler.getCellInventory( is, StorageChannel.ITEMS );
IMEInventoryHandler<IAEFluidStack> fluidCell = cellHandler.getCellInventory( is, StorageChannel.FLUIDS );
IMEInventoryHandler<IAEItemStack> itemCell = cellHandler.getCellInventory( is, this, StorageChannel.ITEMS );
IMEInventoryHandler<IAEFluidStack> fluidCell = cellHandler.getCellInventory( is, this, StorageChannel.FLUIDS );
if ( itemCell != null )
power += cellHandler.cellIdleDrain( is, itemCell );
@@ -494,9 +494,9 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
if ( i == 1 )
{
if ( AEApi.instance().registries().cell().getCellInventory( itemstack, StorageChannel.ITEMS ) != null )
if ( AEApi.instance().registries().cell().getCellInventory( itemstack, this, StorageChannel.ITEMS ) != null )
return true;
if ( AEApi.instance().registries().cell().getCellInventory( itemstack, StorageChannel.FLUIDS ) != null )
if ( AEApi.instance().registries().cell().getCellInventory( itemstack, this, StorageChannel.FLUIDS ) != null )
return true;
}
else
@@ -838,4 +838,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
markForUpdate();
return true;
}
@Override
public void saveChanges(IMEInventory cellInventory)
{
worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
}
}
+9 -2
View File
@@ -22,6 +22,7 @@ import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
@@ -218,7 +219,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
if ( handlersBySlot[x] != null )
{
IMEInventoryHandler cell = handlersBySlot[x].getCellInventory( is, StorageChannel.ITEMS );
IMEInventoryHandler cell = handlersBySlot[x].getCellInventory( is, this, StorageChannel.ITEMS );
if ( cell != null )
{
@@ -231,7 +232,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
}
else
{
cell = handlersBySlot[x].getCellInventory( is, StorageChannel.FLUIDS );
cell = handlersBySlot[x].getCellInventory( is, this, StorageChannel.FLUIDS );
if ( cell != null )
{
@@ -359,4 +360,10 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
{
return itemstack != null && AEApi.instance().registries().cell().isCellHandled( itemstack );
}
@Override
public void saveChanges(IMEInventory cellInventory)
{
worldObj.markTileEntityChunkModified( this.xCoord, this.yCoord, this.zCoord, this );
}
}
+2 -2
View File
@@ -326,8 +326,8 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
if ( currentCell != is )
{
currentCell = is;
cachedFluid = AEApi.instance().registries().cell().getCellInventory( is, StorageChannel.FLUIDS );
cachedItem = AEApi.instance().registries().cell().getCellInventory( is, StorageChannel.ITEMS );
cachedFluid = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.FLUIDS );
cachedItem = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
}
if ( StorageChannel.ITEMS == chan )