mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-22 13:09:50 +00:00
Breaking effect alleles and flower providers into their own namespace.
Cleaned up effect & flower provider alleles. Added basic genome template for Botanical, Blossoming, Floral bees. Added FlowerProviderBotania to grow Mystical Flowers.
This commit is contained in:
1 parent
eeb6cb356d
commit
7afda32063
23 files changed
+604
-690
No files matched your search
@@ -0,0 +1,85 @@
|
||||
package magicbees.bees.allele.flowerProvider;
|
||||
|
||||
import magicbees.main.utils.LocalizationManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
|
||||
public class FlowerProviderAuraNode implements IFlowerProvider {
|
||||
protected int nodeRange = 70;
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedFlower(World world, IIndividual genome, int x, int y, int z) {
|
||||
return this.isNodeWithinRange(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
return pollinatable.getPlantType().size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return LocalizationManager.getLocalizedString("flowerProvider.node");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getItemStacks() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean isNodeWithinRange(World w, int x, int y, int z) {
|
||||
boolean nodeNearby = false;
|
||||
/*
|
||||
* if (ThaumcraftApi.getClosestAuraWithinRange(w, x, y, z,
|
||||
* this.nodeRange) >= 0) { nodeNearby = true; }
|
||||
*/
|
||||
return nodeNearby;
|
||||
}
|
||||
|
||||
/*
|
||||
* protected AuraNode getNodeWithinRange(World w, int x, int y, int z) {
|
||||
* AuraNode node = null;
|
||||
*
|
||||
* int nodeId = ThaumcraftApi.getClosestAuraWithinRange(w, x, y, z,
|
||||
* this.nodeRange); if (nodeId >= 0) { node =
|
||||
* ThaumcraftApi.getNodeCopy(nodeId); }
|
||||
*
|
||||
* return node; }
|
||||
*/
|
||||
|
||||
protected ItemStack[] addItemToProducts(ItemStack[] products, ItemStack itemStack) {
|
||||
for (ItemStack stack : products) {
|
||||
if (stack.getItem() == itemStack.getItem() && stack.getItemDamage() == itemStack.getItemDamage()) {
|
||||
if (stack.stackSize < stack.getItem().getItemStackLimit(stack)) {
|
||||
stack.stackSize += itemStack.stackSize;
|
||||
itemStack.stackSize = Math.max(stack.stackSize - stack.getItem().getItemStackLimit(stack), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (itemStack.stackSize > 0) {
|
||||
ItemStack[] newProducts = new ItemStack[products.length + 1];
|
||||
for (int i = 0; i < products.length; ++i) {
|
||||
newProducts[i] = products[i];
|
||||
}
|
||||
newProducts[products.length] = itemStack;
|
||||
products = newProducts;
|
||||
}
|
||||
|
||||
return products;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user