codetaylor / dropt-1.12

Flexible block drop strategies.
https://minecraft.curseforge.com/projects/dropt
Other
6 stars 2 forks source link

Integer overflow when too far from spawn #80

Closed codetaylor closed 2 years ago

codetaylor commented 2 years ago

Issue Description

Integer overflow in distance matcher when too far from spawn.

Discord discussion: https://discord.com/channels/516841320594276353/516847563085840395/940488566264459355

What Happens

  1. Set up a rule to change dirt drops with debug.
  2. Travel 1000000 blocks from spawn using /tp @p 1000000 ~ ~.
  3. Break dirt nearby.
  4. Notice this in log:
    [DEBUG] [MATCH] [!!] Distance [NaN] inside range [0,2147483647]
    [DEBUG] [!!] Rule not matched

Script

{
  "rules": [
    {
      "debug": true,
      "match": {
        "blocks": {"blocks": ["minecraft:dirt"]}
      },
      "drops": [
        {"item": {"items": ["minecraft:diamond"]}}
      ]
    }
  ]
}
codetaylor commented 2 years ago

Fixed in 1.12.2-1.19.2