Skip to content

Commit

Permalink
update to 0.2.9; fix #8
Browse files Browse the repository at this point in the history
  • Loading branch information
plusls committed Jun 22, 2021
1 parent 7dcacfc commit 81a91f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.17
yarn_mappings=1.17+build.13
loader_version=0.11.6
# Mod Properties
mod_version=0.2.8
mod_version=0.2.9
maven_group=com.plusls
archives_base_name=oh-my-minecraft-client
# Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ public static void init() {
ClientTickEvents.START_CLIENT_TICK.register(RealSneakingEventHandler::preClientTick);
}

final private static float MIN_STEP_HEIGHT = 0.001f;
private static float prevStepHeight;

private static void preClientTick(MinecraftClient minecraftClient) {
if (minecraftClient.player != null) {
if (minecraftClient.player.stepHeight - MIN_STEP_HEIGHT >= 0.00001) {
prevStepHeight = minecraftClient.player.stepHeight;
}
if (Configs.FeatureToggle.REAL_SNEAKING.getBooleanValue() && minecraftClient.player.isSneaking()) {
minecraftClient.player.stepHeight = 0.001f;
minecraftClient.player.stepHeight = MIN_STEP_HEIGHT;
} else {
minecraftClient.player.stepHeight = 0.6f;
minecraftClient.player.stepHeight = prevStepHeight;
}
}
}
Expand Down

0 comments on commit 81a91f8

Please sign in to comment.