-
Posts
13 -
Joined
-
Last visited
Recent Profile Visitors
861 profile views
leduyquang753's Achievements

Tree Puncher (2/8)
0
Reputation
-
leduyquang753 changed their profile photo
-
I am creating a StandingArrowSign block with 2 blockstate values: rotation: Stores the direction the sign is facing, like Vanilla signs | int, 0-15. arrowFacing: Stores the direction of the arrow on its face | int, 0-7. public static final PropertyInteger arrowFacing = PropertyInteger.create("arrowfacing", 0, 7); public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15); There are 16.8=128 possible combinations of these two blockstates, 8 times more than the 16 limit of metadata. So I only stored the rotation value into metadata, and overrid the getActualState method of parent class Block: @Override public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { return state.withProperty(arrowFacing, world.getBlockState(pos).getValue(arrowFacing)); } like the docs said. But reloading the world still resets the rotation to default. My whole class: How to make this value be written into the world saves, like other Vanilla blocks do?
-
-
Putting a package into another package doesn't maen it is a "child" package. In order to make a sub-package of for example com.somethingAwesome with the name anAwesomeThing, you have to make a separate package with the name com.somethingAwesome.anAwesomeThing.
-
Here is the whole source with a slightly modified version of xxmicloxx's Note Block API. NBS-Player.zip The classes worth seeing are cf.leduyquang753.nbsplayer.Main, com.xxmicloxx.NoteBlockAPI.SongPlayer / NoteBlockSongPlayer / SongPlayer, the class NoteBlockSongPlayer is the class that is making errors...
-
So I am making a Forge 1.12 mod that can play note block song (.nbs) files. But when I tried to play note block sounds to the client: String name = Instrument.getInstrument(note.getInstrument()); // One of "block.note.harp", "block.note.bass", "block.note.basedrum",... float pitch = (float)Math.pow(2.0D, (double)(note.getKey - 45) / 12.0D); // Ranges from 1 to 2. Minecraft.getMinecraft().player.playSound(new SoundEvent(new ResourceLocation("minecraft", name)), 1F, pitch); it throws ConcurrentModificationException: [8 | 22/4/2018 14h07:55] [main/FATAL]: Unreported exception thrown! java.util.ConcurrentModificationException: null at com.google.common.collect.HashBiMap$Itr.hasNext(HashBiMap.java:401) ~[guava-21.0.jar:?] at net.minecraft.client.audio.SoundManager.updateAllSounds(SoundManager.java:272) ~[SoundManager.class:?] at net.minecraft.client.audio.SoundHandler.update(SoundHandler.java:297) ~[SoundHandler.class:?] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1983) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Another thing to note is the mod plays multiple sounds at once. Is this the right way to play multiple sounds in Forge? Or is there another way to handle this?
-
Get pitch of sound causes NullPointerException
leduyquang753 replied to leduyquang753's topic in Modder Support
But, there aren't anything to retrieve from the ISoundEventListener class or soundPlay method? The whole class is just... package net.minecraft.client.audio; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public interface ISoundEventListener { void soundPlay(ISound soundIn, SoundEventAccessor accessor); } and nothing else? -
Get pitch of sound causes NullPointerException
leduyquang753 replied to leduyquang753's topic in Modder Support
Uhhh, I'm confused because the ISoundEventListener class seems to be having only one method which maybe used to trigger the event: void soundPlay(ISound soundIn, SoundEventAccessor accessor); Did you tell me to hook up to something related to this? I need these things when a sound is played: The name and the pitch of the sound. -
So I am working on my project NBS Recorder for 1.12 and I need to get the pitch of sounds in order to record them. However, when I try getting the pitch of a sound on PlaySoundEvent: event.getSound().getPitch() it fires NullPointerException: [14:10:57] [main/ERROR] [FML]: Exception caught during firing event net.minecraftforge.client.event.sound.PlaySoundEvent@7e4594ac: java.lang.NullPointerException: null at net.minecraft.client.audio.PositionedSound.getPitch(PositionedSound.java:90) ~[PositionedSound.class:?] at cf.leduyquang753.nbsrecorder.Events.onSound(Events.java:47) ~[Events.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_13_Events_onSound_PlaySoundEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?] at net.minecraftforge.client.ForgeHooksClient.playSound(ForgeHooksClient.java:353) [ForgeHooksClient.class:?] at net.minecraft.client.audio.SoundManager.playSound(SoundManager.java:375) [SoundManager.class:?] at net.minecraft.client.audio.SoundHandler.playSound(SoundHandler.java:261) [SoundHandler.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:518) [WorldClient.class:?] at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:497) [WorldClient.class:?] at net.minecraft.client.network.NetHandlerPlayClient.handleSoundEffect(NetHandlerPlayClient.java:1828) [NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:78) [SPacketSoundEffect.class:?] at net.minecraft.network.play.server.SPacketSoundEffect.processPacket(SPacketSoundEffect.java:13) [SPacketSoundEffect.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) [PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_131] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_131] at net.minecraft.util.Util.runTask(Util.java:53) [Util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1176) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] I'm so confused now because this is the only way to record sounds for my mod (maybe not)...