Add RandomSound support to ContentParser (#9518)

This commit is contained in:
MEEPofFaith 2024-02-04 15:58:40 -08:00 committed by GitHub
parent e521cc5237
commit 9093c92b07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -271,8 +271,9 @@ public class ContentParser{
return new Vec3(data.getFloat("x", 0f), data.getFloat("y", 0f), data.getFloat("z", 0f));
});
put(Sound.class, (type, data) -> {
var field = fieldOpt(Sounds.class, data);
if(data.isArray()) return new RandomSound(parser.readValue(Sound[].class, data));
var field = fieldOpt(Sounds.class, data);
return field != null ? field : Vars.tree.loadSound(data.asString());
});
put(Music.class, (type, data) -> {