Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

So I have some problems, which is

1. I don't understand what this thing does

2. I want to return LazyOptional in my capability provider, but it gives me the cast error because idk how

3. I want to get the type of the LazyOptional(get T from LazyOptional<T>)

 

Please help me out, if there's a necessity to post my code then I will edit this post

I think you should post your code

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

  • 3 months later...
 
 
0
 Advanced issues found
 
 
 
On 4/2/2019 at 7:02 AM, Cadiboo said:

I think you should post your code

^Why? (Almost think you're stupid. No offense)

 

1. From what I understand, it keeps from returning null without the dev knowing.

2. LazyOptional.of((NonNullSupplier<T>) Optional.fromNullable("your capability  instance here"));

3. Use .orElse in LazyOptional and set null as the argument. If you get null and not a capability then the LazyOptional is empty.

 

Took me literally weeks to find the answer for 2. :/

 

And take at me mod source for guidance:

Github

Somehow my post doesn't display properly.

 

Here is a redo:

On 4/2/2019 at 7:02 AM, Cadiboo said:

I think you should post your code

^Why (I Almost think you're stupid. No offense)

 

1. From what I understand, it keeps from returning null without the dev knowing.

2. 

LazyOptional.of((NonNullSupplier<T>) Optional.fromNullable("Your capability instance here"));

3. Use .orElse in LazyOptional and set null as the argument. If you get null and not a capability instance then the LazyOptional is empty.

 

Took me literally weeks to find the answer for 2. :/

And take a look at my mod source for guidance:

https://github.com/WotblitzMC/FEUniversial

Edited by WOTBLITZ

You should return LazyOptional.of(() -> yourCapabilityInstance).cast(); in getCapability, or even better, store LazyOptional.of(() -> yourCapabilityInstance) in a field to reduce the number of objects that you create.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

  • 1 month later...
  • Author

Thank you guys, turns out I found a better solution, you guys can check it out the code on my Github

https://github.com/yuckyh/Equinox

P.S. I hope I'm not necroposting, just want to make sure that this can work and everyone can find out how.

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.