Jump to content

[1.11.2] Replace Access Transformer


LogicTechCorp

Recommended Posts

Use ReflectionHelper.findField or ReflectionHelper.findMethod to get a Field/Method object for the field/method and store it in a private static final field. You'll need to provide both the MCP and SRG names of the field/method.

 

Use Field#get or Field#set to get or set the value of a field. If it's an instance field, pass the instance as the first argument. If it's a static field, pass null as the first argument instead.

 

Use Method#invoke to call a method. If it's an instance method, pass the instance as the first argument. If it's a static method, pass null as the first argument instead. Pass the method's arguments as the vararg argument.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

1 minute ago, Choonster said:

Use ReflectionHelper.findField or ReflectionHelper.findMethod to get a Field/Method object for the field/method and store it in a private static final field. You'll need to provide both the MCP and SRG names of the field/method.

 

Use Field#get or Field#set to get or set the value of a field. If it's an instance field, pass the instance as the first argument. If it's a static field, pass null as the first argument instead.

 

Use Method#invoke to call a method. If it's an instance method, pass the instance as the first argument. If it's a static method, pass null as the first argument instead. Pass the method's arguments as the vararg argument.

Thank you! I will work on it and come back if I have any issues.

Link to comment
Share on other sites

You're using the blocks Field twice and casting the value of the second call to List<Template.EntityInfo> instead of using the entities Field. This will throw a ClassCastException at runtime.

 

It also looks like you're not actually using the size Field.

 

I recommend following Java naming conventions by using CONSTANT_CASE for constant fields.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

9 hours ago, Choonster said:

You're using the blocks Field twice and casting the value of the second call to List<Template.EntityInfo> instead of using the entities Field. This will throw a ClassCastException at runtime.

 

It also looks like you're not actually using the size Field.

 

I recommend following Java naming conventions by using CONSTANT_CASE for constant fields.

Thanks, I didn't see that. Also, the size Field wasn't needed after all since the class has a getSize method.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.