Search in sources :

Example 1 with CentrifugeData

use of com.teamresourceful.resourcefulbees.api.beedata.centrifuge.CentrifugeData in project ResourcefulBees by Resourceful-Bees.

the class RecipeBuilder method onResourceManagerReload.

@Override
public void onResourceManagerReload(@NotNull ResourceManager resourceManager) {
    LOGGER.info("Loading comb recipes for {} bees...", BEE_REGISTRY.getBees().size());
    BEE_REGISTRY.getBees().forEach((s, beeData) -> {
        CentrifugeData centrifugeData = beeData.getCentrifugeData();
        HoneycombData honeycombData = beeData.getHoneycombData();
        if (centrifugeData.hasCentrifugeOutput() && honeycombData.getHoneycombType().equals(HoneycombType.DEFAULT)) {
            Recipe<?> honeycombCentrifuge = this.centrifugeRecipe(s, centrifugeData, honeycombData, 1);
            Recipe<?> honeycombBlockCentrifuge = this.centrifugeRecipe(s, centrifugeData, honeycombData, 9);
            getRecipeManager().recipes.computeIfAbsent(honeycombCentrifuge.getType(), t -> new HashMap<>()).put(honeycombCentrifuge.getId(), honeycombCentrifuge);
            getRecipeManager().recipes.computeIfAbsent(honeycombBlockCentrifuge.getType(), t -> new HashMap<>()).put(honeycombBlockCentrifuge.getId(), honeycombBlockCentrifuge);
        }
        if (Config.HONEYCOMB_BLOCK_RECIPES.get() && honeycombData.getHoneycombType().equals(HoneycombType.DEFAULT)) {
            Recipe<?> honeycombBlock = this.makeHoneycombRecipe(s, honeycombData);
            Recipe<?> honeycomb = this.combBlockToCombRecipe(s, honeycombData);
            getRecipeManager().recipes.computeIfAbsent(honeycombBlock.getType(), t -> new HashMap<>()).put(honeycombBlock.getId(), honeycombBlock);
            getRecipeManager().recipes.computeIfAbsent(honeycomb.getType(), t -> new HashMap<>()).put(honeycomb.getId(), honeycomb);
        }
    });
    if (Config.HONEY_BLOCK_RECIPES.get() && Config.HONEY_GENERATE_BLOCKS.get()) {
        HoneyRegistry.getRegistry().getHoneyBottles().forEach((s, honeyData) -> {
            if (honeyData.doGenerateHoneyBlock() && honeyData.doHoneyBlockRecipe()) {
                Recipe<?> honeyBlock = this.makeHoneyBlockRecipe(honeyData);
                Recipe<?> honeyBottle = this.makeHoneyBottleRecipe(honeyData);
                Recipe<?> bottleToBucket = this.makeBottleToBucketRecipe(honeyData);
                Recipe<?> bucketToBottle = this.makeBucketToBottleRecipe(honeyData);
                Recipe<?> blockToBucket = this.makeBlockToBucketRecipe(honeyData);
                Recipe<?> bucketToBlock = this.makeBucketToBlockRecipe(honeyData);
                getBottleRecipes(honeyBlock, honeyBottle, bottleToBucket);
                getBottleRecipes(bucketToBottle, blockToBucket, bucketToBlock);
            }
        });
    }
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) Config(com.teamresourceful.resourcefulbees.config.Config) Items(net.minecraft.world.item.Items) HoneycombType(com.teamresourceful.resourcefulbees.lib.enums.HoneycombType) ResourceManagerReloadListener(net.minecraft.server.packs.resources.ResourceManagerReloadListener) CentrifugeData(com.teamresourceful.resourcefulbees.api.beedata.centrifuge.CentrifugeData) ResourceManager(net.minecraft.server.packs.resources.ResourceManager) HoneyRegistry(com.teamresourceful.resourcefulbees.registry.HoneyRegistry) HashMap(java.util.HashMap) CentrifugeRecipe(com.teamresourceful.resourcefulbees.recipe.CentrifugeRecipe) AddReloadListenerEvent(net.minecraftforge.event.AddReloadListenerEvent) LOGGER(com.teamresourceful.resourcefulbees.ResourcefulBees.LOGGER) BeeRegistry(com.teamresourceful.resourcefulbees.registry.BeeRegistry) HoneycombData(com.teamresourceful.resourcefulbees.api.beedata.HoneycombData) HoneyBottleData(com.teamresourceful.resourcefulbees.api.honeydata.HoneyBottleData) EventPriority(net.minecraftforge.eventbus.api.EventPriority) ResourcefulBees(com.teamresourceful.resourcefulbees.ResourcefulBees) net.minecraft.world.item.crafting(net.minecraft.world.item.crafting) NonNullList(net.minecraft.core.NonNullList) IBeeRegistry(com.teamresourceful.resourcefulbees.api.IBeeRegistry) ItemStack(net.minecraft.world.item.ItemStack) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent) NotNull(org.jetbrains.annotations.NotNull) HoneycombData(com.teamresourceful.resourcefulbees.api.beedata.HoneycombData) HashMap(java.util.HashMap) CentrifugeData(com.teamresourceful.resourcefulbees.api.beedata.centrifuge.CentrifugeData)

Aggregations

ResourcefulBees (com.teamresourceful.resourcefulbees.ResourcefulBees)1 LOGGER (com.teamresourceful.resourcefulbees.ResourcefulBees.LOGGER)1 IBeeRegistry (com.teamresourceful.resourcefulbees.api.IBeeRegistry)1 HoneycombData (com.teamresourceful.resourcefulbees.api.beedata.HoneycombData)1 CentrifugeData (com.teamresourceful.resourcefulbees.api.beedata.centrifuge.CentrifugeData)1 HoneyBottleData (com.teamresourceful.resourcefulbees.api.honeydata.HoneyBottleData)1 Config (com.teamresourceful.resourcefulbees.config.Config)1 HoneycombType (com.teamresourceful.resourcefulbees.lib.enums.HoneycombType)1 CentrifugeRecipe (com.teamresourceful.resourcefulbees.recipe.CentrifugeRecipe)1 BeeRegistry (com.teamresourceful.resourcefulbees.registry.BeeRegistry)1 HoneyRegistry (com.teamresourceful.resourcefulbees.registry.HoneyRegistry)1 HashMap (java.util.HashMap)1 NonNullList (net.minecraft.core.NonNullList)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 ResourceManager (net.minecraft.server.packs.resources.ResourceManager)1 ResourceManagerReloadListener (net.minecraft.server.packs.resources.ResourceManagerReloadListener)1 ItemStack (net.minecraft.world.item.ItemStack)1 Items (net.minecraft.world.item.Items)1 net.minecraft.world.item.crafting (net.minecraft.world.item.crafting)1 AddReloadListenerEvent (net.minecraftforge.event.AddReloadListenerEvent)1