From 027e8477c2857ae6e32f00e65fb168e5969ddd23 Mon Sep 17 00:00:00 2001 From: PrototypeTrousers Date: Fri, 26 Aug 2022 17:28:00 -0300 Subject: [PATCH] push down some buttons so the JEI doesnt get cutoff vertically. ME autocrafting now uses the cached storage list instead of a full simulated network extraction --- gradle.properties | 2 +- .../java/appeng/crafting/CraftingJob.java | 2 +- .../appeng/crafting/MECraftingInventory.java | 19 +++++++++++++++++++ .../appeng/me/cache/GridStorageCache.java | 11 ----------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/gradle.properties b/gradle.properties index 84694259d..93380ee5d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ aebuild=7 aegroup=appeng aebasename=appliedenergistics2 extended=extended_life -extendedversion=v0.53.3 +extendedversion=v0.53.4 ######################################################### # Versions # ######################################################### diff --git a/src/main/java/appeng/crafting/CraftingJob.java b/src/main/java/appeng/crafting/CraftingJob.java index 9342e4599..3c0e81646 100644 --- a/src/main/java/appeng/crafting/CraftingJob.java +++ b/src/main/java/appeng/crafting/CraftingJob.java @@ -88,7 +88,7 @@ public class CraftingJob implements Runnable, ICraftingJob this.cc = grid.getCache( ICraftingGrid.class ); final GridStorageCache sg = grid.getCache( IStorageGrid.class ); - this.original = sg.getExtractableList( actionSrc ); + this.original = new MECraftingInventory( sg.getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ).getStorageList() ); this.setTree( this.getCraftingTree( cc, what ) ); this.availableCheck = null; diff --git a/src/main/java/appeng/crafting/MECraftingInventory.java b/src/main/java/appeng/crafting/MECraftingInventory.java index 89a8c6232..a5d98dcb4 100644 --- a/src/main/java/appeng/crafting/MECraftingInventory.java +++ b/src/main/java/appeng/crafting/MECraftingInventory.java @@ -187,6 +187,25 @@ public class MECraftingInventory implements IMEInventory this.par = null; } + public MECraftingInventory( final IItemList itemList ) + { + this.localCache = new ItemListIgnoreCrafting<>( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() ); + this.target = null; + this.logExtracted = false; + this.logInjections = false; + this.logMissing = false; + this.missingCache = null; + this.extractedCache = null; + this.injectedCache = null; + + for( IAEItemStack iaeItemStack : itemList ) + { + this.localCache.add( iaeItemStack ); + } + + this.par = null; + } + @Override public IAEItemStack injectItems( final IAEItemStack input, final Actionable mode, final IActionSource src ) { diff --git a/src/main/java/appeng/me/cache/GridStorageCache.java b/src/main/java/appeng/me/cache/GridStorageCache.java index b67eb4004..60b3548fc 100644 --- a/src/main/java/appeng/me/cache/GridStorageCache.java +++ b/src/main/java/appeng/me/cache/GridStorageCache.java @@ -69,7 +69,6 @@ public class GridStorageCache implements IStorageGrid private final HashMap watchers = new HashMap<>(); private final Map, NetworkInventoryHandler> storageNetworks; private final Map, NetworkMonitor> storageMonitors; - private MECraftingInventory localCache = null; private int localDepth; public GridStorageCache( final IGrid g ) @@ -84,7 +83,6 @@ public class GridStorageCache implements IStorageGrid @Override public void onUpdateTick() { - this.localCache = null; this.storageMonitors.forEach( ( channel, monitor ) -> monitor.onTick() ); } @@ -172,15 +170,6 @@ public class GridStorageCache implements IStorageGrid return (IMEMonitor) this.storageMonitors.get( channel ); } - public MECraftingInventory getExtractableList( IActionSource src ) - { - if( localCache == null ) - { - localCache = new MECraftingInventory( getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ), src, false, false, false ); - } - return localCache; - } - private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker ) { if( this.inactiveCellProviders.contains( cc ) )