Search in sources :

Example 1 with CustomBeeData

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

the class BeeNestFeature method setNestBees.

private void setNestBees(BlockPos nestPos, @Nullable ResourceKey<Biome> biomeKey, WorldGenLevel worldIn, Random rand) {
    BlockEntity tileEntity = worldIn.getBlockEntity(nestPos);
    if (tileEntity instanceof TieredBeehiveTileEntity) {
        TieredBeehiveTileEntity nestTE = (TieredBeehiveTileEntity) tileEntity;
        int maxBees = Math.round(Config.HIVE_MAX_BEES.get() * 0.5f);
        for (int i = rand.nextInt(maxBees); i < maxBees; i++) {
            if (biomeKey != null && BeeRegistry.isSpawnableBiome(biomeKey.location())) {
                CustomBeeData beeData = BeeRegistry.getSpawnableBiome(biomeKey.location()).next();
                EntityType<?> entityType = beeData.getEntityType();
                addBeeToNest(entityType, worldIn, nestPos, beeData, rand, nestTE);
            } else
                logMissingBiome(biomeKey);
        }
    }
}
Also used : CustomBeeData(com.teamresourceful.resourcefulbees.api.beedata.CustomBeeData) BeehiveBlockEntity(net.minecraft.world.level.block.entity.BeehiveBlockEntity) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) TieredBeehiveTileEntity(com.teamresourceful.resourcefulbees.tileentity.TieredBeehiveTileEntity)

Example 2 with CustomBeeData

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

the class ResourcefulBee method registerGoals.

@Override
protected void registerGoals() {
    // this method is called before constructor finishes making passed data impossible to access.
    String namespaceID = this.getEncodeId();
    assert namespaceID != null;
    String beeType = namespaceID.substring(namespaceID.lastIndexOf(":") + 1, namespaceID.length() - 4);
    CustomBeeData customBeeData = BeeRegistry.getRegistry().getBeeData(beeType);
    boolean isPassive = customBeeData.getCombatData().isPassive();
    boolean isBreedable = customBeeData.getBreedData().hasParents();
    boolean hasMutation = customBeeData.getMutationData().hasMutation();
    if (!isPassive) {
        this.goalSelector.addGoal(0, new Bee.BeeAttackGoal(this, 1.4, true));
        this.targetSelector.addGoal(1, (new BeeAngerGoal(this)).setAlertOthers());
        this.targetSelector.addGoal(2, new Bee.BeeBecomeAngryTargetGoal(this));
    }
    this.goalSelector.addGoal(1, new EnterBeehiveGoal2());
    if (isBreedable) {
        this.goalSelector.addGoal(2, new BeeBreedGoal(this, 1.0D, beeType));
        this.goalSelector.addGoal(3, new BeeTemptGoal(this, 1.25D));
        this.goalSelector.addGoal(5, new FollowParentGoal(this, 1.25D));
    }
    this.pollinateGoal = new PollinateGoal(this);
    this.goalSelector.addGoal(4, this.pollinateGoal);
    this.beePollinateGoal = new FakePollinateGoal();
    this.goalSelector.addGoal(5, new ResourcefulBee.UpdateBeehiveGoal2());
    this.goToHiveGoal = new ResourcefulBee.FindBeehiveGoal2();
    this.goalSelector.addGoal(5, this.goToHiveGoal);
    this.goToKnownFlowerGoal = new Bee.BeeGoToKnownFlowerGoal();
    this.goalSelector.addGoal(6, this.goToKnownFlowerGoal);
    if (hasMutation) {
        this.goalSelector.addGoal(7, new ResourcefulBee.FindPollinationTargetGoal2());
    }
    if (!Config.MANUAL_MODE.get())
        this.goalSelector.addGoal(8, new BeeWanderGoal());
    this.goalSelector.addGoal(9, new FloatGoal(this));
}
Also used : Bee(net.minecraft.world.entity.animal.Bee) PollinateGoal(com.teamresourceful.resourcefulbees.entity.goals.PollinateGoal) BeeTemptGoal(com.teamresourceful.resourcefulbees.entity.goals.BeeTemptGoal) FollowParentGoal(net.minecraft.world.entity.ai.goal.FollowParentGoal) CustomBeeData(com.teamresourceful.resourcefulbees.api.beedata.CustomBeeData) BeeBreedGoal(com.teamresourceful.resourcefulbees.entity.goals.BeeBreedGoal) FloatGoal(net.minecraft.world.entity.ai.goal.FloatGoal) BeeAngerGoal(com.teamresourceful.resourcefulbees.entity.goals.BeeAngerGoal)

