file dir edit

This commit is contained in:
RyanTLG
2022-03-17 18:59:32 +02:00
parent 8a0f393cc0
commit 3b84706602
59 changed files with 152 additions and 143 deletions

View File

@@ -0,0 +1,38 @@
package net.arcmods.ryantlg.lootTables;
import net.arcmods.ryantlg.gamermod;
import net.arcmods.ryantlg.items.itemsByCrop.weemItems;
import net.fabricmc.fabric.api.loot.v1.FabricLootPoolBuilder;
import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback;
import net.minecraft.loot.condition.RandomChanceLootCondition;
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 grassVanillaWeem {
private static final Identifier GRASS_LOOT_TABLE_ID = new Identifier("minecraft", "blocks/grass");
private static void modifyLootTables() {
LootTableLoadingCallback.EVENT.register(((resourceManager, manager, id, supplier, setter) -> {
if (GRASS_LOOT_TABLE_ID.equals(id)) {
FabricLootPoolBuilder weemSeed = FabricLootPoolBuilder.builder()
.rolls(ConstantLootNumberProvider.create(1))
.with(ItemEntry.builder(weemItems.WEEM_SEEDS))
.withFunction(SetCountLootFunction.builder(ConstantLootNumberProvider.create(1.0f)).build())
.conditionally(RandomChanceLootCondition.builder(0.04f));
supplier.withPool(weemSeed.build());
}
}));
}
public static void register() {
modifyLootTables();
gamermod.LOGGER.info("grassVanillaWeem loaded");
}
}