Pipes replace blocks like grass, vines, etc.
Pipe place sound.
This commit is contained in:
parent
bc788e3f9c
commit
209f382aee
1 changed files with 32 additions and 27 deletions
|
@ -32,29 +32,35 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int side, float par8, float par9, float par10) {
|
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;
|
int blockID = BuildCraftTransport.genericPipeBlock.blockID;
|
||||||
|
Block block = BuildCraftTransport.genericPipeBlock;
|
||||||
|
|
||||||
if (world.getBlockId(i, j, k) == Block.snow.blockID) {
|
int id = world.getBlockId(i, j, k);
|
||||||
side = 0;
|
|
||||||
} else {
|
if (id == Block.snow.blockID) {
|
||||||
if (side == 0) {
|
side = 1;
|
||||||
j--;
|
}
|
||||||
}
|
else if (id != Block.vine.blockID && id != Block.tallGrass.blockID && id != Block.deadBush.blockID
|
||||||
if (side == 1) {
|
&& (Block.blocksList[id] == null || !Block.blocksList[id].isBlockReplaceable(world, i, j, k)))
|
||||||
j++;
|
{
|
||||||
}
|
if (side == 0) {
|
||||||
if (side == 2) {
|
j--;
|
||||||
k--;
|
}
|
||||||
}
|
if (side == 1) {
|
||||||
if (side == 3) {
|
j++;
|
||||||
k++;
|
}
|
||||||
}
|
if (side == 2) {
|
||||||
if (side == 4) {
|
k--;
|
||||||
i--;
|
}
|
||||||
}
|
if (side == 3) {
|
||||||
if (side == 5) {
|
k++;
|
||||||
i++;
|
}
|
||||||
}
|
if (side == 4) {
|
||||||
}
|
i--;
|
||||||
|
}
|
||||||
|
if (side == 5) {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (itemstack.stackSize == 0)
|
if (itemstack.stackSize == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -64,11 +70,10 @@ public class ItemPipe extends ItemBuildCraft implements IItemPipe {
|
||||||
if (BlockGenericPipe.placePipe(pipe, world, i, j, k, blockID, 0)) {
|
if (BlockGenericPipe.placePipe(pipe, world, i, j, k, blockID, 0)) {
|
||||||
|
|
||||||
Block.blocksList[blockID].onBlockPlacedBy(world, i, j, k, entityplayer);
|
Block.blocksList[blockID].onBlockPlacedBy(world, i, j, k, entityplayer);
|
||||||
// To move to a proxt
|
world.playSoundEffect(i + 0.5F, j + 0.5F, k + 0.5F,
|
||||||
// world.playSoundEffect((float)i + 0.5F, (float)j + 0.5F,
|
block.stepSound.getPlaceSound(),
|
||||||
// (float)k + 0.5F, block.stepSound.func_1145_d(),
|
(block.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||||
// (block.stepSound.getVolume() + 1.0F) / 2.0F,
|
block.stepSound.getPitch() * 0.8F);
|
||||||
// block.stepSound.getPitch() * 0.8F);
|
|
||||||
itemstack.stackSize--;
|
itemstack.stackSize--;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue