Skip to content
Kiooeht edited this page Aug 26, 2018 · 3 revisions

Locator Patches

When using Locator patches, you need to use the Matcher class to specify where in the game you want a patch to be inserted. Javassist can match many different types of expressions and ModTheSpire provides a Matcher for each type.

Matcher.TypeCastMatcher

Matches: type cast expressions, i.e. Dog myDog = (Dog) myAnimal

Constructor:

  • String typeName the name of the class that the type cast is casting to

Matcher.ConstructorCallMatcher

Matches: constructor call, i.e. super() or this()

Constructor:

  • Class<?> clazz the Class type of the the class that the constructor is calling
  • String methodName (optional) the name of the method being called, either super or this

Or:

  • String className the name of the class that the constructor is calling
  • String methodName (optional) the name of the method being called, either super or this

Matcher.FieldAccessMatcher

Matches: field access expressions, i.e. myObject.myField

Constructor:

  • Class<?> clazz the Class type of the the class that is having its field accessed
  • String fieldName the name of the field being accessed

Or:

  • String className the name of the class that is having its field accessed
  • String fieldName the name of the field being accessed

Matcher.CatchClauseMatcher

Matches: catch clauses, i.e. catch (SomethingException e) {// do stuff}

Constructor:

  • Class<?> exceptionType the Class type of the class of exception that is being caught
  • boolean isFinally if this matches a catch or finally clause

Or:

  • String exceptionType the name of the class of exception that is being caught
  • boolean isFinally if this matches a catch or finally clause

Matcher.InstanceOfMatcher

Matches: instanceof expressions, i.e. myObject instanceof Animal

Constructor:

  • Class<?> clazz the Class type the type that we're checking if the object is an instance of

Or:

  • String comparedToType the name of the type that we're checking if the object is an instance of

Matcher.MethodCallMatcher

Matches: method calls, i.e. myObject.doAThing()

Constructor:

  • Class<?> clazz the Class type of the class of the object this method is being called on
  • String methodName the name of the method that is being called

Or:

  • String className the name of the class of the object this method is being called on
  • String methodName the name of the method that is being called

Matcher.NewArrayMatcher

Matches: new array expressions, i.e. myArray = new int[3]

Constructor:

  • Class<?> clazz the Class type of the class that is the type of the array

Or:

  • String className the name of the class that is the type of the array

Matcher.NewExprMatcher

Matches: new expressions, i.e. new Object()

Constructor:

  • Class<?> clazz the Class type of the class that is being constructed

Or:

  • String className the name of the class that is being constructed