![minecraft 1.9 modding tutorial minecraft 1.9 modding tutorial](https://i.ytimg.com/vi/gbBKKQiiH4I/maxresdefault.jpg)
- Minecraft 1.9 modding tutorial how to#
- Minecraft 1.9 modding tutorial mod#
- Minecraft 1.9 modding tutorial registration#
Tip: You can attach multiple different capabilities to a capability provider. if you attached the capability to a player you'd use player.getCapability().getMana()). Key Point: To use your capability in your code, you simply use the getCapability() method on the appropriate thing and further call the getter and setter methods as appropriate (e.g. new ResourceLocation(myModID, "Mana")) but the actual name doesn't seem to be too important as you will interact directly with the instance. In this method you're supposed to give a name key (e.g. If you're attaching the capability to a vanilla class, like EntityPlayer you need to handle the AttachCapabilitiesEve nt by checking the entity type and using the event.addCapability() method.(IMana.class, new ManaStorage(), Mana.class). Register your capability with the () method from your "pre-init" handler method of your common proxy.MANA.getStorage()) to call the related writeNBT() and readNBT() methods. the serializeNBT() and deserializeNBT() methods to use the storage (e.g.the hasCapability() and getCapability() methods to provide the constant field.public final static Capability MANA = null ) and "inject" your capability to it by adding the annotation.
![minecraft 1.9 modding tutorial minecraft 1.9 modding tutorial](https://i.ytimg.com/vi/z9ohwIJoh4g/maxresdefault.jpg)
![minecraft 1.9 modding tutorial minecraft 1.9 modding tutorial](https://www.minecraftore.com/wp-content/uploads/2016/06/orespawn-for-minecraft-346x188.jpg)
So there are actually four different cases where you might use capabilities, and they are actually fairly different in terms of what you need to do:
![minecraft 1.9 modding tutorial minecraft 1.9 modding tutorial](https://rubikstouchcube.com/wp-content/uploads/2021/09/R-4.png)
You can attach existing capabilities, like IItemHolder or create your own custom one (e.g. Attaching the capability depends on whether you're attaching to your own class (in which case you the hasCapability() and getCapability() methods) or you handle the AttachCapabilitiesEvent.
Minecraft 1.9 modding tutorial registration#
Registration happens in your pre-init handling code using the () method. The concept of a capability is that you need to both register and "attach" the capability.
Minecraft 1.9 modding tutorial how to#
The official Forge documentation explains how to convert.Ĭapabilities can be attached to entities, tile entities, items and worlds.
Minecraft 1.9 modding tutorial mod#
If you're upgrading your mod you may need to convert your IEEP to Capabilities.