Commits

Doc authored and md_5 committed d83e9d0812a
SPIGOT-6925: Add minecraft:match_tool in LootContext
No tags

src/main/java/org/bukkit/craftbukkit/CraftLootTable.java

Modified
88 88 setMaybe(builder, LootContextParameters.DAMAGE_SOURCE, DamageSource.GENERIC);
89 89 setMaybe(builder, LootContextParameters.ORIGIN, nmsLootedEntity.position());
90 90 }
91 91
92 92 if (context.getKiller() != null) {
93 93 EntityHuman nmsKiller = ((CraftHumanEntity) context.getKiller()).getHandle();
94 94 setMaybe(builder, LootContextParameters.KILLER_ENTITY, nmsKiller);
95 95 // If there is a player killer, damage source should reflect that in case loot tables use that information
96 96 setMaybe(builder, LootContextParameters.DAMAGE_SOURCE, DamageSource.playerAttack(nmsKiller));
97 97 setMaybe(builder, LootContextParameters.LAST_DAMAGE_PLAYER, nmsKiller); // SPIGOT-5603 - Set minecraft:killed_by_player
98 + setMaybe(builder, LootContextParameters.TOOL, nmsKiller.getUseItem()); // SPIGOT-6925 - Set minecraft:match_tool
98 99 }
99 100
100 101 // SPIGOT-5603 - Use LootContext#lootingModifier
101 102 if (context.getLootingModifier() != LootContext.DEFAULT_LOOT_MODIFIER) {
102 103 setMaybe(builder, LootContextParameters.LOOTING_MOD, context.getLootingModifier());
103 104 }
104 105 }
105 106
106 107 // SPIGOT-5603 - Avoid IllegalArgumentException in LootTableInfo#build()
107 108 LootContextParameterSet.Builder nmsBuilder = new LootContextParameterSet.Builder();

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut