-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from serenyadev/master
add sniffer loot shit
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package net.flatkat.ancient_forgotten.loot; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.loot.v2.LootTableEvents; | ||
import net.flatkat.ancient_forgotten.AncientAndForgotten; | ||
import net.flatkat.ancient_forgotten.item.ModItems; | ||
import net.minecraft.loot.entry.ItemEntry; | ||
import net.minecraft.loot.function.SetCountLootFunction; | ||
import net.minecraft.loot.provider.number.ConstantLootNumberProvider; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class ModLoot { | ||
|
||
// TODO: Flatkat this is probs not the correct table, no idea what its called | ||
private static final Identifier SNIFFER_TABLE = new Identifier("minecraft:gameplay/sniffer_digging"); | ||
|
||
private static final Identifier SNIFFER_PHASE = new Identifier(AncientAndForgotten.MOD_ID, "sniffer_phase"); | ||
|
||
public static void init() { | ||
// Make sure this modification happens before other mods potentially add loot pools | ||
LootTableEvents.MODIFY.addPhaseOrdering(SNIFFER_PHASE, Event.DEFAULT_PHASE); | ||
LootTableEvents.MODIFY.register((resourceManager, lootManager, id, tableBuilder, source) -> { | ||
if(id.equals(SNIFFER_TABLE)) { | ||
tableBuilder.modifyPools(pool -> { | ||
pool.with(ItemEntry.builder(ModItems.RUBY).apply(SetCountLootFunction.builder(ConstantLootNumberProvider.create(1)))); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
|
||
} |