WIP
This commit is contained in:
@@ -26,6 +26,8 @@ import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.me.storage.BasicCellInventoryHandler;
|
||||
import appeng.me.storage.CreativeCellInventory;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -735,7 +737,24 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
return input;
|
||||
}
|
||||
return super.injectItems( input, mode, src );
|
||||
T injected = super.injectItems( input, mode, src );
|
||||
if (mode == Actionable.MODULATE && ( injected == null || injected.getStackSize() != input.getStackSize() ))
|
||||
{
|
||||
if( TileChest.this.getProxy().isActive() && this.getInternalHandler().getCellInv() != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
TileChest.this.getProxy().getStorage().postAlterationOfStoredItems(
|
||||
this.getChannel(),
|
||||
Collections.singletonList( input.copy().setStackSize( input.getStackSize() - ( injected == null ? 0 : injected.getStackSize() ) ) ),
|
||||
TileChest.this.mySrc );
|
||||
} catch ( GridAccessException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return injected;
|
||||
}
|
||||
|
||||
private boolean securityCheck( final EntityPlayer player, final SecurityPermissions requiredPermission )
|
||||
@@ -779,7 +798,24 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return super.extractItems( request, mode, src );
|
||||
T extracted = super.extractItems( request, mode, src );
|
||||
if( mode == Actionable.MODULATE && extracted != null )
|
||||
{
|
||||
if( TileChest.this.getProxy().isActive() && this.getInternalHandler().getCellInv() != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
TileChest.this.getProxy().getStorage().postAlterationOfStoredItems(
|
||||
this.getChannel(),
|
||||
Collections.singletonList( request.copy().setStackSize( -extracted.getStackSize() ) ),
|
||||
TileChest.this.mySrc );
|
||||
} catch ( GridAccessException e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return extracted;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user