Jump to content

1.14 World Capability Attaching but Never Available


oitsjustjose

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • @bluedisgusted That actually fully fixed it, thank you so much
    • Hi, I would like to know how to create multiple hitboxes for the player like the ender dragon. I've searched everywhere but I haven't found anything.
    • FOLKWIN EXPERT RECOVERY is the crypto hero we all need in the ongoing battle against cryptocurrency theft. With the rise in popularity of digital assets like Bitcoin and Ethereum, crypto crime has also been on the rise as hackers look to steal funds stored in virtual wallets. Many a crypto investor has fallen victim to clever scams and hacking schemes that drain wallets of their precious coins. But fear not, for FOLKWIN EXPERT RECOVERY has arrived as a beacon of hope for those who have had their hard-earned crypto stolen. This service is like a superhero for tracking down lost or stolen cryptocurrency, utilizing their advanced forensic technology and expertise to follow the blockchain paper trail and identify where your funds have gone. Their team of ethical hackers act like detectives, piecing together crypto transactions and unmasking the thieves behind complex cybercrimes. No case is too difficult for FOLKWIN EXPERT RECOVERY; they have recovered millions in stolen crypto assets from around the globe. Their mission is to reunite victims with their lost funds and bring criminals who prey on cryptocurrency investors to justice. With their help, those who have been robbed of their digital fortunes now have a crypto guardian to call upon in their time of need. FOLKWIN EXPERT RECOVERY gives victims the hope that all is not lost forever when crypto theft occurs.For support, Contact details is: TELEGRAM: @FOLKWIN_EXPERT_RECOVERY, EMAIL: FOLKWINEXPERTRECOVERY at TECH-CENTER dot COM, WEBSITE: WWW.FOLKWINEXPERTRECOVERY.COM .  are the heroes we need in the ongoing battle to make cryptocurrency ownership safe and secure for all. Get FOLKWIN EXPERT RECOVERY on your side when you have issues like this by dialing: Do this and thank me later. God Blessings to all, I'm forever grateful oh God for the successful recovery. I recommend FOLKWIN EXPERT RECOVERY the best ever and i'm so happy i got all my lost money back. Best Regards. Pamela K Ingram.
    • Made it work. As a note, one of the times it didn't recognize the recipe cause the MOD_ID constant I was using somewhere was NOT referencing my MOD_ID but rather another static variable with the same name. Maybe OP is having a similar problem
    • What exactly is the issue?
  • Topics

×
×
  • Create New...

Important Information

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