User Tools

Site Tools


tutorial:sounds

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
tutorial:sounds [2019/08/06 18:36] fudgetutorial:sounds [2019/08/13 15:31] – fixed dedis crash fudge
Line 21: Line 21:
 public class ExampleBlock extends Block { public class ExampleBlock extends Block {
     [...]     [...]
 +    
     @Override     @Override
     public boolean activate(BlockState blockState, World world, BlockPos blockPos, PlayerEntity placedBy, Hand hand, BlockHitResult blockHitResult) {     public boolean activate(BlockState blockState, World world, BlockPos blockPos, PlayerEntity placedBy, Hand hand, BlockHitResult blockHitResult) {
Line 67: Line 68:
 public class ExampleMod { public class ExampleMod {
     [...]     [...]
-    public static SoundEvent MY_SOUND_EVENT new SoundEvent(new Identifier("tutorial:my_sound"));+    public static final Identifier MY_SOUND_ID = new Identifier("tutorial:my_sound") 
 +    public static SoundEvent MY_SOUND_EVENT = new SoundEvent(MY_SOUND_ID);
 } }
 </code> </code>
Line 76: Line 78:
 public void onInitialize(){ public void onInitialize(){
      [...]      [...]
-     Registry.register(Registry.SOUND_EVENT, MY_SOUND_EVENT.getId(), MY_SOUND_EVENT);+     Registry.register(Registry.SOUND_EVENT, ExampleMod.MY_SOUND_ID, MY_SOUND_EVENT);
  
 </code> </code>
tutorial/sounds.txt · Last modified: 2023/01/09 18:20 by slainlight