mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Refactor Bee mutations, genomes, and species.
This commit is contained in:
1 parent
a875a54b93
commit
f51d691002
25 files changed
+1375
-1150
No files matched your search
@@ -12,6 +12,7 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@@ -19,18 +20,17 @@ import net.minecraft.world.World;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class HiveDrop implements IHiveDrop {
|
||||
|
||||
private final IAllele[] template;
|
||||
private final IBeeDefinition beeTemplate;
|
||||
private final ArrayList<ItemStack> additional = new ArrayList<ItemStack>();
|
||||
private final int chance;
|
||||
private float ignobleShare = 0.0f;
|
||||
|
||||
public HiveDrop(int chance, IAllele[] template, ItemStack... bonus) {
|
||||
this.template = template;
|
||||
public HiveDrop(int chance, IBeeDefinition beeTemplate, ItemStack... bonus) {
|
||||
this.beeTemplate = beeTemplate;
|
||||
this.chance = chance;
|
||||
|
||||
Collections.addAll(this.additional, bonus);
|
||||
@@ -41,13 +41,9 @@ public class HiveDrop implements IHiveDrop {
|
||||
return this;
|
||||
}
|
||||
|
||||
private IBee createBee(World world) {
|
||||
return PluginApiculture.beeInterface.getBee(world, PluginApiculture.beeInterface.templateAsGenome(template));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPrincess(World world, int x, int y, int z, int fortune) {
|
||||
IBee bee = createBee(world);
|
||||
IBee bee = beeTemplate.getIndividual();
|
||||
if (world.rand.nextFloat() < ignobleShare) {
|
||||
bee.setIsNatural(false);
|
||||
}
|
||||
@@ -56,10 +52,9 @@ public class HiveDrop implements IHiveDrop {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrones(World world, int x, int y, int z, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ret.add(PluginApiculture.beeInterface.getMemberStack(createBee(world), EnumBeeType.DRONE.ordinal()));
|
||||
return ret;
|
||||
public List<ItemStack> getDrones(World world, int x, int y, int z, int fortune) {
|
||||
ItemStack drone = beeTemplate.getMemberStack(EnumBeeType.DRONE);
|
||||
return Collections.singletonList(drone);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user