ARG!! I'm pulling my hair out with a problem here. :(
The code seems to work just fine but... Every so often (usually on about the fifth or sixth "jump") the player wont be moved to the proper position. I have the position being reported in the terminal but the player ends up being moved somewhere else (very close to where it's supposed to be but off by enough to place me in a rock or something).
If someone could put another set of eyes on this and try to find an error I cannot, I would appreciate it.
https://github.com/blert2112/troll_doors.gitHere's what I have been doing to test this bit of code:
-Place the test block (troll_doors:temp),
-Hop on top of the block and give it a second or two,
-Check the terminal output and compare the reported position with the player's position. You can end up in a dark cave so take some torches,
-Repeat until you end up positioned inside solid ground or under water,
-Notice, at this time the reported position in the terminal will not match the player position. If you enable noclip and move to the proper reported position you will see that it is a valid position.
Any help would be very appreciated. It's probably some mundane thing that I am just not seeing but I can't see how it can work a handful of times and the fail to move the player to the position. Going to keep hammering on it tonight, I think I will start rewriting the whole thing one step at a time. Thanks.
edit: I may have found the problem while rewriting... I think the ABM and GlobalStep were "colliding" if things happened at the "wrong" time.
edit-2: Nope. Rewrote the whole thing so the ABM and GlobalStep cannot "collide". Still, every few "jumps" the player will not be teleported to the position given to it. It is usually 'y' that is off. Instead of the proper value, the value of 'y' is somehow 0 (zero, or actually 0.5 as I add 0.5 to 'y' so the player is not knee deep in dirt/rock).