Posted October 30, 201213 yr package gluszak.minecraft.pedowiewiur; import java.util.Random; import net.minecraft.src.Block; import net.minecraft.src.EntityPlayer; import net.minecraft.src.Material; import net.minecraft.src.World; public class BlockDuba extends GenericBlock{ public BlockDuba(int id, int texture, Material material) { super(id, texture, material); } public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { par1World.playSound(par2, par3, par4, "step.grass", 100f, 0f); par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 100); return true; } public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { par1World.playSound(par2, par3, par4, "step.grass", 100f, 0f); System.out.println("asd"); } } "asd" shows up but sound plays only once
October 30, 201213 yr You have to schedule the update again at the end of updateTick, unless you set the block to tick randomly.
October 30, 201213 yr Author Hey, you didn't understand me. I don't want to play the sound all the time but only twice: once when i click a block and again after some time. But it plays only when i click on the block and it should also play when "asd" shows up in the console.
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.