Fixed Bug: #0620 - Breaks parts now is consistent with breaking blocks.
This commit is contained in:
parent
a29bbac78d
commit
2356b7ce57
5 changed files with 48 additions and 12 deletions
|
@ -441,14 +441,14 @@ 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>();
|
||||||
{
|
if ( te.dropItems() )
|
||||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
|
||||||
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 );
|
||||||
|
@ -532,7 +532,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
||||||
if ( Platform.isClient() )
|
if ( Platform.isClient() )
|
||||||
{
|
{
|
||||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
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 );
|
Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxsFromPool( w, x, y, z, Minecraft.getMinecraft().thePlayer, true );
|
||||||
AxisAlignedBB br = null;
|
AxisAlignedBB br = null;
|
||||||
|
|
|
@ -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 );
|
||||||
|
|
|
@ -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()
|
||||||
{
|
{
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue