Search in sources :

Example 1 with GeoArmorRenderer

use of software.bernie.geckolib3.renderers.geo.GeoArmorRenderer in project geckolib by bernie-g.

the class GeoArmorItem method getArmorTexture.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Nullable
@Override
public final String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) {
    Class<? extends ArmorItem> clazz = this.getClass();
    GeoArmorRenderer renderer = GeoArmorRenderer.getRenderer(clazz);
    return renderer.getTextureLocation((ArmorItem) stack.getItem()).toString();
}
Also used : ArmorItem(net.minecraft.world.item.ArmorItem) GeoArmorRenderer(software.bernie.geckolib3.renderers.geo.GeoArmorRenderer) Nullable(javax.annotation.Nullable)

Example 2 with GeoArmorRenderer

use of software.bernie.geckolib3.renderers.geo.GeoArmorRenderer in project geckolib by bernie-g.

the class GeoArmorRenderer method applySlot.

@SuppressWarnings("incomplete-switch")
public GeoArmorRenderer applySlot(EquipmentSlot slot) {
    modelProvider.getModel(modelProvider.getModelLocation(currentArmorItem));
    IBone headBone = this.getAndHideBone(this.headBone);
    IBone bodyBone = this.getAndHideBone(this.bodyBone);
    IBone rightArmBone = this.getAndHideBone(this.rightArmBone);
    IBone leftArmBone = this.getAndHideBone(this.leftArmBone);
    IBone rightLegBone = this.getAndHideBone(this.rightLegBone);
    IBone leftLegBone = this.getAndHideBone(this.leftLegBone);
    IBone rightBootBone = this.getAndHideBone(this.rightBootBone);
    IBone leftBootBone = this.getAndHideBone(this.leftBootBone);
    switch(slot) {
        case HEAD:
            if (headBone != null)
                headBone.setHidden(false);
            break;
        case CHEST:
            if (bodyBone != null)
                bodyBone.setHidden(false);
            if (rightArmBone != null)
                rightArmBone.setHidden(false);
            if (leftArmBone != null)
                leftArmBone.setHidden(false);
            break;
        case LEGS:
            if (rightLegBone != null)
                rightLegBone.setHidden(false);
            if (leftLegBone != null)
                leftLegBone.setHidden(false);
            break;
        case FEET:
            if (rightBootBone != null)
                rightBootBone.setHidden(false);
            if (leftBootBone != null)
                leftBootBone.setHidden(false);
            break;
    }
    return this;
}
Also used : IBone(software.bernie.geckolib3.core.processor.IBone)

Aggregations

Nullable (javax.annotation.Nullable)1 ArmorItem (net.minecraft.world.item.ArmorItem)1 IBone (software.bernie.geckolib3.core.processor.IBone)1 GeoArmorRenderer (software.bernie.geckolib3.renderers.geo.GeoArmorRenderer)1