mirror of
https://git.zelz.net/catfoolyou/Project164.git
synced 2025-12-14 10:57:42 +00:00
25w14a fix sound bugs
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user