actually fix #43 ? ....

This commit is contained in:
PrototypeTrousers
2021-07-30 07:44:32 -03:00
parent 0b9df31d4e
commit e376e002e9
4 changed files with 77 additions and 9 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ aechannel=stable
aebuild=7 aebuild=7
aegroup=appeng aegroup=appeng
aebasename=appliedenergistics2 aebasename=appliedenergistics2
trousers=omni-fixes-v45i trousers=omni-fixes-v45j
######################################################### #########################################################
# Versions # # Versions #
@@ -19,17 +19,13 @@
package appeng.fluids.parts; package appeng.fluids.parts;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import appeng.api.config.AccessRestriction; import appeng.api.config.AccessRestriction;
import appeng.api.config.Settings; import appeng.api.config.Settings;
import appeng.api.config.StorageFilter; import appeng.api.config.StorageFilter;
import appeng.api.storage.data.IAEItemStack;
import appeng.me.GridAccessException; import appeng.me.GridAccessException;
import appeng.parts.misc.PartStorageBus;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fluids.capability.IFluidTankProperties;
@@ -96,6 +92,21 @@ public class FluidHandlerAdapter implements IMEInventory<IAEFluidStack>, IBaseMo
if( type == Actionable.MODULATE ) 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 try
{ {
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() ); 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 ); IAEFluidStack gatheredAEFluidstack = AEFluidStack.fromFluidStack( gathered );
if( mode == Actionable.MODULATE ) 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 try
{ {
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() ); this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() );
@@ -101,7 +101,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
ItemStack remaining = orgInput; 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 ); remaining = this.itemHandler.insertItem( i, remaining, type == Actionable.SIMULATE );
} }
@@ -121,6 +121,21 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
if( type == Actionable.MODULATE ) 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 try
{ {
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() ); 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 ); IAEItemStack gatheredAEItemStack = AEItemStack.fromItemStack( gathered );
if( mode == Actionable.MODULATE ) 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 try
{ {
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() ); 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 ); ItemStack remaining = this.itemRepository.insertItem( orgInput, type == Actionable.SIMULATE );
// Store the stack in the cache for next time. // Store the stack in the cache for next time.
if (!remaining.isEmpty() && remaining != orgInput) if( !remaining.isEmpty() && remaining != orgInput )
{ {
stackCache = remaining; stackCache = remaining;
} }
@@ -95,6 +95,20 @@ class ItemRepositoryAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<
if( type == Actionable.MODULATE ) 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 try
{ {
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() ); this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() );
@@ -132,6 +146,16 @@ class ItemRepositoryAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<
IAEItemStack extractedAEItemStack = AEItemStack.fromItemStack( extracted ); IAEItemStack extractedAEItemStack = AEItemStack.fromItemStack( extracted );
if( mode == Actionable.MODULATE ) 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 try
{ {
this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() ); this.proxyable.getProxy().getTick().alertDevice( this.proxyable.getProxy().getNode() );