"Critical injection failure: Variable modifier method". Trying to modify a variable in the raycast method, but I get this crash report. #4018
Answered
by
Crystal0404
Raynuz
asked this question in
Mod Dev Support
-
DescriptionSo I'm using a mixin to modify the vec3d2 variable in the Entity.class, but it crashes when I launch it in game. It doesn't crash when I run the mod inside IntelliJ though. I'm making this mod for 1.20.2. Here's what I'm trying to do:
When I run my mod through IntelliJ, it functions normally without any errors or crashes. When I build the mod and try to run it in game, I get this error: https://pastebin.com/NdhHutA2 |
Beta Was this translation helpful? Give feedback.
Answered by
Crystal0404
Aug 9, 2024
Replies: 1 comment 1 reply
-
You can use @WrapOperation(
method = "raycast",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/entity/Entity;getRotationVec(F)Lnet/minecraft/util/math/Vec3d;"
)
)
private Vec3d hello(Entity instance, float tickDelta, Operation<Vec3d> original) {
if (instance != MinecraftClient.getInstance().player) {
return original.call(instance, tickDelta);
}
// do sth
return original.call(instance, tickDelta);
} wiki link: https://github.com/LlamaLad7/MixinExtras/wiki/WrapOperation |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Raynuz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use
MixinExtras
to do itwiki link: https://github.com/LlamaLad7/MixinExtras/wiki/WrapOperation