actually fix #43 ? ....
This commit is contained in:
@@ -19,17 +19,13 @@
|
||||
package appeng.fluids.parts;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.StorageFilter;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||
@@ -96,6 +92,21 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
|
||||
|
||||
if( type == Actionable.MODULATE )
|
||||
{
|
||||
IAEFluidStack added;
|
||||
if( remaining == 0 )
|
||||
{
|
||||
added = input;
|
||||
}
|
||||
else
|
||||
{
|
||||
added = input.copy().setStackSize( input.getStackSize() - remaining );
|
||||
}
|
||||
this.cache.currentlyCached.add( added );
|
||||
if( access.hasPermission( AccessRestriction.READ ) )
|
||||
{
|
||||
postDifference( Collections.singletonList( added ) );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() );
|
||||
@@ -128,6 +139,15 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
|
||||
IAEFluidStack gatheredAEFluidstack = AEFluidStack.fromFluidStack( gathered );
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
IAEFluidStack cachedStack = this.cache.currentlyCached.findPrecise( request );
|
||||
if( cachedStack != null )
|
||||
{
|
||||
cachedStack.decStackSize( gathered.amount );
|
||||
if( access.hasPermission( AccessRestriction.READ ) )
|
||||
{
|
||||
postDifference( Collections.singletonList( gatheredAEFluidstack.copy().setStackSize( -gathered.amount ) ) );
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() );
|
||||
|
||||
@@ -101,7 +101,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
|
||||
ItemStack remaining = orgInput;
|
||||
|
||||
for ( int i = 0; i < slotCount && !remaining.isEmpty(); i++ )
|
||||
for( int i = 0; i < slotCount && !remaining.isEmpty(); i++ )
|
||||
{
|
||||
remaining = this.itemHandler.insertItem( i, remaining, type == Actionable.SIMULATE );
|
||||
}
|
||||
@@ -121,6 +121,21 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
|
||||
if( type == Actionable.MODULATE )
|
||||
{
|
||||
IAEItemStack added;
|
||||
if( remaining.isEmpty() )
|
||||
{
|
||||
added = iox;
|
||||
}
|
||||
else
|
||||
{
|
||||
added = iox.copy().setStackSize( iox.getStackSize() - remaining.getCount() );
|
||||
}
|
||||
this.cache.currentlyCached.add( added );
|
||||
if( access.hasPermission( AccessRestriction.READ ) )
|
||||
{
|
||||
postDifference( Collections.singletonList( added ) );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() );
|
||||
@@ -203,6 +218,15 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
|
||||
IAEItemStack gatheredAEItemStack = AEItemStack.fromItemStack( gathered );
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
IAEItemStack cachedStack = this.cache.currentlyCached.findPrecise( gatheredAEItemStack );
|
||||
if( cachedStack != null )
|
||||
{
|
||||
cachedStack.decStackSize( gatheredAEItemStack.getStackSize() );
|
||||
if( access.hasPermission( AccessRestriction.READ ) )
|
||||
{
|
||||
postDifference( Collections.singletonList( gatheredAEItemStack.copy().setStackSize( -gatheredAEItemStack.getStackSize() ) ) );
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() );
|
||||
|
||||
@@ -81,7 +81,7 @@ class ItemRepositoryAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<
|
||||
ItemStack remaining = this.itemRepository.insertItem( orgInput, type == Actionable.SIMULATE );
|
||||
|
||||
// Store the stack in the cache for next time.
|
||||
if (!remaining.isEmpty() && remaining != orgInput)
|
||||
if( !remaining.isEmpty() && remaining != orgInput )
|
||||
{
|
||||
stackCache = remaining;
|
||||
}
|
||||
@@ -95,6 +95,20 @@ class ItemRepositoryAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<
|
||||
|
||||
if( type == Actionable.MODULATE )
|
||||
{
|
||||
IAEItemStack added;
|
||||
if( remaining.isEmpty() )
|
||||
{
|
||||
added = iox;
|
||||
}
|
||||
else
|
||||
{
|
||||
added = iox.copy().setStackSize( iox.getStackSize() - remaining.getCount() );
|
||||
}
|
||||
this.cache.currentlyCached.add( added );
|
||||
if( access.hasPermission( AccessRestriction.READ ) )
|
||||
{
|
||||
postDifference( Collections.singletonList( added ) );
|
||||
}
|
||||
try
|
||||
{
|
||||
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() );
|
||||
@@ -132,6 +146,16 @@ class ItemRepositoryAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<
|
||||
IAEItemStack extractedAEItemStack = AEItemStack.fromItemStack( extracted );
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
IAEItemStack cachedStack = this.cache.currentlyCached.findPrecise( extractedAEItemStack );
|
||||
if( cachedStack != null )
|
||||
{
|
||||
cachedStack.decStackSize( extractedAEItemStack.getStackSize() );
|
||||
if( access.hasPermission( AccessRestriction.READ ) )
|
||||
{
|
||||
postDifference( Collections.singletonList( extractedAEItemStack.copy().setStackSize( -extractedAEItemStack.getStackSize() ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() );
|
||||
|
||||
Reference in New Issue
Block a user