Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

YaBoiChips

Members
  • Joined

  • Last visited

  1. so im having an issue in making a bag. i want to right click on the bag and it opens. yet i cant find a way to make a inventory without a tile entity and i cant link a tile entity to a item https://pastebin.com/LwuCxSfK (this is my container class) how would i link that to say CharmBagItem? https://pastebin.com/Z9eYX2TC (registry)
  2. alright here's what i got Sound: https://pastebin.com/mYrzU3vn SoundHandler: https://pastebin.com/g3QxTusJ still isnt working. what do i need to change i dont see anything that i did wrong
  3. i have no idea how to use SoundHandler. can u send me an example? i cant find one online. thanks for all ur help so far
  4. i want to play a sound when i hold an item (specificaly a lightsaber and have it buzz) i got that to work before but the sound wouldnt stop so im trying a different method
  5. ya uhhhhhhhh can u link me to something that uses that im not 100% sure on how they work
  6. here is the sound event i made public class SaberSoundEvent extends TickableSound { private final ClientPlayerEntity player; public SaberSoundEvent(ClientPlayerEntity playerIn){ super(SoundList.BUZZ, SoundCategory.NEUTRAL); this.player = playerIn; this.attenuationType = ISound.AttenuationType.NONE; this.repeat = true; this.repeatDelay = 0; this.volume = 0.1F; } public void tick() { if (this.player.getHeldItemMainhand().getItem() == ItemList.blue_lightsaber) { this.x = (float) this.player.getPosX(); this.y = (float) this.player.getPosY(); this.z = (float) this.player.getPosZ(); this.volume = 0.0F + 1.0F; this.pitch = 0.7F + 0.5F; } else { this.donePlaying = true; } } } what have i done wrong do i have to override or subscribe the event?
  7. alright so ive converted it to a tickable sound public class SaberSoundEvent extends TickableSound { private final ClientPlayerEntity player; public SaberSoundEvent(ClientPlayerEntity playerIn){ super(SoundList.BUZZ, SoundCategory.NEUTRAL); this.player = playerIn; this.attenuationType = ISound.AttenuationType.NONE; this.repeat = true; this.repeatDelay = 0; this.volume = 0.1F; } public void tick() { if (this.player.getHeldItemMainhand().getItem() == ItemList.blue_lightsaber) { this.x = (float) this.player.getPosX(); this.y = (float) this.player.getPosY(); this.z = (float) this.player.getPosZ(); this.volume = 0.0F + 1.0F; this.pitch = 0.7F + 0.5F; } else { this.donePlaying = true; } } } kinda based it on a few things. but it wont play the sound now, do i need to subscribe it or register it?
  8. so i cant use playertickevent then. so i have to re-write it (also @OnlyIn is what they use in vanilla)
  9. @OnlyIn(Dist.CLIENT) public class ModSoundEvent { @SubscribeEvent public void soundEvent(TickEvent.PlayerTickEvent event){ { if (event.player.getHeldItemMainhand().getItem() == ItemList.blue_lightsaber) { event.player.playSound(SoundList.BUZZ, 0.5f, 1.0f);} else { event.player.playSound(SoundList.HURT,0.5f, 1.0f); } } alright (srry for late didnt code for a few days) i made it only in the client and i figured out kinda what i need to do but i dont know how to stop a sound with TickEvent. is it possible or do i have to redo it (i tried doing it the way MinecrartTickableSound does it and it didnt work. thanks for the tip anyways i figured out some stuff with it)
  10. I have made a sound event to play a sound when holding an item. but now i cant figure out how to stop playing the sound when you stop holding the item public class ModSoundEvent { @SubscribeEvent public void SoundEvent(TickEvent.PlayerTickEvent event) { { if (event.player.getHeldItemMainhand().getItem() == ItemList.blue_lightsaber) { event.player.playSound(SoundList.BUZZ, 0.5f, 1.0f); } } how would i make this happen would i add an if statement after and is there something like .stopSound available to use??? thanks in advance
  11. i got this now yet it doesn't work. i think I'm overriding in the wrong spot where would i put it? @Overide public void inventoryTick(ItemStack stack, Entity entityIn, boolean isSelected) { if (stack.getItem() == ItemList.blue_lightsaber && isSelected) { entityIn.playSound(SoundEvents.AMBIENT_CAVE, 10.0f, 1.0f); } }
  12. alright ive gone and done that does that help
  13. thanks for the advice is there a paste code thing like discord or should i just format it?
  14. YaBoiChips joined the community
  15. this is the code i have (edited it may work now) https://pastebin.com/q09EtFMA i have 0 clue why it wont work (ambient cave is a placeholder) im on forge 1.15

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.