/// <summary> /// Called when the block is clicked by a player. Args: x, y, z, entityPlayer /// </summary> public override void OnBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) { if (par1World.IsRemote) { return; } TileEntityNote tileentitynote = (TileEntityNote)par1World.GetBlockTileEntity(par2, par3, par4); if (tileentitynote != null) { tileentitynote.TriggerNote(par1World, par2, par3, par4); } }
/// <summary> /// Called upon block activation (left or right click on the block.). The three integers represent x,y,z of the /// block. /// </summary> public override bool BlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) { if (par1World.IsRemote) { return(true); } TileEntityNote tileentitynote = (TileEntityNote)par1World.GetBlockTileEntity(par2, par3, par4); if (tileentitynote != null) { tileentitynote.ChangePitch(); tileentitynote.TriggerNote(par1World, par2, par3, par4); } return(true); }
/// <summary> /// Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are /// their own) Args: x, y, z, neighbor BlockID /// </summary> public override void OnNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { if (par5 > 0) { bool flag = par1World.IsBlockIndirectlyGettingPowered(par2, par3, par4); TileEntityNote tileentitynote = (TileEntityNote)par1World.GetBlockTileEntity(par2, par3, par4); if (tileentitynote != null && tileentitynote.PreviousRedstoneState != flag) { if (flag) { tileentitynote.TriggerNote(par1World, par2, par3, par4); } tileentitynote.PreviousRedstoneState = flag; } } }