Skip to content

[Forge 1.20.1] FD loot modifiers isn't compatible with other GLM #1268

@TheRealVoin

Description

@TheRealVoin

Farmer's delight version: latest (1.2.11)

I noticed this issue while developing my mod. I couldn't change FD loot modifiers in any way.

The problem is in AddLootTableModifier class. It uses getRandomItemsRaw() method, which is deprecated. And there is commetary: "/ Use a non-'Raw' version of 'getRandomItems', so that the Forge Global Loot Modifiers will be applied"

@Deprecated // Use a non-'Raw' version of 'getRandomItems', so that the Forge Global Loot Modifiers will be applied
   public void getRandomItemsRaw(LootContext pContext, Consumer<ItemStack> pOutput) {
      LootContext.VisitedEntry<?> visitedentry = LootContext.createVisitedEntry(this);
      if (pContext.pushVisitedElement(visitedentry)) {
         Consumer<ItemStack> consumer = LootItemFunction.decorate(this.compositeFunction, pOutput, pContext);

         for(LootPool lootpool : this.pools) {
            lootpool.addRandomItems(consumer, pContext);
         }

         pContext.popVisitedElement(visitedentry);
      } else {
         LOGGER.warn("Detected infinite loop in loot tables");
      }

   }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions