1
1
package net .minestom .generators ;
2
2
3
- import com .google .gson .JsonArray ;
3
+ import com .google .gson .JsonElement ;
4
4
import com .google .gson .JsonObject ;
5
5
import net .minecraft .world .level .block .SoundType ;
6
6
import net .minestom .datagen .DataGenerator ;
10
10
public class BlockSoundTypeGenerator extends DataGenerator {
11
11
12
12
@ Override
13
- public JsonArray generate () {
14
- JsonArray blockSoundTypes = new JsonArray ();
13
+ public JsonElement generate () {
14
+ JsonObject blockSoundTypes = new JsonObject ();
15
15
16
16
try {
17
17
for (var field : SoundType .class .getDeclaredFields ()) {
@@ -20,15 +20,14 @@ public JsonArray generate() {
20
20
SoundType soundType = (SoundType ) field .get (null );
21
21
String name = field .getName ().toLowerCase ();
22
22
JsonObject soundTypeJson = new JsonObject ();
23
- soundTypeJson .addProperty ("name" , name );
24
23
soundTypeJson .addProperty ("volume" , soundType .volume );
25
24
soundTypeJson .addProperty ("pitch" , soundType .pitch );
26
25
soundTypeJson .addProperty ("breakSound" , soundType .getBreakSound ().location ().toString ());
27
26
soundTypeJson .addProperty ("hitSound" , soundType .getHitSound ().location ().toString ());
28
27
soundTypeJson .addProperty ("fallSound" , soundType .getFallSound ().location ().toString ());
29
28
soundTypeJson .addProperty ("placeSound" , soundType .getPlaceSound ().location ().toString ());
30
29
soundTypeJson .addProperty ("stepSound" , soundType .getStepSound ().location ().toString ());
31
- blockSoundTypes .add (soundTypeJson );
30
+ blockSoundTypes .add ("minecraft:" + name , soundTypeJson );
32
31
}
33
32
} catch (Throwable e ) {
34
33
throw new RuntimeException (e );
0 commit comments