-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added sneakToNotWaterlog and tickRateAffectsChatKey
- Loading branch information
1 parent
0e94527
commit b2f06c0
Showing
8 changed files
with
105 additions
and
12 deletions.
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
...in/java/me/senseiwells/essential_client/mixins/sneak_to_not_waterlog/BucketItemMixin.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,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); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...java/me/senseiwells/essential_client/mixins/tick_rate_affect_chat_key/MinecraftMixin.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,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("/"); | ||
} | ||
} | ||
} | ||
} |
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