Spectrum

Spectrum

2M Downloads

[BUG] Potentially unintended sapling drop rates

VelizarBG opened this issue ยท 6 comments

commented

Describe the bug
The drop rates for magic saplings are lower than what might've been intended.

Here's the problematic snippet present in the loot tables of all leaves blocks:

{
  "condition": "minecraft:table_bonus",
  "enchantment": "minecraft:fortune",
  "chances": [
    0.05,
    0.0625,
    0.083333336,
    0.1
  ]
},
{
  "condition": "minecraft:table_bonus",
  "enchantment": "spectrum:resonance",
  "chances": [
    0,
    0.8
  ]
}

I'll assume you know how the minecraft:table_bonus condition works and get straight to the point: these two conditions are inside a conditions list. In order to drop the sapling all conditions inside the list need to yield true. Suppose we're breaking the magic leaves block by hand or waiting for it to decay. In that case the developer's intent might've been for the sapling to drop 5% of the time, as is the case with all vanilla leaves. Unfortunately that is not the case because the Fortune enchantment condition is followed by a Resonance enchantment condition that says it's always going to yield false unless the player's tool has a level of Resonance 1 or higher.

Expected behavior
Magic leaves should drop saplings more often.

Proposed fix
The cases of the player breaking a leaves block with either Fortune or Resonance are treated mutually exclusive, as the two enchantments actually are such. Here's how that could look like:

Click to view loot table
{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "bonus_rolls": 0,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "name": "spectrum:orange_leaves",
              "conditions": [
                {
                  "condition": "minecraft:alternative",
                  "terms": [
                    {
                      "condition": "minecraft:match_tool",
                      "predicate": {
                        "items": [
                          "minecraft:shears"
                        ]
                      }
                    },
                    {
                      "condition": "minecraft:match_tool",
                      "predicate": {
                        "enchantments": [
                          {
                            "enchantment": "minecraft:silk_touch",
                            "levels": {
                              "min": 1
                            }
                          }
                        ]
                      }
                    }
                  ]
                }
              ]
            },
            {
              "type": "minecraft:item",
              "name": "spectrum:orange_sapling",
              "conditions": [
                {
                  "condition": "minecraft:survives_explosion"
                },
                {
                  "condition": "minecraft:alternative",
                  "terms": [
                    {
                      "condition": "minecraft:table_bonus",
                      "enchantment": "minecraft:fortune",
                      "chances": [
                        0.05,
                        0.0625,
                        0.083333336,
                        0.1
                      ]
                    },
                    {
                      "condition": "minecraft:table_bonus",
                      "enchantment": "spectrum:resonance",
                      "chances": [
                        0,
                        0.8
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "rolls": 1,
      "bonus_rolls": 0,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "spectrum:orange_pigment",
          "conditions": [
            {
              "condition": "minecraft:survives_explosion"
            },
            {
              "condition": "minecraft:table_bonus",
              "enchantment": "minecraft:fortune",
              "chances": [
                0.2,
                0.25,
                0.3,
                0.35,
                0.4
              ]
            }
          ]
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:inverted",
          "term": {
            "condition": "minecraft:alternative",
            "terms": [
              {
                "condition": "minecraft:match_tool",
                "predicate": {
                  "items": [
                    "minecraft:shears"
                  ]
                }
              },
              {
                "condition": "minecraft:match_tool",
                "predicate": {
                  "enchantments": [
                    {
                      "enchantment": "minecraft:silk_touch",
                      "levels": {
                        "min": 1
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  ]
}
commented

oooh, true, true. The previous values are definitely missing a 0 there, ty!

commented

Looking at the current loot tables in https://github.com/DaFuqs/Spectrum/blob/1.19-deeper-down/src/main/resources/data/spectrum/loot_tables/blocks/orange_leaves.json those are fixed in the current development branch already.
Leaving this open so I will include those changes in the next hotfix release, should there be one until the next major.

commented
commented

Colored Saplings are not meant to be fully renewable until lategame (Resonance) to

  • give an incentive for the player to build interesting ways to farm dye.
  • discourage mindless farming of large amounts of pigments for the Trinkets (since there will come a more efficient way to get Ink down the line)

=> there should be rare sapling drops as a nice goodie, but not enough that the player can farm them without crafting new ones, once in a while.

commented

Right, I'm just saying it doesn't feel right to have a 2.5%, 5%, 7.5% drop chance for Fortune 0, 1 and 2 respectively but a 1% chance for Fortune 3.

commented

Fixed in 1.6.9