PluginBugs / Issues-ItemsAdder

Repository used to keep track of issues of my plugin ItemsAdder
https://itemsadder.devs.beer
52 stars 21 forks source link

Durability bug with items that have unbreaking #1408

Closed purejosh closed 2 years ago

purejosh commented 2 years ago

Terms

Discord tag (optional)

purejosh#2047

What happened?

Tools with unbreaking III can have a lag when calculating durability. For example, I was using the diamond hammer with unbreaking III, and unbreaking was working normally for a few swings. After the 4th usage, the durability went down 41 points. This resulted in a member of my server losing his diamond hammer, which is very expensive in my server. Keep in mind, this tool has been configured to break 3x3x1 on my server, so 9 durability should be used when unbreaking doesn't absorb the durability loss. It seems to have cached the durability loss in the background, and when unbreaking wasn't doing its job that break cycle, it resulted in a massive loss of durability. As if it were storing the blocks broken in the background, but only applied them to the hammer's durability when it didn't get saved by unbreaking.

Steps to reproduce the issue

1, Equip diamond hammer with unbreaking III, configure item to break more than 1 block. (3x3x1 in my case, but 3x3x3 would be even more noticeable)

  1. Break blocks and observe durability
  2. Repeat until durability loss exceeds standard block breaking count. (9/27, depending on configuration)

Server version

1.18.1

ItemsAdder Version

2.5.0-beta

ProtocolLib Version

4.8.0-SNAPSHOT-b538

LoneLibs Version

1.0.16b

LightAPI Version (optional)

No response

LibsDisguises Version (optional)

No response

FULL server log

Nothing related to the bug is located in the server log.

Error (optional)

No response

ItemsAdder config.yml

metrics: true
update-checker: true
disable-plugin-loading-messages_DONT_ASK_ME_FOR_SUPPORT_IF_YOU_SET_TRUE__THANKS: false
resource-pack:
  hosting:
    no-host:
      enabled: false
    auto-external-host:
      enabled: false
    self-host:
      enabled: true
      server-ip: 192.34.113.4
      pack-port: 25566
    external-host:
      enabled: false
      url: ''
      skip-url-file-type-check___DONT_ASK_HELP_IF_SET_TRUE: false
  apply-on-join: true
  kick-player-on-decline: false
  kick-player-on-fail: false
  delay-ticks: 1
  notify-other-plugins-interfering: true
  title:
    enabled: true
  protect-player:
    black-screen: true
    hide-hud: true
    cancel-movement: true
    lock-player: true
  command:
    usage-cooldown-seconds: 60
  custom-font:
    enabled: false
    name: ipaexg.ttf
    shift: '[0,0]'
    size: 11.0
    oversample: 2.0
  thin-font:
    enabled: false
  zip:
    protect-file-from-unzip:
      enabled: false
      extreme: false
    overwrite-vanilla-models: true
    overwrite-vanilla-lang-json: false
    fix_transparent_noteblocks__disable-for-more-performance: false
    ignore-files-ext:
    - db
    - yml
    - xcf
    - html
    compress-png-files: true
    compress-json-files: true
    generate-custom-armors-textures:
      _: 'Available values: VANILLA_1_17 or OPTIFINE'
      enabled: true
      mode: VANILLA_1_17
  items:
    CustomModelData-starting-value:
      ALL: 10000
      DIAMOND: 11000
config_files:
  lang: en
  dictionaries-lang: en
  extract-default-items: false
  extract-default-resources: false
blocks:
  light-api: true
  fix-glitched-blocks:
    enabled: true
    only-new-chunks: false
    search-also-in-these-biomes:
      enabled: false
      biomes:
      - BEACH
      - BIRCH_FOREST
      - BIRCH_FOREST_HILLS
      - FOREST
      - MOUNTAINS
      - MOUNTAIN_EDGE
      - GRAVELLY_MOUNTAINS
      - PLAINS
      - RIVER
  cancel-break-wrong-tool:
    enabled: true
    send-actionbar: true
  campfire:
    unlit-on-place: true
    allow-any-item: true
  disable-REAL: true
  disable-REAL_TRANSPARENT: false
  disable-REAL_NOTE: false
  disable-REAL_WIRE: false
  disable-FIRE: false
items:
  fix-show-attack-and-damage-as-lore: true
  give_death_location_maps: true
  hide-custom-durability-lore: true
liquids:
  enabled: true
huds:
  enabled: true
mobs:
  disable-MOB-behaviour__DISABLE_AT_YOUR_OWN_RISK: false
