fix: allow playing long songs

This is actually an unsigned short, not a short.
See https://noteblock.world/song/b91BWfUTnH for an example
This commit is contained in:
amy 2026-03-29 16:03:31 -03:00
parent 84df266240
commit c2253055a0
No known key found for this signature in database

View file

@ -78,9 +78,9 @@ public class NBSConverter {
} }
final ArrayList<NBSNote> nbsNotes = new ArrayList<>(); final ArrayList<NBSNote> nbsNotes = new ArrayList<>();
short tick = -1; int tick = -1;
while (true) { while (true) {
final int tickJumps = buffer.getShort(); final int tickJumps = Short.toUnsignedInt(buffer.getShort());
if (tickJumps == 0) break; if (tickJumps == 0) break;
tick += tickJumps; tick += tickJumps;
@ -231,6 +231,7 @@ public class NBSConverter {
String sound = Util.sanitizeName(path, Identifier::isAllowedInIdentifier) String sound = Util.sanitizeName(path, Identifier::isAllowedInIdentifier)
.replaceFirst("\\.ogg$", "") .replaceFirst("\\.ogg$", "")
.replaceFirst("^minecraft/", "") .replaceFirst("^minecraft/", "")
.replaceFirst("\\d+$", "")
.replace('/', '.'); .replace('/', '.');
// if there's no path, it's probably a note block sound // if there's no path, it's probably a note block sound