#ProtocolLib sounds

1 messages · Page 1 of 1 (latest)

heavy stag
#

How can i differentiate between sounds?

#

So

#

what i have so far is

#

Now i need to figure out how to get the data from the packet

vast yew
#

ProtocolLib utilizes a thing called uhh

#

Structure modifiers

heavy stag
vast yew
#

Which essentially represent fields in the NMS packet class

heavy stag
#

o

#

found it

vast yew
#

You'd want to read...

#

Gimme a sec

heavy stag
#

lemme move it here

vast yew
#

Oh btw not Named Sound Effect

#

That applies to sounds added by a resourcepack

#

Not sounds built into the game

heavy stag
vast yew
#

Wait

#

Okay that's odd one sec lemme check those

heavy stag
#

found it

#

its entity sound

#

i think

vast yew
#

Probably

heavy stag
#

yep

#

it is

lime aspen
heavy stag
#

actually

#

lets just check

#

or is it

#

Sound effect

#

hm

vast yew
#

Btw I should mention that there is no structure modifier for SoundEffect types

#

Although actually that doesn't really matter since SoundEffect is NMS and you probably don't wanna use it

heavy stag
#

yes

#

i don't include nms so i cna't make that mistake

vast yew
#

Entity Sound's sound ID is the third field, although it's the first int field, so you'd use .getIntegers().read(0)

#

Also yes the index is relative to the field type

heavy stag
#

found it

vast yew
#

That fucked with me personally

heavy stag
#

oh wait

#

so now

#

i need to figure how to get the sound id dynamically

#

so it works in more versions

vast yew
#

Nah

#

That's the job of ProtocolLib

heavy stag
#

??

#

if i compare id to 1013

#

that 1013 might change

vast yew
#

It will probably work for most versions

heavy stag
#

k ig

vast yew
#

In order to get it dynamically you'd have to interface with Minecraft's registry

heavy stag
#

ohk

vast yew
#

So unfortunately you may have to use NMS

#

cuuuuz

#

Wellll

#

actually

#

You could use .getModifier().read(0)

#

Which would return an Object

#

which you could then reflect upon to get the ID

#

...if it stores the ID

#

Well shit

#

The other solution is to directly compare the object to SoundEffects.SPYGLASS_STOP_USING but that wouldn't work across versions all too well

#

So yeah either way you're gonna need to put a lot of effort into cross-version shit

#

Soz