Skip to content

Commit

Permalink
Finish updating and features
Browse files Browse the repository at this point in the history
- Added sneakToNotWaterlog and tickRateAffectsChatKey
  • Loading branch information
senseiwells committed Dec 5, 2024
1 parent 0e94527 commit b2f06c0
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 12 deletions.
10 changes: 6 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ plugins {
}

repositories {
mavenLocal()
mavenCentral()
maven("https://maven.parchmentmc.org/")
maven("https://maven.terraformersmc.com/")
Expand All @@ -21,7 +20,7 @@ repositories {
maven("https://jitpack.io")
}

val modVersion = "2.0.0-beta.3"
val modVersion = "2.1.0-beta.1"
val releaseVersion = "${modVersion}+${libs.versions.minecraft.get()}"
version = releaseVersion
group = "me.senseiwells"
Expand Down Expand Up @@ -70,8 +69,11 @@ tasks {
publishMods {
file = remapJar.get().archiveFile
changelog = """
Added `Custom Time Out` config which lets you set how long until your
client times out your connection to the server while it hangs.
Update to 1.21.4
Added:
- `sneakToNotWaterlog` which allows you to bypass waterlogging by holding your sneak key
- `tickRateAffectsChatKey` which allows you to bypass the delay when opening chat with lower tick rates
""".trimIndent()
type = BETA
modLoaders.add("fabric")
Expand Down
7 changes: 4 additions & 3 deletions libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ fabric-loader = "0.16.9"
fabric-api = "0.110.5+1.21.4"
parchment = "1.21:2024.07.28"
fabric-kotlin = "1.11.0+kotlin.2.0.0"
mod-menu = "12.0.0-beta.1"
mod-menu = "13.0.0-beta.1"
keybinds = "0.1.11+1.21.4"
yacl = "3.6.1+1.21.2-fabric"
yacl = "3.6.2+1.21.4-fabric"
carpet = "1.4.160"
chunk-debug = "2.1.3+1.21.4"

# Plugins
fabric-loom = "1.9-SNAPSHOT"
mod-publish = "0.7.0"
mod-publish = "0.8.1"

[libraries]
minecraft = { module = "com.mojang:minecraft" , version.ref = "minecraft" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;


@Mixin(KeyboardInput.class)
public class KeyboardInputMixin {
@Shadow @Final private Options options;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package me.senseiwells.essential_client.mixins.sneak_to_not_waterlog;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import me.senseiwells.essential_client.EssentialClientConfig;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BucketItem;
import net.minecraft.world.level.block.LiquidBlockContainer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.*;

@Mixin(BucketItem.class)
public class BucketItemMixin {
@WrapOperation(
method = "use",
constant = @Constant(classValue = LiquidBlockContainer.class)
)
private boolean playerCheckBypass(
Object object,
Operation<Boolean> original,
@Local(argsOnly = true) Player player
) {
if (EssentialClientConfig.getInstance().getSneakToNotWaterlog()) {
return original.call(object) && !player.isSecondaryUseActive();
}
return original.call(object);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package me.senseiwells.essential_client.mixins.tick_rate_affect_chat_key;

import me.senseiwells.essential_client.EssentialClientConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.client.Options;
import net.minecraft.client.gui.screens.Overlay;
import net.minecraft.client.gui.screens.Screen;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Minecraft.class)
public abstract class MinecraftMixin {
@Shadow @Nullable public Screen screen;
@Shadow @Final public Options options;
@Shadow private @Nullable Overlay overlay;

@Shadow protected abstract void openChatScreen(String defaultText);

@Inject(
method = "runTick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V",
ordinal = 0
),
slice = @Slice(
from = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/Minecraft;tick()V"
)
)
)
private void onTick(boolean renderLevel, CallbackInfo ci) {
if (!EssentialClientConfig.getInstance().getTickRateAffectsChatKey()) {
while (this.options.keyChat.consumeClick()) {
this.openChatScreen("");
}

if (this.screen == null && this.overlay == null && this.options.keyCommand.consumeClick()) {
this.openChatScreen("/");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class EssentialClientConfig {
@CustomDescription
@SerialEntry var betterAccurateBlockPlacement: Boolean = false

@Bool(colored = true)
@AutoGen(category = "gameplay")
@SerialEntry var sneakToNotWaterlog: Boolean = false

@FloatSlider(min = 0.0F, max = 10.0F, step = 0.5F)
@AutoGen(category = "gameplay")
@SerialEntry var spectatorScrollMaxSpeed: Float = 1.0F
Expand All @@ -35,6 +39,10 @@ class EssentialClientConfig {
@AutoGen(category = "gameplay")
@SerialEntry var spectatorScrollSensitivity: Float = 1.0F

@Bool(colored = true)
@AutoGen(category = "gameplay")
@SerialEntry var tickRateAffectsChatKey: Boolean = true

@IntField
@AutoGen(category = "technical")
@SerialEntry var announceAfk: Int = 0
Expand Down
10 changes: 6 additions & 4 deletions src/main/resources/assets/essential-client/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
"yacl3.config.essential-client:config.betterAccurateBlockPlacement": "Better Accurate Block Placement",
"yacl3.config.essential-client:config.betterAccurateBlockPlacement.desc.1": "This is the same as accurate block placement for tweakeroo but without the need for any server-side mods",
"yacl3.config.essential-client:config.betterAccurateBlockPlacement.desc.2": "This uses some packet hacking, which may flag anti-cheat on some servers",
"yacl3.config.essential-client:config.sneakToNotWaterlog": "Sneak To Not Waterlog",
"yacl3.config.essential-client:config.sneakToNotWaterlog.desc.1": "Allows you to sneak when using a bucket on a waterloggable block to avoid waterlogging",
"yacl3.config.essential-client:config.spectatorScrollMaxSpeed": "Increase Spectator Scroll Speed",
"yacl3.config.essential-client:config.spectatorScrollMaxSpeed.desc.1": "Increases the limit at which you can scroll to go faster in spectator",
"yacl3.config.essential-client:config.spectatorScrollSensitivity": "Increase Spectator Scroll Sensitivity",
"yacl3.config.essential-client:config.spectatorScrollSensitivity.desc.1": "Increases the sensitivity at which you can scroll to go faster in spectator",
"yacl3.config.essential-client:config.switchToTotem": "Switch To Totem",
"yacl3.config.essential-client:config.switchToTotem.desc.1": "This will switch to a totem (if you have one) under a set amount of health",
"yacl3.config.essential-client:config.tickRateAffectsChatKey": "Tick Rate Affects Chat Key",
"yacl3.config.essential-client:config.tickRateAffectsChatKey.desc.1": "Whether the tick rate affects your chat key, when true, with a lower tick rate it will take longer to open chat (vanilla behaviour)",

"yacl3.config.essential-client:config.category.technical": "Technical",
"yacl3.config.essential-client:config.announceAfk": "Announce AFK",
"yacl3.config.essential-client:config.announceAfk.desc.1": "This announces when you become AFK after a set amount of time (in ticks)",
"yacl3.config.essential-client:config.announceAfkMessage": "Announce AFK Message",
Expand All @@ -19,8 +23,6 @@
"yacl3.config.essential-client:config.announceBackMessage": "Announce Back Message",
"yacl3.config.essential-client:config.announceBackMessage.desc.1": "This is the message you announce after you are back from being AFK",
"yacl3.config.essential-client:config.announceBackMessage.desc.2": "Requires 'Announce AFK' to be enabled",

"yacl3.config.essential-client:config.category.technical": "Technical",
"yacl3.config.essential-client:config.carpetAlwaysSetDefault": "Carpet Always Set Default",
"yacl3.config.essential-client:config.carpetAlwaysSetDefault.desc.1": "This makes it so whenever you set a carpet rule, it automatically sets it to default",
"yacl3.config.essential-client:config.creativeWalkSpeed": "Creative Walk Speed",
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/essential-client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"lava_opacity.SectionCompilerMixin",
"persistent_chat_history.GuiMixin",
"spectator_scrolling.MouseHandlerMixin",
"tick_rate_affect_chat_key.MinecraftMixin",
"toggle_tab.GuiMixin"
],
"injectors": {
Expand All @@ -36,6 +37,7 @@
"mixins": [
"creative_walk_speed.PlayerMixin",
"custom_time_out.ConnectionMixin",
"sneak_to_not_waterlog.BucketItemMixin",
"yacl.SimpleOptionFactoryMixin"
]
}

0 comments on commit b2f06c0

Please sign in to comment.