How do you interact with value after registering it
Eilux opened this issue ยท 7 comments
I have my component interface and implementation, I have the entrypoint set up and the NBT data appears in game, but how do I interact with my component implementation class in order to change and read the value stored there?
Usually that is accomplished by invoking one of the many get*() methods on your registered ComponentKey.
if you attached your component to players, you do KEY.get(player), if you attached it to chunks you do KEY.get(chunk), etc.
I'm defiantly doing something wrong here the game crashes whenever I run this line:
Components.MODE_KEY.get(client.player).incrementPlaceMode();
Could you post a crash report ? You may have forgotten to add your registration class as an entrypoint.
Wiki page: https://github.com/OnyxStudios/Cardinal-Components-API/wiki/Registering-and-using-a-component#3-attaching-your-component
Sorry for the delay in reply I did some poking around and fixed the crash but now I'm facing a new problem I need to read and write the NBT data for my component but I don't know what argument it expects for readFromNBT() and writeToNBT()