Skip to content

Commit

Permalink
Merge pull request #1 from serenyadev/master
Browse files Browse the repository at this point in the history
add sniffer loot shit
  • Loading branch information
Flatkat authored Sep 8, 2024
2 parents 1405f33 + b7c3d4b commit 6872e63
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.flatkat.ancient_forgotten.block.ModBlocks;
import net.flatkat.ancient_forgotten.item.ModItemGroups;
import net.flatkat.ancient_forgotten.item.ModItems;
import net.flatkat.ancient_forgotten.loot.ModLoot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -26,5 +27,6 @@ public void onInitialize() {

ModItems.registerModItems();
ModBlocks.registerModBlocks();
ModLoot.init();
}
}
32 changes: 32 additions & 0 deletions src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java
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))));
});
}
});
}


}

0 comments on commit 6872e63

Please sign in to comment.