Skip to content

Commit 6370cf4

Browse files
committed
Mouvement limitator
1 parent 992b610 commit 6370cf4

File tree

4 files changed

+21
-57
lines changed

4 files changed

+21
-57
lines changed

src/main/java/com/cyao/mixin/CameraMixin.java

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.cyao.mixin;
22

3-
import net.minecraft.client.MinecraftClient;
43
import net.minecraft.client.render.Camera;
54
import org.spongepowered.asm.mixin.Mixin;
65
import org.spongepowered.asm.mixin.injection.At;
7-
import org.spongepowered.asm.mixin.injection.ModifyArg;
86
import org.spongepowered.asm.mixin.injection.ModifyVariable;
7+
import org.spongepowered.asm.mixin.injection.Redirect;
98

109
@Mixin(Camera.class)
1110
public class CameraMixin {
@@ -27,12 +26,8 @@ protected boolean thirdPerson(boolean value) {
2726
}
2827

2928
// Offset the camera a bit more
30-
@ModifyArg(
31-
method = "update(Lnet/minecraft/world/BlockView;Lnet/minecraft/entity/Entity;ZZF)V",
32-
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;moveBy(FFF)V"),
33-
index = 0
34-
)
35-
protected float offsetCamera(float x) {
36-
return x - 4.0f;
29+
@Redirect(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;clipToSpace(F)F"))
30+
protected float offsetCamera(Camera instance, float f) {
31+
return f + 5.0f;
3732
}
3833
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.cyao.mixin;
2+
3+
import net.minecraft.entity.player.PlayerEntity;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.injection.At;
6+
import org.spongepowered.asm.mixin.injection.ModifyArgs;
7+
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
8+
9+
@Mixin(PlayerEntity.class)
10+
public class PlayerEntityMixin {
11+
@ModifyArgs(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(DDD)D", ordinal = 1))
12+
private void clampArgs(Args args) {
13+
args.set(1, -0.5);
14+
args.set(2, 0.5);
15+
}
16+
}

src/main/java/com/cyao/mixin/WordPresetMixin.java

-47
This file was deleted.

src/main/resources/flat-minecraft.mixins.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"mixins": [
66
"CameraMixin",
77
"GameOptionsMixin",
8-
"WordPresetMixin"
8+
"PlayerEntityMixin"
99
],
1010
"injectors": {
1111
"defaultRequire": 1

0 commit comments

Comments
 (0)