
YaBoiChips
Members-
Posts
14 -
Joined
-
Last visited
Everything posted by YaBoiChips
-
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)
-
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
-
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
-
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
-
ya uhhhhhhhh can u link me to something that uses that im not 100% sure on how they work
-
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?
-
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?
-
so i cant use playertickevent then. so i have to re-write it (also @OnlyIn is what they use in vanilla)
-
@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)
-
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
-
How to call a sound to be played when an item is held
YaBoiChips replied to YaBoiChips's topic in Modder Support
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); } } -
How to call a sound to be played when an item is held
YaBoiChips replied to YaBoiChips's topic in Modder Support
alright ive gone and done that does that help -
How to call a sound to be played when an item is held
YaBoiChips replied to YaBoiChips's topic in Modder Support
thanks for the advice is there a paste code thing like discord or should i just format it? -
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