Example 3 with CustomBeeData

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

the class HiveCategory method getHoneycombRecipes.

public static List<Recipe> getHoneycombRecipes() {
    final int[] outputQuantities = { Config.T1_APIARY_QUANTITY.get(), Config.T2_APIARY_QUANTITY.get(), Config.T3_APIARY_QUANTITY.get(), Config.T4_APIARY_QUANTITY.get() };
    final Item[] apiaryTiers = { ModItems.T1_APIARY_ITEM.get(), ModItems.T2_APIARY_ITEM.get(), ModItems.T3_APIARY_ITEM.get(), ModItems.T4_APIARY_ITEM.get() };
    List<Recipe> recipes = new ArrayList<>();
    BeeRegistry.getRegistry().getBees().forEach(((s, customBeeData) -> {
        List<ApiaryOutputType> outputs = customBeeData.getHoneycombData().getApiaryOutputTypes();
        List<Integer> customAmounts = customBeeData.getHoneycombData().getApiaryOutputAmounts();
        if (customBeeData.getHoneycombData().getHoneycombType() != HoneycombType.NONE) {
            recipes.add(new Recipe(customBeeData.getHoneycombData().getHoneycomb().getDefaultInstance(), NESTS, customBeeData, false));
            for (int i = 0; i < 4; i++) {
                Item outputItem = outputs.get(i).equals(ApiaryOutputType.COMB) ? customBeeData.getHoneycombData().getHoneycomb() : customBeeData.getHoneycombData().getHoneycombBlock();
                int amount = customAmounts != null && customAmounts.get(i) > 0 ? customAmounts.get(i) : outputQuantities[i];
                ItemStack outputStack = new ItemStack(outputItem, amount);
                recipes.add(new Recipe(outputStack, apiaryTiers[i].getDefaultInstance(), customBeeData, true));
            }
        }
    }));
    return recipes;
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) Config(com.teamresourceful.resourcefulbees.config.Config) Arrays(java.util.Arrays) HoneycombType(com.teamresourceful.resourcefulbees.lib.enums.HoneycombType) IDrawable(mezz.jei.api.gui.drawable.IDrawable) IIngredients(mezz.jei.api.ingredients.IIngredients) Item(net.minecraft.world.item.Item) IGuiHelper(mezz.jei.api.helpers.IGuiHelper) PoseStack(com.mojang.blaze3d.vertex.PoseStack) EntityIngredient(com.teamresourceful.resourcefulbees.compat.jei.ingredients.EntityIngredient) ArrayList(java.util.ArrayList) ApiaryOutputType(com.teamresourceful.resourcefulbees.lib.enums.ApiaryOutputType) I18n(net.minecraft.client.resources.language.I18n) IRecipeLayout(mezz.jei.api.gui.IRecipeLayout) ModItems(com.teamresourceful.resourcefulbees.registry.ModItems) IGuiItemStackGroup(mezz.jei.api.gui.ingredient.IGuiItemStackGroup) List(java.util.List) BeeRegistry(com.teamresourceful.resourcefulbees.registry.BeeRegistry) CustomBeeData(com.teamresourceful.resourcefulbees.api.beedata.CustomBeeData) ResourcefulBees(com.teamresourceful.resourcefulbees.ResourcefulBees) IGuiIngredientGroup(mezz.jei.api.gui.ingredient.IGuiIngredientGroup) ItemStack(net.minecraft.world.item.ItemStack) VanillaTypes(mezz.jei.api.constants.VanillaTypes) NotNull(org.jetbrains.annotations.NotNull) Collections(java.util.Collections) Item(net.minecraft.world.item.Item) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ItemStack(net.minecraft.world.item.ItemStack)

Example 4 with CustomBeeData

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

the class JEICompat method registerInfoDesc.

