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

@ -441,14 +441,14 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
AEBaseTile te = getTileEntity( w, x, y, z );
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 );
else
te.getNoDrops( w, x, y, z, drops );
// Cry ;_; ...
Platform.spawnDrops( w, x, y, z, drops );
}
// Cry ;_; ...
Platform.spawnDrops( w, x, y, z, drops );
}
super.breakBlock( w, x, y, z, a, b );
@ -532,7 +532,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
if ( Platform.isClient() )
{
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset(player ) );
LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) );
Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z, Minecraft.getMinecraft().thePlayer, true );
AxisAlignedBB br = null;

View file

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

View file

@ -731,6 +731,20 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
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
public void markForUpdate()
{

View file

@ -3,6 +3,7 @@ package appeng.tile;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.EnumMap;
@ -44,7 +45,19 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
private ForgeDirection forward = 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 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()
{
@ -450,9 +468,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
public void securityBreak()
{
worldObj.func_147480_a( xCoord, yCoord, zCoord, true ); // worldObj.destroyBlock( xCoord, yCoord, zCoord, true
// );
dropItems = false;
worldObj.func_147480_a( xCoord, yCoord, zCoord, true );
disableDrops();
}
public void saveChanges()

View file

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