From 2b2edd2c5ec98decb23981eb71a22876210b69e0 Mon Sep 17 00:00:00 2001 From: Corosauce Date: Sun, 7 Apr 2024 19:59:55 +0100 Subject: [PATCH] v2.8.3. Fix tornado grabbing players underground, caused by using heightmap type that isnt synced to client, likely caused other issues like client side particles. --- gradle.properties | 2 +- src/main/java/weather2/util/WeatherUtilBlock.java | 2 +- src/main/java/weather2/util/WeatherUtilEntity.java | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index f977e723..944228c7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -54,7 +54,7 @@ mod_name=Weather2 # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=All Rights Reserved # The mod version. See https://semver.org/ -mod_version=1.20.1-2.8.2 +mod_version=1.20.1-2.8.3 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/weather2/util/WeatherUtilBlock.java b/src/main/java/weather2/util/WeatherUtilBlock.java index ffc31890..65a6de63 100644 --- a/src/main/java/weather2/util/WeatherUtilBlock.java +++ b/src/main/java/weather2/util/WeatherUtilBlock.java @@ -444,7 +444,7 @@ public static BlockState setBlockWithLayerState(Block block, int height) { } public static BlockPos getPrecipitationHeightSafe(Level world, BlockPos pos) { - return getPrecipitationHeightSafe(world, pos, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES); + return getPrecipitationHeightSafe(world, pos, Heightmap.Types.MOTION_BLOCKING); } /** diff --git a/src/main/java/weather2/util/WeatherUtilEntity.java b/src/main/java/weather2/util/WeatherUtilEntity.java index c6fb1ed7..6f84b122 100644 --- a/src/main/java/weather2/util/WeatherUtilEntity.java +++ b/src/main/java/weather2/util/WeatherUtilEntity.java @@ -205,7 +205,10 @@ public static boolean isPosOutside(Level parWorld, Vec3 parPos) { public static boolean isPosOutside(Level parWorld, Vec3 parPos, boolean cheapCheck, boolean eachSideClearCheck) { - if (WeatherUtilBlock.getPrecipitationHeightSafe(parWorld, new BlockPos(Mth.floor(parPos.x), 0, Mth.floor(parPos.z))).getY() < parPos.y+1) return true; + int height = WeatherUtilBlock.getPrecipitationHeightSafe(parWorld, new BlockPos(Mth.floor(parPos.x), 0, Mth.floor(parPos.z))).getY(); + if (height < parPos.y+1) { + return true; + } if (cheapCheck) return false; int rangeCheck = 5; @@ -263,7 +266,11 @@ public static boolean isPosOutside(Level parWorld, Vec3 parPos, boolean cheapChe public static boolean checkVecOutside(Level parWorld, Vec3 parPos, Vec3 parCheckPos) { BlockHitResult blockhitresult = parWorld.clip(new ClipContext(parPos, parCheckPos, ClipContext.Block.VISUAL, ClipContext.Fluid.NONE, null)); if (blockhitresult.getType() == HitResult.Type.MISS) { - if (WeatherUtilBlock.getPrecipitationHeightSafe(parWorld, new BlockPos(Mth.floor(parCheckPos.x), 0, Mth.floor(parCheckPos.z))).getY() < parCheckPos.y) return true; + int height = WeatherUtilBlock.getPrecipitationHeightSafe(parWorld, new BlockPos(Mth.floor(parCheckPos.x), 0, Mth.floor(parCheckPos.z))).getY(); + System.out.println("height: " + height + " vs " + parCheckPos.y); + if (height < parCheckPos.y) { + return true; + } } return false; }