Buckets:
| package com.example.examplemod; | |
| import net.fabricmc.fabric.api.loot.v3.LootTableEvents; | |
| import net.minecraft.loot.LootPool; | |
| import net.minecraft.loot.condition.RandomChanceLootCondition; | |
| import net.minecraft.loot.entry.ItemEntry; | |
| import net.minecraft.loot.provider.number.ConstantLootNumberProvider; | |
| import net.minecraft.registry.RegistryKeys; | |
| import net.minecraft.util.Identifier; | |
| /** | |
| * Add extra loot drops to an existing loot table (vanilla or modded) | |
| * without overwriting it. LootTableEvents.MODIFY API (v3) is current | |
| * for 1.21.7 - 1.21.11. | |
| */ | |
| public final class ExampleLootModifier { | |
| private ExampleLootModifier() {} | |
| public static void register() { | |
| LootTableEvents.MODIFY.register((key, tableBuilder, source, registries) -> { | |
| // Only modify the loot table for "minecraft:blocks/stone" | |
| if (key.getValue().equals(Identifier.ofVanilla("blocks/stone"))) { | |
| LootPool.Builder pool = LootPool.builder() | |
| .rolls(ConstantLootNumberProvider.create(1)) | |
| .with(ItemEntry.builder(ExampleMod.EXAMPLE_GEM)) | |
| .conditionally(RandomChanceLootCondition.builder(0.01f)); // 1% chance | |
| tableBuilder.pool(pool); | |
| } | |
| }); | |
| } | |
| } | |
Xet Storage Details
- Size:
- 1.28 kB
- Xet hash:
- 9a558a84ed5317e931cdc2f8309a096ca269706fe3cba30355fdc8cb1ba81b5c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.