Minor MetaFile reformatting

This commit is contained in:
James Seibel
2022-12-11 17:28:07 -06:00
parent c3c170d07a
commit 38a8c73311
2 changed files with 43 additions and 25 deletions
@@ -18,35 +18,41 @@ import com.seibel.lod.core.logging.DhLoggerBuilder;
import com.seibel.lod.core.util.LodUtil;
import org.apache.logging.log4j.Logger;
/**
* Used size: 40 bytes <br>
* Remaining space: 24 bytes <br>
* Total size: 64 bytes <br> <br><br>
*
*
* Metadata format: <br> <br>
*
* 4 bytes: magic bytes: "DHv0" (in ascii: 0x44 48 76 30) (this also signals the metadata format) <br>
* 4 bytes: section X position <br>
* 4 bytes: section Y position (Unused, for future proofing) <br>
* 4 bytes: section Z position <br> <br>
*
* 4 bytes: data checksum <br> //TODO: Implement checksum
* 1 byte: section detail level <br>
* 1 byte: data detail level // Note: not sure if this is needed <br>
* 1 byte: loader version <br>
* 1 byte: unused <br> <br>
*
* 8 bytes: datatype identifier <br> <br>
*
* 8 bytes: data version
*/
public class MetaFile
{
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
//Metadata format:
//
// 4 bytes: magic bytes: "DHv0" (in ascii: 0x44 48 76 30) (this also signal the metadata format)
// 4 bytes: section X position
// 4 bytes: section Y position (Unused, for future proofing)
// 4 bytes: section Z position
//
// 4 bytes: data checksum //TODO: Implement checksum
// 1 byte: section detail level
// 1 byte: data detail level // Note: not sure if this is needed
// 1 byte: loader version
// 1 byte: unused
//
// 8 bytes: datatype identifier
//
// 8 bytes: data version
// Used size: 40 bytes
// Remaining space: 24 bytes
// Total size: 64 bytes
public static final int METADATA_SIZE = 64;
public static final int METADATA_RESERVED_SIZE = 24;
public static final int METADATA_MAGIC_BYTES = 0x44_48_76_30;
// Currently set to false because for some reason Window is throwing PermissionDeniedException when trying to atomic replace a file...
/** Currently set to false because for some reason Window is throwing PermissionDeniedException when trying to atomic replace a file... */
public static final boolean USE_ATOMIC_MOVE_REPLACE = false;
public final DhSectionPos pos;
@@ -56,12 +56,23 @@ public class PlayerData
* I'm not sure what this will look like for worlds that don't have a spawn point.
*/
public DhBlockPos worldSpawnPointBlockPos;
@Nullable
public static PlayerData tryGetPlayerData(IMinecraftClientWrapper mcClient) {
if (!mcClient.playerExists()) return null;
try {
public static PlayerData tryGetPlayerData(IMinecraftClientWrapper mcClient)
{
if (!mcClient.playerExists())
{
return null;
}
try
{
return new PlayerData(mcClient);
} catch (RuntimeException e) {
}
catch (RuntimeException e)
{
// Player no longer exists due to concurrency. FIXME: Remember here is called not on main thread!!!
return null;
}
@@ -125,7 +136,8 @@ public class PlayerData
@Override
public String toString()
{
return "PlayerBlockPos: [" + playerBlockPos.getX() + "," + playerBlockPos.getY() + "," + playerBlockPos.getZ() + "]";
return "PlayerBlockPos: [" + playerBlockPos.x + "," + playerBlockPos.y + "," + playerBlockPos.z + "]";
}
}