[Legacy] GeckoLib Fabric

[Legacy] GeckoLib Fabric

3M Downloads

Triggerable Animations not working with Armor Rendering

awitkowski0 opened this issue ยท 0 comments

commented

Hi, I am unable to create a working trigger able animation for armors.

Trigger for it is working (Item Renderer is the same as Armor)

Armor Animation Works (Not triggered)
armor

Controller

    @Override
    public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
        controllers.add(new AnimationController<>(this, "charge_controller", state -> PlayState.CONTINUE).triggerableAnim("charge", DefaultAnimations.ATTACK_CHARGE));
    }

Trigger Calls (This is called from a C2S packet):

    @Override
    public void press(PlayerEntity playerEntity, ItemStack armorStack) {
        super.press(playerEntity, armorStack);

        ItemStack weapon = playerEntity.getInventory().getMainHandStack();
        ThematicArmor armor = ThematicHelper.getArmor(armorStack);

        if (weapon.getItem() instanceof AquamanTrident aquamanTrident) {
            if (!playerEntity.world.isClient) {
                if (this.getCooldown(armorStack) <= 0) {
                    armor.triggerAnim(playerEntity, GeoItem.getOrAssignId(armorStack, (ServerWorld)playerEntity.world), "charge_controller", "charge");

                    this.incrementCooldown(armorStack, 20 * 20);
                }
            }
        }
    }```
   
Renderer Code Call:
```java
@Override
    public void createRenderer(Consumer<Object> consumer) {
        consumer.accept(new RenderProvider() {
            private final GeoArmorRenderer<?> armorRenderer = new ThematicArmorRenderer(new Identifier(modId, armorId));
            private final ThematicArmorItemRenderer itemRenderer = new ThematicArmorItemRenderer(armorId);

            @Override
            public @NotNull BipedEntityModel<LivingEntity> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, BipedEntityModel<LivingEntity> original) {

                // This prepares our GeoArmorRenderer for the current render frame.
                // These parameters may be null however, so we don't do anything further with them
                this.armorRenderer.prepForRender(livingEntity, itemStack, equipmentSlot, original);

                // Initialize each collection's renderers
                for (Collection collection : ThematicClient.getCollections()) {
                    collection.prepRenderers(livingEntity, itemStack, equipmentSlot, original);
                }

                return this.armorRenderer;
            }

            @Override
            public BuiltinModelItemRenderer getCustomRenderer() {
                return this.itemRenderer;
            }
        });
    }

Actual Renderer:

    /**
     * Create a new instance of this renderer class.
     *
     * @param armor, armor identifier e.g "armor/Herobrine"
     */
    public ThematicArmorRenderer(Identifier armor) {
        super(new ThematicArmorModel(armor));
    }

Animation:
{ "format_version": "1.8.0", "animations": { "attack.charge": { "animation_length": 0.5, "bones": { "armorRightArm": { "rotation": { "0.0": { "vector": [0, 0, 0] }, "0.2917": { "vector": [-141.57316, -25.49671, 28.48347] }, "0.4167": { "vector": [-73.20844, -37.37543, -2.50203] } }, "position": { "0.0": { "vector": [0, 0, 0] }, "0.2917": { "vector": [0, 0, 0] }, "0.4167": { "vector": [0, 0, 0] } } }, "armorLeftArm": { "rotation": { "0.0": { "vector": [0, 0, 0] }, "0.2917": { "vector": [-135, 45, -15] }, "0.4167": { "vector": [-67.71344, 51.15988, -8.57941] } }, "position": { "0.0": { "vector": [0, 0, 0] }, "0.2917": { "vector": [0, 0, 0] }, "0.4167": { "vector": [0, 0, 0] } } } } } }, "geckolib_format_version": 2 }

(Copied from grade properties)
minecraft version 1.19.4
yarn mappings 1.19.4+build.2
loader 0.14.19
fabric 0.80.0+1.19.4
geckolib-fabric-1.19.4:4.1.3

Sorry for posting so much code, just trying to be thorough, if you need anything from me lmk.