Kibe Utilities

Kibe Utilities

8M Downloads

Sleeping bag teleported player to 0, 0, 0 and they fell out of the world

Tsudico opened this issue ยท 2 comments

commented

A player logged into my server, noticed it was dark, and immediately slept with the sleeping bag. They died and a death chest was placed as close to 0, 0, 0 as it could get while still being in world. It looks like the sleeping position of the player is determined by the following code in SleepingBag.kt:

        val sleepingPos = rayTraceContext.run {
            if(this.type == HitResult.Type.BLOCK) {
                return@run BlockPos(this.pos)
            }else{
                return@run BlockPos.ORIGIN
            }
        }

Shouldn't a rayTrace if it isn't HitResult.Type.BLOCK actually return the player position or fail instead of BlockPos.ORIGIN which is located at 0, 0, 0?

commented

Weird, even if BlockPos.ORIGIN gets returned the other fail-safes should have gotten triggered, I don't know why that didn't happen... I will change it to return the player position tho.

commented

You would think that when it checks if the position above it is obstructed it would be by bedrock. I think it might have had something to do with the combination of the player just loading into the server and being far enough away from origin that the chunk with origin wasn't loaded so it didn't think anything was above it.