-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix searching for main supporting block #1709
Conversation
What version(s) source have you checked when making this? Asking because it might have changed at some point |
1.16 - 1.20.1, main supporting block was added in 1.19 iirc, so it should be fine |
Can you test this (and or check source) in 1.21, 1.12, and 1.8? |
I tested this with 1.21.1 client, but I was checking 1.20.1, 1.18, 1.16.4 sources 1.20.1, 1.18.2, 1.16.4 source it is all the same: int i = Mth.floor(box.minX - 1.0E-7D) - 1;
int j = Mth.floor(box.maxX + 1.0E-7D) + 1;
int k = Mth.floor(box.minY - 1.0E-7D) - 1;
int l = Mth.floor(box.maxY + 1.0E-7D) + 1;
int m = Mth.floor(box.minZ - 1.0E-7D) - 1;
int n = Mth.floor(box.maxZ + 1.0E-7D) + 1; in 1.8 it is different: int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.floor_double(bb.maxX + 1.0D);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.floor_double(bb.maxY + 1.0D);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.floor_double(bb.maxZ + 1.0D); and in 1.12.2: int i = MathHelper.floor(p_191504_2_.minX) - 1;
int j = MathHelper.ceil(p_191504_2_.maxX) + 1;
int k = MathHelper.floor(p_191504_2_.minY) - 1;
int l = MathHelper.ceil(p_191504_2_.maxY) + 1;
int i1 = MathHelper.floor(p_191504_2_.minZ) - 1;
int j1 = MathHelper.ceil(p_191504_2_.maxZ) + 1; the Collisions#hasMaterial method doesn't check whether there is a collision with player's AABB (maybe there should be one?), so that's why i didn't want to modify it directly edit: also there is diff in 1.8 and 1.12, idk if it makes any difference: 1.8 - 1.12 public boolean intersects(double x1, double y1, double z1, double x2, double y2, double z2)
{
return this.minX < x2 && this.maxX > x1 && this.minY < y2 && this.maxY > y1 && this.minZ < z2 && this.maxZ > z1;
} 1.20.1 public static boolean voxelShapeIntersect(final AABB box, final double minX, final double minY, final double minZ,
final double maxX, final double maxY, final double maxZ) {
return (box.minX - maxX) < -COLLISION_EPSILON && (box.maxX - minX) > COLLISION_EPSILON &&
(box.minY - maxY) < -COLLISION_EPSILON && (box.maxY - minY) > COLLISION_EPSILON &&
(box.minZ - maxZ) < -COLLISION_EPSILON && (box.maxZ - minZ) > COLLISION_EPSILON;
} |
I think |
The new code only runs on modern versions so it shouldn't matter for old versions |
fixes #1698
main issue was
Grim/src/main/java/ac/grim/grimac/utils/nmsutil/Collisions.java
Lines 651 to 656 in 0293606
being different than vanilla
also there is no reason for cloning WrapperBlockState in Collisions#hasMaterial as we don't modify the state anywhere