Jump to content

[1.7.2] Need Help Playing Sounds


TLHPoE

Recommended Posts

I don't know what went wrong, but a couple of versions back (1024), the sounds were working perfectly.

Now, they don't.

 

I call the sounds like this:

worldObj.playSoundAtEntity(player, "realmoffera:coinBag.pickUp", 0.1F, 0.5F * ((UtilRF.RANDOM.nextFloat() - UtilRF.RANDOM.nextFloat()) * 0.7F + 1.8F));

 

I get this in the console:

[10:58:31] [Client thread/WARN]: Unable to play unknown soundEvent: realmoffera:coinBag.pickUp

 

Here are my folders:

bbKwHt1.png

 

Finally, here's my sounds.json file:

{
"mob.mummy.say": {
	"category": "hostile",
	"sounds": [
		"name": "mob/mummy/say"
	]
},
"mob.mummy.death": {
	"category": "hostile",
	"sounds": [
		"name": "mob/mummy/death"
	]
},
"mob.mummy.hurt": {
	"category": "hostile",
	"sounds": [
		"name": "mob/mummy/hurt"
	]
},
"mob.paladin.death": {
	"category": "hostile",
	"sounds": [
		"name": "mob/paladin/death"
	]
},
"mob.paladin.hurt": {
	"category": "hostile",
	"sounds": [
		"name": "mob/paladin/hurt"
	]
},
"coinBag.pickUp": {
	"category": "player",
	"sounds": [
		"name": "coinBag/pickUp1", "coinBag/pickUp2", "coinBag/pickUp3"
	]
}
}

Kain

Link to comment
Share on other sites

I was just scrolling through my console, and I found this:

[11:16:42] [Client thread/WARN]: Invalid sounds.json
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated array at line 5 column 11
at com.google.gson.internal.Streams.parse(Streams.java:56) ~[streams.class:?]
at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?]
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) ~[TypeAdapterRuntimeTypeWrapper.class:?]
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:187) ~[MapTypeAdapterFactory$Adapter.class:?]
at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145) ~[MapTypeAdapterFactory$Adapter.class:?]
at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
at com.google.gson.Gson.fromJson(Gson.java:768) ~[Gson.class:?]
at net.minecraft.client.audio.SoundHandler.onResourceManagerReload(SoundHandler.java:83) [soundHandler.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:527) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:892) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_51]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_51]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
Caused by: com.google.gson.stream.MalformedJsonException: Unterminated array at line 5 column 11
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) ~[JsonReader.class:?]
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:465) ~[JsonReader.class:?]
at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:403) ~[JsonReader.class:?]
at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:658) ~[TypeAdapters$25.class:?]
at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:667) ~[TypeAdapters$25.class:?]
at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:642) ~[TypeAdapters$25.class:?]
at com.google.gson.internal.Streams.parse(Streams.java:44) ~[streams.class:?]
... 17 more

 

I know something is wrong with line 5 at column 11 (I don't know how to count columns?), but it doesn't seem like anything is wrong.

Kain

Link to comment
Share on other sites

I don't think a name : value is allowed inside an array.

{"name1": "value", "name2": 3} <- is object form

["value1", "value2", "value3"]  <- is array form

 

[{"name": "value here"}, {"name": "another value"}] <- objects inside array are allowed

Link to comment
Share on other sites

Mazetar: Does a tab count as a character?

 

sequituri: Nope, :(

 

{ 
"mob.mummy.say": {
	"category": "hostile",
	"sounds": [{
	"mob/mummy/say"
	}]
},
"mob.mummy.death": {
	"category": "hostile",
	"sounds": [{
		"name": "mob/mummy/death"
	}]
},
"mob.mummy.hurt": {
	"category": "hostile",
	"sounds": [{
		"name": "mob/mummy/hurt"
	}]
},
"mob.paladin.death": {
	"category": "hostile",
	"sounds": [{
		"name": "mob/paladin/death"
	}]
},
"mob.paladin.hurt": {
	"category": "hostile",
	"sounds": [{
		"name": "mob/paladin/hurt"
	}]
},
"coinBag.pickUp": {
	"category": "player",
	"sounds": [{
		"name": "coinBag/pickUp1", "coinBag/pickUp2", "coinBag/pickUp3"
	}]
}
}

 

Edit: I got it to work, but I had to cut the amout of sounds in 1 name to 1.

 

{ 
"mob.mummy.say": {
  "category": "hostile",
  "sounds": [{
  "name": "mob/mummy/say"
  }]
},
"mob.mummy.death": {
  "category": "hostile",
  "sounds": [{
   "name": "mob/mummy/death"
  }]
},
"mob.mummy.hurt": {
  "category": "hostile",
  "sounds": [{
   "name": "mob/mummy/hurt"
  }]
},
"mob.paladin.death": {
  "category": "hostile",
  "sounds": [{
   "name": "mob/paladin/death"
  }]
},
"mob.paladin.hurt": {
  "category": "hostile",
  "sounds": [{
   "name": "mob/paladin/hurt"
  }]
},
"coinBag.pickUp": {
  "category": "player",
  "sounds": [{
   "name": "coinBag/pickUp1"
  }]
}
}

Kain

Link to comment
Share on other sites

You shouldn't need to cut the number of sounds down to one; try removing "name", as that may be setting some flag that indicates there is only one sound.

 

EDIT: Curly brackets within the array brackets is neither required nor correct:

[ -sounds- ] is just fine, [{ -sounds- }] breaks the json file format for multiple sound names, though it seemingly works for single sounds.

 

Here is what part of my sounds.json file looks like:

"break_jar": {"category": "block","sounds":["block/ceramic1","block/ceramic2","block/ceramic3","block/ceramic4"]},
"hit_peg": {"category": "block","sounds":["block/hit_peg1","block/hit_peg2","block/hit_peg3","block/hit_peg4"]},
"hit_rusty": {"category": "block","sounds":["block/hit_rusty1","block/hit_rusty2","block/hit_rusty3"]},
"lock_chest": {"category": "block","sounds":["block/lock_chest"]},
"lock_door": {"category": "block","sounds":["block/lock_door"]},
etc.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
    • It is an issue with quark - update it to this build: https://www.curseforge.com/minecraft/mc-mods/quark/files/3642325
    • Remove Instant Massive Structures Mod from your server     Add new crash-reports with sites like https://paste.ee/  
    • Update your drivers: https://www.amd.com/en/support/graphics/amd-radeon-r9-series/amd-radeon-r9-200-series/amd-radeon-r9-280x
  • Topics

×
×
  • Create New...

Important Information

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