Skip to content

Commit

Permalink
v2.8.3. Fix tornado grabbing players underground, caused by using hei…
Browse files Browse the repository at this point in the history
…ghtmap type that isnt synced to client, likely caused other issues like client side particles.
  • Loading branch information
Corosauce committed Apr 7, 2024
1 parent 0659d42 commit 2b2edd2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/weather2/util/WeatherUtilBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/weather2/util/WeatherUtilEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2b2edd2

Please sign in to comment.