// gravy, we could add Kube hooks for this, but the info card is a one-stop-shop for all bee data at a glance
// I'm not entirely sure what other data should be defined here using Kube that we don't already provide
// since we're already adding a "Lore" field and "Author" field
public void registerInfoDesc(IRecipeRegistration registration) {
    for (EntityIngredient bee : EntityIngredientFactory.create()) {
        CustomBeeData beeData = bee.getBeeData();
        StringBuilder stats = new StringBuilder();
        String aqua = ChatFormatting.DARK_AQUA.toString();
        String purple = ChatFormatting.DARK_PURPLE.toString();
        stats.append(aqua).append(" Base Health: ").append(purple).append(beeData.getCombatData().getBaseHealth()).append("\n");
        stats.append(aqua).append(" Attack Damage: ").append(purple).append(beeData.getCombatData().getAttackDamage()).append("\n");
        stats.append(aqua).append(" Honeycomb Type: ").append(purple).append(StringUtils.capitalize(beeData.getHoneycombData().getHoneycombType().toString())).append("\n");
        stats.append(aqua).append(" Max Time in Hive: ").append(purple).append(beeData.getCoreData().getMaxTimeInHive()).append(" ticks\n");
        stats.append(aqua).append(" Has Mutation: ").append(purple).append(StringUtils.capitalize(String.valueOf(beeData.getMutationData().hasMutation()))).append("\n");
        if (beeData.getMutationData().hasMutation()) {
            stats.append(aqua).append(" Mutation Count: ").append(purple).append(StringUtils.capitalize(String.valueOf(beeData.getMutationData().getMutationCount()))).append("\n");
        }
        stats.append(aqua).append(" Is Breedable: ").append(purple).append(StringUtils.capitalize(String.valueOf(beeData.getBreedData().hasParents()))).append("\n");
        if (beeData.getBreedData().hasParents()) {
            stats.append(aqua).append(" Parents: ").append(purple);
        // NEED TO SETUP WITH NEW BeeFamily OBJECT
        /*                Iterator<String> parent1 = beeData.getBreedData().getParent1().iterator();
                Iterator<String> parent2 = beeData.getBreedData().getParent2().iterator();

                while (parent1.hasNext() && parent2.hasNext()) {
                    stats.append(StringUtils.capitalize(parent1.next())).append(" Bee, ")
                            .append(StringUtils.capitalize(parent2.next())).append(" Bee\n");
                }*/
        }
        if (beeData.getTraitData().hasTraits()) {
            StringJoiner traits = new StringJoiner(", ");
            // noinspection deprecation
            beeData.getTraitData().getTraits().forEach(trait -> traits.add(WordUtils.capitalize(trait.replace("_", " "))));
            stats.append(aqua).append(" Traits: ").append(purple).append(traits).append("\n");
        }
        stats.append(aqua).append(" Spawns in World: ").append(purple).append(StringUtils.capitalize(String.valueOf(beeData.getSpawnData().canSpawnInWorld()))).append("\n");
        if (beeData.getSpawnData().canSpawnInWorld()) {
            stats.append(aqua).append(" Light Level: ").append(purple).append(beeData.getSpawnData().getLightLevel()).append("\n");
            stats.append(aqua).append(" Min Y Level: ").append(purple).append(beeData.getSpawnData().getMinYLevel()).append("\n");
            stats.append(aqua).append(" Max Y Level: ").append(purple).append(beeData.getSpawnData().getMaxYLevel()).append("\n");
            stats.append(aqua).append(" Min Group Size: ").append(purple).append(beeData.getSpawnData().getMinGroupSize()).append("\n");
            stats.append(aqua).append(" Max Group Size: ").append(purple).append(beeData.getSpawnData().getMaxGroupSize()).append("\n");
            stats.append(aqua).append(" Biomes: ").append(purple).append(beeData.getSpawnData().getSpawnableBiomesAsString());
        }
        registration.addIngredientInfo(bee, ENTITY_INGREDIENT, new TextComponent(stats.toString()));
    }
}
Also used : TextComponent(net.minecraft.network.chat.TextComponent) CustomBeeData(com.teamresourceful.resourcefulbees.api.beedata.CustomBeeData) EntityIngredient(com.teamresourceful.resourcefulbees.compat.jei.ingredients.EntityIngredient)

Example 5 with CustomBeeData

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

the class BeepediaUtils method getItemMutationsContaining.

