Java Code Examples for net.minecraft.world.World#playAuxSFX()

The following examples show how to use net.minecraft.world.World#playAuxSFX() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
public int onWandRightClick(World world, ItemStack wandstack, EntityPlayer player, int x, int y, int z, int side, int md) {
    if (!world.isRemote) {
        this.drop = false;
        world.setBlock(x, y, z, ConfigBlocks.blockAiry, 0, 3);
        TileExtendedNode tn = (TileExtendedNode) world.getTileEntity(x, y, z);
        if (tn != null) {
            tn.setAspects(getAspects());
            tn.setNodeModifier(getNodeModifier());
            tn.setNodeType(getNodeType());
            tn.setExtendedNodeType(getExtendedNodeType());
            new Injector(tn, TileNode.class).setField("id", getId());
            tn.readBehaviorSnapshot(getBehaviorSnapshot());
            world.markBlockForUpdate(x, y, z);
            tn.markDirty();
        }
    }
    world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(ConfigBlocks.blockJar) + 61440);
    player.worldObj.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "random.glass", 1.0F, 0.9F + player.worldObj.rand.nextFloat() * 0.2F, false);
    player.swingItem();
    return 0;
}
 
Example 2
Source Project: ExtraCells1   File: BlockMEDropper.java    License: MIT License 5 votes vote down vote up
protected void dispense(World world, int x, int y, int z, ItemStack toDispense)
{
	BlockSourceImpl blockSource = new BlockSourceImpl(world, x, y, z);
	world.playAuxSFX(1001, x, y, z, 0);
	IBehaviorDispenseItem ibehaviordispenseitem = getBehaviorForItemStack(toDispense);
	ibehaviordispenseitem.dispense(blockSource, toDispense);
}
 
Example 3
Source Project: Artifacts   File: BlockTrap.java    License: MIT License 5 votes vote down vote up
protected void dispense(World par1World, int par2, int par3, int par4, int i)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(par1World, par2, par3, par4, i);
    TileEntityTrap tileentitydispenser = (TileEntityTrap)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int l = -1;
        int c = 0;
        do {
        	l = tileentitydispenser.func_146017_i();
        	if(l > 0 && getBehaviorForItemStack(tileentitydispenser.getStackInSlot(l)) == defaultBehavior) {
        		l = -5;
        		c++;
        	}
        } while(l < -2 && c < 20);
        if (l < 0)
        {
            par1World.playAuxSFX(1001, par2, par3, par4, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(l);
            IBehaviorTrapItem ibehaviordispenseitem = this.getBehaviorForItemStack(itemstack);
            
            if (ibehaviordispenseitem != IBehaviorTrapItem.itemDispenseBehaviorProvider)
            {
                //ItemStack itemstack1 = ibehaviordispenseitem.dispense((IBlockSource) blocksourceimpl, itemstack);
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize <= 0 ? null : itemstack1);
            }
        }
    }
}
 
Example 4
Source Project: Et-Futurum   File: Sponge.java    License: The Unlicense 4 votes vote down vote up
protected void tryAbsorb(World worldIn, int x, int y, int z, boolean wet) {
	if (!wet && absorb(worldIn, x, y, z)) {
		worldIn.setBlockMetadataWithNotify(x, y, z, 1, 2);
		worldIn.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(Blocks.water));
	}
}