Repository navigation
RiftLibrary Armor
Creating armor in RiftLibrary requires the following steps:
- Creating your Blockbench Model
- Creating your Geo Model
- Creating your Item class
- Creating and registering your renderer
Steps #1 and #2 will not be covered on this page, instead visit their respective links for info. This page will focus on steps #3 and #4. It also assumes that you have already registered the items associated with each armor piece.
Creating an item class for an armor piece and rendering it in the inventory and etc is the same as with items, so feel free to refer to the guide for adding RiftLibrary items. The only difference is that it must extend GeoArmorItem.
public class ExampleArmorItem extends GeoArmorItem implements IAnimatable {
private final AnimationBuilder IDLE_ANIM = new AnimationBuilder().addAnimation("move.idle", true);
private AnimationFactory factory = new AnimationFactory(this);
public ExampleArmorItem(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot slot) {
super(materialIn, renderIndexIn, slot);
}
@Override
public void registerControllers(AnimationData data) {
data.addAnimationController(new AnimationController<>(this, "idle", 0, this::idleAnimController));
}
private PlayState idleAnimController(AnimationEvent event) {
event.getController().setAnimation(IDLE_ANIM);
return PlayState.CONTINUE;
}
@Override
public AnimationFactory getFactory() {
return this.factory;
}
}Now here's where things get different. The renderer for your armor class must extend GeoArmorRenderer<T>, with T being the armor class you're making the renderer for. However, you must also associate bones in the model for the armor with their corresponding variables.
To elaborate, RiftLibrary armors operate on a humanoid model basis. This means that the expected format for an armor roughly resembles a humanoid in that it has two arms, two legs, two feet, a torso, and a head. We need to tell the renderer which of our 'bones' align with the humanoid representation of them, so that it can match them up for rendering.
Here's an example renderer class:
public class ExampleArmorRenderer extends GeoArmorRenderer<ExampleArmorItem> {
public ExampleArmorRenderer() {
super(new ExampleArmorModel());
this.headBone = "helmet";
this.bodyBone = "chestplate";
this.rightArmBone = "rightArm";
this.leftArmBone = "leftArm";
this.rightLegBone = "rightLeg";
this.leftLegBone = "leftLeg";
this.rightBootBone = "rightBoot";
this.leftBootBone = "leftBoot";
}
}In the ModelRegistryEvent event of your mod, register your armor renderer as so:
GeoArmorRenderer.registerArmorRenderer(PotatoArmorItem.class, new PotatoArmorRenderer());