
import classes.Colors
import classes.Utils
import classes.jeiCategories.FirewoodRecipeCategory

def jeiCatWrappers = []

[
    [ore('softwoodLumber'), ore('softwoodLog'), ore('softwoodPlanks'), ore('softFirewood')] : [
        // Vanilla
            [item('contenttweaker:lumber_vanilla_spruce')          , item('minecraft:log', 1)        , item('minecraft:planks', 1)          , item('contenttweaker:firewood_spruce')              ],

        // Biomes O Plenty
            [item('contenttweaker:lumber_umbran')                  , item('biomesoplenty:log_0', 6)  , item('biomesoplenty:planks_0', 2)    , item('contenttweaker:firewood_umbran')              ],
            [item('contenttweaker:lumber_fir')                     , item('biomesoplenty:log_0', 7)  , item('biomesoplenty:planks_0', 3)    , item('contenttweaker:firewood_fir')                 ],
            [item('contenttweaker:lumber_ethereal')                , item('biomesoplenty:log_1', 4)  , item('biomesoplenty:planks_0', 4)    , item('contenttweaker:firewood_ethereal')            ],
            [item('contenttweaker:lumber_magic')                   , item('biomesoplenty:log_1', 5)  , item('biomesoplenty:planks_0', 5)    , item('contenttweaker:firewood_magic')               ],
            [item('contenttweaker:lumber_redwood')                 , item('biomesoplenty:log_2', 4)  , item('biomesoplenty:planks_0', 8)    , item('contenttweaker:firewood_redwood')             ],
            [item('contenttweaker:lumber_pine')                    , item('biomesoplenty:log_2', 6)  , item('biomesoplenty:planks_0', 10)   , item('contenttweaker:firewood_pine')                ],

        // Forestry
            [item('contenttweaker:lumber_planks.larch')            , item('forestry:logs.0')         , item('forestry:planks.0')            , item('contenttweaker:forestry_firewood_larch')      ],
            [item('contenttweaker:lumber_planks.sequoia')          , item('forestry:logs.1', 3)      , item('forestry:planks.0', 7)         , item('contenttweaker:forestry_firewood_sequoia')    ],
            [item('contenttweaker:lumber_planks.kapok')            , item('forestry:logs.2')         , item('forestry:planks.0', 8)         , item('contenttweaker:forestry_firewood_kapok')      ],
            [item('contenttweaker:lumber_planks.pine')             , item('forestry:logs.5')         , item('forestry:planks.1', 4)         , item('contenttweaker:forestry_firewood_pine')       ],
            [item('contenttweaker:lumber_planks.giganteum')        , item('forestry:logs.6')         , item('forestry:planks.1', 8)         , item('contenttweaker:forestry_firewood_giganteum')  ],

        ],

    [ore('hardwoodLumber'), ore('hardwoodLog'), ore('hardwoodPlanks'), ore('hardFirewood')] : [
        // Vanilla
            [item('contenttweaker:lumber_vanilla_oak')             , item('minecraft:log')           , item('minecraft:planks')             ,  item('contenttweaker:firewood_oak')                ],
            [item('contenttweaker:lumber_vanilla_birch')           , item('minecraft:log', 2)        , item('minecraft:planks', 2)          ,  item('contenttweaker:firewood_birch')              ],
            [item('contenttweaker:lumber_vanilla_jungle')          , item('minecraft:log', 3)        , item('minecraft:planks', 3)          ,  item('contenttweaker:firewood_jungle')             ],
            [item('contenttweaker:lumber_vanilla_acacia')          , item('minecraft:log2')          , item('minecraft:planks', 4)          ,  item('contenttweaker:firewood_acacia')             ],
            [item('contenttweaker:lumber_vanilla_dark_oak')        , item('minecraft:log2', 1)       , item('minecraft:planks', 5)          ,  item('contenttweaker:firewood_dark_oak')           ],

        // Biomes O Plenty
            [item('contenttweaker:lumber_sacred_oak')              , item('biomesoplenty:log_0', 4)  , item('biomesoplenty:planks_0')       ,  item('contenttweaker:firewood_sacred_oak')         ],
            [item('contenttweaker:lumber_cherry')                  , item('biomesoplenty:log_0', 5)  , item('biomesoplenty:planks_0', 1)    ,  item('contenttweaker:firewood_cherry')             ],
            [item('contenttweaker:lumber_mangrove')                , item('biomesoplenty:log_1', 6)  , item('biomesoplenty:planks_0', 6)    ,  item('contenttweaker:firewood_mangrove')           ],
            [item('contenttweaker:lumber_willow')                  , item('biomesoplenty:log_2', 5)  , item('biomesoplenty:planks_0', 9)    ,  item('contenttweaker:firewood_willow')             ],
            [item('contenttweaker:lumber_hellbark')                , item('biomesoplenty:log_2', 7)  , item('biomesoplenty:planks_0', 11)   ,  item('contenttweaker:firewood_hellbark')           ],
            [item('contenttweaker:lumber_jacaranda')               , item('biomesoplenty:log_3', 4)  , item('biomesoplenty:planks_0', 12)   ,  item('contenttweaker:firewood_jacaranda')          ],
            [item('contenttweaker:lumber_mahogany')                , item('biomesoplenty:log_3', 5)  , item('biomesoplenty:planks_0', 13)   ,  item('contenttweaker:firewood_mahogany')           ],
            [item('contenttweaker:lumber_ebony')                   , item('biomesoplenty:log_3', 6)  , item('biomesoplenty:planks_0', 14)   ,  item('contenttweaker:firewood_ebony')              ],
            [item('contenttweaker:lumber_eucalyptus')              , item('biomesoplenty:log_3', 7)  , item('biomesoplenty:planks_0', 15)   ,  item('contenttweaker:firewood_eucalyptus')         ],

        // Rustic
            [item('contenttweaker:lumber_planks_olive')            , item('rustic:log')              , item('rustic:planks')                ,  item('contenttweaker:rustic_firewood_olive')       ],
            [item('contenttweaker:lumber_planks_ironwood')         , item('rustic:log', 1)           , item('rustic:planks', 1)             ,  item('contenttweaker:rustic_firewood_ironwood')    ],

        // Forestry
            [item('contenttweaker:lumber_planks.teak')             , item('forestry:logs.0', 1)      , item('forestry:planks.0', 1)         , item('contenttweaker:forestry_firewood_teak')       ],
            [item('contenttweaker:lumber_planks.acacia')           , item('forestry:logs.0', 2)      , item('forestry:planks.0', 2)         , item('contenttweaker:forestry_firewood_acacia')     ],
            [item('contenttweaker:lumber_planks.lime')             , item('forestry:logs.0', 3)      , item('forestry:planks.0', 3)         , item('contenttweaker:forestry_firewood_lime')       ],
            [item('contenttweaker:lumber_planks.chestnut')         , item('forestry:logs.1')         , item('forestry:planks.0', 4)         , item('contenttweaker:forestry_firewood_chestnut')   ],
            [item('contenttweaker:lumber_planks.wenge')            , item('forestry:logs.1', 1)      , item('forestry:planks.0', 5)         , item('contenttweaker:forestry_firewood_wenge')      ],
            [item('contenttweaker:lumber_planks.ebony')            , item('forestry:logs.2', 1)      , item('forestry:planks.0', 9)         , item('contenttweaker:forestry_firewood_ebony')      ],
            [item('contenttweaker:lumber_planks.mahogany')         , item('forestry:logs.2', 2)      , item('forestry:planks.0', 10)        , item('contenttweaker:forestry_firewood_mahogany')   ],
            [item('contenttweaker:lumber_planks.balsa')            , item('forestry:logs.2', 3)      , item('forestry:planks.0', 11)        , item('contenttweaker:forestry_firewood_balsa')      ],
            [item('contenttweaker:lumber_planks.willow')           , item('forestry:logs.3')         , item('forestry:planks.0', 12)        , item('contenttweaker:forestry_firewood_willow')     ],
            [item('contenttweaker:lumber_planks.walnut')           , item('forestry:logs.3', 1)      , item('forestry:planks.0', 13)        , item('contenttweaker:forestry_firewood_walnut')     ],
            [item('contenttweaker:lumber_planks.greenheart')       , item('forestry:logs.3', 2)      , item('forestry:planks.0', 14)        , item('contenttweaker:forestry_firewood_greenheart') ],
            [item('contenttweaker:lumber_planks.cherry')           , item('forestry:logs.3', 3)      , item('forestry:planks.0', 15)        , item('contenttweaker:forestry_firewood_cherry')     ],
            [item('contenttweaker:lumber_planks.mahoe')            , item('forestry:logs.4')         , item('forestry:planks.1')            , item('contenttweaker:forestry_firewood_mahoe')      ],
            [item('contenttweaker:lumber_planks.poplar')           , item('forestry:logs.4', 1)      , item('forestry:planks.1', 1)         , item('contenttweaker:forestry_firewood_poplar')     ],
            [item('contenttweaker:lumber_planks.plum')             , item('forestry:logs.5', 1)      , item('forestry:planks.1', 5)         , item('contenttweaker:forestry_firewood_plum')       ],
            [item('contenttweaker:lumber_planks.maple')            , item('forestry:logs.5', 2)      , item('forestry:planks.1', 6)         , item('contenttweaker:forestry_firewood_maple')      ],
            [item('contenttweaker:lumber_planks.citrus')           , item('forestry:logs.5', 3)      , item('forestry:planks.1', 7)         , item('contenttweaker:forestry_firewood_citrus')     ],
            [item('contenttweaker:lumber_planks.ipe')              , item('forestry:logs.6', 1)      , item('forestry:planks.1', 9)         , item('contenttweaker:forestry_firewood_ipe')        ],
            [item('contenttweaker:lumber_planks.padauk')           , item('forestry:logs.6', 2)      , item('forestry:planks.1', 10)        , item('contenttweaker:forestry_firewood_padauk')     ],
            [item('contenttweaker:lumber_planks.cocobolo')         , item('forestry:logs.6', 3)      , item('forestry:planks.1', 11)        , item('contenttweaker:forestry_firewood_cocobolo')   ],
            [item('contenttweaker:lumber_planks.zebrawood')        , item('forestry:logs.7')         , item('forestry:planks.1', 12)        , item('contenttweaker:forestry_firewood_zebrawood')  ],

        // Cuisine
            [item('contenttweaker:cuisine_citrus_lumber')          , item('cuisine:log')             , item('cuisine:planks')              , item('contenttweaker:cuisine_firewood_citrus')      ],

    ],

    [ore('pseudowoodLumber'), ore('pseudowoodLog'), ore('pseudowoodPlanks'), ore('pseudoFirewood')] : [
        // Biomes O Plenty
            [item('contenttweaker:lumber_palm')                    , item('biomesoplenty:log_1', 7)  , item('biomesoplenty:planks_0', 7)    , item('contenttweaker:firewood_palm')                ],

        // Forestry
            [item('contenttweaker:lumber_planks.baobab')           , item('forestry:logs.1', 2)      , item('forestry:planks.0', 6)         , item('contenttweaker:forestry_firewood_baobab')     ],
            [item('contenttweaker:lumber_planks.palm')             , item('forestry:logs.4', 2)      , item('forestry:planks.1', 2)         , item('contenttweaker:forestry_firewood_palm')       ],
            [item('contenttweaker:lumber_planks.papaya')           , item('forestry:logs.4', 3)      , item('forestry:planks.1', 3)         , item('contenttweaker:forestry_firewood_papaya')     ],
    ]
].each {
    def oredicts = it.key
    def itemLists = it.value
    itemLists.each { items ->
        def lumber = items[0]
        def log = items[1]
        def planks = items[2]
        def firewood = items[3]

        // Lumber
        oredicts[0].add(lumber)

        // Logs
        oredicts[1].add(log)
        ore('tooBig').add(log)

        // Planks
        oredicts[2].add(planks)

        // Firewood
        oredicts[3].add(firewood)
        ore('firewood').add(firewood)

        // JEI Category
        jeiCatWrappers << new FirewoodRecipeCategory.RecipeWrapper(log, firewood * 6, item('minecraft:flint'), item('pyrotech:material', 10))
        jeiCatWrappers << new FirewoodRecipeCategory.RecipeWrapper(log, firewood * 6, item('contenttweaker:splitting_wedge'))
    }
}