public static List<ItemMutation> getItemMutationsContaining(CustomBeeData beeData) {
    List<ItemMutation> mutations = new LinkedList<>();
    BeeRegistry.getRegistry().getBees().forEach((// THIS MAY BE BROKE AND NEED FIXING!
    s, // THIS MAY BE BROKE AND NEED FIXING!
    beeData1) -> beeData1.getMutationData().getItemMutations().forEach((block, randomCollection) -> randomCollection.forEach(itemOutput -> {
        if (itemOutput.getItem() == BeeSpawnEggItem.byId(beeData.getEntityType())) {
            mutations.add(new ItemMutation(BeeInfoUtils.getEntityType(beeData1.getRegistryID()), block, randomCollection, beeData1.getMutationData().getMutationCount()));
        }
    })));
    return mutations;
}
Also used : LightLevel(com.teamresourceful.resourcefulbees.lib.enums.LightLevel) Beepedia(com.teamresourceful.resourcefulbees.item.Beepedia) Tag(net.minecraft.nbt.Tag) Component(net.minecraft.network.chat.Component) CustomBeeEntity(com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity) EntityMutation(com.teamresourceful.resourcefulbees.api.beedata.mutation.EntityMutation) ItemMutation(com.teamresourceful.resourcefulbees.api.beedata.mutation.ItemMutation) Collectors(java.util.stream.Collectors) BeeFamily(com.teamresourceful.resourcefulbees.api.beedata.breeding.BeeFamily) List(java.util.List) CompoundTag(net.minecraft.nbt.CompoundTag) Entity(net.minecraft.world.entity.Entity) Pair(org.apache.commons.lang3.tuple.Pair) NBTConstants(com.teamresourceful.resourcefulbees.lib.constants.NBTConstants) BeeRegistry(com.teamresourceful.resourcefulbees.registry.BeeRegistry) Minecraft(net.minecraft.client.Minecraft) BeepediaScreen(com.teamresourceful.resourcefulbees.client.gui.screen.beepedia.BeepediaScreen) BeeSpawnEggItem(com.teamresourceful.resourcefulbees.item.BeeSpawnEggItem) CustomBeeData(com.teamresourceful.resourcefulbees.api.beedata.CustomBeeData) ItemStack(net.minecraft.world.item.ItemStack) LinkedList(java.util.LinkedList) TranslatableComponent(net.minecraft.network.chat.TranslatableComponent) ModConstants(com.teamresourceful.resourcefulbees.lib.constants.ModConstants) ItemMutation(com.teamresourceful.resourcefulbees.api.beedata.mutation.ItemMutation) LinkedList(java.util.LinkedList)

Aggregations

CustomBeeData (com.teamresourceful.resourcefulbees.api.beedata.CustomBeeData)6 EntityIngredient (com.teamresourceful.resourcefulbees.compat.jei.ingredients.EntityIngredient)2 BeeRegistry (com.teamresourceful.resourcefulbees.registry.BeeRegistry)2 TieredBeehiveTileEntity (com.teamresourceful.resourcefulbees.tileentity.TieredBeehiveTileEntity)2 List (java.util.List)2 CompoundTag (net.minecraft.nbt.CompoundTag)2 Entity (net.minecraft.world.entity.Entity)2 ItemStack (net.minecraft.world.item.ItemStack)2 PoseStack (com.mojang.blaze3d.vertex.PoseStack)1 ResourcefulBees (com.teamresourceful.resourcefulbees.ResourcefulBees)1 BeeFamily (com.teamresourceful.resourcefulbees.api.beedata.breeding.BeeFamily)1 EntityMutation (com.teamresourceful.resourcefulbees.api.beedata.mutation.EntityMutation)1 ItemMutation (com.teamresourceful.resourcefulbees.api.beedata.mutation.ItemMutation)1 BeepediaScreen (com.teamresourceful.resourcefulbees.client.gui.screen.beepedia.BeepediaScreen)1 Config (com.teamresourceful.resourcefulbees.config.Config)1 BeeAngerGoal (com.teamresourceful.resourcefulbees.entity.goals.BeeAngerGoal)1 BeeBreedGoal (com.teamresourceful.resourcefulbees.entity.goals.BeeBreedGoal)1 BeeTemptGoal (com.teamresourceful.resourcefulbees.entity.goals.BeeTemptGoal)1 PollinateGoal (com.teamresourceful.resourcefulbees.entity.goals.PollinateGoal)1 CustomBeeEntity (com.teamresourceful.resourcefulbees.entity.passive.CustomBeeEntity)1