11package net .minestom .generators ;
22
3- import com .google .gson .JsonArray ;
3+ import com .google .gson .JsonElement ;
44import com .google .gson .JsonObject ;
55import net .minecraft .world .level .block .SoundType ;
66import net .minestom .datagen .DataGenerator ;
1010public class BlockSoundTypeGenerator extends DataGenerator {
1111
1212 @ Override
13- public JsonArray generate () {
14- JsonArray blockSoundTypes = new JsonArray ();
13+ public JsonElement generate () {
14+ JsonObject blockSoundTypes = new JsonObject ();
1515
1616 try {
1717 for (var field : SoundType .class .getDeclaredFields ()) {
@@ -20,15 +20,14 @@ public JsonArray generate() {
2020 SoundType soundType = (SoundType ) field .get (null );
2121 String name = field .getName ().toLowerCase ();
2222 JsonObject soundTypeJson = new JsonObject ();
23- soundTypeJson .addProperty ("name" , name );
2423 soundTypeJson .addProperty ("volume" , soundType .volume );
2524 soundTypeJson .addProperty ("pitch" , soundType .pitch );
2625 soundTypeJson .addProperty ("breakSound" , soundType .getBreakSound ().location ().toString ());
2726 soundTypeJson .addProperty ("hitSound" , soundType .getHitSound ().location ().toString ());
2827 soundTypeJson .addProperty ("fallSound" , soundType .getFallSound ().location ().toString ());
2928 soundTypeJson .addProperty ("placeSound" , soundType .getPlaceSound ().location ().toString ());
3029 soundTypeJson .addProperty ("stepSound" , soundType .getStepSound ().location ().toString ());
31- blockSoundTypes .add (soundTypeJson );
30+ blockSoundTypes .add ("minecraft:" + name , soundTypeJson );
3231 }
3332 } catch (Throwable e ) {
3433 throw new RuntimeException (e );
0 commit comments