mods.jei.category.categoryBuilder()
    .id(FirewoodRecipeCategory.UID)
    .category(guiHelper -> new FirewoodRecipeCategory(guiHelper))
    .wrapper(jeiCatWrappers)
    .register()

ore('softwoodLumber').setBurnTime(80)
ore('softwoodLog').setBurnTime(0)
ore('softwoodPlanks').setBurnTime(150)
ore('softFirewood').setBurnTime(105)

ore('hardwoodLumber').setBurnTime(120)
ore('hardwoodLog').setBurnTime(0)
ore('hardwoodPlanks').setBurnTime(220)
ore('hardFirewood').setBurnTime(205)

ore('pseudowoodLumber').setBurnTime(80)
ore('pseudowoodLog').setBurnTime(0)
ore('pseudowoodPlanks').setBurnTime(105)
ore('pseudoFirewood').setBurnTime(105)

item('minecraft:stick').setBurnTime(25)

ore('softwoodLumber').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.soft_wood"))
ore('softwoodLog').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.soft_wood"))
ore('softwoodPlanks').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.soft_wood"))
ore('softFirewood').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.soft_wood"))

ore('hardwoodLumber').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.hard_wood"))
ore('hardwoodLog').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.hard_wood"))
ore('hardwoodPlanks').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.hard_wood"))
ore('hardFirewood').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.hard_wood"))

