Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6925

Missing Parameter Tool

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Windows 10

    • 1.18.1-R0.1-SNAPSHOT
    • Yes

      The CraftLootTable type does not have any implementation for setting LootContextParameters.TOOL. I was able to fix this in my own plugin by making an alternate type and adding the following line:

       

      setMaybe(builder, LootContextParameters.KILLER_ENTITY, nmsKiller);
      // If there is a player killer, damage source should reflect that in case loot tables use that information
      
      //NEW LINE
      setMaybe(builder, LootContextParameters.TOOL, (CraftItemStack.asNMSCopy(context.getKiller().getItemInUse())));
      
      setMaybe(builder, LootContextParameters.DAMAGE_SOURCE, DamageSource.playerAttack(nmsKiller)); 

      I imagine theres a better way of fixing it, I'm very new to this.

      Anyways, this parameter is necessary when generating loot tables with fishing contexts which as far as I can tell does not work in current spigot implementation.

            Doc Doc
            billybobjoebobpi@gmail.com John Barnhill
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: