Jump to content

YaBoiChips

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by YaBoiChips

  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. thanks for the advice is there a paste code thing like discord or should i just format it?
  13. 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
×
×
  • Create New...

Important Information

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