Closed Laike-Endaril closed 3 years ago
I'm assuming the surrounding blocks of the slab are also slabs. There's nothing I can do to prevent that, because even when sitting down without holding sneak and then standing up in that configuration, you will fall through the floor. The code to determine where to place the player when they stop sitting is on Minecraft's side (same one as for Minecarts and Horses).
Ah, makes sense. In this case, it was a single slab in the air (and therefore the only place to put the player upon no-longer-sitting).
Well, if you can catch the unmount event, you might be able to offset the player position up one half block (teleport), but that may in turn cause one tick of suffocation in a 2-block-high area. Not sure.
In any case, not completely game breaking or anything...so long as it's not above lava/the void :P
Would it be possible to at least prevent sitting in such unsafe configuration in the first place? It should be possible to predict when the vanilla code would place the player in an unsafe place, and disallow sitting there (maybe with a configuration option?)
How would such a detection look? I don't want to have to check multiple block states at possible positions just for this.
Another possible option:
Very minimal checks, and never makes any situation worse than it currently is...except in extreme edge cases where you have exposed lava held 2 blocks high via signs, with the top of a half slab on the ground being 1.5 blocks down from the bottom of the lava, maybe...
In any case, I think it would solve most "reasonable" placement issues. If you wanted to go one step further, then after the "one block up" check fails, you'd move on to "one block East", "one block North", etc. Probably wouldn't want to adjust position more than a certain amount though if you did this
Doung a few extra blockstate checks here https://github.com/bl4ckscor3/Sit/blob/f2635dcaa26328e62e57f81303df014a6bc47c04/src/main/java/bl4ckscor3/mod/sit/SitHandler.java#L35-L40 definitely wouldn't hurt anything. Even some simplified checks for the currently known issues, not exhaustive search for all the possible unsafe situations would be a huge improvement.
I don't want to have to check multiple block states at possible positions just for this.
I don't see any reason to avoid that. This code is called relatively infrequently, and only on user interaction, so even a few hundred block accesses won't hurt performance. Sure, players could abuse it and spam right click to lag the server a little bit... but it's also trivial to cause way bigger issues with just a bit of redstone so I don't consider that an issue.
Having a floor of but slabs (usually since it can prevent mob spawning) it does get annoying to be push under the floor... I imagine what it will do if people were on a skyblock type modpack... yikes...
I would suggest that when standing, the player will stand on top when it comes to slabs.
Yet this bug could be useful to make secret entrances.
Perhaps to make the key for going under CTRL+Shift to go under the slab.
I simply want to add that a similar bug happen when sitting in front of a path block. Totally not game breaking, just wanted it reported ;)
Huh, I can't reproduce this. Simply can't sit on a slab when the shift is being held.
You're right. I will publish an update tomorrow that will not allow the player to sit when they sneak-rightclick, as there is another bug associated with not doing so.
This will cause you to sit, and then immediately stop sitting. You will go through the floor...sometimes. Unsure of exact qualifications, but could reproduce fairly often in a dedicated test (no other mods).