Skip to content

Commit

Permalink
add enable swim config
Browse files Browse the repository at this point in the history
  • Loading branch information
baguchi committed Nov 15, 2023
1 parent cb0bcb9 commit 59805f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class BetterWithAquatic implements ModInitializer {

public static final String MOD_ID = "better_with_aquatic";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
private boolean enable_swim;
private static boolean enable_swim;

private void handleConfig() {
Properties prop = new Properties();
Expand All @@ -32,7 +32,7 @@ private void handleConfig() {
IDUtils.initIds(
config.getInt("starting_block_id"),
config.getInt("starting_item_id"));
this.enable_swim = config.getBoolean("enable_swim");
enable_swim = config.getBoolean("enable_swim");
config.updateConfig();
}

Expand All @@ -46,7 +46,7 @@ public void onInitialize() {
NetworkHelper.register(SwimPacket.class, true, false);
}

public boolean isEnableSwim() {
public static boolean isEnableSwim() {
return enable_swim;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package baguchan.better_with_aquatic.mixin.client;

import baguchan.better_with_aquatic.BetterWithAquatic;
import baguchan.better_with_aquatic.api.ISwiming;
import net.minecraft.client.input.KeyboardInput;
import net.minecraft.client.option.GameSettings;
Expand Down Expand Up @@ -29,7 +30,9 @@ public void tick(EntityPlayer entityplayer, CallbackInfo ci) {
if (keys[0]) {
this.sprintTime = 0;
if (this.sprintTime < 9) {
((ISwiming) entityplayer).setSwimming(true);
if (BetterWithAquatic.isEnableSwim()) {
((ISwiming) entityplayer).setSwimming(true);
}
}
} else {
if (this.sprintTime < 20) {
Expand Down

0 comments on commit 59805f4

Please sign in to comment.