-
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
5d6682a
commit 458822f
Showing
6 changed files
with
39 additions
and
20 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
14 changes: 4 additions & 10 deletions
14
src/main/java/net/toshimichi/thymine/mixin/GameRendererMixin.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 |
---|---|---|
@@ -1,23 +1,17 @@ | ||
package net.toshimichi.thymine.mixin; | ||
|
||
import net.minecraft.client.option.SimpleOption; | ||
import net.minecraft.client.render.GameRenderer; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.toshimichi.thymine.ThymineMod; | ||
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.Redirect; | ||
|
||
@Mixin(GameRenderer.class) | ||
abstract public class GameRendererMixin { | ||
|
||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V"), method = "renderWorld") | ||
public void bobView(GameRenderer instance, MatrixStack matrices, float tickDelta) { | ||
if (!ThymineMod.getOptions().noScreenBobbing) { | ||
bobView(matrices, tickDelta); | ||
} | ||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/SimpleOption;getValue()Ljava/lang/Object;", ordinal = 0), method = "renderWorld", require = 0) | ||
public Object bobView(SimpleOption<Boolean> instance) { | ||
return !ThymineMod.getOptions().noScreenBobbing; | ||
} | ||
|
||
@Shadow | ||
protected abstract void bobView(MatrixStack matrices, float tickDelta); | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/net/toshimichi/thymine/mixin/KeyBindingMixin.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,25 @@ | ||
package net.toshimichi.thymine.mixin; | ||
|
||
import net.minecraft.client.option.KeyBinding; | ||
import net.toshimichi.thymine.ThymineMod; | ||
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.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(KeyBinding.class) | ||
public class KeyBindingMixin { | ||
|
||
@Final | ||
@Shadow | ||
private String translationKey; | ||
|
||
@Inject(at = @At("HEAD"), method = "isPressed", cancellable = true) | ||
public void isPressed(CallbackInfoReturnable<Boolean> cir) { | ||
if (ThymineMod.getOptions().toggleSprint && translationKey.equals("key.sprint")) { | ||
cir.setReturnValue(ThymineMod.getOptions().sprint); | ||
} | ||
} | ||
} |
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