Search in sources :

Example 1 with HoneycombData

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

the class ColorHandler method onItemColors.

public static void onItemColors(ColorHandlerEvent.Item event) {
    ItemColors colors = event.getItemColors();
    BEE_REGISTRY.getBees().forEach(((s, beeData) -> {
        HoneycombData honeycombData = beeData.getHoneycombData();
        if (honeycombData.getHoneycombType().equals(HoneycombType.DEFAULT) && !honeycombData.getColor().isDefault()) {
            registerItems(colors, HoneycombItem::getColor, BeeInfoUtils.getItem(ResourcefulBees.MOD_ID + ":" + s + "_honeycomb"));
            registerItems(colors, HoneycombBlock::getItemColor, BeeInfoUtils.getItem(ResourcefulBees.MOD_ID + ":" + s + "_honeycomb_block"));
        }
        if (!beeData.getRenderData().getColorData().getSpawnEggPrimaryColor().isDefault() && !beeData.getRenderData().getColorData().getSpawnEggSecondaryColor().isDefault()) {
            registerItems(colors, BeeSpawnEggItem::getColor, BeeInfoUtils.getItem(ResourcefulBees.MOD_ID + ":" + s + "_bee_spawn_egg"));
        }
    }));
    HoneyRegistry.getRegistry().getHoneyBottles().forEach((h, honeyData) -> {
        registerItems(colors, CustomHoneyBottleItem::getColor, honeyData.getHoneyBottleRegistryObject().get());
        if (Config.HONEY_GENERATE_BLOCKS.get() && honeyData.doGenerateHoneyBlock()) {
            registerItems(colors, CustomHoneyBlock::getItemColor, honeyData.getHoneyBlockItemRegistryObject().get());
        }
        if (Config.HONEY_GENERATE_FLUIDS.get() && honeyData.doGenerateHoneyFluid()) {
            registerItems(colors, CustomHoneyBucketItem::getColor, honeyData.getHoneyBucketItemRegistryObject().get());
        }
    });
    registerItems(colors, BeeJar::getColor, ModItems.BEE_JAR.get());
}
Also used : BlockColor(net.minecraft.client.color.block.BlockColor) CustomHoneyBlock(com.teamresourceful.resourcefulbees.block.CustomHoneyBlock) Config(com.teamresourceful.resourcefulbees.config.Config) HoneycombType(com.teamresourceful.resourcefulbees.lib.enums.HoneycombType) BeeInfoUtils(com.teamresourceful.resourcefulbees.utils.BeeInfoUtils) ModItems(com.teamresourceful.resourcefulbees.registry.ModItems) HoneyRegistry(com.teamresourceful.resourcefulbees.registry.HoneyRegistry) HoneycombBlock(com.teamresourceful.resourcefulbees.block.HoneycombBlock) LOGGER(com.teamresourceful.resourcefulbees.ResourcefulBees.LOGGER) com.teamresourceful.resourcefulbees.item(com.teamresourceful.resourcefulbees.item) ItemColors(net.minecraft.client.color.item.ItemColors) BeeRegistry(com.teamresourceful.resourcefulbees.registry.BeeRegistry) ItemLike(net.minecraft.world.level.ItemLike) HoneycombData(com.teamresourceful.resourcefulbees.api.beedata.HoneycombData) BlockColors(net.minecraft.client.color.block.BlockColors) ResourcefulBees(com.teamresourceful.resourcefulbees.ResourcefulBees) Block(net.minecraft.world.level.block.Block) IBeeRegistry(com.teamresourceful.resourcefulbees.api.IBeeRegistry) ColorHandlerEvent(net.minecraftforge.client.event.ColorHandlerEvent) ItemColor(net.minecraft.client.color.item.ItemColor) HoneycombData(com.teamresourceful.resourcefulbees.api.beedata.HoneycombData) ItemColors(net.minecraft.client.color.item.ItemColors) CustomHoneyBlock(com.teamresourceful.resourcefulbees.block.CustomHoneyBlock)

Example 2 with HoneycombData

use of com.teamresourceful.resourcefulbees.api.beedata.HoneycombData 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)

Example 3 with HoneycombData

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

the class RegistryHandler method registerDynamicBees.

public static void registerDynamicBees() {
    BeeRegistry.getRegistry().getBees().forEach((name, beeData) -> {
        HoneycombData honeyData = beeData.getHoneycombData();
        if (honeyData.getHoneycombType().equals(HoneycombType.DEFAULT)) {
            registerHoneycomb(name, honeyData);
        }
        registerBee(name, beeData.getRenderData().getSizeModifier());
    });
}
Also used : HoneycombData(com.teamresourceful.resourcefulbees.api.beedata.HoneycombData)

