mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 23:47:38 +01:00
Merge pull request #6356 from IThundxr/mc1.18/big-outlines-fix
Fix IHaveBigOutline not working in the y axis
This commit is contained in:
commit
7888c14082
1 changed files with 25 additions and 37 deletions
|
@ -20,7 +20,6 @@ import net.minecraftforge.common.ForgeMod;
|
|||
* For mods wanting to use this take a look at {@link IHaveBigOutline}
|
||||
*/
|
||||
public class BigOutlines {
|
||||
|
||||
static BlockHitResult result = null;
|
||||
|
||||
public static void pick() {
|
||||
|
@ -45,8 +44,9 @@ public class BigOutlines {
|
|||
MutableBlockPos p = BlockPos.ZERO.mutable();
|
||||
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
p.set(pos.getX() + x, pos.getY(), pos.getZ() + z);
|
||||
p.set(pos.getX() + x, pos.getY() + y, pos.getZ() + z);
|
||||
BlockState blockState = mc.level.getBlockState(p);
|
||||
|
||||
if (!(blockState.getBlock() instanceof IHaveBigOutline))
|
||||
|
@ -77,6 +77,7 @@ public class BigOutlines {
|
|||
result = new BlockHitResult(vec, hit.getDirection(), hitPos, hit.isInside());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result != null;
|
||||
});
|
||||
|
@ -84,17 +85,4 @@ public class BigOutlines {
|
|||
if (result != null)
|
||||
mc.hitResult = result;
|
||||
}
|
||||
|
||||
static boolean isValidPos(Player player, BlockPos pos) {
|
||||
// verify that the server will accept the fake result
|
||||
double x = player.getX() - (pos.getX() + .5);
|
||||
double y = player.getY() - (pos.getY() + .5) + 1.5;
|
||||
double z = player.getZ() - (pos.getZ() + .5);
|
||||
double distSqr = x * x + y * y + z * z;
|
||||
double maxDist = player.getAttribute(ForgeMod.REACH_DISTANCE.get())
|
||||
.getValue() + 1;
|
||||
maxDist *= maxDist;
|
||||
return distSqr <= maxDist;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue