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);
}
}
}
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));
}
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;
}
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()));
}
}
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;
}
Aggregations