Skip to content

Make auto-spliting on item damages optional (tools/weapons/etc.) #35

Closed

Description

@NukuHack

it's just when u want to equip more than 1 armor it don't let to do , it allways equip only one (but u can equip shields fine)

Activity

  1. NukuHack commented on Jul 25, 2022

    @NukuHack
    Author

    lol tested if u somehow manage to equip more than 1 armor in one slot it unequip them if it got damaged (one will stay "in you" and the others got send back to ur inv) sadly it also work with shield

  2. NukuHack commented on Jul 25, 2022

    @NukuHack
    Author

    lol if u have something in ur hand (more than 1) and it got dmg (lost durability) it got unstacked so u will have 1 in ur hand and the rest in ur inv

  3. NukuHack commented on Jul 25, 2022

    @NukuHack
    Author

    ofc if ur inv is full , u will have only one of that thing and the rest will be dropped on the ground

  4. changed the title [-]All Stackable Armor[/-] [+]All Stackable / Armor[/+] on Jul 26, 2022
  5. KrisCris commented on Jul 27, 2022

    @KrisCris
    Owner

    lol if u have something in ur hand (more than 1) and it got dmg (lost durability) it got unstacked so u will have 1 in ur hand and the rest in ur inv

    ofc if ur inv is full , u will have only one of that thing and the rest will be dropped on the ground

    I think that's the intended behavior, I made it do that.

    Whereas without my fixes, all damageable items just got the same dmg lol

  6. KrisCris commented on Jul 27, 2022

    @KrisCris
    Owner

    @Redirect(method = "damage(ILnet/minecraft/util/math/random/Random;Lnet/minecraft/server/network/ServerPlayerEntity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;setDamage(I)V"))
    private void splitStackedTools(ItemStack stack, int damage, int amount, Random random, @Nullable ServerPlayerEntity player){
    ItemStack rest = null;
    if (stack.getCount()>1 && ItemsHelper.isModified(stack) && player!=null){
    rest = stack.copy();
    rest.decrement(1);
    stack.setCount(1);
    }
    stack.setDamage(damage);
    if (rest != null){
    ItemsHelper.insertNewItem(player,rest);
    }
    }
    }

    I honestly can't come up with a better solution. So this probably won't be fixed as this is not a bug.

  7. added
    wontfixThis will not be worked on
    and removed
    bugSomething isn't working
    on Jul 27, 2022
  8. NukuHack commented on Jul 27, 2022

    @NukuHack
    Author

    in vanilla mc if u obtain stacked armors/tools it's cool bc if u break it u will get all the rest with full durability i mean the durability resets so this is useless :(

  9. NukuHack commented on Jul 27, 2022

    @NukuHack
    Author

    @Redirect(method = "damage(ILnet/minecraft/util/math/random/Random;Lnet/minecraft/server/network/ServerPlayerEntity;)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;setDamage(I)V"))
    private void splitStackedTools(ItemStack stack, int damage, int amount, Random random, @Nullable ServerPlayerEntity player){
    ItemStack rest = null;
    if (stack.getCount()>1 && ItemsHelper.isModified(stack) && player!=null){
    rest = stack.copy();
    rest.decrement(1);
    stack.setCount(1);
    }
    stack.setDamage(damage);
    if (rest != null){
    ItemsHelper.insertNewItem(player,rest);
    }
    }
    }

    I honestly can't come up with a better solution. So this probably won't be fixed as this is not a bug.

    it wouls be cool if u would make it to togle-able or something like that

  10. KrisCris commented on Jul 27, 2022

    @KrisCris
    Owner

    hmm what do you mean? when you are using a stack of tools/shields/weapons, only one of them will get damaged.

  11. KrisCris commented on Jul 27, 2022

    @KrisCris
    Owner

    by disable that code, not just one, ALL stack of them lose durability

  12. NukuHack commented on Jul 27, 2022

    @NukuHack
    Author

    by disable that code, not just one, ALL stack of them lose durability

    yes ... but if u manage to break that item one will be loosen

  13. KrisCris commented on Jul 27, 2022

    @KrisCris
    Owner

    yes ... but if u manage to break that item one will be loosen

    you mean the damaged item will be unstacked, right?

    I don't think a stack of items can have different states, like one with full durability while the rest are broken or something

  14. NukuHack commented on Jul 27, 2022

    @NukuHack
    Author

    i try-ed with leather armor and gold tools if u have
    64 gold pickaxe (in stack) and u break 32 block with it u will have 63 gold pickaxe (in stack) and the one is broken (bc gold tools have 32 durability)
    and if u have 64 leather cap in ur helmet slot and it got 55 damage (the leather cap durability) u will have 63 leather cap in ur armor slot

  15. NukuHack commented on Jul 27, 2022

    @NukuHack
    Author

    yes if u manually unstack them before one break all will have the durability loss but i don't want that so i wait untill it gets breaked

  16. KrisCris commented on Jul 27, 2022

    @KrisCris
    Owner

    lol i see... the game resets the durability of the rest of the stacks to full when one item is broken... so if you have 2 damaged item happens to have the same durability, and you stack them together, broke one, another one get full durability

  17. KrisCris commented on Jul 27, 2022

    @KrisCris
    Owner

    anyway... if you prefer this way...
    there you go AllStackable-v1.5.6-1.19.zip
    make sure you have "noAutoUnstackDamageableTools": 1 in your config, something like the following:

    [
        {
            "minecraft:golden_axe": 16
        },
        {
            "permissionLevel": 4,
            "stackEmptyShulkerBoxOnly": 0,
            "noAutoUnstackDamageableTools": 1
        }
    ]
  18. KrisCris commented on Jul 27, 2022

    @KrisCris
    Owner

    lol i see... the game resets the durability of the rest of the stacks to full when one item is broken... so if you have 2 damaged item happens to have the same durability, and you stack them together, broke one, another one get full durability

    so yeah, i will not fix the reset issue as the game has no idea what's the durability of the rest of the stack lol

  19. changed the title [-]All Stackable / Armor[/-] [+]Make auto-spliting on item damages optional (tools/weapons/etc.)[/+] on Jul 27, 2022
  20. added
    documentationImprovements or additions to documentation
    and removed
    wontfixThis will not be worked on
    on Jul 27, 2022
  21. Repository owner locked and limited conversation to collaborators on Jul 27, 2022
  22. converted this issue into a discussion #36 on Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions