Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.21] Constant Breaking sound with Incorrect code from Better End Elytra API #101

Open
ENDERSTIXgaming opened this issue Sep 9, 2024 · 11 comments
Assignees
Labels
invalid This doesn't seem right

Comments

@ENDERSTIXgaming
Copy link

I have an elytra in the cape slot and it makes an item break sound over and over while flying even if it doesn't lose durability cause UNB 3. obv the item break sound should only play when it runs out of durability. I tried the elytra in my chestplate slot and it doesn't make that sound but if it's in the cape slot it does

accessories-fabric-1.0.0-beta.33+1.21.jar

@Dragon-Seeker
Copy link
Member

Are you using the compat layers and what is the elytra mod exactly?

@ENDERSTIXgaming
Copy link
Author

I have accessories_tclayer-3.10.0-beta.10+1.21.jar
accessories-fabric-1.0.0-beta.34+1.21.jar
trinkets-3.10.0.jar
and elytraslot-fabric-9.0.0+1.21.jar

(if there's a mod I didn't list that I need I MIGHT have it lmk what to look for and I'll look for it)

@Dragon-Seeker
Copy link
Member

Ok, will investigate the issue futher

@Dragon-Seeker
Copy link
Member

Tried to reproduce the issues but had not such problem... frankly couldn't get the elytra to make any breaking noise.

@Dragon-Seeker
Copy link
Member

Could you be able to post a video of the issue?

@ENDERSTIXgaming
Copy link
Author

having trouble uploading the video. it's too big.

@ENDERSTIXgaming
Copy link
Author

ENDERSTIXgaming commented Sep 21, 2024

seems to only happen with soul elytra from deeper and darker
https://github.com/user-attachments/assets/6ebb7d8d-bbf7-4ab4-abdd-b58f5b467903

@Dragon-Seeker Dragon-Seeker changed the title item in accessories slot make the item broke sound every time it WOULD take damage [1.21] Constant Breaking sound with Soul Elytra from Deeper and Darker using ElytaSlot Sep 21, 2024
@Dragon-Seeker Dragon-Seeker added bug Something isn't working Trinkets Compat Related to the trinkets compatibility layer unknown cause The issue or bug is unknown to what or how it happend labels Sep 21, 2024
@Dragon-Seeker Dragon-Seeker self-assigned this Sep 23, 2024
@EvilVoids
Copy link

I have discovered a possible fix. I believe it is cause from the accessories mods which allows the shift click into accessory slots. What I did to fix what apply the Dragon Chest Piece from the dragon loot mod in an accessory slot and it seemed to fix the problem. This may or may not work with other elytra but that is what I found that fixed it.

@Dragon-Seeker Dragon-Seeker added the help wanted Extra attention is needed label Jan 1, 2025
@Suleos
Copy link

Suleos commented Jan 9, 2025

I was looking at your mod list because I was having the same exact issue, this is actually caused by BetterEnd. Removing it will solve the problem, but of course that's not a great fix all things considered.

@Dragon-Seeker
Copy link
Member

...this is actually caused by BetterEnd.

If such is true then its quite a weird bug, to say the least.

@Dragon-Seeker Dragon-Seeker removed the unknown cause The issue or bug is unknown to what or how it happend label Jan 26, 2025
@Dragon-Seeker
Copy link
Member

It seems the issue has been found to be a problem with a portion of Better End code that also causes this issue for Trinkets as stated here and here with the issue resolvable by fixing some code within Better End here with the adjusted code below but it is at this time the Developers of the Mod are not maintaining such further so this issue can not be resolved unless action is taken on Better End Team:

BCLElytraUtils.onBreak = (entity, chestStack) -> {
    var oTrinketComponent = TrinketsApi.getTrinketComponent(entity);

    var possibleTrinketSlot = null;

    if (oTrinketComponent.isPresent()) {
        List<Tuple<SlotReference, ItemStack>> equipped = oTrinketComponent.get().getEquipped(Elytra::isElytra);

        for (var slot : equipped) {
            var slotStack = slot.getB();
            if (slotStack == chestStack) {
                possibleTrinketSlot = slot.getA();
                break;
            }
        }
    }
    
    if (possibleTrinketSlot == null) {
        chestStack.hurtAndBreak(1, entity, EquipmentSlot.CHEST);
    } else if(entity instanceof ServerPlayer player) {
        // Mostly 1:1 copy of Fabric API handling for having custom damage handler for breaking: https://github.com/FabricMC/fabric/blob/5ca99b905c7ea1ddfe796066fc10b0d16e37d869/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/ItemStackMixin.java#L49
        int hurtAmount = 1;

        Consumer<Item> onBreakConsumer = (item) -> {
            TrinketsApi.onTrinketBroken(chestStack, possibleTrinketSlot, player);
        };

        var handler = ((ItemExtensions)chestStack.getItem()).fabric_getCustomDamageHandler();
        if (handler != null && !player.isInCreativeMode()) {
            // Track whether an item has been broken by custom handler
            var isBroken = new MutableBoolean(false);

            hurtAmount = handler.damage(chestStack, amount, player, EquipmentSlot.CHEST, () -> {
                isBroken.setTrue();
                chestStack.decrement(1);
                onBreakConsumer.accept(this.getItem());
            });

              // If item is broken, there's no reason to call the original.
              if (isBroken.booleanValue()) return;
        } 

        chestStack.hurtAndBreak(hurtAmount, (ServerLevel) player.level(), player, onBreakConsumer);
    }
};

@Dragon-Seeker Dragon-Seeker added wontfix This will not be worked on and removed bug Something isn't working help wanted Extra attention is needed Trinkets Compat Related to the trinkets compatibility layer labels Jan 26, 2025
@Dragon-Seeker Dragon-Seeker changed the title [1.21] Constant Breaking sound with Soul Elytra from Deeper and Darker using ElytaSlot [1.21] Constant Breaking sound with Better End Elytra API Jan 26, 2025
@Dragon-Seeker Dragon-Seeker removed the wontfix This will not be worked on label Jan 26, 2025
@Dragon-Seeker Dragon-Seeker changed the title [1.21] Constant Breaking sound with Better End Elytra API [1.21] Constant Breaking sound with Incorrect code from Better End Elytra API Feb 8, 2025
@Dragon-Seeker Dragon-Seeker added the invalid This doesn't seem right label Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

4 participants