PlayerDetector.getPlayersInRange will use the -x and -z as the center point, not the center of the block
zyxkad opened this issue ยท 8 comments
Describe
As the title, player detector get player in range will use the min x and min z (and/or min y, not sure) as the center point to detect, but I except it will use the center point of itself.
Steps to reproduce
- Place a player detector
- Place a computer next to it
- enter lua environment, wrap the player detector
- stand at the +x pos next to the detector, and do
.getPlayerInRange(1)
, there are nothing - stand at the -x pos next to the detector, and do
.getPlayerInRange(1)
, you will be there
Multiplayer?
Yes
Version
1.19.2-0.7.26r
Minecraft, Forge and maybe other related mods versions
Forge 43.2.8 Minecraft 1.19.2
Screenshots or Videos
My.Movie.mp4
Crashlog/log
No response
That really should not happen, have you test that with the feet position or the eye position of the player?
I also can't really reproduce this, the block is always the center
That really should not happen, have you test that with the feet position or the eye position of the player?
I tried both, I will make a screenrecording for it
Yes, I didn't describe it clearly, I mean if the block at (0, 0, 0), it will use (0, 0, 0) as the center search point, but I expect it will use (0.5, 0.5, 0.5) as the searching point
@SirEndii I decide to make a pr for this issue, now your arguments for playerDetector are all ints, but getNearbyPlayers
accept doubles https://nekoyue.github.io/ForgeJavaDocs-NG/javadoc/1.19.3/net/minecraft/world/phys/AABB.html. I am not sure the int is on purpose for some reason?
Edit:
BlockPos also accept doubles
getPlayersInRange
fixed in #450, but I'm not sure if getPlayersInCubic
have the same problem too.