Merge pull request #2805 from halvors/fix/get-pick-block

Update getPickBlock() to use the new non-deprecated version.
This commit is contained in:
Aidan 2015-07-08 09:28:44 -07:00
commit b743618186
5 changed files with 14 additions and 15 deletions

View file

@ -51,11 +51,11 @@ public class BlockBounding extends Block implements IPeripheralProvider
} }
@Override @Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
{ {
try { try {
TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(x, y, z); TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(x, y, z);
return world.getBlock(tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ).getPickBlock(target, world, tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ); return world.getBlock(tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ).getPickBlock(target, world, tileEntity.mainX, tileEntity.mainY, tileEntity.mainZ, player);
} catch(Exception e) { } catch(Exception e) {
return null; return null;
} }

View file

@ -129,7 +129,7 @@ public class BlockCardboardBox extends BlockContainer
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock) public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
{ {
ItemStack itemStack = getPickBlock(null, world, x, y, z); ItemStack itemStack = getPickBlock(null, world, x, y, z, null);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
@ -149,7 +149,7 @@ public class BlockCardboardBox extends BlockContainer
} }
@Override @Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
{ {
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(x, y, z); TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(x, y, z);
@ -176,7 +176,7 @@ public class BlockCardboardBox extends BlockContainer
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z)); EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z, player));
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
} }

View file

@ -204,8 +204,7 @@ public class BlockEnergyCube extends BlockContainer implements IPeripheralProvid
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z)); EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z, player));
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
} }
@ -238,7 +237,7 @@ public class BlockEnergyCube extends BlockContainer implements IPeripheralProvid
} }
@Override @Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
{ {
TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(x, y, z); TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(MekanismBlocks.EnergyCube); ItemStack itemStack = new ItemStack(MekanismBlocks.EnergyCube);
@ -257,7 +256,7 @@ public class BlockEnergyCube extends BlockContainer implements IPeripheralProvid
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock) public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
{ {
ItemStack itemStack = getPickBlock(null, world, x, y, z); ItemStack itemStack = getPickBlock(null, world, x, y, z, null);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);

View file

@ -142,7 +142,7 @@ public class BlockGasTank extends BlockContainer
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z)); EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z, player));
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
} }
@ -152,7 +152,7 @@ public class BlockGasTank extends BlockContainer
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock) public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
{ {
ItemStack itemStack = getPickBlock(null, world, x, y, z); ItemStack itemStack = getPickBlock(null, world, x, y, z, null);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
@ -208,7 +208,7 @@ public class BlockGasTank extends BlockContainer
} }
@Override @Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
{ {
TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(x, y, z); TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(MekanismBlocks.GasTank); ItemStack itemStack = new ItemStack(MekanismBlocks.GasTank);

View file

@ -447,7 +447,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds, IP
double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; double motionY = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D; double motionZ = (world.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z)); EntityItem entityItem = new EntityItem(world, x + motionX, y + motionY, z + motionZ, getPickBlock(null, world, x, y, z, player));
world.spawnEntityInWorld(entityItem); world.spawnEntityInWorld(entityItem);
} }
@ -456,7 +456,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds, IP
} }
@Override @Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
{ {
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getTileEntity(x, y, z); TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(GeneratorsBlocks.Generator, 1, world.getBlockMetadata(x, y, z)); ItemStack itemStack = new ItemStack(GeneratorsBlocks.Generator, 1, world.getBlockMetadata(x, y, z));
@ -493,7 +493,7 @@ public class BlockGenerator extends BlockContainer implements ISpecialBounds, IP
public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock) public ItemStack dismantleBlock(World world, int x, int y, int z, boolean returnBlock)
{ {
ItemStack itemStack = getPickBlock(null, world, x, y, z); ItemStack itemStack = getPickBlock(null, world, x, y, z, null);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);