ZotCoreLoader
- исправлено получение runtimeId для BlockState - исправлено не правильное определение id для блоков из дампа иннера
This commit is contained in:
@@ -79,23 +79,19 @@ public class GlobalBlockPalette implements HookClass {
|
|||||||
for (Object elem : json) {
|
for (Object elem : json) {
|
||||||
final JSONObject e = (JSONObject) elem;
|
final JSONObject e = (JSONObject) elem;
|
||||||
|
|
||||||
//BlockStateRegistry.registerState(e);
|
final int legacyId = e.getInt("newId");
|
||||||
if(e.toString().split("null").length != 1)
|
|
||||||
throw new RuntimeException("Пиздуй ищи причину null в дампе!\n"+e);
|
|
||||||
|
|
||||||
final int legacyId = e.getInt("oldId");
|
|
||||||
final int legacyData = e.getInt("data");
|
final int legacyData = e.getInt("data");
|
||||||
|
final JSONObject states = e.getJSONObject("states");
|
||||||
|
|
||||||
if(legacyId > 8000)
|
if(legacyId > 8000)
|
||||||
throw new IOException("Ты чё еблан? Какова хуя в дампе блок с id "+legacyId);
|
throw new IOException("Ты чё еблан? Какова хуя в дампе блок с id "+legacyId);
|
||||||
|
|
||||||
final long hash = computeStateHash(e.getInt("newId"), e.getJSONObject("states"), stateIdByName);
|
final long hash = computeStateHash(legacyId, states, stateIdByName);
|
||||||
if (stateHashToLegacyIdData.containsKey(hash))
|
if (stateHashToLegacyIdData.containsKey(hash))
|
||||||
throw new RuntimeException("hash collision: " + hash + " "+e);
|
throw new RuntimeException("hash collision: " + hash + " "+e);
|
||||||
|
|
||||||
debug_hash.put(hash, e);
|
debug_hash.put(hash, e);
|
||||||
BlockStateRegisters.addState(hash, e.getJSONObject("states"));
|
BlockStateRegisters.addState(hash, states);
|
||||||
// log.info(e.getString("nameId") + legacyId + ":" + legacyData + " -> " + hash);
|
|
||||||
stateHashToLegacyIdData.put(hash, (legacyId << 16) | legacyData);
|
stateHashToLegacyIdData.put(hash, (legacyId << 16) | legacyData);
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public class BlockState {
|
|||||||
this.data = meta.getDamage();
|
this.data = meta.getDamage();
|
||||||
}else
|
}else
|
||||||
this.data = 0;
|
this.data = 0;
|
||||||
this.runtimeId = GlobalBlockPalette.getOrCreateRuntimeId(id, data);
|
this.runtimeId = GlobalBlockPalette.getOrCreateRuntimeId(InnerCoreServer.PROTOCOL, id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockState(int id, Map<?, Integer> map) {
|
public BlockState(int id, Map<?, Integer> map) {
|
||||||
|
|||||||
Reference in New Issue
Block a user