ClassiCube icon indicating copy to clipboard operation
ClassiCube copied to clipboard

ClassicWorld spawn position format

Open andreasgoulas opened this issue 6 years ago • 5 comments
trafficstars

According to wiki.vg, the coordinates of the spawn position are in player-position units (32 units per block). This convention has been adopted by other server software, such as fCraft.

ClassiCube interprets the coordinates as block coordinates: https://github.com/UnknownShadow200/ClassiCube/blob/6e9152a3287a348b345fa4d8c338b3f54fbac8dc/src/Formats.c#L523-L525

What's the reason for this inconsistency?

andreasgoulas avatar May 21 '19 09:05 andreasgoulas

From memory, the original java classicube incorrectly stored block coordinates, which I duplicated in ClassicalSharp to stay compatible, and duplicated again in C rewrite

Probably ExactX/Y/Z floats should be added to Spawn tag On May 21, 2019 7:41 PM, "Andrew Goulas" [email protected] wrote:

According to wiki.vg https://wiki.vg/ClassicWorld_file_format, the coordinates of the spawn position are in player-position units (32 units per block). This convention has been adopted by other server software, such as fCraft.

ClassiCube interprets the coordinates as block coordinates: https://github.com/UnknownShadow200/ClassiCube/blob/ 6e9152a3287a348b345fa4d8c338b3f54fbac8dc/src/Formats.c#L523-L525

What's the reason for this inconsistency?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/UnknownShadow200/ClassiCube/issues/585?email_source=notifications&email_token=ABRVGJF2HGUDXFEQH5RBS73PWO7SZA5CNFSM4HOJF6CKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GU5KSYA, or mute the thread https://github.com/notifications/unsubscribe-auth/ABRVGJBAZHBW3KWRBXTPJBDPWO7SZANCNFSM4HOJF6CA .

UnknownShadow200 avatar May 22 '19 02:05 UnknownShadow200

May I suggest a temporary backwards-compatible solution? If the coordinates are within the bounds of the level, interpret them as block coordinates. If not, interpret them as player coordinates. The only downside is that spawn positions near the origin of the world, when stored in player-position units, will be read incorrectly. This should be extremely rare. For example, in a 128x64x128 level, you will not be able to place the spawn at x<4, y<2, z<4.

andreasgoulas avatar May 22 '19 06:05 andreasgoulas

Except at one point ClassicalSharp did write player position instead of block coordinates.

I can't check right now, but 99% sure I workaround by dividing spawn by 32 if it's outside the map. Look for a comment or World_IsValidPos On May 22, 2019 4:10 PM, "Andrew Goulas" [email protected] wrote:

May I suggest a temporary backwards-compatible solution? If the coordinates are within the bounds of the level, interpret them as block coordinates. If not, interpret them as player coordinates. The only downside is that spawn positions near the origin of the world, when stored in player-position units, will be read incorrectly. This should be extremely rare. For example, in a 128x64x128 level, you will not be able to place the spawn at x<4, y<2, z<4.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/UnknownShadow200/ClassiCube/issues/585?email_source=notifications&email_token=ABRVGJGQE2HYSV4QCCRQALLPWTPV5A5CNFSM4HOJF6CKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV6AB4I#issuecomment-494665969, or mute the thread https://github.com/notifications/unsubscribe-auth/ABRVGJGLVXGGD25RJFPDCJTPWTPV5ANCNFSM4HOJF6CA .

UnknownShadow200 avatar May 22 '19 07:05 UnknownShadow200

Indeed you are right. I guess the only discussion left is whether storing the position using the more accurate format would be beneficial, since ClassiCube can read both.

andreasgoulas avatar May 22 '19 07:05 andreasgoulas

If implemented please put here:

ClassicWorld = {
  Metadata = {
    CPE = {
      SetSpawn = {
        SetSpawn.X = i32:2064
        SetSpawn.Y = i32:1072
        SetSpawn.Z = i32:2064
        SetSpawn.H = i8:96
        SetSpawn.P = i8:0
      }
    }
  }
}

rdebath avatar Sep 06 '22 19:09 rdebath