ZotCoreLoader
- исправлено сохранение
This commit is contained in:
@@ -3,6 +3,7 @@ package com.reider745.hooks;
|
|||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import cn.nukkit.Server;
|
import cn.nukkit.Server;
|
||||||
import cn.nukkit.block.BlockID;
|
import cn.nukkit.block.BlockID;
|
||||||
|
import cn.nukkit.nbt.tag.CompoundTag;
|
||||||
import cn.nukkit.network.protocol.ProtocolInfo;
|
import cn.nukkit.network.protocol.ProtocolInfo;
|
||||||
import cn.nukkit.utils.MainLogger;
|
import cn.nukkit.utils.MainLogger;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
@@ -149,6 +150,11 @@ public class GlobalBlockPalette implements HookClass {
|
|||||||
return runtimeIdToLegacy.get(runtimeId);
|
return runtimeIdToLegacy.get(runtimeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public static int getLegacyFullId(int protocol, CompoundTag tag){
|
||||||
|
throw new RuntimeException("use getLegacyFullId(int, CompoundTag)");
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public static int getOrCreateRuntimeId(int protocol, int id, int meta){
|
public static int getOrCreateRuntimeId(int protocol, int id, int meta){
|
||||||
return get(id, meta);
|
return get(id, meta);
|
||||||
@@ -161,7 +167,6 @@ public class GlobalBlockPalette implements HookClass {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public static int getOrCreateRuntimeId(int legacyId){
|
public static int getOrCreateRuntimeId(int legacyId){
|
||||||
Server.mvw("GlobalBlockPalette#getOrCreateRuntimeId(int)");
|
|
||||||
return getOrCreateRuntimeId(ProtocolInfo.CURRENT_PROTOCOL, legacyId >> 4, legacyId & 0xf);
|
return getOrCreateRuntimeId(ProtocolInfo.CURRENT_PROTOCOL, legacyId >> 4, legacyId & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ import java.util.List;
|
|||||||
|
|
||||||
public class FileUtils {
|
public class FileUtils {
|
||||||
public static JSONObject readJSON(File file){
|
public static JSONObject readJSON(File file){
|
||||||
return new JSONObject(file);
|
try{
|
||||||
|
return new JSONObject(readFileText(file));
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new RuntimeException(e.getCause().toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String readFileText(File file) throws Exception {
|
public static String readFileText(File file) throws Exception {
|
||||||
|
|||||||
+1
-1
@@ -80,6 +80,7 @@ public class WorldDataSaver {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json == null) {
|
if (json == null) {
|
||||||
json = readJsonWithLockCheck(worldDirectory, "moddata.json", false);
|
json = readJsonWithLockCheck(worldDirectory, "moddata.json", false);
|
||||||
if (json == null) {
|
if (json == null) {
|
||||||
@@ -139,7 +140,6 @@ public class WorldDataSaver {
|
|||||||
|
|
||||||
|
|
||||||
public void logError(String message, SaverState state, Throwable err) {
|
public void logError(String message, SaverState state, Throwable err) {
|
||||||
ICLog.e("Saver", message, err);
|
|
||||||
errorLog.add(new LoggedSavesError(message, state, err));
|
errorLog.add(new LoggedSavesError(message, state, err));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -64,7 +64,6 @@ public class WorldDataScopeRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void readAllScopes(JSONObject json, SavesErrorHandler errorHandler, MissingScopeHandler missingScopeHandler) {
|
public void readAllScopes(JSONObject json, SavesErrorHandler errorHandler, MissingScopeHandler missingScopeHandler) {
|
||||||
System.out.println(json);
|
|
||||||
for (Map.Entry<String, SaverScope> entry : scopeMap.entrySet()) {
|
for (Map.Entry<String, SaverScope> entry : scopeMap.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
Object data = json.opt(key);
|
Object data = json.opt(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user