From 78a54a987c639d518c2ccef95549377a658d3c32 Mon Sep 17 00:00:00 2001 From: sery Date: Sun, 8 Sep 2024 13:01:22 +0200 Subject: [PATCH 1/2] add sniffer loot shit --- .../AncientAndForgotten.java | 2 ++ .../ancient_forgotten/loot/ModLoot.java | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java diff --git a/src/main/java/net/flatkat/ancient_forgotten/AncientAndForgotten.java b/src/main/java/net/flatkat/ancient_forgotten/AncientAndForgotten.java index 4201151..9cb27f3 100644 --- a/src/main/java/net/flatkat/ancient_forgotten/AncientAndForgotten.java +++ b/src/main/java/net/flatkat/ancient_forgotten/AncientAndForgotten.java @@ -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; @@ -26,5 +27,6 @@ public void onInitialize() { ModItems.registerModItems(); ModBlocks.registerModBlocks(); + ModLoot.init(); } } \ No newline at end of file diff --git a/src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java b/src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java new file mode 100644 index 0000000..6c7ddf4 --- /dev/null +++ b/src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java @@ -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: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)))); + }); + } + }); + } + + +} From b7c3d4bf109573073653b0c9fe5c53020cb6cc77 Mon Sep 17 00:00:00 2001 From: sery Date: Sun, 8 Sep 2024 13:04:26 +0200 Subject: [PATCH 2/2] weewee --- src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java b/src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java index 6c7ddf4..c762dd6 100644 --- a/src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java +++ b/src/main/java/net/flatkat/ancient_forgotten/loot/ModLoot.java @@ -12,7 +12,7 @@ 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:sniffer_digging"); + 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");