mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Save custom blocks in the mantle under their custom id
A custom state's key is its base block, so a provider block (Nexo, ItemsAdder) held in a mantle section that was written to disk before its chunk generated read back as the vanilla base block. The mantle now saves it under its custom id, which reads back through its provider.
This commit is contained in:
1 parent
d5e75114ab
commit
8ca183d0c2
2 files changed
+48
-1
No files matched your search
+7
-1
@@ -28,7 +28,13 @@ public class PlatformBlockMatter extends RawMatter<PlatformBlockState> {
|
||||
|
||||
@Override
|
||||
public void writeNode(PlatformBlockState b, DataOutputStream dos) throws IOException {
|
||||
dos.writeUTF(b.key());
|
||||
dos.writeUTF(persistedKey(b));
|
||||
}
|
||||
|
||||
/** A custom block's key is its base block, so it is saved under its custom id, which reads back through its provider. */
|
||||
private static String persistedKey(PlatformBlockState state) {
|
||||
String customKey = state.isCustom() ? state.deferredPlacementKey() : null;
|
||||
return customKey == null ? state.key() : customKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user