Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • "Reflections" Documentation?
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
SleepyCatGuy

"Reflections" Documentation?

By SleepyCatGuy, January 28 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

SleepyCatGuy    0

SleepyCatGuy

SleepyCatGuy    0

  • Tree Puncher
  • SleepyCatGuy
  • Members
  • 0
  • 6 posts
Posted January 28

Any sources or docs were I can find out how to use reflections? I keep reading its a better option than access transformers but cant find anything on it. I also am seeing "@override" in source code for other mods, but I do not know if that is Reflections or something else entirely. I need to be able to change a private function to something else.

 

Sub-Question (I don't really need to know more of a want to know): is there a way to get a live object created from a class from another mod?

  • Quote

Share this post


Link to post
Share on other sites

ChampionAsh5357    165

ChampionAsh5357

ChampionAsh5357    165

  • World Shaper
  • ChampionAsh5357
  • Members
  • 165
  • 1038 posts
Posted January 28

Reflection is a java concept, as such there's no documentation here. ObfuscationReflectionHelper is a forge added class as a wrapper to deal with changing method names due to mappings. However, this has full javadocs.

 

4 minutes ago, SleepyCatGuy said:

Sub-Question (I don't really need to know more of a want to know): is there a way to get a live object created from a class from another mod?

Sure, a registered object can be grabbed from the associated registry. Although you might want to add that mod as a dependency (either hard or soft) to better handle that case.

  • Thanks 1
  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7697

diesieben07

diesieben07    7697

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7697
  • 56419 posts
Posted January 28
6 hours ago, ChampionAsh5357 said:

Sure, a registered object can be grabbed from the associated registry. Although you might want to add that mod as a dependency (either hard or soft) to better handle that case.

A good way to do this is to simply store a RegistryObject in a static final field using its of factory method.

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2416

Draco18s

Draco18s    2416

  • Reality Controller
  • Draco18s
  • Members
  • 2416
  • 16005 posts
Posted January 28
13 hours ago, SleepyCatGuy said:

I also am seeing "@override" in source code for other mods, but I do not know if that is Reflections or something else entirely.

https://www.geeksforgeeks.org/overriding-in-java/

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • diesieben07
      [1.16.5] Help with custom Backpack (slot background and mouse wheel move)

      By diesieben07 · Posted 6 minutes ago

      I do not understand. How is the offhand slot relevant regarding the background color of your slot?   Assuming you want a keyboard key to open the GUI: Make a KeyBinding. Use ClientTickEvent to check if its pressed. If it is, send a packet to the server, which then calls NetworkHooks#openGui. You can preemptively also open it on the client to hide the latency of the two network roundtrips.
    • diesieben07
      When I try to run my mod after I just added Deferred Registries it crashes

      By diesieben07 · Posted 8 minutes ago

      That is not how you make a Git repo. At all.   This creates a BlockItem for all of your blocks. One of your blocks has the registry name "copper_ore", hence this will create a BlockItem with registry name "copper_ore". This then creates another Item with registry name "copper_ore". This is not allowed, registry names must be unique.
    • Extrupt
      Forge won't fully download

      By Extrupt · Posted 10 minutes ago

      thanks for the help! it worked!
    • Luis_ST
      [1.16.5] Help with custom Backpack (slot background and mouse wheel move)

      By Luis_ST · Posted 11 minutes ago

      I've already tried that and it's not how it's supposed to work. For example, if I put an item in the offand slot, the background texture is set to default. that's how it should work   I'll try the event   Another question which event should I use to open my BackpackContainer. I know that there is the KeyInputEvent when I use this I don't get a ServerPlayerEntity which I need to open the GUI with NetworkHooks#openGui. I currently use TickEvent#PlayerTickEvent which is not the best solution. Is there another / better way to do this?
    • ThisIsNotOriginal
      When I try to run my mod after I just added Deferred Registries it crashes

      By ThisIsNotOriginal · Posted 13 minutes ago

      https://github.com/hakerman74/ModPractice   This is my repo for the code I didnt add my assets file  
  • Topics

    • Luis_ST
      3
      [1.16.5] Help with custom Backpack (slot background and mouse wheel move)

      By Luis_ST
      Started Yesterday at 07:47 AM

    • ThisIsNotOriginal
      17
      When I try to run my mod after I just added Deferred Registries it crashes

      By ThisIsNotOriginal
      Started 16 hours ago

    • Extrupt
      5
      Forge won't fully download

      By Extrupt
      Started 42 minutes ago

    • HDMI_Steckdose
      1
      Forge error Forge won't open

      By HDMI_Steckdose
      Started 17 minutes ago

    • Retsal
      7
      [1.16.x] Custom block as a shop

      By Retsal
      Started Yesterday at 01:04 PM

  • Who's Online (See full list)

    • troublemaker_47
    • CAS_ual_TY
    • diesieben07
    • reu_24
    • Extrupt
    • ThisIsNotOriginal
    • Coloringgamer
    • Katie328
    • Luis_ST
    • Tavi007
    • Draco18s
    • dresacraft
    • hugo.talento@gmail.com
    • HDMI_Steckdose
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • "Reflections" Documentation?
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community