Jump to content

Recommended Posts

Posted

Help Please:

 

 

Okay so whenever i try to activate my block directly my sound doubles up. but if i do it from another block touching one side it will play the sound normally. my theory is that when i put a lever or button on it is it accounts for the direct and indirect power. how do i fix this? Also id like to mention it is a stream sound.

 

[
package ---;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockNote;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.modId.mod;

public class SoundBlock1 extends Block{

public SoundBlock1(Material Material) {
	super(Material);
	this.setResistance(4);
	this.setCreativeTab(---.---);
}
public void onBlockAdded(World world, int x, int y, int z){
	if(!world.isRemote){
		if(!world.isBlockIndirectlyGettingPowered(x, y, z)){

		}else if(world.isBlockIndirectlyGettingPowered(x, y, z)){
			world.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "Sound Goes Here", 1.0F, 0.0F + 1.0F);
		}
	}
}

public void onNeighborBlockChange(World world, int x, int y, int z, Block block){
	if(!world.isRemote){
		if(!world.isBlockIndirectlyGettingPowered(x, y, z)){

		}else if(world.isBlockIndirectlyGettingPowered(x, y, z)){
			world.playSoundEffect((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "Sound", 1.0F, 0.0F + 1.0F);
		}
	}
}

@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister){
this.blockIcon = iconRegister.registerIcon(net.modid + ":" + this.getUnlocalizedName().substring(5));
}
}]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.