Fixed Bug: #0620 - Breaks parts now is consistent with breaking blocks.

This commit is contained in:
AlgorithmX2 2014-09-04 22:42:48 -05:00
parent a29bbac78d
commit 2356b7ce57
5 changed files with 48 additions and 12 deletions

View file

@ -440,16 +440,16 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
{ {
AEBaseTile te = getTileEntity( w, x, y, z ); AEBaseTile te = getTileEntity( w, x, y, z );
if ( te != null ) if ( te != null )
{
if ( te.dropItems )
{ {
ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
if ( te.dropItems() )
te.getDrops( w, x, y, z, drops ); te.getDrops( w, x, y, z, drops );
else
te.getNoDrops( w, x, y, z, drops );
// Cry ;_; ... // Cry ;_; ...
Platform.spawnDrops( w, x, y, z, drops ); Platform.spawnDrops( w, x, y, z, drops );
} }
}
super.breakBlock( w, x, y, z, a, b ); super.breakBlock( w, x, y, z, a, b );
if ( te != null ) if ( te != null )

View file

@ -282,7 +282,7 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
{ {
AEBaseTile tile = getTileEntity( world, x, y, z ); AEBaseTile tile = getTileEntity( world, x, y, z );
if ( tile != null ) if ( tile != null )
tile.dropItems = false; tile.disableDrops();
// maybe ray trace? // maybe ray trace?
} }
return super.removedByPlayer( world, player, x, y, z ); return super.removedByPlayer( world, player, x, y, z );

View file

@ -731,6 +731,20 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
return drops; return drops;
} }
public List getNoDrops(List drops)
{
for (ForgeDirection s : ForgeDirection.values())
{
IPart part = getPart( s );
if ( part != null )
{
part.getDrops( drops, false );
}
}
return drops;
}
@Override @Override
public void markForUpdate() public void markForUpdate()
{ {

View file

@ -3,6 +3,7 @@ package appeng.tile;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumMap; import java.util.EnumMap;
@ -44,7 +45,19 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
private ForgeDirection forward = ForgeDirection.UNKNOWN; private ForgeDirection forward = ForgeDirection.UNKNOWN;
private ForgeDirection up = ForgeDirection.UNKNOWN; private ForgeDirection up = ForgeDirection.UNKNOWN;
public boolean dropItems = true; public static ThreadLocal<WeakReference<AEBaseTile>> dropNoItems = new ThreadLocal();
public void disableDrops()
{
dropNoItems.set( new WeakReference<AEBaseTile>( this ) );
}
public boolean dropItems()
{
WeakReference<AEBaseTile> what = dropNoItems.get();
return what == null || what.get() != this;
}
public int renderFragment = 0; public int renderFragment = 0;
public String customName; public String customName;
@ -366,6 +379,11 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
} }
public void getNoDrops(World w, int x, int y, int z, ArrayList<ItemStack> drops)
{
}
public void onReady() public void onReady()
{ {
@ -450,9 +468,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
public void securityBreak() public void securityBreak()
{ {
worldObj.func_147480_a( xCoord, yCoord, zCoord, true ); // worldObj.destroyBlock( xCoord, yCoord, zCoord, true worldObj.func_147480_a( xCoord, yCoord, zCoord, true );
// ); disableDrops();
dropItems = false;
} }
public void saveChanges() public void saveChanges()

View file

@ -162,6 +162,11 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl
cb.getDrops( drops ); cb.getDrops( drops );
} }
public void getNoDrops(World w, int x, int y, int z, ArrayList<ItemStack> drops)
{
cb.getNoDrops( drops );
}
@Override @Override
public IGridNode getGridNode(ForgeDirection dir) public IGridNode getGridNode(ForgeDirection dir)
{ {