25w14a fix sound bugs

This commit is contained in:
Catfoolyou
2025-03-31 15:20:21 -04:00
parent 1b974a6b47
commit e604fc30e8
123 changed files with 34268 additions and 34227 deletions

View File

@@ -5,7 +5,7 @@ import java.util.List;
public class ConfigConstants {
public static final String version = "25w13b";
public static final String version = "25w14a";
public static final String mainMenuString = "Eaglercraft " + version;
public static final String forkMe = "https://git.zelz.net/catfoolyou/Project164";

View File

@@ -1,13 +1,11 @@
package net.minecraft.src;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.*;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom;
import org.json.JSONObject;
public class SoundManager {
@@ -64,6 +62,25 @@ public class SoundManager {
if(this.sounddefinitions == null) {
this.sounddefinitions = new HashMap();
for(int j = 0; j < 2; ++j) {
JSONObject jsonObject = new JSONObject(EaglerAdapter.fileContents("sounds.json"));
try {
if (j == 0) EaglerAdapter.setPlaybackOffsetDelay(0.03f);
for (String key : jsonObject.keySet()) {
JSONObject soundEntry = jsonObject.getJSONObject(key);
if (soundEntry.has("sounds")) {
Object soundsObj = soundEntry.get("sounds");
String soundsStr = soundsObj.toString();
int count = soundsStr.equals("[]") ? 0 : soundsStr.split(",").length;
sounddefinitions.put(key, count);
}
}
} catch (Exception e) {
e.printStackTrace();
}
byte[] b = EaglerAdapter.loadResourceBytes("/sounds/sounds.dat" + (j == 1 ? "x" : ""));
if(b != null) {
try {