check if actually added before removing (#3639)

Fixes #3634
This commit is contained in:
fscan
2018-08-01 00:17:10 +02:00
committed by GitHub
parent ad1eff2adb
commit 8a72ebca89
2 changed files with 1 additions and 17 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
@Override
public void securityBreak()
{
if( this.getItemStack().getCount() > 0 )
if( this.getItemStack().getCount() > 0 && this.getGridNode() != null )
{
final List<ItemStack> items = new ArrayList<>();
items.add( this.is.copy() );
@@ -19,9 +19,7 @@
package appeng.parts.misc;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -48,7 +46,6 @@ import appeng.items.parts.PartModels;
import appeng.me.helpers.AENetworkProxy;
import appeng.parts.PartBasicState;
import appeng.parts.PartModel;
import appeng.util.Platform;
public class PartToggleBus extends PartBasicState
@@ -105,19 +102,6 @@ public class PartToggleBus extends PartBasicState
return AECableType.GLASS;
}
@Override
public void securityBreak()
{
if( this.getItemStack().getCount() > 0 )
{
final List<ItemStack> items = new ArrayList<>();
items.add( this.getItemStack().copy() );
this.getHost().removePart( this.getSide(), false );
Platform.spawnDrops( this.getTile().getWorld(), this.getTile().getPos(), items );
this.getItemStack().setCount( 0 );
}
}
@Override
public void getBoxes( final IPartCollisionHelper bch )
{