Posted January 14, 20214 yr 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 January 14, 20214 yr by e2rifia
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.