User Tools

Site Tools


Sidebar

Setup

Basics

Items

Blocks and Block Entities

Fluids

Entities

World Generation

Miscellaneous

Events

Mixins

Dynamic Data Generation

Advanced

Tutorials for Minecraft 1.15

Tutorials for Minecraft 1.14

Documentation

tutorial:mixin_redirectors

Mixin redirectors

introduction

Redirectors are methods that can replace method invocations, field accesses, object creation, and instanceof checks. Redirectors are declared by @Redirect annotations and generally look like this:

  1. @Redirect(method = "${signatureOfMethodInWhichToRedirect}",
  2. at = @At(value = "${injectionPointReference}", target = "${signature}"))
  3. public ReturnType redirectSomeMethod(Arg0Type, arg0, Arg1Type arg1) {
  4. MyClass.doMyComputations();
  5.  
  6. return computeSomethingElse();
  7. }

Refer to the specific redirection tutorials for information about injection point references:

tutorial/mixin_redirectors.txt · Last modified: 2020/08/17 01:10 by user11681