ore('pseudowoodLumber').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.pseudo_wood"))
ore('pseudowoodLog').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.pseudo_wood"))
ore('pseudowoodPlanks').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.pseudo_wood"))
ore('pseudoFirewood').addTooltip(Colors.GOLD + Utils.localize("underdog.tooltip.pseudo_wood"))

// ore('tooBig').addAll(ore('softwoodLog'));
// ore('tooBig').addAll(ore('hardwoodLog'));
// ore('tooBig').addAll(ore('pseudowoodLog'));
ore('tooBig').addTooltip(Utils.localize("underdog.tooltip.too_big"))

// ore('firewood').addAll(ore('softFirewood'));
// ore('firewood').addAll(ore('hardFirewood'));
// ore('firewood').addAll(ore('pseudoFirewood'));

// // Rustic Painted Wood
// item('contenttweaker:painted_wood_white_lumber')      , null                     , item('rustic:painted_wood_white')
// item('contenttweaker:painted_wood_orange_lumber')     , null                     , item('rustic:painted_wood_orange')
// item('contenttweaker:painted_wood_magenta_lumber')    , null                     , item('rustic:painted_wood_magenta')
// item('contenttweaker:painted_wood_light_blue_lumber') , null                     , item('rustic:painted_wood_light_blue')
// item('contenttweaker:painted_wood_yellow_lumber')     , null                     , item('rustic:painted_wood_yellow')
// item('contenttweaker:painted_wood_lime_lumber')       , null                     , item('rustic:painted_wood_lime')
// item('contenttweaker:painted_wood_pink_lumber')       , null                     , item('rustic:painted_wood_pink')
// item('contenttweaker:painted_wood_gray_lumber')       , null                     , item('rustic:painted_wood_gray')
// item('contenttweaker:painted_wood_silver_lumber')     , null                     , item('rustic:painted_wood_silver')
// item('contenttweaker:painted_wood_cyan_lumber')       , null                     , item('rustic:painted_wood_cyan')
// item('contenttweaker:painted_wood_purple_lumber')     , null                     , item('rustic:painted_wood_purple')
// item('contenttweaker:painted_wood_blue_lumber')       , null                     , item('rustic:painted_wood_blue')
// item('contenttweaker:painted_wood_brown_lumber')      , null                     , item('rustic:painted_wood_brown')
// item('contenttweaker:painted_wood_green_lumber')      , null                     , item('rustic:painted_wood_green')
// item('contenttweaker:painted_wood_red_lumber')        , null                     , item('rustic:painted_wood_red')
// item('contenttweaker:painted_wood_black_lumber')      , null                     , item('rustic:painted_wood_black')

// // Immersive Engineering
// item('contenttweaker:treated_wood_lumber')            , null                     , item('immersiveengineering:treated_wood')

// // Pyrotech
// item('contenttweaker:tarred_lumber')                  , null                     , item('pyrotech:planks_tarred')