Example 4 with HoneycombData

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

the class ColorHandler method onBlockColors.

public static void onBlockColors(ColorHandlerEvent.Block event) {
    BlockColors colors = event.getBlockColors();
    BEE_REGISTRY.getBees().forEach(((s, beeData) -> {
        HoneycombData honeycombData = beeData.getHoneycombData();
        if (honeycombData.getHoneycombType().equals(HoneycombType.DEFAULT) && (!honeycombData.getColor().isDefault())) {
            registerBlocks(colors, HoneycombBlock::getBlockColor, BeeInfoUtils.getBlock(ResourcefulBees.MOD_ID + ":" + s + "_honeycomb_block"));
        }
    }));
    HoneyRegistry.getRegistry().getHoneyBottles().forEach((h, honeyData) -> {
        if (Config.HONEY_GENERATE_BLOCKS.get() && honeyData.doGenerateHoneyBlock()) {
            registerBlocks(colors, CustomHoneyBlock::getBlockColor, honeyData.getHoneyBlockRegistryObject().get());
        }
    });
}
Also used : BlockColor(net.minecraft.client.color.block.BlockColor) CustomHoneyBlock(com.teamresourceful.resourcefulbees.block.CustomHoneyBlock) Config(com.teamresourceful.resourcefulbees.config.Config) HoneycombType(com.teamresourceful.resourcefulbees.lib.enums.HoneycombType) BeeInfoUtils(com.teamresourceful.resourcefulbees.utils.BeeInfoUtils) ModItems(com.teamresourceful.resourcefulbees.registry.ModItems) HoneyRegistry(com.teamresourceful.resourcefulbees.registry.HoneyRegistry) HoneycombBlock(com.teamresourceful.resourcefulbees.block.HoneycombBlock) LOGGER(com.teamresourceful.resourcefulbees.ResourcefulBees.LOGGER) com.teamresourceful.resourcefulbees.item(com.teamresourceful.resourcefulbees.item) ItemColors(net.minecraft.client.color.item.ItemColors) BeeRegistry(com.teamresourceful.resourcefulbees.registry.BeeRegistry) ItemLike(net.minecraft.world.level.ItemLike) HoneycombData(com.teamresourceful.resourcefulbees.api.beedata.HoneycombData) BlockColors(net.minecraft.client.color.block.BlockColors) ResourcefulBees(com.teamresourceful.resourcefulbees.ResourcefulBees) Block(net.minecraft.world.level.block.Block) IBeeRegistry(com.teamresourceful.resourcefulbees.api.IBeeRegistry) ColorHandlerEvent(net.minecraftforge.client.event.ColorHandlerEvent) ItemColor(net.minecraft.client.color.item.ItemColor) HoneycombData(com.teamresourceful.resourcefulbees.api.beedata.HoneycombData) CustomHoneyBlock(com.teamresourceful.resourcefulbees.block.CustomHoneyBlock) BlockColors(net.minecraft.client.color.block.BlockColors)

Aggregations

HoneycombData (com.teamresourceful.resourcefulbees.api.beedata.HoneycombData)4 ResourcefulBees (com.teamresourceful.resourcefulbees.ResourcefulBees)3 LOGGER (com.teamresourceful.resourcefulbees.ResourcefulBees.LOGGER)3 IBeeRegistry (com.teamresourceful.resourcefulbees.api.IBeeRegistry)3 Config (com.teamresourceful.resourcefulbees.config.Config)3 HoneycombType (com.teamresourceful.resourcefulbees.lib.enums.HoneycombType)3 BeeRegistry (com.teamresourceful.resourcefulbees.registry.BeeRegistry)3 HoneyRegistry (com.teamresourceful.resourcefulbees.registry.HoneyRegistry)3 CustomHoneyBlock (com.teamresourceful.resourcefulbees.block.CustomHoneyBlock)2 HoneycombBlock (com.teamresourceful.resourcefulbees.block.HoneycombBlock)2 com.teamresourceful.resourcefulbees.item (com.teamresourceful.resourcefulbees.item)2 ModItems (com.teamresourceful.resourcefulbees.registry.ModItems)2 BeeInfoUtils (com.teamresourceful.resourcefulbees.utils.BeeInfoUtils)2 BlockColor (net.minecraft.client.color.block.BlockColor)2 BlockColors (net.minecraft.client.color.block.BlockColors)2 ItemColor (net.minecraft.client.color.item.ItemColor)2 ItemColors (net.minecraft.client.color.item.ItemColors)2 ItemLike (net.minecraft.world.level.ItemLike)2 Block (net.minecraft.world.level.block.Block)2 ColorHandlerEvent (net.minecraftforge.client.event.ColorHandlerEvent)2