Skip to content

Commit ba579c0

Browse files
authored
Change JSON format of Block Sound Types so they can work with a registry container (#41)
1 parent b0f5260 commit ba579c0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

DataGenerator/src/main/java/net/minestom/generators/BlockSoundTypeGenerator.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package net.minestom.generators;
22

3-
import com.google.gson.JsonArray;
3+
import com.google.gson.JsonElement;
44
import com.google.gson.JsonObject;
55
import net.minecraft.world.level.block.SoundType;
66
import net.minestom.datagen.DataGenerator;
@@ -10,8 +10,8 @@
1010
public 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

Comments
 (0)