Jump to content

Lolzorrior

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Lolzorrior

  1. Definitely late to the party, but I've spent the past couple days working on learning how to use capabilities too. I finally got a pretty basic capability working, so I hope this helps. Like said earlier, casting from LazyOptional doesn't work. After some digging, it turns out you can still access your functions by using a lambda expression. First post here, so I can't figure out how to format my code into something readable here, so here's the link to my repository. https://github.com/lolzorrior/SupernaturalMod-1.15.2/blob/master/src/main/java/com/lolzorrior/supernaturalmod/ForgeEventSubscriber.java Take a look at the onPlayerLogsIn function. Essentially, you use the LazyOptionals ifPresent function and then use a lambda function from there. Feel free to take a look at my PowerProvider.class to see how I handled the NBT functions.
×
×
  • Create New...

Important Information

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