package net.cmr.jurassicrevived.datagen;

import net.cmr.jurassicrevived.block.ModBlocks;
import net.cmr.jurassicrevived.item.ModItems;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount;
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;

public class ModBlockLootTableProvider {

    public interface BlockLootHelper {
        void dropSelf(Block block);
        void add(Block block, LootTable.Builder builder);
        LootTable.Builder createMultipleOreDrops(Block block, Item item, float minDrops, float maxDrops);
		LootTable.Builder createRandomOreDrops(Block block, Item silkTouchDrop, Item firstDrop, Item secondDrop, float minRolls, float maxRolls, double firstDropChance);
		LootTable.Builder createPotFlowerItemTable(Block block);
    }

    public static void registerBlockLootTables(BlockLootHelper helper) {
        helper.dropSelf(ModBlocks.CAT_PLUSHIE.get());
        helper.dropSelf(ModBlocks.TRASH_CAN.get());
        helper.dropSelf(ModBlocks.BENCH.get());
        helper.dropSelf(ModBlocks.CHARRED_TERRACOTTA.get());
        helper.dropSelf(ModBlocks.FENCE_LIGHT.get());
        helper.dropSelf(ModBlocks.LIGHT_POST.get());
        helper.dropSelf(ModBlocks.GYPSUM_COBBLESTONE.get());
        helper.dropSelf(ModBlocks.GYPSUM_STONE_BRICKS.get());
        helper.dropSelf(ModBlocks.SMOOTH_GYPSUM_STONE.get());
        helper.dropSelf(ModBlocks.CHISELED_GYPSUM_STONE.get());
        helper.dropSelf(ModBlocks.GYPSUM_BRICK_STAIRS.get());
        helper.dropSelf(ModBlocks.GYPSUM_BRICK_SLAB.get());
        helper.dropSelf(ModBlocks.GYPSUM_BRICK_WALL.get());
        helper.dropSelf(ModBlocks.STONE_FOSSIL.get());
        helper.dropSelf(ModBlocks.DEEPSLATE_FOSSIL.get());
        helper.dropSelf(ModBlocks.LOW_SECURITY_FENCE_POLE.get());
        helper.dropSelf(ModBlocks.LOW_SECURITY_FENCE_WIRE.get());
        helper.dropSelf(ModBlocks.MEDIUM_SECURITY_FENCE_POLE.get());
        helper.dropSelf(ModBlocks.MEDIUM_SECURITY_FENCE_WIRE.get());
        helper.dropSelf(ModBlocks.ITEM_PIPE.get());
        helper.dropSelf(ModBlocks.FLUID_PIPE.get());
        helper.dropSelf(ModBlocks.POWER_PIPE.get());

        helper.add(ModBlocks.GYPSUM_STONE.get(),
                helper.createMultipleOreDrops(ModBlocks.GYPSUM_STONE.get(), ModBlocks.GYPSUM_COBBLESTONE.get().asItem(),1, 1));
        helper.add(ModBlocks.AMBER_ORE.get(),
                helper.createMultipleOreDrops(ModBlocks.AMBER_ORE.get(), ModItems.MOSQUITO_IN_AMBER.get(),1, 1));
        helper.add(ModBlocks.DEEPSLATE_ICE_SHARD_ORE.get(),
                helper.createMultipleOreDrops(ModBlocks.DEEPSLATE_ICE_SHARD_ORE.get(), ModItems.FROZEN_LEECH.get(),1, 1));
		helper.add(ModBlocks.PERMAFROST.get(),
			helper.createMultipleOreDrops(ModBlocks.PERMAFROST.get(), ModItems.FROZEN_BONE.get(),1, 1));

        helper.dropSelf(ModBlocks.REINFORCED_STONE.get());
        helper.dropSelf(ModBlocks.REINFORCED_STONE_BRICKS.get());
        helper.dropSelf(ModBlocks.CHISELED_REINFORCED_STONE.get());
        helper.dropSelf(ModBlocks.REINFORCED_BRICK_STAIRS.get());
        helper.dropSelf(ModBlocks.REINFORCED_BRICK_SLAB.get());
        helper.dropSelf(ModBlocks.REINFORCED_BRICK_WALL.get());

        helper.dropSelf(ModBlocks.APATOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.ALBERTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.BRACHIOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.CERATOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.DILOPHOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.TRICERATOPS_EGG.get());
        helper.dropSelf(ModBlocks.SPINOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.OURANOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.PARASAUROLOPHUS_EGG.get());
        helper.dropSelf(ModBlocks.INDOMINUS_REX_EGG.get());
        helper.dropSelf(ModBlocks.GALLIMIMUS_EGG.get());
        helper.dropSelf(ModBlocks.DIPLODOCUS_EGG.get());
        helper.dropSelf(ModBlocks.COMPSOGNATHUS_EGG.get());
        helper.dropSelf(ModBlocks.TYRANNOSAURUS_REX_EGG.get());
        helper.dropSelf(ModBlocks.VELOCIRAPTOR_EGG.get());
        helper.dropSelf(ModBlocks.BARYONYX_EGG.get());
        helper.dropSelf(ModBlocks.CARNOTAURUS_EGG.get());
        helper.dropSelf(ModBlocks.CONCAVENATOR_EGG.get());
        helper.dropSelf(ModBlocks.DEINONYCHUS_EGG.get());
        helper.dropSelf(ModBlocks.EDMONTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.GIGANOTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.GUANLONG_EGG.get());
        helper.dropSelf(ModBlocks.HERRERASAURUS_EGG.get());
        helper.dropSelf(ModBlocks.MAJUNGASAURUS_EGG.get());
        helper.dropSelf(ModBlocks.PROCOMPSOGNATHUS_EGG.get());
        helper.dropSelf(ModBlocks.PROTOCERATOPS_EGG.get());
        helper.dropSelf(ModBlocks.RUGOPS_EGG.get());
        helper.dropSelf(ModBlocks.SHANTUNGOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.STEGOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.STYRACOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.THERIZINOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.DISTORTUS_REX_EGG.get());
        helper.dropSelf(ModBlocks.ALLOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.ALVAREZSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.ANKYLOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.ARAMBOURGIANIA_EGG.get());
        helper.dropSelf(ModBlocks.CARCHARODONTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.CEARADACTYLUS_EGG.get());
        helper.dropSelf(ModBlocks.CHASMOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.COELOPHYSIS_EGG.get());
        helper.dropSelf(ModBlocks.COELURUS_EGG.get());
        helper.dropSelf(ModBlocks.CORYTHOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.DIMORPHODON_EGG.get());
        helper.dropSelf(ModBlocks.DRYOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.GEOSTERNBERGIA_EGG.get());
        helper.dropSelf(ModBlocks.GUIDRACO_EGG.get());
        helper.dropSelf(ModBlocks.HADROSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.HYPSILOPHODON_EGG.get());
        helper.dropSelf(ModBlocks.INDORAPTOR_EGG.get());
        helper.dropSelf(ModBlocks.INOSTRANCEVIA_EGG.get());
        helper.dropSelf(ModBlocks.LAMBEOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.LUDODACTYLUS_EGG.get());
        helper.dropSelf(ModBlocks.MAMENCHISAURUS_EGG.get());
        helper.dropSelf(ModBlocks.METRIACANTHOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.MOGANOPTERUS_EGG.get());
        helper.dropSelf(ModBlocks.NYCTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.ORNITHOLESTES_EGG.get());
        helper.dropSelf(ModBlocks.ORNITHOMIMUS_EGG.get());
        helper.dropSelf(ModBlocks.OVIRAPTOR_EGG.get());
        helper.dropSelf(ModBlocks.PACHYCEPHALOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.PROCERATOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.PTERANODON_EGG.get());
        helper.dropSelf(ModBlocks.PTERODAUSTRO_EGG.get());
        helper.dropSelf(ModBlocks.QUETZALCOATLUS_EGG.get());
        helper.dropSelf(ModBlocks.RAJASAURUS_EGG.get());
        helper.dropSelf(ModBlocks.SEGISAURUS_EGG.get());
        helper.dropSelf(ModBlocks.TAPEJARA_EGG.get());
        helper.dropSelf(ModBlocks.TITANOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.TROODON_EGG.get());
        helper.dropSelf(ModBlocks.TROPEOGNATHUS_EGG.get());
        helper.dropSelf(ModBlocks.TUPUXUARA_EGG.get());
        helper.dropSelf(ModBlocks.UTAHRAPTOR_EGG.get());
        helper.dropSelf(ModBlocks.ZHENYUANOPTERUS_EGG.get());
        helper.dropSelf(ModBlocks.ACHILLOBATOR_EGG.get());
        helper.dropSelf(ModBlocks.SUCHOMIMUS_EGG.get());
        helper.dropSelf(ModBlocks.CHILESAURUS_EGG.get());
        helper.dropSelf(ModBlocks.MUSSASAURUS_EGG.get());
        helper.dropSelf(ModBlocks.THESCELOSAURUS_EGG.get());

        helper.dropSelf(ModBlocks.INCUBATED_APATOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_ALBERTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_BRACHIOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_CERATOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_DILOPHOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_TRICERATOPS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_SPINOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_OURANOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_PARASAUROLOPHUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_INDOMINUS_REX_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_GALLIMIMUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_DIPLODOCUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_COMPSOGNATHUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_TYRANNOSAURUS_REX_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_VELOCIRAPTOR_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_BARYONYX_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_CARNOTAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_CONCAVENATOR_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_DEINONYCHUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_EDMONTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_GIGANOTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_GUANLONG_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_HERRERASAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_MAJUNGASAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_PROCOMPSOGNATHUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_PROTOCERATOPS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_RUGOPS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_SHANTUNGOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_STEGOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_STYRACOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_THERIZINOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_DISTORTUS_REX_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_ALLOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_ALVAREZSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_ANKYLOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_ARAMBOURGIANIA_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_CARCHARODONTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_CEARADACTYLUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_CHASMOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_COELOPHYSIS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_COELURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_CORYTHOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_DIMORPHODON_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_DRYOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_GEOSTERNBERGIA_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_GUIDRACO_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_HADROSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_HYPSILOPHODON_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_INDORAPTOR_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_INOSTRANCEVIA_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_LAMBEOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_LUDODACTYLUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_MAMENCHISAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_METRIACANTHOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_MOGANOPTERUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_NYCTOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_ORNITHOLESTES_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_ORNITHOMIMUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_OVIRAPTOR_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_PACHYCEPHALOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_PROCERATOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_PTERANODON_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_PTERODAUSTRO_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_QUETZALCOATLUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_RAJASAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_SEGISAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_TAPEJARA_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_TITANOSAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_TROODON_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_TROPEOGNATHUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_TUPUXUARA_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_UTAHRAPTOR_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_ZHENYUANOPTERUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_ACHILLOBATOR_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_SUCHOMIMUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_CHILESAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_MUSSASAURUS_EGG.get());
        helper.dropSelf(ModBlocks.INCUBATED_THESCELOSAURUS_EGG.get());

        helper.dropSelf(ModBlocks.ROYAL_FERN.get());
        helper.add(ModBlocks.POTTED_ROYAL_FERN.get(), helper.createPotFlowerItemTable(ModBlocks.ROYAL_FERN.get()));

        helper.dropSelf(ModBlocks.HORSETAIL_FERN.get());
        helper.add(ModBlocks.POTTED_HORSETAIL_FERN.get(), helper.createPotFlowerItemTable(ModBlocks.HORSETAIL_FERN.get()));

        helper.dropSelf(ModBlocks.WESTERN_SWORD_FERN.get());
        helper.add(ModBlocks.POTTED_WESTERN_SWORD_FERN.get(), helper.createPotFlowerItemTable(ModBlocks.WESTERN_SWORD_FERN.get()));

        helper.dropSelf(ModBlocks.ONYCHIOPSIS.get());
        helper.add(ModBlocks.POTTED_ONYCHIOPSIS.get(), helper.createPotFlowerItemTable(ModBlocks.ONYCHIOPSIS.get()));
    }
}
