Jump to content

Recommended Posts

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!

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

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

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

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

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

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