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

I've been working on using Capabilities (instead of WorldSavedData due to issues with its complexity mentioned in another thread) and at this point, I'm lost. I'm instantiating my Capability and everything seems to be initialized as it should. You can see here how I'm calling it, and it always comes back null; at this point in execution I have an IWorld instance as I'm generating plutons in the world. Since it always comes back null, there's nothing I can do with it -- am I not supposed to be doing this??

 

I've seen :

GeolosysAPI.PLUTON_CAPABILITY.getDefaultInstance()

But it seems like "default" is implying that this isn't how I should be using this, and I haven't seen any other 1.14.x code using a World capability as of yet.

 

As usual, thanks for the help!

18 minutes ago, oitsjustjose said:

As usual, thanks for the help!

I dont see you using the AttachCapabilityEvent<World> anywhere in your code.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author
Just now, Animefan8888 said:

I dont see you using the AttachCapabilityEvent<World> anywhere in your code.

Here - and it triggers so I know I haven't botched something with the static vs. non-static access: 

6 minutes ago, oitsjustjose said:

Here - and it triggers so I know I haven't botched something with the static vs. non-static access: 

Weird I even used the search feature on github. Must've spelt it wrong.

Quote

public <T> LazyOptional<T> getCapability(@Nonnull final Capability<T> capIn, final @Nullable Direction side)
    {
        if (capIn instanceof IPlutonCapability)
        {
            return cap.cast();
        }

        return LazyOptional.empty();
    }

The bolded statement will never be true. You need to check if capIn == YOUR_CAPABILITY_VALUE. You need a

@CapabilityInject(ISomething.class)

public static final Capability<ISomething> YOUR_CAPABILITY_VALUE = null;

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author
Just now, Animefan8888 said:

Weird I even used the search feature on github. Must've spelt it wrong.

The bolded statement will never be true. You need to check if capIn == YOUR_CAPABILITY_VALUE. You need a

@CapabilityInject(ISomething.class)

public static final Capability<ISomething> YOUR_CAPABILITY_VALUE = null;

Ahhh that makes sense. I already have the @CapabilityInject portion in the Geolosys API, but your instanceof point is spot on. Let me try it and see if that resolves my issue.

  • Author

That was it. Wow, there's so much involvement in getting a Capability to work with little-to-no wiggle-room for error. 

 

Thanks for the help!!

  • Author

Fair - I'm just used to things in Forge having fewer components and allowing for some difference in implementation, and having Forge offer some default implementations.

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.