Posted September 26, 20195 yr 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!
September 26, 20195 yr 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.
September 26, 20195 yr 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:
September 26, 20195 yr 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.
September 26, 20195 yr 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.
September 26, 20195 yr 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!!
September 26, 20195 yr 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.