-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
8c26c80
commit 7ba6ed6
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
common/src/main/java/miyucomics/hexical/mixin/ClientPlayerEntityMixin.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,36 @@ | ||
package miyucomics.hexical.mixin; | ||
|
||
import at.petrak.hexcasting.client.gui.GuiSpellcasting; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.input.Input; | ||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import net.minecraft.client.option.GameOptions; | ||
import net.minecraft.client.option.KeyBinding; | ||
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.callback.CallbackInfo; | ||
|
||
@Mixin(ClientPlayerEntity.class) | ||
public class ClientPlayerEntityMixin { | ||
@Shadow public Input input; | ||
|
||
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/tutorial/TutorialManager;onMovement(Lnet/minecraft/client/input/Input;)V")) | ||
private void onInputUpdate(CallbackInfo info) { | ||
MinecraftClient client = MinecraftClient.getInstance(); | ||
if (!(client.currentScreen instanceof GuiSpellcasting)) | ||
return; | ||
KeyBinding.updatePressedStates(); | ||
GameOptions keys = client.options; | ||
keys.dropKey.setPressed(false); | ||
input.pressingForward = keys.forwardKey.isPressed(); | ||
input.pressingBack = keys.backKey.isPressed(); | ||
input.pressingLeft = keys.leftKey.isPressed(); | ||
input.pressingRight = keys.rightKey.isPressed(); | ||
input.jumping = keys.jumpKey.isPressed(); | ||
input.sneaking = keys.sneakKey.isPressed(); | ||
if (!client.player.isSprinting()) | ||
client.player.setSprinting(keys.sprintKey.isPressed()); | ||
} | ||
} |
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