| 917 | } |
| 918 | |
| 919 | static cc_bool LocalPlayer_HandleSetSpawn(int key, struct InputDevice* device) { |
| 920 | struct LocalPlayer* p = &LocalPlayer_Instances[device->mappedIndex]; |
| 921 | if (Gui.InputGrab) return false; |
| 922 | |
| 923 | if (p->Hacks.CanRespawn) { |
| 924 | |
| 925 | if (!p->Hacks.CanNoclip && !p->Base.OnGround) { |
| 926 | Chat_AddRaw("&cCannot set spawn midair when noclip is disabled"); |
| 927 | return false; |
| 928 | } |
| 929 | |
| 930 | /* Spawn is normally centered to match vanilla Minecraft classic */ |
| 931 | if (!p->Hacks.CanNoclip) { |
| 932 | /* Don't want to use Position because it is interpolated between prev and next. */ |
| 933 | /* This means it can be halfway between stepping up a stair and clip through the floor. */ |
| 934 | p->Spawn = p->Base.prev.pos; |
| 935 | } else { |
| 936 | p->Spawn.x = Math_Floor(p->Base.Position.x) + 0.5f; |
| 937 | p->Spawn.y = p->Base.Position.y; |
| 938 | p->Spawn.z = Math_Floor(p->Base.Position.z) + 0.5f; |
| 939 | } |
| 940 | |
| 941 | p->SpawnYaw = p->Base.Yaw; |
| 942 | if (!Game_ClassicMode) p->SpawnPitch = p->Base.Pitch; |
| 943 | |
| 944 | CPE_SendNotifyPositionAction(4, p->Spawn.x, p->Spawn.y, p->Spawn.z); |
| 945 | } |
| 946 | return LocalPlayer_HandleRespawn(key, device); |
| 947 | } |
| 948 | |
| 949 | static cc_bool LocalPlayer_HandleFly(int key, struct InputDevice* device) { |
| 950 | struct LocalPlayer* p = &LocalPlayer_Instances[device->mappedIndex]; |
nothing calls this directly
no test coverage detected