From 24b6d69c087003812599576e1d6b27b30a74e6e6 Mon Sep 17 00:00:00 2001 From: xsun <1563770452@qq.com> Date: Thu, 16 Feb 2017 20:02:40 +0800 Subject: [PATCH] fix some bugs that allow us to dupe any items. --- gradle.properties | 4 ++-- .../appeng/container/AEBaseContainer.java | 4 ++-- .../appeng/me/cache/GridStorageCache.java | 24 ++++++++++++------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index a709a63ad9a..b8257bfdadb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ aeversion=rv3 -aechannel=alpha -aebuild=0 +aechannel=beta +aebuild=7 aegroup=appeng aebasename=appliedenergistics2 diff --git a/src/main/java/appeng/container/AEBaseContainer.java b/src/main/java/appeng/container/AEBaseContainer.java index bfcfd9de88f..548c45c4143 100644 --- a/src/main/java/appeng/container/AEBaseContainer.java +++ b/src/main/java/appeng/container/AEBaseContainer.java @@ -547,14 +547,14 @@ public ItemStack transferStackInSlot( final EntityPlayer p, final int idx ) { if( Platform.isSameItemPrecise( destination, tis ) ) { - return null; + break; } else if( destination == null ) { cs.putStack( tis.copy() ); cs.onSlotChanged(); this.updateSlot( cs ); - return null; + break; } } } diff --git a/src/main/java/appeng/me/cache/GridStorageCache.java b/src/main/java/appeng/me/cache/GridStorageCache.java index 1b6bc3e4c97..975b869b465 100644 --- a/src/main/java/appeng/me/cache/GridStorageCache.java +++ b/src/main/java/appeng/me/cache/GridStorageCache.java @@ -87,15 +87,19 @@ public void removeNode( final IGridNode node, final IGridHost machine ) if( machine instanceof ICellContainer ) { final ICellContainer cc = (ICellContainer) machine; + final CellChangeTracker tracker = new CellChangeTracker(); - this.getGrid().postEvent( new MENetworkCellArrayUpdate() ); - this.removeCellProvider( cc, new CellChangeTracker() ).applyChanges(); this.inactiveCellProviders.remove( cc ); + this.removeCellProvider( cc, tracker ); + this.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + + tracker.applyChanges(); } if( machine instanceof IStackWatcherHost ) { final IStackWatcher myWatcher = this.watchers.get( machine ); + if( myWatcher != null ) { myWatcher.clear(); @@ -113,9 +117,13 @@ public void addNode( final IGridNode node, final IGridHost machine ) this.inactiveCellProviders.add( cc ); this.getGrid().postEvent( new MENetworkCellArrayUpdate() ); + if( node.isActive() ) { - this.addCellProvider( cc, new CellChangeTracker() ).applyChanges(); + final CellChangeTracker tracker = new CellChangeTracker(); + + this.addCellProvider( cc, tracker ); + tracker.applyChanges(); } } @@ -177,10 +185,10 @@ private CellChangeTracker removeCellProvider( final ICellProvider cc, final Cell { if( this.activeCellProviders.contains( cc ) ) { - this.inactiveCellProviders.add( cc ); this.activeCellProviders.remove( cc ); BaseActionSource actionSrc = new BaseActionSource(); + if( cc instanceof IActionHost ) { actionSrc = new MachineSource( (IActionHost) cc ); @@ -214,22 +222,22 @@ public void cellUpdate( final MENetworkCellArrayUpdate ev ) for( final ICellProvider cc : ll ) { - boolean Active = true; + boolean active = true; if( cc instanceof IActionHost ) { final IGridNode node = ( (IActionHost) cc ).getActionableNode(); if( node != null && node.isActive() ) { - Active = true; + active = true; } else { - Active = false; + active = false; } } - if( Active ) + if( active ) { this.addCellProvider( cc, tracker ); }