Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • (1.16.2) Making a new capability
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
e2rifia

(1.16.2) Making a new capability

By e2rifia, Thursday at 01:12 PM in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

e2rifia    0

e2rifia

e2rifia    0

  • Tree Puncher
  • e2rifia
  • Members
  • 0
  • 16 posts
Posted Thursday at 01:12 PM (edited)

I tried to follow this page to create a capability.

https://mcforge.readthedocs.io/en/latest/datastorage/capabilities/

This is what I have so far. NBTBase and EnumFacing are not found to be imported. If they are out of date, what should I use instead?

 

import com.e2rifia.chants.util.IState;


import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;

 

public class IHaveMana implements ICapabilitySerializable<NBTBase> {
    @CapabilityInject(IState.class)
    public static final Capability<IState> STATE_CAPABILITY = null;

    private IState instance = STATE_CAPABILITY.getDefaultInstance();

    @Override
    public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
        return capability == STATE_CAPABILITY;
    }

    @Override
    public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
        return capability == STATE_CAPABILITY ? STATE_CAPABILITY.<T>cast(this.instance) : null;
    }

    @Override
    public NBTBase serializeNBT() {
        return STATE_CAPABILITY.getStorage().writeNBT(STATE_CAPABILITY, this.instance, null);
    }

    @Override
    public void deserializeNBT(NBTBase nbt) {
        STATE_CAPABILITY.getStorage().readNBT(STATE_CAPABILITY, this.instance, null, nbt);
    }

Edited Thursday at 01:13 PM by e2rifia
  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7586

diesieben07

diesieben07    7586

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7586
  • 54922 posts
Posted Thursday at 01:14 PM

EnumFacing is Direction now.

NBTBase would be INBT.

  • Like 1
  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • AurenX
      [1.16.4] Generation Help

      By AurenX · Posted 10 minutes ago

      Started to update my mod to 1.16.4 and i hit a roadblock. I started my mod in 1.12 and lost my computer so my work halted, But what i had working was overriding the nether generation and putting overworld generation on top essentially replacing the bedrock layer with layers that would have hills, lava lakes, lava rivers, trees, etc...; added biomes so there would some variation. At that time i had to create a world provider and chunk generator and replace the nether world provider. Obviously this has changed to the new json format What i have working is the dimension json and the dimension type json (tested with a new dimension and then overriding the default nether), can add biomes to it. My question is with this new json system it appears the chunk generator is called from the json nether being (multi_noise). Am i going down the wrong path here or what are the proper steps. What is recommended here?      
    • gibbyj
      Help using Minecraft Forge on Manjaro Linux

      By gibbyj · Posted 25 minutes ago

      For the record, we made decent progress.  Learned how to activate logging and read the log file in .minecraft folder.  Found that I had mis-configured execution options (heap 64M when 32M was the max allowable).  Fixed that and latest versions of Forge started working.  May be able to get the older ones working too, by using an Oracle 1.8 jvm.   But my son is having fun with forge and some recent mods.
    • JeffMan
      [1.15] replacing chunks

      By JeffMan · Posted 36 minutes ago

      What library is it using?
    • ChampionAsh5357
      [1.16.5 ] Dust Block Texture Glitch

      By ChampionAsh5357 · Posted 59 minutes ago

      I would try increasing the size of the model to around 0.005 compared to a flat plane.
    • ChampionAsh5357
      [1.15] replacing chunks

      By ChampionAsh5357 · Posted 1 hour ago

      Since this mod is uses a library that is present within Forge, yes it is possible. Although, you should prioritize handling these items in events if possible.
  • Topics

    • AurenX
      0
      [1.16.4] Generation Help

      By AurenX
      Started 10 minutes ago

    • gibbyj
      3
      Help using Minecraft Forge on Manjaro Linux

      By gibbyj
      Started 4 hours ago

    • JeffMan
      2
      [1.15] replacing chunks

      By JeffMan
      Started 6 hours ago

    • Linky132
      1
      [1.16.5 ] Dust Block Texture Glitch

      By Linky132
      Started 4 hours ago

    • Forix
      1
      [1.16.4] Multiple worlds

      By Forix
      Started 5 hours ago

  • Who's Online (See full list)

    • Terence O'Meally
    • AurenX
    • sarkozi
    • Asw3atyNerd
    • FrostyTerror
    • Choonster
    • chuckdie5el
    • st4s1k
    • thorstenschwager
    • JeffMan
    • Jason_Whittaker
    • DaemonUmbra
    • 2665374329@qq.com
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • (1.16.2) Making a new capability
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community