kkempfer / Create-Survive-Explore

Harness technology to survive harsh environments, automate your world, and uncover hidden wonders
GNU General Public License v3.0
0 stars 0 forks source link

[BUG] Missing attack sound and player animation for knives, skillet and the Create wrench #93

Open kkempfer opened 1 month ago

kkempfer commented 1 month ago

Modpack Version

Unreleased for Minecraft 1.19.2

Did the issue happen in singleplayer or on a server?

Singleplayer

Describe the bug

In first and third person view, there is no custom sound and player animation for knives, skillet and the Create wrench.

Expected behavior

We shoud have something similar to the other tools and weapons. The knives could mimic the behavior of the sword and machete, while the skillet could reproduce the axe. The wrench could mimic the shovel or pickaxe.

Screenshots

No response

To Reproduce

No response

Crash Report

No response

Logs

No response

Have you modified the modpack?

No

User Modifications

No response

Additional details

No response

kkempfer commented 2 weeks ago

This server script kubejs/server_scripts/player_swinging_animation.js does not work. Writing it down here as a backup.

let AbstractClientPlayer = Java.loadClass('net.minecraft.client.player.AbstractClientPlayer');
let AnimationHolder = Java.loadClass('elocindev.animation_overhaul.api.AnimationHolder');
let AnimationOverhaul = Java.loadClass('elocindev.animation_overhaul.AnimationOverhaul');
let ResourceLocation = Java.loadClass('net.minecraft.resources.ResourceLocation');

function playAnimationOverhaul(player, animationName) {
    let resourceLocation = new ResourceLocation(AnimationOverhaul.MODID, animationName);
    let animationHolder = new AnimationHolder(resourceLocation, true);
    let animation = animationHolder.getAnimation()

    // This is wrong
    player.playAnimation(animation, 1.0, 1);

};

PlayerEvents.tick(event => {
    const player = event.player;
    const itemInHand = player.getMainHandItem();

    if (itemInHand.id === 'farmersdelight:golden_knife' && player.swinging && player.swingTime === 0) {
        playAnimationOverhaul(player, 'sword_swing_first');
    }

});