Posted September 25, 201410 yr 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)); } }]
September 28, 201410 yr Author Haha Thanks very much i was able to solve the problem looking into some of the dispenser code! So thanks!
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.