-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
56 additions
and
25 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
common/src/main/java/dev/igalaxy/takeitslow/mixin/LivingEntityMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package dev.igalaxy.takeitslow.mixin; | ||
|
||
import dev.igalaxy.takeitslow.TakeItSlow; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.level.GameType; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(LivingEntity.class) | ||
public class LivingEntityMixin { | ||
@ModifyVariable(method = "setSprinting(Z)V", at = @At("HEAD")) | ||
private boolean modifySetSprinting(boolean bl) { | ||
if (((Object) this) instanceof LocalPlayer) { | ||
LocalPlayer player = (LocalPlayer) (Object) this; | ||
|
||
GameType localPlayerMode = ((LocalPlayerAccessor)player).getMinecraft().gameMode.getPlayerMode(); | ||
|
||
boolean allowSwimming = TakeItSlow.getConfig().allowSwimming; | ||
boolean allowCreative = TakeItSlow.getConfig().allowCreative; | ||
|
||
boolean isUnderwater = player.isUnderWater(); | ||
boolean isCreative = localPlayerMode == GameType.CREATIVE; | ||
boolean isSpectator = localPlayerMode == GameType.SPECTATOR; | ||
|
||
return (isUnderwater && bl && allowSwimming) || (isCreative && bl && allowCreative) || (isSpectator && bl && allowCreative); | ||
} | ||
return bl; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
common/src/main/java/dev/igalaxy/takeitslow/mixin/LocalPlayerAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.igalaxy.takeitslow.mixin; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(LocalPlayer.class) | ||
public interface LocalPlayerAccessor { | ||
@Accessor | ||
Minecraft getMinecraft(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
org.gradle.jvmargs=-Xmx2048M | ||
|
||
minecraft_version=1.19 | ||
minecraft_version=1.19.4 | ||
enabled_platforms=fabric,forge | ||
|
||
archives_base_name=take-it-slow | ||
mod_version=1.0.3 | ||
mod_version=1.1.0 | ||
maven_group=dev.igalaxy.takeitslow | ||
|
||
architectury_version=5.6.22 | ||
architectury_version=8.1.73 | ||
|
||
fabric_loader_version=0.14.7 | ||
|
||
forge_version=1.19-41.1.0 | ||
forge_version=1.19.4-45.0.9 | ||
|
||
cloth_version = 8.+ | ||
modmenu_version = 4.0.4 | ||
cloth_version = 10.+ | ||
modmenu_version = 6.1.0-rc.4 | ||
|
||
|
||
|