font_images:
  chat:
    enabled: true
    doublecheck-permission__disable-for-more-performance: false
    add-hover-suggestion: true
  command:
    enabled: true
    commandblocks: true
    excluded:
    - home
    - sethome
    - tpa
  sign:
    enabled: true
  book:
    enabled: true
  anvil:
    enabled: true
  inventory-title:
    enabled: true
  tab-header-footer:
    enabled: true
  vault-prefix-suffix:
    enabled: true
    update-every-ticks: 1200
  scoreboard-teams:
    enabled: false
    update-every-ticks: 3600
  player-display-name:
    enabled: true
    update-every-ticks: 1200
  replace-in-customitems-name-and-lore: true
effects:
  hide-scoreboard-numbers: false
  text-effects:
    enabled: true
    replace-in-customitems-name-and-lore: true
    chat:
      enabled: true
    sign:
      enabled: true
    book:
      enabled: true
    anvil:
      enabled: true
    tab-header-footer:
      enabled: true
entities:
  max-furniture-vehicles-per-chunk: 50
  allow-removing-old-furnitures_2_3_11: false
recipes:
  hide-vanilla-unrecognized-recipe-errors: true
  custom-recipes:
    unlock:
      all-on-join: false
      on-pickup:
        any: false
        ingredients: true
  remove-vanilla-recipes:
    enabled: true
    list:
      DIAMOND_SWORD: false
      IRON_INGOT: false
debug:
  items:
    log-files-loading: false
    log-items-loading: false
    log-items-loading-disabled: false
    log-font-images-loading: false
    log-huds-loading: false
    log-attribute-modifiers-loading: false
    log-warnings: false
    log-loots-loading: false
    log-loots-loading-disabled: false
    log-armors-loading: false
  recipes:
    log-recipes-loading: false
    log-recipes-loading-disabled: false
    log-recipes-removed-vanilla: false
  resource-pack:
    log-extract-default-resources: false
    log-not-extract-default-resources-already-exist: false
  blocks:
    log-save: false
    log-save-on-unload: false
    log-mined-unknown-blocks: true
  worlds-populators:
    log-loading: false
    log-loading-disabled: false
    log-loading-no-populators: false
    log-loading-no-world: true
    log-generation: false
  trees-populators:
    log-loading: false
    log-loading-disabled: false
    log-loading-no-populators: false
    log-loading-no-world: true
    log-generation: false
  surface-decorators:
    log-loading: false
    log-loading-disabled: false
    log-loading-no-decorators: false
    log-loading-no-world: true
    log-generation: false
  player-stats:
    log-save: false
  performance:
    loading-ms: true
  huds:
    log-triggers: false
  other:
    log-dictionaries-loading: false
    log-liquids-loading: false
    log-minecraft_lang_overwrite-loading: false
  categories:
    log-total-loaded: true
    log-single-loaded: false
    log-single-loaded-overwrite: false
    log-single-skip: false

Problematic items yml configuration file (optional)

info:
  namespace: itemsadder
recipes:
  crafting_table:
    diamond_hammer:
      permission: itemsadder.diamond_hammer
      enabled: true
      pattern:
      - DDD
      - DsD
      - XsX
      ingredients:
        s: STICK
        D: DIAMOND_BLOCK
      result:
        item: itemsadder:diamond_hammer
        amount: 1
  anvil_repair:
    diamond_hammer:
      permission: itemsadder.diamond_hammer
      ingredient: DIAMOND
      item: itemsadder:diamond_hammer
items:
  diamond_hammer:
    display_name: Diamond Hammer
    permission: diamond_hammer
    lore:
    - 'lore-1-demoniac_hammer'
    resource:
      material: DIAMOND_PICKAXE
      generate: true
      textures:
      - item/diamond_hammer.png
    durability:
      max_custom_durability: 1561
      custom_durability: 1561
    attribute_modifiers:
      mainhand:
        attackDamage: 9.0
        attackSpeed: 0.6
    events:
      block_break:
        multiple_break:
          keep_ores: true
          drop_all_blocks:
            enabled: false
            need_silk_touch: false
          size: 3
        decrement_durability:
          amount: 0

Other files, you can drag and drop them here to upload. (optional)

No response

Screenshots/Videos (you can drag and drop files or paste links)

No response

LoneDev6 commented 2 years ago

Strange. Anyway there is no "caching" of any type. Durability is removed each time a block is broken.

I'll try to reproduce the issue and tell you what is the reason of this behaviour

LoneDev6 commented 2 years ago

I cannot reproduce the issue, but I found two problems in my code:

I fixed both of them, now it will work like a vanilla item (unbreaking formula).