Skip to content

Commit

Permalink
fix some bugs that allow us to dupe any items.
Browse files Browse the repository at this point in the history
  • Loading branch information
xsun committed Feb 16, 2017
1 parent f558e64 commit 24b6d69
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
aeversion=rv3
aechannel=alpha
aebuild=0
aechannel=beta
aebuild=7
aegroup=appeng
aebasename=appliedenergistics2

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/appeng/container/AEBaseContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
24 changes: 16 additions & 8 deletions src/main/java/appeng/me/cache/GridStorageCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
}
}

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
}
Expand Down

0 comments on commit 24b6d69

Please sign in to comment.