Pipes replace blocks like grass, vines, etc.

Pipe place sound.
This commit is contained in:
tcooc 2012-12-21 16:28:37 -05:00
parent bc788e3f9c
commit 209f382aee

View file

@ -32,10 +32,16 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int side, float par8, float par9, float par10) {
int blockID = BuildCraftTransport.genericPipeBlock.blockID;
Block block = BuildCraftTransport.genericPipeBlock;
if (world.getBlockId(i, j, k) == Block.snow.blockID) {
side = 0;
} else {
int id = world.getBlockId(i, j, k);
if (id == Block.snow.blockID) {
side = 1;
}
else if (id != Block.vine.blockID && id != Block.tallGrass.blockID && id != Block.deadBush.blockID
&& (Block.blocksList[id] == null || !Block.blocksList[id].isBlockReplaceable(world, i, j, k)))
{
if (side == 0) {
j--;
}
@ -64,11 +70,10 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
if (BlockGenericPipe.placePipe(pipe, world, i, j, k, blockID, 0)) {
Block.blocksList[blockID].onBlockPlacedBy(world, i, j, k, entityplayer);
// To move to a proxt
// world.playSoundEffect((float)i + 0.5F, (float)j + 0.5F,
// (float)k + 0.5F, block.stepSound.func_1145_d(),
// (block.stepSound.getVolume() + 1.0F) / 2.0F,
// block.stepSound.getPitch() * 0.8F);
world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F,
block.stepSound.getPlaceSound(),
(block.stepSound.getVolume() + 1.0F) / 2.0F,
block.stepSound.getPitch() * 0.8F);
itemstack.stackSize--;
}
return true;