package ru.dbotthepony.mc.otm.datagen.loot

import net.minecraft.world.level.storage.loot.functions.SetComponentsFunction
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import ru.dbotthepony.mc.otm.datagen.modLootTable
import ru.dbotthepony.mc.otm.registry.game.MDataComponentTypes
import ru.dbotthepony.mc.otm.registry.game.MEntityTypes
import ru.dbotthepony.mc.otm.registry.game.MItems

fun addEntityLoot(loot: LootTables) {
	loot.builder(LootContextParamSets.ENTITY, modLootTable("entities/loader")) {
		lootPool {
			item(MItems.MECHANICAL_PARTS) {
				setCount(1, 3)
				setWeight(7)
			}
			item(MItems.ELECTRIC_PARTS) {
				setCount(1, 1)
				setWeight(1)
			}
			setRolls(1)
		}
	}

	loot.builder(LootContextParamSets.ENTITY, MEntityTypes.BREAD_MONSTER.defaultLootTable) {
		lootPool {
			item(MItems.IMPERFECT_BREAD) {
				apply(SetComponentsFunction.setComponent(MDataComponentTypes.INERT, true))
			}
		}
	}
}
