-
Notifications
You must be signed in to change notification settings - Fork 9
How to register your resources
We are going to see how to register your resources (models and animations) with the CraftStudio API
@Mod.EventBusSubscriber
@Mod(name = "TestMod", modid = Mod_Test.MODID)
public class Mod_Test
{
public static final String MODID = "testmod";
@SidedProxy(clientSide = "path.to.ClientProxy", serverSide = "path.to.CommonProxy")
private static CommonProxy proxy;
@Instance(Mod_Test.MODID)
private static Mod_Test instance;
public static Mod_Test getInstance() {
return Mod_Test.instance;
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void registerModels(RegistryEvent.Register<CSReadedModel> e) {
Mod_Test.proxy.registerModels();
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void registerAnims(RegistryEvent.Register<CSReadedAnim> e) {
Mod_Test.proxy.registerAnims();
}
}As you may seen, we need to add two methods:
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void registerModels(RegistryEvent.Register<CSReadedModel> e) {}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void registerAnimations(RegistryEvent.Register<CSReadedAnim> e) {}These methods are used to register your resources in order to use them in your project.
The same way we register a block, an item or an entity in the registry of forge.
Now, we need to create two same methods (for the name) in your proxy classes
public class CommonProxy
{
public void registerModels() {}
public void registerAnims() {}
// Other methods...
}public class ClientProxy extends CommonProxy
{
CSRegistryHelper registry = new CSRegistryHelper(Mod_Test.MODID);
@Override
public void registerModels() {
super.registerModels();
registry.register(ResourceType.MODEL, RenderType.ENTITY, "your_model");
}
@Override
public void registerAnims() {
super.registerAnims();
registry.register(ResourceType.ANIM, RenderType.ENTITY, "your_animation");
}
}In the ClientProxy,
Start to instaciate the CSRegistryHelper class and define your mod id in the constructor
And call register method to register (thx captain' obvious) your resources in the API
registry.register(resourceTypeIn, renderTypeIn, resourceIn);resourceTypeIn define if your resource is a model or an animation with ResourceType.MODEL or ResourceType.ANIM
renderTypeIn define if your resource is a block or an entity with RenderType.BLOCK or RenderType.ENTITY
resourceIn the name of your resource in your mod assets
Your resources needs to be in a special assets folder to be properly readed by the API.
- assets
- your_modid
- craftstudio
- animations
- blocks
- your_animation.csjsmodelanim
- entity
- your_animation.csjsmodelanim
- blocks
- models
- blocks
- your_animation.csjsmodel
- entity
- your_animation.csjsmodel
- blocks
- animations
- craftstudio
- your_modid
○ CraftStudio
-
[EN] Export CraftStudio's Model(s), Animation(s) and Texture
-
[FR] Exporter les Modèles, Animations et Texture de CraftStudio
○ Minecraft Forge
-
JavaDoc(0.1)
-
[FR/EN] Example Mod
-
[EN] Tutorials
- Entities
- Blocks
- Add a render to a block (W.I.P)
- How to animate a block (W.I.P)
-
[FR] Tutoriels
- Entités
- Blocs
- Ajouter un rendu à un bloc (W.I.P)
- Comment animer un bloc (W.I.P)
○ [EN/FR] Version of the Api
