Skip to content

"Critical injection failure: Variable modifier method". Trying to modify a variable in the raycast method, but I get this crash report. #4018

Discussion options

You must be logged in to vote

You can use MixinExtras to do it

    @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

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Raynuz
Comment options

Answer selected by Raynuz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
2 participants