package me.km;

import me.km.blocks.ModBlocks;
import me.km.items.ModItems;
import net.minecraft.item.Item;
import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

public class CommonEvents {
    @SubscribeEvent
    public void getFuelBurnTime(FurnaceFuelBurnTimeEvent e) {
        Item item = e.getItemStack().getItem();
        if(item == ModItems.sling || item == ModBlocks.bookshelfAcacia.asItem()
                || item == ModBlocks.bookshelfBirch.asItem()
                || item == ModBlocks.bookshelfDarkOak.asItem()
                || item == ModBlocks.bookshelfJungle.asItem()
                || item == ModBlocks.bookshelfSpruce.asItem()) {
            e.setBurnTime(300);
        } else if(item == ModItems.woodenBattleAxe || item == ModItems.woodenDagger
                || item == ModItems.woodenHammer || item == ModItems.woodenScepter
                || item == ModItems.woodenStick) {
            e.setBurnTime(200);
        } else if(item == ModBlocks.crateAcacia.asItem()
                || item == ModBlocks.crateBigOak.asItem()
                || item == ModBlocks.crateBirch.asItem()
                || item == ModBlocks.crateJungle.asItem()
                || item == ModBlocks.crateOak.asItem()
                || item == ModBlocks.crateSpruce.asItem()) {
            e.setBurnTime(2700);
        }
    }

    /*private static final java.util.HashSet<Class> test = new java.util.HashSet<>();
    
    static
    {
        test.add(net.minecraftforge.event.world.ChunkDataEvent.class);
        test.add(net.minecraftforge.event.TickEvent.class);
        test.add(net.minecraftforge.event.entity.living.LivingSpawnEvent.class);
        test.add(net.minecraftforge.event.entity.living.LivingEvent.class);
        test.add(net.minecraftforge.event.TickEvent.class);
        test.add(net.minecraftforge.event.AttachCapabilitiesEvent.class);
        test.add(net.minecraftforge.event.entity.EntityMobGriefingEvent.class);
        test.add(net.minecraftforge.event.entity.living.LivingDestroyBlockEvent.class);
        test.add(net.minecraftforge.event.entity.PlaySoundAtEntityEvent.class);
        test.add(net.minecraftforge.event.entity.EntityEvent.class);
        test.add(net.minecraftforge.event.LootTableLoadEvent.class);
        test.add(net.minecraftforge.event.world.ChunkEvent.class);
        test.add(net.minecraftforge.event.world.WorldEvent.class);
        test.add(net.minecraftforge.event.entity.living.LivingFallEvent.class);
        test.add(net.minecraftforge.event.entity.player.PlayerEvent.class);
        test.add(net.minecraftforge.event.world.ChunkWatchEvent.class);
        test.add(net.minecraftforge.event.entity.living.LivingEntityUseItemEvent.class);
        test.add(net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent.class);
        test.add(net.minecraftforge.event.entity.EntityJoinWorldEvent.class);
        test.add(net.minecraftforge.event.entity.living.LivingPackSizeEvent.class);
    }
    
    @SubscribeEvent
    public void onChat(net.minecraftforge.event.ServerChatEvent e)
    {
        try
        {
            Class c = Class.forName(e.getMessage());
            if(!test.add(c))
            {
                test.remove(c);
            }
        }
        catch(Exception ex)
        {
        }
    }
    
    @SubscribeEvent
    public void test(net.minecraftforge.eventbus.api.Event e)
    {
        Class c = e.getClass();
        if(c.getEnclosingClass() != null)
        {
            c = c.getEnclosingClass();
        }
        if(test.contains(c))
        {
            return;
        }
        org.apache.logging.log4j.LogManager.getLogger().warn(c);
    }*/
}
