This commit is contained in:
kuba6000 committed 2022-10-12 21:09:45 +02:00
1 parent d993c90c3e
commit 14a712260b
156 files changed
+14896 -13422

No files matched your search

+272 -251
View File
@@ -1,5 +1,15 @@
package magicbees.bees;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IAlleleRegistry;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IFlowerProvider;
import magicbees.api.MagicBeesAPI;
import magicbees.bees.allele.effect.AlleleEffectCrumbling;
import magicbees.bees.allele.effect.AlleleEffectCure;
@@ -30,287 +40,298 @@ import magicbees.main.utils.compat.ThermalModsHelper;
import net.minecraft.potion.Potion;
import thaumcraft.api.nodes.NodeType;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IAlleleRegistry;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IFlowerProvider;
public class Allele implements IAllele {
private static final String FLOWER_ARS_MAGICA_PLANT = "flowerArsMagicaPlant";
private static final String FLOWER_BOTANIA = "flowerBotania";
private static final String EFFECT_TE_BLIZZY = "TEBlizzy";
private static final String EFFECT_TE_BLITZ = "TEBlitz";
private static final String EFFECT_TE_BASALZ = "TEBasalz";
private static final String EFFECT_AM_WISP = "AMWisp";
private static final String EFFECT_MANA_DRAIN = "ManaDrain";
private static final String EFFECT_DREAMING = "Dreaming";
private static final String EFFECT_WISPY = "Wispy";
private static final String EFFECT_BATTY = "Batty";
private static final String EFFECT_BRAINY = "Brainy";
private static final String EFFECT_NODE_RAVENING = "NodeRavening";
private static final String EFFECT_NODE_PURIFYING = "NodePurifying";
private static final String EFFECT_NODE_TAINTING = "NodeTainting";
private static final String EFFECT_NODE_REPAIR = "NodeRepair";
private static final String EFFECT_NODE_EMPOWER = "NodeEmpower";
private static final String EFFECT_VIS_RECHARGE = "VisRecharge";
private static final String FLOWERS_AURA_NODE = "AuraNode";
private static final String FLOWERS_THAUMCRAFT_PLANT = "ThaumcraftPlant";
public static AlleleFloat speedBlinding;
private static final String FLOWER_ARS_MAGICA_PLANT = "flowerArsMagicaPlant";
private static final String FLOWER_BOTANIA = "flowerBotania";
private static final String EFFECT_TE_BLIZZY = "TEBlizzy";
private static final String EFFECT_TE_BLITZ = "TEBlitz";
private static final String EFFECT_TE_BASALZ = "TEBasalz";
private static final String EFFECT_AM_WISP = "AMWisp";
private static final String EFFECT_MANA_DRAIN = "ManaDrain";
private static final String EFFECT_DREAMING = "Dreaming";
private static final String EFFECT_WISPY = "Wispy";
private static final String EFFECT_BATTY = "Batty";
private static final String EFFECT_BRAINY = "Brainy";
private static final String EFFECT_NODE_RAVENING = "NodeRavening";
private static final String EFFECT_NODE_PURIFYING = "NodePurifying";
private static final String EFFECT_NODE_TAINTING = "NodeTainting";
private static final String EFFECT_NODE_REPAIR = "NodeRepair";
private static final String EFFECT_NODE_EMPOWER = "NodeEmpower";
private static final String EFFECT_VIS_RECHARGE = "VisRecharge";
private static final String FLOWERS_AURA_NODE = "AuraNode";
private static final String FLOWERS_THAUMCRAFT_PLANT = "ThaumcraftPlant";
public static IAlleleBeeEffect forestryBaseEffect;
public static AlleleFloat speedBlinding;
public static IAlleleFlowers flowerBookshelf;
public static IAlleleFlowers flowerThaumcraft;
public static IAlleleFlowers flowerArsMagica;
public static IAlleleFlowers flowerAuraNode;
public static IAlleleFlowers flowerBotania;
public static IAlleleBeeEffect forestryBaseEffect;
public static IAlleleEffect effectCleansing;
public static IAlleleEffect effectDigSpeed;
public static IAlleleEffect effectMoveSpeed;
public static IAlleleEffect effectSlowSpeed;
public static IAlleleEffect effectWithering;
public static IAlleleEffect effectVisRecharge;
public static IAlleleEffect effectNodeEmpower;
public static IAlleleEffect effectNodeRepair;
public static IAlleleEffect effectNodeConversionTaint;
public static IAlleleEffect effectNodeConversionPure;
public static IAlleleEffect effectNodeConversionHungry;
public static IAlleleEffect effectTransmuting;
public static IAlleleEffect effectCrumbling;
public static IAlleleEffect effectInvisibility;
public static IAlleleEffect effectDreaming;
public static IAlleleFlowers flowerBookshelf;
public static IAlleleFlowers flowerThaumcraft;
public static IAlleleFlowers flowerArsMagica;
public static IAlleleFlowers flowerAuraNode;
public static IAlleleFlowers flowerBotania;
public static IAlleleEffect spawnWolf;
public static IAlleleEffect spawnBats;
public static IAlleleEffect spawnCow;
public static IAlleleEffect spawnChicken;
public static IAlleleEffect spawnPig;
public static IAlleleEffect spawnSheep;
public static IAlleleEffect spawnCat;
public static IAlleleEffect spawnHorse;
public static IAlleleEffect spawnGhast;
public static IAlleleEffect spawnSpider;
public static IAlleleEffect spawnBlaze;
public static IAlleleEffect spawnBrainyZombie;
public static IAlleleEffect spawnWisp;
public static IAlleleEffect spawnBlizz;
public static IAlleleEffect spawnBlitz;
public static IAlleleEffect spawnBasalz;
public static IAlleleEffect spawnManaDrainer;
public static IAlleleEffect spawnWispOrHecate;
public static IAlleleEffect effectCleansing;
public static IAlleleEffect effectDigSpeed;
public static IAlleleEffect effectMoveSpeed;
public static IAlleleEffect effectSlowSpeed;
public static IAlleleEffect effectWithering;
public static IAlleleEffect effectVisRecharge;
public static IAlleleEffect effectNodeEmpower;
public static IAlleleEffect effectNodeRepair;
public static IAlleleEffect effectNodeConversionTaint;
public static IAlleleEffect effectNodeConversionPure;
public static IAlleleEffect effectNodeConversionHungry;
public static IAlleleEffect effectTransmuting;
public static IAlleleEffect effectCrumbling;
public static IAlleleEffect effectInvisibility;
public static IAlleleEffect effectDreaming;
public static void setupAdditionalAlleles() {
forestryBaseEffect = (IAlleleBeeEffect) getBaseAllele("effectNone");
IFlowerProvider vanillaFlowers = ((IAlleleFlowers)getBaseAllele("flowersVanilla")).getProvider();
public static IAlleleEffect spawnWolf;
public static IAlleleEffect spawnBats;
public static IAlleleEffect spawnCow;
public static IAlleleEffect spawnChicken;
public static IAlleleEffect spawnPig;
public static IAlleleEffect spawnSheep;
public static IAlleleEffect spawnCat;
public static IAlleleEffect spawnHorse;
public static IAlleleEffect spawnGhast;
public static IAlleleEffect spawnSpider;
public static IAlleleEffect spawnBlaze;
public static IAlleleEffect spawnBrainyZombie;
public static IAlleleEffect spawnWisp;
public static IAlleleEffect spawnBlizz;
public static IAlleleEffect spawnBlitz;
public static IAlleleEffect spawnBasalz;
public static IAlleleEffect spawnManaDrainer;
public static IAlleleEffect spawnWispOrHecate;
speedBlinding = new AlleleFloat("speedBlinding", 2f, false, EnumBeeChromosome.SPEED);
flowerBookshelf = new AlleleFlower("Bookshelf", new FlowerProviderBookshelf(), true);
public static void setupAdditionalAlleles() {
forestryBaseEffect = (IAlleleBeeEffect) getBaseAllele("effectNone");
IFlowerProvider vanillaFlowers = ((IAlleleFlowers) getBaseAllele("flowersVanilla")).getProvider();
effectCleansing = new AlleleEffectCure("Curative", false);
effectDigSpeed = new AlleleEffectPotion("DigSpeed", Potion.digSpeed, 15, false);
effectMoveSpeed = new AlleleEffectPotion("MoveSpeed", Potion.moveSpeed, 10, false);
effectSlowSpeed = new AlleleEffectPotion("SlowSpeed", Potion.moveSlowdown, 3, false).setMalicious();
effectWithering = new AlleleEffectPotion("Withering", Potion.wither, 10, false).setMalicious();
speedBlinding = new AlleleFloat("speedBlinding", 2f, false, EnumBeeChromosome.SPEED);
flowerBookshelf = new AlleleFlower("Bookshelf", new FlowerProviderBookshelf(), true);
TransmutationEffectController controller = new TransmutationEffectController(
new TransmutationEffectRailcraft(),
new TransmutationEffectVanilla()
);
MagicBeesAPI.transmutationEffectController = controller;
effectTransmuting = new AlleleEffectTransmuting("Transmuting", true, controller, 200);
effectCrumbling = new AlleleEffectCrumbling("Crumbling", true);
effectCleansing = new AlleleEffectCure("Curative", false);
effectDigSpeed = new AlleleEffectPotion("DigSpeed", Potion.digSpeed, 15, false);
effectMoveSpeed = new AlleleEffectPotion("MoveSpeed", Potion.moveSpeed, 10, false);
effectSlowSpeed = new AlleleEffectPotion("SlowSpeed", Potion.moveSlowdown, 3, false).setMalicious();
effectWithering = new AlleleEffectPotion("Withering", Potion.wither, 10, false).setMalicious();
effectInvisibility = new AlleleEffectPotion("Invisibility", Potion.invisibility, 10, false);
TransmutationEffectController controller =
new TransmutationEffectController(new TransmutationEffectRailcraft(), new TransmutationEffectVanilla());
MagicBeesAPI.transmutationEffectController = controller;
effectTransmuting = new AlleleEffectTransmuting("Transmuting", true, controller, 200);
effectCrumbling = new AlleleEffectCrumbling("Crumbling", true);
spawnGhast = new AlleleEffectSpawnMob("Ghastly", false, "Ghast", "mob.ghast.moan")
.setThrottle(2060)
.setChanceToSpawn(10)
.setMaxMobsInSpawnZone(1);
spawnSpider = new AlleleEffectSpawnMob("Spidery", false, "Spider", "mob.spider.step")
.setThrottle(400)
.setChanceToSpawn(70)
.setMaxMobsInSpawnZone(4);
spawnBlaze = new AlleleEffectSpawnMob("Ablaze", false, "Blaze", "mob.blaze.breathe")
.setThrottle(800)
.setChanceToSpawn(60)
.setMaxMobsInSpawnZone(2);
spawnWolf = new AlleleEffectSpawnMob("Canine", false , "Wolf", "mob.wolf.panting")
.setThrottle(650)
.setChanceToSpawn(40)
.setMaxMobsInSpawnZone(2);
spawnPig = new AlleleEffectSpawnMob("Porcine", true, "Pig", "mob.pig.say")
.setThrottle(350)
.setMaxMobsInSpawnZone(4);
spawnCow = new AlleleEffectSpawnMob("Bovine", true, "Cow", "mob.cow.say")
.setThrottle(640)
.setMaxMobsInSpawnZone(3);
spawnChicken = new AlleleEffectSpawnMob("Chicken", true, "Chicken", "mob.chicken.hurt")
.setThrottle(20)
.setMaxMobsInSpawnZone(20);
spawnSheep = new AlleleEffectSpawnMob("Sheep", false, "Sheep", "mob.sheep.say")
.setThrottle(450)
.setMaxMobsInSpawnZone(5);
spawnCat = new AlleleEffectSpawnMob("Catty", false, "Ozelot", "mob.cat.meow")
.setThrottle(702)
.setChanceToSpawn(60)
.setMaxMobsInSpawnZone(2);
spawnHorse = new AlleleEffectSpawnMob("Horse", false, "EntityHorse", "mob.horse.idle")
.setThrottle(450)
.setChanceToSpawn(59)
.setMaxMobsInSpawnZone(2);
effectInvisibility = new AlleleEffectPotion("Invisibility", Potion.invisibility, 10, false);
if (ThaumcraftHelper.isActive()) {
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, new FlowerProviderThaumcraftFlower(), false);
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, new FlowerProviderAuraNode(), true);
effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
effectNodeEmpower = new AlleleEffectEmpowering(EFFECT_NODE_EMPOWER, false);
effectNodeRepair = new AlleleEffectNodeRepair(EFFECT_NODE_REPAIR, false);
effectNodeConversionTaint = new AlleleEffectNodeConversion(EFFECT_NODE_TAINTING, NodeType.TAINTED, false, 250);
effectNodeConversionPure = new AlleleEffectNodeConversion(EFFECT_NODE_PURIFYING, NodeType.PURE, false, 250);
effectNodeConversionHungry = new AlleleEffectNodeConversion(EFFECT_NODE_RAVENING, NodeType.HUNGRY, false, 2);
spawnGhast = new AlleleEffectSpawnMob("Ghastly", false, "Ghast", "mob.ghast.moan")
.setThrottle(2060)
.setChanceToSpawn(10)
.setMaxMobsInSpawnZone(1);
spawnSpider = new AlleleEffectSpawnMob("Spidery", false, "Spider", "mob.spider.step")
.setThrottle(400)
.setChanceToSpawn(70)
.setMaxMobsInSpawnZone(4);
spawnBlaze = new AlleleEffectSpawnMob("Ablaze", false, "Blaze", "mob.blaze.breathe")
.setThrottle(800)
.setChanceToSpawn(60)
.setMaxMobsInSpawnZone(2);
spawnWolf = new AlleleEffectSpawnMob("Canine", false, "Wolf", "mob.wolf.panting")
.setThrottle(650)
.setChanceToSpawn(40)
.setMaxMobsInSpawnZone(2);
spawnPig = new AlleleEffectSpawnMob("Porcine", true, "Pig", "mob.pig.say")
.setThrottle(350)
.setMaxMobsInSpawnZone(4);
spawnCow = new AlleleEffectSpawnMob("Bovine", true, "Cow", "mob.cow.say")
.setThrottle(640)
.setMaxMobsInSpawnZone(3);
spawnChicken = new AlleleEffectSpawnMob("Chicken", true, "Chicken", "mob.chicken.hurt")
.setThrottle(20)
.setMaxMobsInSpawnZone(20);
spawnSheep = new AlleleEffectSpawnMob("Sheep", false, "Sheep", "mob.sheep.say")
.setThrottle(450)
.setMaxMobsInSpawnZone(5);
spawnCat = new AlleleEffectSpawnMob("Catty", false, "Ozelot", "mob.cat.meow")
.setThrottle(702)
.setChanceToSpawn(60)
.setMaxMobsInSpawnZone(2);
spawnHorse = new AlleleEffectSpawnMob("Horse", false, "EntityHorse", "mob.horse.idle")
.setThrottle(450)
.setChanceToSpawn(59)
.setMaxMobsInSpawnZone(2);
spawnBrainyZombie = new AlleleEffectSpawnMob(EFFECT_BRAINY, false, ThaumcraftHelper.Entity.BRAINY_ZOMBIE.entityID)
.setAggrosPlayerOnSpawn()
.setThrottle(800)
.setSpawnsOnPlayerNear(null)
.setMaxMobsInSpawnZone(2);
if (ThaumcraftHelper.isActive()) {
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, new FlowerProviderThaumcraftFlower(), false);
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, new FlowerProviderAuraNode(), true);
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, ThaumcraftHelper.Entity.FIREBAT.entityID)
.setThrottle(300)
.setSpawnsOnPlayerNear("Bat");
effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
effectNodeEmpower = new AlleleEffectEmpowering(EFFECT_NODE_EMPOWER, false);
effectNodeRepair = new AlleleEffectNodeRepair(EFFECT_NODE_REPAIR, false);
effectNodeConversionTaint =
new AlleleEffectNodeConversion(EFFECT_NODE_TAINTING, NodeType.TAINTED, false, 250);
effectNodeConversionPure = new AlleleEffectNodeConversion(EFFECT_NODE_PURIFYING, NodeType.PURE, false, 250);
effectNodeConversionHungry =
new AlleleEffectNodeConversion(EFFECT_NODE_RAVENING, NodeType.HUNGRY, false, 2);
spawnWisp = new AlleleEffectSpawnWisp(EFFECT_WISPY, false, ThaumcraftHelper.Entity.WISP.entityID, "thaumcraft.wisplive")
.setThrottle(1800)
.setChanceToSpawn(79);
}
else {
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, "Bat")
.setThrottle(150);
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, vanillaFlowers, false);
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, vanillaFlowers, true);Allele.effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
effectNodeEmpower = new AlleleEffectPlaceholder(EFFECT_NODE_EMPOWER, false);
effectNodeRepair = new AlleleEffectPlaceholder(EFFECT_NODE_REPAIR, false);
effectNodeConversionTaint = new AlleleEffectPlaceholder(EFFECT_NODE_TAINTING, false);
effectNodeConversionPure = new AlleleEffectPlaceholder(EFFECT_NODE_PURIFYING, false);
effectNodeConversionHungry = new AlleleEffectPlaceholder(EFFECT_NODE_RAVENING, false);
spawnBrainyZombie = new AlleleEffectPlaceholder(EFFECT_BRAINY, false);
spawnWisp = new AlleleEffectPlaceholder(EFFECT_WISPY, false);
}
spawnBrainyZombie = new AlleleEffectSpawnMob(
EFFECT_BRAINY, false, ThaumcraftHelper.Entity.BRAINY_ZOMBIE.entityID)
.setAggrosPlayerOnSpawn()
.setThrottle(800)
.setSpawnsOnPlayerNear(null)
.setMaxMobsInSpawnZone(2);
if (BotaniaHelper.isActive()) {
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, new FlowerProviderBotania(), true);
effectDreaming = new AlleleEffectTransmuting(EFFECT_DREAMING, false,
new TransmutationEffectController(new TransmutationEffectLBotaniaLiving()), 100);
}
else {
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, vanillaFlowers, true);
effectDreaming = new AlleleEffectPlaceholder(EFFECT_DREAMING, false);
}
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, ThaumcraftHelper.Entity.FIREBAT.entityID)
.setThrottle(300)
.setSpawnsOnPlayerNear("Bat");
if (ArsMagicaHelper.isActive()) {
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, new FlowerProviderArsMagicaFlower(), false);
spawnManaDrainer = new AlleleEffectSpawnMobWeighted(EFFECT_MANA_DRAIN, true, 20,
new String[] { ArsMagicaHelper.Name + ".MobManaCreeper", ArsMagicaHelper.Name + ".ManaVortex" },
new int[] { 60, 2 }
);
spawnWisp = new AlleleEffectSpawnWisp(
EFFECT_WISPY, false, ThaumcraftHelper.Entity.WISP.entityID, "thaumcraft.wisplive")
.setThrottle(1800)
.setChanceToSpawn(79);
} else {
spawnBats = new AlleleEffectSpawnMob(EFFECT_BATTY, false, "Bat").setThrottle(150);
spawnWispOrHecate = new AlleleEffectSpawnMobWeighted(EFFECT_AM_WISP, true, 20,
new String[] { ArsMagicaHelper.Name + ".MobWisp", ArsMagicaHelper.Name + ".MobHecate" },
new int[] { 40, 3 }
);
}
else {
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, vanillaFlowers, false);
spawnManaDrainer = new AlleleEffectPlaceholder(EFFECT_MANA_DRAIN, true);
spawnWispOrHecate = new AlleleEffectPlaceholder(EFFECT_AM_WISP, true);
}
flowerThaumcraft = new AlleleFlower(FLOWERS_THAUMCRAFT_PLANT, vanillaFlowers, false);
flowerAuraNode = new AlleleFlower(FLOWERS_AURA_NODE, vanillaFlowers, true);
Allele.effectVisRecharge = new AlleleEffectRecharge(EFFECT_VIS_RECHARGE, false);
effectNodeEmpower = new AlleleEffectPlaceholder(EFFECT_NODE_EMPOWER, false);
effectNodeRepair = new AlleleEffectPlaceholder(EFFECT_NODE_REPAIR, false);
effectNodeConversionTaint = new AlleleEffectPlaceholder(EFFECT_NODE_TAINTING, false);
effectNodeConversionPure = new AlleleEffectPlaceholder(EFFECT_NODE_PURIFYING, false);
effectNodeConversionHungry = new AlleleEffectPlaceholder(EFFECT_NODE_RAVENING, false);
spawnBrainyZombie = new AlleleEffectPlaceholder(EFFECT_BRAINY, false);
spawnWisp = new AlleleEffectPlaceholder(EFFECT_WISPY, false);
}
//TODO TE spawning
if (ThermalModsHelper.isActive()) {
spawnBlizz = new AlleleEffectSpawnMob(EFFECT_TE_BLIZZY, true, ThermalModsHelper.Entity.BLIZZ.entityID, ThermalModsHelper.Entity.BLIZZ.soundName)
.setThrottle(100)
.setChanceToSpawn(80);
spawnBlitz = new AlleleEffectSpawnMob(EFFECT_TE_BLITZ, true, ThermalModsHelper.Entity.BLITZ.entityID, ThermalModsHelper.Entity.BLITZ.soundName)
.setThrottle(100)
.setChanceToSpawn(80);
spawnBasalz = new AlleleEffectSpawnMob(EFFECT_TE_BASALZ, true, ThermalModsHelper.Entity.BASALZ.entityID, ThermalModsHelper.Entity.BASALZ.soundName)
.setThrottle(100)
.setChanceToSpawn(80);
}
else {
spawnBlizz = new AlleleEffectPlaceholder(EFFECT_TE_BLIZZY, true);
spawnBlitz = new AlleleEffectPlaceholder(EFFECT_TE_BLITZ, true);
spawnBasalz = new AlleleEffectPlaceholder(EFFECT_TE_BASALZ, true);
}
}
if (BotaniaHelper.isActive()) {
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, new FlowerProviderBotania(), true);
effectDreaming = new AlleleEffectTransmuting(
EFFECT_DREAMING,
false,
new TransmutationEffectController(new TransmutationEffectLBotaniaLiving()),
100);
} else {
flowerBotania = new AlleleFlower(FLOWER_BOTANIA, vanillaFlowers, true);
effectDreaming = new AlleleEffectPlaceholder(EFFECT_DREAMING, false);
}
public static void registerDeprecatedAlleleReplacements() {
IAlleleRegistry registry = AlleleManager.alleleRegistry;
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeAttract", effectNodeEmpower);
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodePurify", effectNodeConversionPure);
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeFlux", effectNodeConversionTaint);
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeCharge", effectNodeEmpower);
registry.registerDeprecatedAlleleReplacement("magicbees.speciesTCAttractive", BeeSpecies.TC_EMPOWERING.getSpecies());
registry.registerDeprecatedAlleleReplacement("magicbees.speciesBMBloodyBMBloody", BeeSpecies.EARTHY.getSpecies());
registry.registerDeprecatedAlleleReplacement("magicbees.speciesBMBloodyBMBound", BeeSpecies.ARCANE.getSpecies());
}
if (ArsMagicaHelper.isActive()) {
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, new FlowerProviderArsMagicaFlower(), false);
spawnManaDrainer = new AlleleEffectSpawnMobWeighted(
EFFECT_MANA_DRAIN,
true,
20,
new String[] {ArsMagicaHelper.Name + ".MobManaCreeper", ArsMagicaHelper.Name + ".ManaVortex"},
new int[] {60, 2});
public static IAlleleBeeSpecies getBaseSpecies(String name) {
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("forestry.species").append(name).toString());
}
spawnWispOrHecate = new AlleleEffectSpawnMobWeighted(
EFFECT_AM_WISP,
true,
20,
new String[] {ArsMagicaHelper.Name + ".MobWisp", ArsMagicaHelper.Name + ".MobHecate"},
new int[] {40, 3});
} else {
flowerArsMagica = new AlleleFlower(FLOWER_ARS_MAGICA_PLANT, vanillaFlowers, false);
spawnManaDrainer = new AlleleEffectPlaceholder(EFFECT_MANA_DRAIN, true);
spawnWispOrHecate = new AlleleEffectPlaceholder(EFFECT_AM_WISP, true);
}
public static IAlleleBeeSpecies getExtraSpecies(String name) {
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder()).append("extrabees.species.").append(name.toLowerCase())
.toString());
}
// TODO TE spawning
if (ThermalModsHelper.isActive()) {
spawnBlizz = new AlleleEffectSpawnMob(
EFFECT_TE_BLIZZY,
true,
ThermalModsHelper.Entity.BLIZZ.entityID,
ThermalModsHelper.Entity.BLIZZ.soundName)
.setThrottle(100)
.setChanceToSpawn(80);
spawnBlitz = new AlleleEffectSpawnMob(
EFFECT_TE_BLITZ,
true,
ThermalModsHelper.Entity.BLITZ.entityID,
ThermalModsHelper.Entity.BLITZ.soundName)
.setThrottle(100)
.setChanceToSpawn(80);
spawnBasalz = new AlleleEffectSpawnMob(
EFFECT_TE_BASALZ,
true,
ThermalModsHelper.Entity.BASALZ.entityID,
ThermalModsHelper.Entity.BASALZ.soundName)
.setThrottle(100)
.setChanceToSpawn(80);
} else {
spawnBlizz = new AlleleEffectPlaceholder(EFFECT_TE_BLIZZY, true);
spawnBlitz = new AlleleEffectPlaceholder(EFFECT_TE_BLITZ, true);
spawnBasalz = new AlleleEffectPlaceholder(EFFECT_TE_BASALZ, true);
}
}
public static IAllele getBaseAllele(String name) {
return AlleleManager.alleleRegistry.getAllele("forestry." + name);
}
public static void registerDeprecatedAlleleReplacements() {
IAlleleRegistry registry = AlleleManager.alleleRegistry;
public static IAllele getAllele(String name) {
return AlleleManager.alleleRegistry.getAllele(name);
}
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeAttract", effectNodeEmpower);
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodePurify", effectNodeConversionPure);
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeFlux", effectNodeConversionTaint);
registry.registerDeprecatedAlleleReplacement("magicbees.effectNodeCharge", effectNodeEmpower);
registry.registerDeprecatedAlleleReplacement(
"magicbees.speciesTCAttractive", BeeSpecies.TC_EMPOWERING.getSpecies());
registry.registerDeprecatedAlleleReplacement(
"magicbees.speciesBMBloodyBMBloody", BeeSpecies.EARTHY.getSpecies());
registry.registerDeprecatedAlleleReplacement(
"magicbees.speciesBMBloodyBMBound", BeeSpecies.ARCANE.getSpecies());
}
private String uid;
private boolean dominant;
public static IAlleleBeeSpecies getBaseSpecies(String name) {
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele(
(new StringBuilder()).append("forestry.species").append(name).toString());
}
public Allele(String id, boolean isDominant, IChromosomeType... chromosomeTypes) {
this.uid = "magicbees." + id;
this.dominant = isDominant;
AlleleManager.alleleRegistry.registerAllele(this, chromosomeTypes);
}
public static IAlleleBeeSpecies getExtraSpecies(String name) {
return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele((new StringBuilder())
.append("extrabees.species.")
.append(name.toLowerCase())
.toString());
}
@Override
public String getUID() {
return this.uid;
}
public static IAllele getBaseAllele(String name) {
return AlleleManager.alleleRegistry.getAllele("forestry." + name);
}
@Override
public boolean isDominant() {
return this.dominant;
}
public static IAllele getAllele(String name) {
return AlleleManager.alleleRegistry.getAllele(name);
}
@Override
public String getName() {
return LocalizationManager.getLocalizedString(getUID());
}
private String uid;
private boolean dominant;
@Override
public String getUnlocalizedName() {
return this.uid;
}
public Allele(String id, boolean isDominant, IChromosomeType... chromosomeTypes) {
this.uid = "magicbees." + id;
this.dominant = isDominant;
AlleleManager.alleleRegistry.registerAllele(this, chromosomeTypes);
}
@Override
public String getUID() {
return this.uid;
}
@Override
public boolean isDominant() {
return this.dominant;
}
@Override
public String getName() {
return LocalizationManager.getLocalizedString(getUID());
}
@Override
public String getUnlocalizedName() {
return this.uid;
}
}
+67 -80
View File
@@ -1,95 +1,82 @@
package magicbees.bees;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
public abstract class AlleleEffect extends Allele implements IAlleleBeeEffect
{
protected int throttle;
protected boolean combinable;
public abstract class AlleleEffect extends Allele implements IAlleleBeeEffect {
protected int throttle;
protected boolean combinable;
public AlleleEffect(String id, boolean isDominant, int timeout)
{
super("effect" + id, isDominant, EnumBeeChromosome.EFFECT);
this.throttle = timeout;
combinable = false;
}
public AlleleEffect(String id, boolean isDominant, int timeout) {
super("effect" + id, isDominant, EnumBeeChromosome.EFFECT);
this.throttle = timeout;
combinable = false;
}
@Override
public boolean isCombinable()
{
return combinable;
}
public AlleleEffect setIsCombinable(boolean canCombine) {
combinable = canCombine;
return this;
}
@Override
public boolean isCombinable() {
return combinable;
}
@Override
public abstract IEffectData validateStorage(IEffectData storedData);
public AlleleEffect setIsCombinable(boolean canCombine) {
combinable = canCombine;
return this;
}
@Override
public final IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
{
int count = storedData.getInteger(0);
if (count >= this.throttle)
{
storedData = this.doEffectThrottled(genome, storedData, housing);
}
else
{
storedData.setInteger(0, count + 1);
}
return storedData;
}
/**
* @param genome
* @param storedData
* @param housing
* @return
*/
protected abstract IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
@Override
public abstract IEffectData validateStorage(IEffectData storedData);
@Override
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
{
return Allele.forestryBaseEffect.doFX(genome, storedData, housing);
}
@SuppressWarnings("unchecked")
protected <T extends Entity> List<T> getEntitiesWithinRange(IBeeGenome genome, IBeeHousing housing, Class<T> entityClass)
{
// Get the size of the affected area
int[] area = genome.getTerritory();
ChunkCoordinates coords = housing.getCoordinates();
// Calculate offset
int[] min = new int[3];
int[] max = new int[3];
min[0] = coords.posX - area[0] / 2;
max[0] = coords.posX + area[0] / 2;
min[1] = coords.posY - area[1] / 2;
max[1] = coords.posY + area[1] / 2;
min[2] = coords.posZ - area[2] / 2;
max[2] = coords.posZ + area[2] / 2;
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(min[0], min[1], min[2], max[0], max[1], max[2]);
return (List<T>)housing.getWorld().getEntitiesWithinAABB(entityClass, bounds);
}
@Override
public final IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
int count = storedData.getInteger(0);
if (count >= this.throttle) {
storedData = this.doEffectThrottled(genome, storedData, housing);
} else {
storedData.setInteger(0, count + 1);
}
return storedData;
}
/**
* @param genome
* @param storedData
* @param housing
* @return
*/
protected abstract IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
@Override
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
return Allele.forestryBaseEffect.doFX(genome, storedData, housing);
}
@SuppressWarnings("unchecked")
protected <T extends Entity> List<T> getEntitiesWithinRange(
IBeeGenome genome, IBeeHousing housing, Class<T> entityClass) {
// Get the size of the affected area
int[] area = genome.getTerritory();
ChunkCoordinates coords = housing.getCoordinates();
// Calculate offset
int[] min = new int[3];
int[] max = new int[3];
min[0] = coords.posX - area[0] / 2;
max[0] = coords.posX + area[0] / 2;
min[1] = coords.posY - area[1] / 2;
max[1] = coords.posY + area[1] / 2;
min[2] = coords.posZ - area[2] / 2;
max[2] = coords.posZ + area[2] / 2;
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(min[0], min[1], min[2], max[0], max[1], max[2]);
return (List<T>) housing.getWorld().getEntitiesWithinAABB(entityClass, bounds);
}
}
+10 -14
View File
@@ -3,20 +3,16 @@ package magicbees.bees;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IChromosomeType;
public class AlleleFloat extends Allele implements IAlleleFloat
{
private float value;
public AlleleFloat(String id, float val, boolean isDominant, IChromosomeType... chromosomeTypes)
{
super(id, isDominant, chromosomeTypes);
this.value = val;
}
public class AlleleFloat extends Allele implements IAlleleFloat {
private float value;
@Override
public float getValue()
{
return this.value;
}
public AlleleFloat(String id, float val, boolean isDominant, IChromosomeType... chromosomeTypes) {
super(id, isDominant, chromosomeTypes);
this.value = val;
}
@Override
public float getValue() {
return this.value;
}
}
+14 -19
View File
@@ -1,29 +1,24 @@
package magicbees.bees;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IFlowerProvider;
public class AlleleFlower extends Allele implements IAlleleFlowers
{
private IFlowerProvider provider;
public AlleleFlower(String uid, IFlowerProvider flowerProvider, boolean isDominant)
{
super("flower" + uid, isDominant, EnumBeeChromosome.FLOWER_PROVIDER);
this.provider = flowerProvider;
}
public class AlleleFlower extends Allele implements IAlleleFlowers {
private IFlowerProvider provider;
@Override
public IFlowerProvider getProvider()
{
return this.provider;
}
public AlleleFlower(String uid, IFlowerProvider flowerProvider, boolean isDominant) {
super("flower" + uid, isDominant, EnumBeeChromosome.FLOWER_PROVIDER);
this.provider = flowerProvider;
}
@Override
public String getName() {
return this.provider.getDescription();
}
@Override
public IFlowerProvider getProvider() {
return this.provider;
}
@Override
public String getName() {
return this.provider.getDescription();
}
}
+26 -25
View File
@@ -3,31 +3,32 @@ package magicbees.bees;
import magicbees.api.bees.AuraChargeType;
public enum AuraCharge {
MUTATION(AuraChargeType.MUTATION, 850, 11),
DEATH(AuraChargeType.DEATH, 400, 5),
PRODUCTION(AuraChargeType.PRODUCTION, 300, 3),
;
MUTATION(AuraChargeType.MUTATION, 850, 11),
DEATH(AuraChargeType.DEATH, 400, 5),
PRODUCTION(AuraChargeType.PRODUCTION, 300, 3),
;
public final AuraChargeType type;
public final int duration;
/** The number of ticks to count between draining vis from the environment **/
public final int tickRate;
public final int flag;
public final AuraChargeType type;
public final int duration;
/** The number of ticks to count between draining vis from the environment **/
public final int tickRate;
AuraCharge(AuraChargeType chargeType, int duration, int tickRate) {
this.type = chargeType;
this.duration = duration;
this.tickRate = tickRate;
flag = 1 << ordinal();
}
public static AuraCharge fromChargeType(AuraChargeType type) {
for (AuraCharge charge : values()) {
if (type == charge.type) {
return charge;
}
}
return null;
}
public final int flag;
AuraCharge(AuraChargeType chargeType, int duration, int tickRate) {
this.type = chargeType;
this.duration = duration;
this.tickRate = tickRate;
flag = 1 << ordinal();
}
public static AuraCharge fromChargeType(AuraChargeType type) {
for (AuraCharge charge : values()) {
if (type == charge.type) {
return charge;
}
}
return null;
}
}
@@ -1,128 +1,110 @@
package magicbees.bees;
import java.util.ArrayList;
import magicbees.main.utils.LocalizationManager;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IClassification;
import java.util.ArrayList;
import magicbees.main.utils.LocalizationManager;
public enum BeeClassification implements IClassification
{
VEILED("Veiled", "Velatapis"),
ARCANE("Arcane", "Arcanapis"),
SUPERNATURAL("Supernatural", "Occultapis"),
SCHOLARLY("Scholarly", "Doctapis"),
SKULKING("Skulking", "Malevolenapis"),
MAGICAL("Magic", "Magicapis"),
TIME("Time", "Tempestivapis"),
SOUL("Soul", "Animapis"),
ABOMINABLE("Abominable", "Detestabilapis"),
EXTRINSIC("Extrinsic", "Extrarapis"),
METALLIC("Metallic", "Metalliapis"),
GEM("Gem", "Lapidapis"),
TRANSMUTING("Transmuting", "Transmutapis"),
THAUMIC("Thaumic", "Thaumiapis"),
FLESHY("Fleshy", "Carnosapis"),
ALCHEMICAL("Alchemical", "Alchimiapis"),
ESSENTIAL("Essential", "Essentiapis"),
THERMAL("Thermal", "Thermametallic"),
ADORABLE("Adorable", "Amabilis"),
public enum BeeClassification implements IClassification {
VEILED("Veiled", "Velatapis"),
ARCANE("Arcane", "Arcanapis"),
SUPERNATURAL("Supernatural", "Occultapis"),
SCHOLARLY("Scholarly", "Doctapis"),
SKULKING("Skulking", "Malevolenapis"),
MAGICAL("Magic", "Magicapis"),
TIME("Time", "Tempestivapis"),
SOUL("Soul", "Animapis"),
BLOODY("Bloody", "Sanguis"),
BOTANICAL("Botanical", "Botanica"),
;
private String uID;
private String latin;
private ArrayList<IAlleleSpecies> species;
private IClassification parent;
private EnumClassLevel level;
private BeeClassification(String name, String scientific)
{
this.uID = "classification." + name.toLowerCase();
this.latin = scientific;
this.level = EnumClassLevel.GENUS;
this.species = new ArrayList<IAlleleSpecies>();
this.parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
AlleleManager.alleleRegistry.registerClassification(this);
}
@Override
public EnumClassLevel getLevel()
{
return this.level;
}
ABOMINABLE("Abominable", "Detestabilapis"),
EXTRINSIC("Extrinsic", "Extrarapis"),
@Override
public String getUID()
{
return this.uID;
}
METALLIC("Metallic", "Metalliapis"),
GEM("Gem", "Lapidapis"),
TRANSMUTING("Transmuting", "Transmutapis"),
@Override
public String getName()
{
return LocalizationManager.getLocalizedString(getUID());
}
THAUMIC("Thaumic", "Thaumiapis"),
FLESHY("Fleshy", "Carnosapis"),
@Override
public String getScientific()
{
return this.latin;
}
ALCHEMICAL("Alchemical", "Alchimiapis"),
@Override
public String getDescription()
{
return LocalizationManager.getLocalizedString(getUID() + ".description");
}
ESSENTIAL("Essential", "Essentiapis"),
@Override
public IClassification[] getMemberGroups()
{
return null;
}
THERMAL("Thermal", "Thermametallic"),
ADORABLE("Adorable", "Amabilis"),
@Override
public void addMemberGroup(IClassification group)
{
}
BLOODY("Bloody", "Sanguis"),
@Override
public IAlleleSpecies[] getMemberSpecies()
{
return this.species.toArray(new IAlleleSpecies[this.species.size()]);
}
BOTANICAL("Botanical", "Botanica"),
;
@Override
public void addMemberSpecies(IAlleleSpecies species)
{
if (!this.species.contains(species))
{
this.species.add(species);
}
}
private String uID;
private String latin;
private ArrayList<IAlleleSpecies> species;
private IClassification parent;
private EnumClassLevel level;
@Override
public IClassification getParent()
{
return this.parent;
}
private BeeClassification(String name, String scientific) {
this.uID = "classification." + name.toLowerCase();
this.latin = scientific;
this.level = EnumClassLevel.GENUS;
this.species = new ArrayList<IAlleleSpecies>();
this.parent = AlleleManager.alleleRegistry.getClassification("family.apidae");
AlleleManager.alleleRegistry.registerClassification(this);
}
@Override
public void setParent(IClassification parent)
{
this.parent = parent;
}
@Override
public EnumClassLevel getLevel() {
return this.level;
}
@Override
public String getUID() {
return this.uID;
}
@Override
public String getName() {
return LocalizationManager.getLocalizedString(getUID());
}
@Override
public String getScientific() {
return this.latin;
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString(getUID() + ".description");
}
@Override
public IClassification[] getMemberGroups() {
return null;
}
@Override
public void addMemberGroup(IClassification group) {}
@Override
public IAlleleSpecies[] getMemberSpecies() {
return this.species.toArray(new IAlleleSpecies[this.species.size()]);
}
@Override
public void addMemberSpecies(IAlleleSpecies species) {
if (!this.species.contains(species)) {
this.species.add(species);
}
}
@Override
public IClassification getParent() {
return this.parent;
}
@Override
public void setParent(IClassification parent) {
this.parent = parent;
}
}
File diff suppressed because it is too large. Load diff
@@ -1,23 +1,22 @@
package magicbees.bees;
import forestry.api.apiculture.IBeeIconColourProvider;
import java.awt.Color;
import forestry.api.apiculture.IBeeIconColourProvider;
public enum BeeIconColourProvider implements IBeeIconColourProvider {
RAINBOW {
@Override
public int getIconColour(int renderPass) {
if (renderPass == 0) {
int hue = (int) (System.currentTimeMillis() >> 2) % 360;
return Color.getHSBColor(hue / 360f, 0.75f, 0.80f).getRGB();
} else if (renderPass == 1) {
int hue = (int) (System.currentTimeMillis() >> 3) % 360;
hue += 60;
hue = hue % 360;
return Color.getHSBColor(hue / 360f, 0.5f, 0.6f).getRGB();
}
return 0xffffff;
}
}
RAINBOW {
@Override
public int getIconColour(int renderPass) {
if (renderPass == 0) {
int hue = (int) (System.currentTimeMillis() >> 2) % 360;
return Color.getHSBColor(hue / 360f, 0.75f, 0.80f).getRGB();
} else if (renderPass == 1) {
int hue = (int) (System.currentTimeMillis() >> 3) % 360;
hue += 60;
hue = hue % 360;
return Color.getHSBColor(hue / 360f, 0.5f, 0.6f).getRGB();
}
return 0xffffff;
}
}
}
@@ -1,51 +1,47 @@
package magicbees.bees;
import java.util.Locale;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IBeeIconProvider;
import java.util.Locale;
import magicbees.main.CommonProxy;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public enum BeeIconProvider implements IBeeIconProvider {
SKULKING(CommonProxy.DOMAIN + ":bees/skulking/"),
DOCTORAL(CommonProxy.DOMAIN + ":bees/doctoral/");
SKULKING(CommonProxy.DOMAIN + ":bees/skulking/"),
DOCTORAL(CommonProxy.DOMAIN + ":bees/doctoral/");
@SideOnly(Side.CLIENT)
private IIcon[][] icons;
private final String iconPath;
@SideOnly(Side.CLIENT)
private IIcon[][] icons;
BeeIconProvider(String iconPath) {
this.iconPath = iconPath;
}
private final String iconPath;
@Override
public void registerIcons(IIconRegister itemMap) {
this.icons = new IIcon[EnumBeeType.VALUES.length][3];
BeeIconProvider(String iconPath) {
this.iconPath = iconPath;
}
IIcon body1 = itemMap.registerIcon(iconPath + "body1");
@Override
public void registerIcons(IIconRegister itemMap) {
this.icons = new IIcon[EnumBeeType.VALUES.length][3];
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
EnumBeeType beeType = EnumBeeType.VALUES[i];
if (beeType == EnumBeeType.NONE)
continue;
IIcon body1 = itemMap.registerIcon(iconPath + "body1");
String beeTypeIconPath = iconPath + beeType.toString().toLowerCase(Locale.ENGLISH);
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
EnumBeeType beeType = EnumBeeType.VALUES[i];
if (beeType == EnumBeeType.NONE) continue;
icons[i][0] = itemMap.registerIcon(beeTypeIconPath + ".outline");
icons[i][1] = (beeType != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon(beeTypeIconPath + ".body");
icons[i][2] = itemMap.registerIcon(beeTypeIconPath + ".body2");
}
}
String beeTypeIconPath = iconPath + beeType.toString().toLowerCase(Locale.ENGLISH);
@Override
public IIcon getIcon(EnumBeeType type, int renderPass) {
return icons[type.ordinal()][Math.min(renderPass, 2)];
}
icons[i][0] = itemMap.registerIcon(beeTypeIconPath + ".outline");
icons[i][1] = (beeType != EnumBeeType.LARVAE) ? body1 : itemMap.registerIcon(beeTypeIconPath + ".body");
icons[i][2] = itemMap.registerIcon(beeTypeIconPath + ".body2");
}
}
@Override
public IIcon getIcon(EnumBeeType type, int renderPass) {
return icons[type.ordinal()][Math.min(renderPass, 2)];
}
}
+97 -99
View File
@@ -1,16 +1,5 @@
package magicbees.bees;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import magicbees.block.types.HiveType;
import magicbees.item.types.DropType;
import magicbees.main.Config;
import magicbees.main.utils.Tuple;
import magicbees.main.utils.compat.ExtraBeesHelper;
import net.minecraft.item.ItemStack;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBee;
@@ -18,95 +7,104 @@ import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeRoot;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import magicbees.block.types.HiveType;
import magicbees.item.types.DropType;
import magicbees.main.Config;
import magicbees.main.utils.Tuple;
import magicbees.main.utils.compat.ExtraBeesHelper;
import net.minecraft.item.ItemStack;
public class BeeManager
{
public static IBeeRoot beeRoot;
public class BeeManager {
public static IBeeRoot beeRoot;
private static List<Tuple<IAlleleBeeSpecies, Double>> worldgenSpeciesWeights = new ArrayList<Tuple<IAlleleBeeSpecies, Double>>();
private static double worldgenSpeciesWeightsTotal = 0;
public static void getBeeRoot() {
beeRoot = (IBeeRoot)AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
}
public static void setupAlleles() {
Allele.setupAdditionalAlleles();
BeeSpecies.setupBeeSpecies();
Allele.registerDeprecatedAlleleReplacements();
}
public static void lateBeeInit()
{
BeeMutation.setupMutations();
BeeProductHelper.initBaseProducts();
BeeProductHelper.initOreDictSProducts();
HiveType.initHiveData();
beeRoot.setResearchSuitability(Config.drops.getStackForType(DropType.INTELLECT), 0.5f);
}
public static ItemStack getDefaultItemStackForSpecies(IAlleleBeeSpecies beeSpecies, EnumBeeType type) {
IBee bee = getBeeFromSpecies(beeSpecies, false);
return BeeManager.beeRoot.getMemberStack(bee, type.ordinal());
}
public static IBee getBeeFromSpecies(IAlleleBeeSpecies beeSpecies, boolean applyRainResist) {
IAllele[] speciesTemplate = BeeManager.beeRoot.getTemplate(beeSpecies.getUID());
if (applyRainResist) {
speciesTemplate = BeeGenomeManager.addRainResist(speciesTemplate);
}
IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(speciesTemplate);
return BeeManager.beeRoot.getBee(null, genome);
}
public static IAlleleBeeSpecies getRandomWorldgenSpecies(Random r) {
Collections.shuffle(worldgenSpeciesWeights);
double value = r.nextDouble() * worldgenSpeciesWeightsTotal;
IAlleleBeeSpecies species = Allele.getBaseSpecies("Forest");
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
value -= t.right.doubleValue();
if (value <= 0.0) {
species = t.left;
break;
}
}
return species;
}
public static void addWorldgenSpeciesWeight(IAlleleBeeSpecies species, double d) {
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(species, d));
worldgenSpeciesWeightsTotal += d;
}
public static void populateSpeciesListRarity() {
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Forest"), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Meadows"), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Tropical"), 10.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Modest"), 16.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Wintry"), 10.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Ended"), 0.5));
if (ExtraBeesHelper.isActive()) {
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Water"), 12.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Rock"), 16.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Basalt"), 10.0));
}
private static List<Tuple<IAlleleBeeSpecies, Double>> worldgenSpeciesWeights =
new ArrayList<Tuple<IAlleleBeeSpecies, Double>>();
private static double worldgenSpeciesWeightsTotal = 0;
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.MYSTICAL.getSpecies(), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.UNUSUAL.getSpecies(), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.SORCEROUS.getSpecies(), 13.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.ATTUNED.getSpecies(), 6.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.INFERNAL.getSpecies(), 10.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.OBLIVION.getSpecies(), 1.0));
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
worldgenSpeciesWeightsTotal += t.right.doubleValue();
}
}
public static void getBeeRoot() {
beeRoot = (IBeeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
}
public static void setupAlleles() {
Allele.setupAdditionalAlleles();
BeeSpecies.setupBeeSpecies();
Allele.registerDeprecatedAlleleReplacements();
}
public static void lateBeeInit() {
BeeMutation.setupMutations();
BeeProductHelper.initBaseProducts();
BeeProductHelper.initOreDictSProducts();
HiveType.initHiveData();
beeRoot.setResearchSuitability(Config.drops.getStackForType(DropType.INTELLECT), 0.5f);
}
public static ItemStack getDefaultItemStackForSpecies(IAlleleBeeSpecies beeSpecies, EnumBeeType type) {
IBee bee = getBeeFromSpecies(beeSpecies, false);
return BeeManager.beeRoot.getMemberStack(bee, type.ordinal());
}
public static IBee getBeeFromSpecies(IAlleleBeeSpecies beeSpecies, boolean applyRainResist) {
IAllele[] speciesTemplate = BeeManager.beeRoot.getTemplate(beeSpecies.getUID());
if (applyRainResist) {
speciesTemplate = BeeGenomeManager.addRainResist(speciesTemplate);
}
IBeeGenome genome = BeeManager.beeRoot.templateAsGenome(speciesTemplate);
return BeeManager.beeRoot.getBee(null, genome);
}
public static IAlleleBeeSpecies getRandomWorldgenSpecies(Random r) {
Collections.shuffle(worldgenSpeciesWeights);
double value = r.nextDouble() * worldgenSpeciesWeightsTotal;
IAlleleBeeSpecies species = Allele.getBaseSpecies("Forest");
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
value -= t.right.doubleValue();
if (value <= 0.0) {
species = t.left;
break;
}
}
return species;
}
public static void addWorldgenSpeciesWeight(IAlleleBeeSpecies species, double d) {
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(species, d));
worldgenSpeciesWeightsTotal += d;
}
public static void populateSpeciesListRarity() {
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Forest"), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Meadows"), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Tropical"), 10.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Modest"), 16.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Wintry"), 10.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getBaseSpecies("Ended"), 0.5));
if (ExtraBeesHelper.isActive()) {
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Water"), 12.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Rock"), 16.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(Allele.getExtraSpecies("Basalt"), 10.0));
}
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.MYSTICAL.getSpecies(), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.UNUSUAL.getSpecies(), 20.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.SORCEROUS.getSpecies(), 13.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.ATTUNED.getSpecies(), 6.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.INFERNAL.getSpecies(), 10.0));
worldgenSpeciesWeights.add(new Tuple<IAlleleBeeSpecies, Double>(BeeSpecies.OBLIVION.getSpecies(), 1.0));
for (Tuple<IAlleleBeeSpecies, Double> t : worldgenSpeciesWeights) {
worldgenSpeciesWeightsTotal += t.right.doubleValue();
}
}
}
File diff suppressed because it is too large. Load diff
+430 -393
View File
@@ -1,5 +1,7 @@
package magicbees.bees;
import static magicbees.bees.BeeSpecies.*;
import magicbees.item.types.CombType;
import magicbees.item.types.DropType;
import magicbees.item.types.NuggetType;
@@ -11,433 +13,468 @@ import magicbees.main.utils.LogHelper;
import magicbees.main.utils.compat.AppliedEnergisticsHelper;
import magicbees.main.utils.compat.ArsMagicaHelper;
import magicbees.main.utils.compat.BotaniaHelper;
import magicbees.main.utils.compat.BotaniaHelper.PastureSeed;
import magicbees.main.utils.compat.EquivalentExchangeHelper;
import magicbees.main.utils.compat.ForestryHelper;
import magicbees.main.utils.compat.RedstoneArsenalHelper;
import magicbees.main.utils.compat.ThaumcraftHelper;
import magicbees.main.utils.compat.ThermalModsHelper;
import magicbees.main.utils.compat.BotaniaHelper.PastureSeed;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import static magicbees.bees.BeeSpecies.*;
public class BeeProductHelper {
public static void initBaseProducts() {
MYSTICAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
SORCEROUS.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
UNUSUAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
ATTUNED.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
ELDRITCH.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
ESOTERIC.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.18f);
MYSTERIOUS.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.20f);
ARCANE.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.25f)
.addSpecialty(Config.drops.getStackForType(DropType.ENCHANTED, 1), 0.09f);
public static void initBaseProducts() {
MYSTICAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
SORCEROUS.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
UNUSUAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
ATTUNED.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
ELDRITCH.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.15f);
CHARMED.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.18f);
ENCHANTED.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.20f);
SUPERNATURAL.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.25f)
.addSpecialty(Config.pollen.getStackForType(PollenType.UNUSUAL), 0.08f);
ESOTERIC.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.18f);
MYSTERIOUS.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.20f);
ARCANE.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.25f)
.addSpecialty(Config.drops.getStackForType(DropType.ENCHANTED, 1), 0.09f);
ETHEREAL.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.10f);
CHARMED.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.18f);
ENCHANTED.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.20f);
SUPERNATURAL
.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.25f)
.addSpecialty(Config.pollen.getStackForType(PollenType.UNUSUAL), 0.08f);
WINDY.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.25f);
FIREY.addProduct(Config.combs.getStackForType(CombType.FIREY), 0.25f);
EARTHY.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.25f);
WATERY.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.25f)
.addSpecialty(new ItemStack(Blocks.ice), 0.025f);
ETHEREAL.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.10f);
PUPIL.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.20f);
SCHOLARLY.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.25f);
SAVANT.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.40f);
WINDY.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.25f);
FIREY.addProduct(Config.combs.getStackForType(CombType.FIREY), 0.25f);
EARTHY.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.25f);
WATERY.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.25f)
.addSpecialty(new ItemStack(Blocks.ice), 0.025f);
AWARE.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
SPIRIT.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.22f)
.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.16f);
SOUL.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.28f)
.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.20f);
PUPIL.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.20f);
SCHOLARLY.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.25f);
SAVANT.addProduct(Config.combs.getStackForType(CombType.PAPERY), 0.40f);
SKULKING.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f);
GHASTLY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.08f)
.addSpecialty(new ItemStack(Items.ghast_tear), 0.099f);
SPIDERY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.13f)
.addProduct(new ItemStack(Items.string), 0.08f)
.addSpecialty(new ItemStack(Items.spider_eye), 0.08f);
SMOULDERING.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f)
.addSpecialty(new ItemStack(Items.blaze_rod), 0.05f);
BRAINY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(new ItemStack(Items.rotten_flesh), 0.06f);
BIGBAD.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.18f)
.addProduct(new ItemStack(Items.beef), 0.12f)
.addProduct(new ItemStack(Items.chicken), 0.12f)
.addSpecialty(new ItemStack(Items.melon), 0.20f);
BATTY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addSpecialty(new ItemStack(Items.string), 0.20f);
CHICKEN.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.23f)
.addSpecialty(new ItemStack(Items.feather), 0.08f)
.addSpecialty(new ItemStack(Items.egg), 0.08f);
BEEF.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Items.leather), 0.165f);
PORK.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addSpecialty(new ItemStack(Items.carrot), 0.165f);
SHEEPISH.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Blocks.wool), 0.16f)
.addSpecialty(new ItemStack(Items.wheat), 0.24f);
HORSE.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Items.leather), 0.24f)
.addSpecialty(new ItemStack(Items.apple), 0.38f);
CATTY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Items.fish), 0.24f);
AWARE.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
SPIRIT.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.22f)
.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.16f);
SOUL.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.28f)
.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.20f);
TIMELY.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.16f);
LORDLY.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.19f);
DOCTORAL.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.24f)
.addSpecialty(new ItemStack(Config.jellyBaby), 0.078f);
SKULKING.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f);
GHASTLY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.08f)
.addSpecialty(new ItemStack(Items.ghast_tear), 0.099f);
SPIDERY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.13f)
.addProduct(new ItemStack(Items.string), 0.08f)
.addSpecialty(new ItemStack(Items.spider_eye), 0.08f);
SMOULDERING
.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f)
.addSpecialty(new ItemStack(Items.blaze_rod), 0.05f);
BRAINY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(new ItemStack(Items.rotten_flesh), 0.06f);
BIGBAD.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.18f)
.addProduct(new ItemStack(Items.beef), 0.12f)
.addProduct(new ItemStack(Items.chicken), 0.12f)
.addSpecialty(new ItemStack(Items.melon), 0.20f);
BATTY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addSpecialty(new ItemStack(Items.string), 0.20f);
CHICKEN.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.23f)
.addSpecialty(new ItemStack(Items.feather), 0.08f)
.addSpecialty(new ItemStack(Items.egg), 0.08f);
BEEF.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Items.leather), 0.165f);
PORK.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addSpecialty(new ItemStack(Items.carrot), 0.165f);
SHEEPISH.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Blocks.wool), 0.16f)
.addSpecialty(new ItemStack(Items.wheat), 0.24f);
HORSE.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Items.leather), 0.24f)
.addSpecialty(new ItemStack(Items.apple), 0.38f);
CATTY.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.25f)
.addSpecialty(new ItemStack(Items.fish), 0.24f);
INFERNAL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.12f);
HATEFUL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.18f);
SPITEFUL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.24f);
WITHERING.addSpecialty(Config.miscResources.getStackForType(ResourceType.SKULL_CHIP), 0.15f);
TIMELY.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.16f);
LORDLY.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.19f);
DOCTORAL.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.24f)
.addSpecialty(new ItemStack(Config.jellyBaby), 0.078f);
OBLIVION.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.14f);
NAMELESS.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.19f);
ABANDONED.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.24f);
FORLORN.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.30f);
DRACONIC.addSpecialty(Config.miscResources.getStackForType(ResourceType.DRAGON_DUST), 0.15f);
INFERNAL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.12f);
HATEFUL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.18f);
SPITEFUL.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.24f);
WITHERING.addSpecialty(Config.miscResources.getStackForType(ResourceType.SKULL_CHIP), 0.15f);
IRON.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.IRON), 0.18f);
GOLD.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(new ItemStack(Items.gold_nugget, 1), 0.16f);
DIAMOND.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.DIAMOND), 0.06f);
EMERALD.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.EMERALD), 0.04f);
COPPER.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.COPPER), 0.20f);
TIN.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.TIN), 0.20f);
APATITE.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.APATITE), 0.10f);
MUTABLE.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.30f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.10f);
TRANSMUTING.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.30f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 0.05f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SIMMERING.ordinal()), 0.05f);
CRUMBLING.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.30f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.POWDERY.ordinal()), 0.10f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.COCOA.ordinal()), 0.15f);
INVISIBLE.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.35f);
OBLIVION.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.14f);
NAMELESS.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.19f);
ABANDONED.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.24f);
FORLORN.addProduct(Config.combs.getStackForType(CombType.FORGOTTEN), 0.30f);
DRACONIC.addSpecialty(Config.miscResources.getStackForType(ResourceType.DRAGON_DUST), 0.15f);
}
IRON.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.IRON), 0.18f);
GOLD.addProduct(ForestryHelper.itemHoneycomb, 0.10f).addSpecialty(new ItemStack(Items.gold_nugget, 1), 0.16f);
DIAMOND.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.DIAMOND), 0.06f);
EMERALD.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.EMERALD), 0.04f);
COPPER.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.COPPER), 0.20f);
TIN.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.TIN), 0.20f);
APATITE.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addSpecialty(Config.nuggets.getStackForType(NuggetType.APATITE), 0.10f);
public static void initOreDictSProducts() {
SILVER.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("ingotSilver").size() > 0) {
SILVER.addSpecialty(Config.nuggets.getStackForType(NuggetType.SILVER), 0.16f);
}
else {
SILVER.setInactive();
}
LEAD.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("ingotLead").size() > 0) {
LEAD.addSpecialty(Config.nuggets.getStackForType(NuggetType.LEAD), 0.17f);
}
else {
LEAD.setInactive();
}
ALUMINUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetAluminum").size() > 0) {
ALUMINUM.addSpecialty(OreDictionary.getOres("nuggetAluminum").get(0), 0.20f);
} else {
ALUMINUM.setInactive();
}
MUTABLE.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.30f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.10f);
TRANSMUTING
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.30f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 0.05f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SIMMERING.ordinal()), 0.05f);
CRUMBLING
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.30f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.POWDERY.ordinal()), 0.10f)
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.COCOA.ordinal()), 0.15f);
TE_PLATINUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetPlatinum").size() > 0&& OreDictionary.getOres("ingotPlatinum").size() > 0) {
TE_PLATINUM.addSpecialty(OreDictionary.getOres("nuggetPlatinum").get(0), 0.18f);
} else {
TE_PLATINUM.setInactive();
}
INVISIBLE.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.35f);
}
TE_NICKEL.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetNickel").size() > 0 && OreDictionary.getOres("ingotNickel").size() > 0) {
TE_NICKEL.addSpecialty(OreDictionary.getOres("nuggetNickel").get(0), 0.18f);
} else {
TE_NICKEL.setInactive();
}
public static void initOreDictSProducts() {
SILVER.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("ingotSilver").size() > 0) {
SILVER.addSpecialty(Config.nuggets.getStackForType(NuggetType.SILVER), 0.16f);
} else {
SILVER.setInactive();
}
ARDITE.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetArdite").size() > 0) {
ARDITE.addSpecialty(OreDictionary.getOres("nuggetArdite").get(0), 0.18f);
} else {
ARDITE.setInactive();
}
LEAD.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("ingotLead").size() > 0) {
LEAD.addSpecialty(Config.nuggets.getStackForType(NuggetType.LEAD), 0.17f);
} else {
LEAD.setInactive();
}
COBALT.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetCobalt").size() > 0) {
COBALT.addSpecialty(OreDictionary.getOres("nuggetCobalt").get(0), 0.18f);
}
if (OreDictionary.getOres("nuggetNaturalCobalt").size() > 0) {
COBALT.addSpecialty(OreDictionary.getOres("nuggetNaturalCobalt").get(0), 0.24f);
}
if (COBALT.getSpecies().getSpecialtyChances().size() <= 0) {
COBALT.setInactive();
}
ALUMINUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetAluminum").size() > 0) {
ALUMINUM.addSpecialty(OreDictionary.getOres("nuggetAluminum").get(0), 0.20f);
} else {
ALUMINUM.setInactive();
}
TE_BRONZE.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetBronze").size() > 0 && OreDictionary.getOres("ingotBronze").size() > 0) {
TE_BRONZE.addSpecialty(OreDictionary.getOres("nuggetBronze").get(0), 0.18f);
} else {
TE_BRONZE.setInactive();
}
TE_PLATINUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetPlatinum").size() > 0
&& OreDictionary.getOres("ingotPlatinum").size() > 0) {
TE_PLATINUM.addSpecialty(OreDictionary.getOres("nuggetPlatinum").get(0), 0.18f);
} else {
TE_PLATINUM.setInactive();
}
TE_INVAR.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetInvar").size() > 0 && OreDictionary.getOres("ingotInvar").size() > 0) {
TE_INVAR.addSpecialty(OreDictionary.getOres("nuggetInvar").get(0), 0.18f);
} else {
TE_INVAR.setInactive();
}
TE_NICKEL.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetNickel").size() > 0
&& OreDictionary.getOres("ingotNickel").size() > 0) {
TE_NICKEL.addSpecialty(OreDictionary.getOres("nuggetNickel").get(0), 0.18f);
} else {
TE_NICKEL.setInactive();
}
TE_ELECTRUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetElectrum").size() > 0 && OreDictionary.getOres("ingotElectrum").size() > 0) {
TE_ELECTRUM.addSpecialty(OreDictionary.getOres("nuggetElectrum").get(0), 0.18f);
} else {
TE_ELECTRUM.setInactive();
}
ARDITE.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetArdite").size() > 0) {
ARDITE.addSpecialty(OreDictionary.getOres("nuggetArdite").get(0), 0.18f);
} else {
ARDITE.setInactive();
}
MANYULLYN.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetManyullyn").size() > 0) {
MANYULLYN.addSpecialty(OreDictionary.getOres("nuggetManyullyn").get(0), 0.16f);
} else {
MANYULLYN.setInactive();
}
OSMIUM.addProduct(ForestryHelper.itemHoneycomb, 0.15f);
if (OreDictionary.getOres("nuggetOsmium").size() > 0) {
OSMIUM.addSpecialty(OreDictionary.getOres("nuggetOsmium").get(0), 0.16f);
}
else {
OSMIUM.setInactive();
}
CERTUS.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("crystalCertusQuartz").size() > 0) {
CERTUS.addSpecialty(OreDictionary.getOres("crystalCertusQuartz").get(0), 0.08f);
}
else {
CERTUS.setInactive();
}
SILICON.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("itemSilicon").size() > 0) {
SILICON.addSpecialty(OreDictionary.getOres("itemSilicon").get(0), 0.16f);
}
else {
SILICON.setInactive();
}
FLUIX.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("crystalFluix").size() > 0) {
FLUIX.addSpecialty(OreDictionary.getOres("crystalFluix").get(0), 0.06f);
}
else {
FLUIX.setInactive();
}
}
public static void initThaumcraftProducts() {
TC_AIR.addProduct(Config.combs.getStackForType(CombType.TC_AIR), 0.20f);
TC_FIRE.addProduct(Config.combs.getStackForType(CombType.TC_FIRE), 0.20f);
TC_WATER.addProduct(Config.combs.getStackForType(CombType.TC_WATER), 0.20f);
TC_EARTH.addProduct(Config.combs.getStackForType(CombType.TC_EARTH), 0.20f);
TC_ORDER.addProduct(Config.combs.getStackForType(CombType.TC_ORDER), 0.20f);
TC_CHAOS.addProduct(Config.combs.getStackForType(CombType.TC_CHAOS), 0.20f);
COBALT.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetCobalt").size() > 0) {
COBALT.addSpecialty(OreDictionary.getOres("nuggetCobalt").get(0), 0.18f);
}
if (OreDictionary.getOres("nuggetNaturalCobalt").size() > 0) {
COBALT.addSpecialty(OreDictionary.getOres("nuggetNaturalCobalt").get(0), 0.24f);
}
if (COBALT.getSpecies().getSpecialtyChances().size() <= 0) {
COBALT.setInactive();
}
TC_VIS.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.10f);
TC_REJUVENATING.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
TC_EMPOWERING.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.14f);
TC_EMPOWERING.addSpecialty(new ItemStack(ForestryHelper.pollen, 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), 0.02f);
TC_NEXUS.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.25f);
TC_NEXUS.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.12f);
TC_NEXUS.addSpecialty(new ItemStack(ForestryHelper.pollen, 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), 0.02f);
TC_TAINT.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
TC_TAINT.addProduct(new ItemStack(ForestryHelper.craftingResource, 1 , ForestryHelper.Propolis.STICKY.ordinal()), 0.213f);
TC_PURE.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.16f);
TC_PURE.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.19f);
TC_HUNGRY.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.28f);
TC_HUNGRY.addSpecialty(Config.combs.getStackForType(CombType.TEMPORAL), 0.195f);
TC_WISPY.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 0.22f)
.addSpecialty(new ItemStack(ForestryHelper.craftingResource, 1, ForestryHelper.CraftingMaterial.SILK_WISP.ordinal()), 0.04f);
TC_VOID.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (ThaumcraftHelper.isActive()) {
SCHOLARLY.addSpecialty(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT), 0.02f);
SAVANT.addSpecialty(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT), 0.05f);
TE_BRONZE.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetBronze").size() > 0
&& OreDictionary.getOres("ingotBronze").size() > 0) {
TE_BRONZE.addSpecialty(OreDictionary.getOres("nuggetBronze").get(0), 0.18f);
} else {
TE_BRONZE.setInactive();
}
TC_AIR.addSpecialty(Config.propolis.getStackForType(PropolisType.AIR), 0.18f);
TC_FIRE.addSpecialty(Config.propolis.getStackForType(PropolisType.FIRE), 0.18f);
TC_WATER.addSpecialty(Config.propolis.getStackForType(PropolisType.WATER), 0.18f);
TC_EARTH.addSpecialty(Config.propolis.getStackForType(PropolisType.EARTH), 0.18f);
TC_ORDER.addSpecialty(Config.propolis.getStackForType(PropolisType.ORDER), 0.18f);
TC_CHAOS.addSpecialty(Config.propolis.getStackForType(PropolisType.CHAOS), 0.18f);
TE_INVAR.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetInvar").size() > 0
&& OreDictionary.getOres("ingotInvar").size() > 0) {
TE_INVAR.addSpecialty(OreDictionary.getOres("nuggetInvar").get(0), 0.18f);
} else {
TE_INVAR.setInactive();
}
BATTY.addSpecialty(new ItemStack(Items.gunpowder), 0.04f);
BRAINY.addSpecialty(new ItemStack(ThaumcraftHelper.zombieBrain, 1), 0.02f);
CHICKEN.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetChicken, 1), 0.09f);
BEEF.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetBeef, 1), 0.09f);
PORK.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetPork, 1), 0.09f);
TC_VOID.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetMetal, 1, ThaumcraftHelper.NuggetType.VOID_METAL.ordinal()), 0.155f);
}
}
public static void initEquivalentExchange3Species() {
EE_MINIUM.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.16f);
if (EquivalentExchangeHelper.isActive()) {
EE_MINIUM.addSpecialty(new ItemStack(EquivalentExchangeHelper.minuimShard), 0.06f);
}
}
public static void initArsMagicaSpecies() {
AM_ESSENCE.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.12f);
AM_QUINTESSENCE.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.23f);
AM_EARTH.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_AIR.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_FIRE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_WATER.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_LIGHTNING.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_PLANT.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_ICE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_ARCANE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.19f);
AM_VORTEX.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.10f);
AM_WIGHT.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.30f)
.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f);
if (ArsMagicaHelper.isActive()) {
AM_QUINTESSENCE.addSpecialty(new ItemStack(ArsMagicaHelper.itemResource, 1, ArsMagicaHelper.ResourceType.ARCANE_COMPOUND.ordinal()), 0.05f);
AM_EARTH.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.EARTH.ordinal()), 0.07f);
AM_AIR.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.AIR.ordinal()), 0.07f);
AM_FIRE.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.FIRE.ordinal()), 0.07f);
AM_WATER.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.WATER.ordinal()), 0.07f);
AM_LIGHTNING.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.LIGHTNING.ordinal()), 0.07f);
AM_PLANT.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.PLANT.ordinal()), 0.07f);
AM_ICE.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.ICE.ordinal()), 0.07f);
AM_ARCANE.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.ARCANE.ordinal()), 0.11f);
AM_VORTEX.addSpecialty(new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.EARTH.ordinal()), 0.15f);
AM_WIGHT.addSpecialty(new ItemStack(ArsMagicaHelper.itemResource, 1, ArsMagicaHelper.ResourceType.ARCANE_COMPOUND.ordinal()), 0.11f);
}
}
public static void initThermalExpansionProducts() {
TE_DANTE.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f)
.addSpecialty(new ItemStack(Items.blaze_powder), 0.05f);
TE_PYRO.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f)
.addSpecialty(new ItemStack(Items.blaze_powder), 0.05f);
TE_DESTABILIZED.addProduct(Config.combs.getStackForType(CombType.TE_DESTABILIZED), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
.addSpecialty(new ItemStack(Items.redstone), 0.05f);
TE_LUX.addProduct(Config.combs.getStackForType(CombType.TE_LUX), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
.addSpecialty(new ItemStack(Items.glowstone_dust), 0.05f);
TE_WINSOME.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_ENDEARING), 0.05f)
.addSpecialty(new ItemStack(Items.ender_pearl), 0.05f);
TE_ENDEARING.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.MYSTERIOUS.ordinal()), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_ENDEARING), 0.05f);
TE_COAL.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_CARBON), 0.05f)
.addSpecialty(new ItemStack(Items.coal), 0.05f);
TE_BLIZZY.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.FROZEN.ordinal()), 0.10f);
TE_GELID.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.FROZEN.ordinal()), 0.10f);
TE_SHOCKING.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.16f);
TE_AMPED.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.29f);
TE_GROUNDED.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.16f);
TE_ROCKING.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.29f);
TE_SIGNALUS.addProduct(Config.combs.getStackForType(CombType.TE_DESTABILIZED), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f);
TE_LUMIUS.addProduct(Config.combs.getStackForType(CombType.TE_LUX), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f);
if (ThermalModsHelper.isActive()) {
LogHelper.info("Thermal Expansion bees active");
TE_BLIZZY.addSpecialty(ThermalModsHelper.dustBlizz, 0.09f);
TE_GELID.addSpecialty(ThermalModsHelper.dustCryotheum, 0.09f);
TE_DANTE.addSpecialty(ThermalModsHelper.dustSulfur, 0.09f);
TE_PYRO.addSpecialty(ThermalModsHelper.dustPyrotheum, 0.09f);
TE_SHOCKING.addSpecialty(ThermalModsHelper.dustBlitz, 0.09f);
TE_AMPED.addSpecialty(ThermalModsHelper.dustAerotheum, 0.09f);
TE_GROUNDED.addSpecialty(ThermalModsHelper.dustBasalz, 0.09f);
TE_ROCKING.addSpecialty(ThermalModsHelper.dustPetrotheum, 0.09f);
TE_WINSOME.addSpecialty(ThermalModsHelper.dustPlatinum, 0.09f);
TE_ENDEARING.addSpecialty(ThermalModsHelper.enderiumNugget, 0.09f);
TE_SIGNALUS.addSpecialty(ThermalModsHelper.signalumNugget, 0.09f);
TE_LUMIUS.addSpecialty(ThermalModsHelper.lumiumNugget, 0.09f);
}
}
public static void initRedstoneArsenelProducts() {
RSA_FLUXED.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (RedstoneArsenalHelper.isActive()) {
RSA_FLUXED.addSpecialty(RedstoneArsenalHelper.fluxNugget, 0.09f);
}
}
public static void initBotaniaProducts() {
BOT_ROOTED.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.10f);
BOT_BOTANIC.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.05f);
BOT_BLOSSOM.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.20f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.05f);
BOT_FLORAL.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.25f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.05f);
BOT_VAZBEE.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.05f)
.addProduct(new ItemStack(Items.dye, 1, 9), 0.20f)
.addProduct(new ItemStack(Blocks.wool, 1, 9), 0.02f)
.addProduct(new ItemStack(Blocks.red_flower, 1, 7), 0.06f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.15f);
BOT_SOMNOLENT.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.08f)
.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.15f);
BOT_DREAMING.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.16f)
.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.33f);
BOT_ALFHEIM.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.28f);
if (BotaniaHelper.isActive()) {
for (int i = 0; i < 16; ++i) {
ItemStack petal = new ItemStack(BotaniaHelper.itemPetal, 1, i);
BOT_BOTANIC.addSpecialty(petal, 0.01f);
BOT_BLOSSOM.addSpecialty(petal, 0.04f);
BOT_FLORAL.addSpecialty(petal, 0.16f);
}
TE_ELECTRUM.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetElectrum").size() > 0
&& OreDictionary.getOres("ingotElectrum").size() > 0) {
TE_ELECTRUM.addSpecialty(OreDictionary.getOres("nuggetElectrum").get(0), 0.18f);
} else {
TE_ELECTRUM.setInactive();
}
for (PastureSeed type : PastureSeed.values()) {
BOT_VAZBEE.addSpecialty(new ItemStack(BotaniaHelper.itemPastureSeed, 1, type.ordinal()), 0.04f);
}
}
}
public static void initAppEngProducts() {
AE_SKYSTONE.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.19f);
if (AppliedEnergisticsHelper.skystone != null) {
AE_SKYSTONE.addSpecialty(new ItemStack(AppliedEnergisticsHelper.skystone), 0.02f);
}
else {
AE_SKYSTONE.setInactive();
}
}
MANYULLYN.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("nuggetManyullyn").size() > 0) {
MANYULLYN.addSpecialty(OreDictionary.getOres("nuggetManyullyn").get(0), 0.16f);
} else {
MANYULLYN.setInactive();
}
OSMIUM.addProduct(ForestryHelper.itemHoneycomb, 0.15f);
if (OreDictionary.getOres("nuggetOsmium").size() > 0) {
OSMIUM.addSpecialty(OreDictionary.getOres("nuggetOsmium").get(0), 0.16f);
} else {
OSMIUM.setInactive();
}
CERTUS.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("crystalCertusQuartz").size() > 0) {
CERTUS.addSpecialty(OreDictionary.getOres("crystalCertusQuartz").get(0), 0.08f);
} else {
CERTUS.setInactive();
}
SILICON.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("itemSilicon").size() > 0) {
SILICON.addSpecialty(OreDictionary.getOres("itemSilicon").get(0), 0.16f);
} else {
SILICON.setInactive();
}
FLUIX.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (OreDictionary.getOres("crystalFluix").size() > 0) {
FLUIX.addSpecialty(OreDictionary.getOres("crystalFluix").get(0), 0.06f);
} else {
FLUIX.setInactive();
}
}
public static void initThaumcraftProducts() {
TC_AIR.addProduct(Config.combs.getStackForType(CombType.TC_AIR), 0.20f);
TC_FIRE.addProduct(Config.combs.getStackForType(CombType.TC_FIRE), 0.20f);
TC_WATER.addProduct(Config.combs.getStackForType(CombType.TC_WATER), 0.20f);
TC_EARTH.addProduct(Config.combs.getStackForType(CombType.TC_EARTH), 0.20f);
TC_ORDER.addProduct(Config.combs.getStackForType(CombType.TC_ORDER), 0.20f);
TC_CHAOS.addProduct(Config.combs.getStackForType(CombType.TC_CHAOS), 0.20f);
TC_VIS.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.10f);
TC_REJUVENATING.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
TC_EMPOWERING.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.14f);
TC_EMPOWERING.addSpecialty(
new ItemStack(ForestryHelper.pollen, 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), 0.02f);
TC_NEXUS.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.25f);
TC_NEXUS.addProduct(Config.combs.getStackForType(CombType.TEMPORAL), 0.12f);
TC_NEXUS.addSpecialty(
new ItemStack(ForestryHelper.pollen, 1, ForestryHelper.Pollen.CRYSTALLINE.ordinal()), 0.02f);
TC_TAINT.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.18f);
TC_TAINT.addProduct(
new ItemStack(ForestryHelper.craftingResource, 1, ForestryHelper.Propolis.STICKY.ordinal()), 0.213f);
TC_PURE.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.16f);
TC_PURE.addSpecialty(Config.combs.getStackForType(CombType.SOUL), 0.19f);
TC_HUNGRY.addProduct(Config.combs.getStackForType(CombType.INTELLECT), 0.28f);
TC_HUNGRY.addSpecialty(Config.combs.getStackForType(CombType.TEMPORAL), 0.195f);
TC_WISPY.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 0.22f)
.addSpecialty(
new ItemStack(
ForestryHelper.craftingResource,
1,
ForestryHelper.CraftingMaterial.SILK_WISP.ordinal()),
0.04f);
TC_VOID.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (ThaumcraftHelper.isActive()) {
SCHOLARLY.addSpecialty(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT), 0.02f);
SAVANT.addSpecialty(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT), 0.05f);
TC_AIR.addSpecialty(Config.propolis.getStackForType(PropolisType.AIR), 0.18f);
TC_FIRE.addSpecialty(Config.propolis.getStackForType(PropolisType.FIRE), 0.18f);
TC_WATER.addSpecialty(Config.propolis.getStackForType(PropolisType.WATER), 0.18f);
TC_EARTH.addSpecialty(Config.propolis.getStackForType(PropolisType.EARTH), 0.18f);
TC_ORDER.addSpecialty(Config.propolis.getStackForType(PropolisType.ORDER), 0.18f);
TC_CHAOS.addSpecialty(Config.propolis.getStackForType(PropolisType.CHAOS), 0.18f);
BATTY.addSpecialty(new ItemStack(Items.gunpowder), 0.04f);
BRAINY.addSpecialty(new ItemStack(ThaumcraftHelper.zombieBrain, 1), 0.02f);
CHICKEN.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetChicken, 1), 0.09f);
BEEF.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetBeef, 1), 0.09f);
PORK.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetPork, 1), 0.09f);
TC_VOID.addSpecialty(
new ItemStack(ThaumcraftHelper.nuggetMetal, 1, ThaumcraftHelper.NuggetType.VOID_METAL.ordinal()),
0.155f);
}
}
public static void initEquivalentExchange3Species() {
EE_MINIUM.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.16f);
if (EquivalentExchangeHelper.isActive()) {
EE_MINIUM.addSpecialty(new ItemStack(EquivalentExchangeHelper.minuimShard), 0.06f);
}
}
public static void initArsMagicaSpecies() {
AM_ESSENCE.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.12f);
AM_QUINTESSENCE.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.23f);
AM_EARTH.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_AIR.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_FIRE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_WATER.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_LIGHTNING.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_PLANT.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_ICE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.12f);
AM_ARCANE.addProduct(Config.combs.getStackForType(CombType.AM_POTENT), 0.19f);
AM_VORTEX.addProduct(Config.combs.getStackForType(CombType.AM_ESSENCE), 0.10f);
AM_WIGHT.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.30f)
.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f);
if (ArsMagicaHelper.isActive()) {
AM_QUINTESSENCE.addSpecialty(
new ItemStack(
ArsMagicaHelper.itemResource, 1, ArsMagicaHelper.ResourceType.ARCANE_COMPOUND.ordinal()),
0.05f);
AM_EARTH.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.EARTH.ordinal()), 0.07f);
AM_AIR.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.AIR.ordinal()), 0.07f);
AM_FIRE.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.FIRE.ordinal()), 0.07f);
AM_WATER.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.WATER.ordinal()), 0.07f);
AM_LIGHTNING.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.LIGHTNING.ordinal()), 0.07f);
AM_PLANT.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.PLANT.ordinal()), 0.07f);
AM_ICE.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.ICE.ordinal()), 0.07f);
AM_ARCANE.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.ARCANE.ordinal()), 0.11f);
AM_VORTEX.addSpecialty(
new ItemStack(ArsMagicaHelper.essence, 1, ArsMagicaHelper.EssenceType.EARTH.ordinal()), 0.15f);
AM_WIGHT.addSpecialty(
new ItemStack(
ArsMagicaHelper.itemResource, 1, ArsMagicaHelper.ResourceType.ARCANE_COMPOUND.ordinal()),
0.11f);
}
}
public static void initThermalExpansionProducts() {
TE_DANTE.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f)
.addSpecialty(new ItemStack(Items.blaze_powder), 0.05f);
TE_PYRO.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.MOLTEN), 0.10f)
.addSpecialty(new ItemStack(Items.blaze_powder), 0.05f);
TE_DESTABILIZED
.addProduct(Config.combs.getStackForType(CombType.TE_DESTABILIZED), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
.addSpecialty(new ItemStack(Items.redstone), 0.05f);
TE_LUX.addProduct(Config.combs.getStackForType(CombType.TE_LUX), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f)
.addSpecialty(new ItemStack(Items.glowstone_dust), 0.05f);
TE_WINSOME
.addProduct(Config.combs.getStackForType(CombType.FURTIVE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_ENDEARING), 0.05f)
.addSpecialty(new ItemStack(Items.ender_pearl), 0.05f);
TE_ENDEARING
.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.MYSTERIOUS.ordinal()), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_ENDEARING), 0.05f);
TE_COAL.addProduct(ForestryHelper.itemHoneycomb, 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TE_CARBON), 0.05f)
.addSpecialty(new ItemStack(Items.coal), 0.05f);
TE_BLIZZY.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.FROZEN.ordinal()), 0.10f);
TE_GELID.addProduct(new ItemStack(ForestryHelper.beeComb, 1, ForestryHelper.Comb.FROZEN.ordinal()), 0.10f);
TE_SHOCKING.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.16f);
TE_AMPED.addProduct(Config.combs.getStackForType(CombType.AIRY), 0.29f);
TE_GROUNDED.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.16f);
TE_ROCKING.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.29f);
TE_SIGNALUS
.addProduct(Config.combs.getStackForType(CombType.TE_DESTABILIZED), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f);
TE_LUMIUS
.addProduct(Config.combs.getStackForType(CombType.TE_LUX), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.OCCULT), 0.10f);
if (ThermalModsHelper.isActive()) {
LogHelper.info("Thermal Expansion bees active");
TE_BLIZZY.addSpecialty(ThermalModsHelper.dustBlizz, 0.09f);
TE_GELID.addSpecialty(ThermalModsHelper.dustCryotheum, 0.09f);
TE_DANTE.addSpecialty(ThermalModsHelper.dustSulfur, 0.09f);
TE_PYRO.addSpecialty(ThermalModsHelper.dustPyrotheum, 0.09f);
TE_SHOCKING.addSpecialty(ThermalModsHelper.dustBlitz, 0.09f);
TE_AMPED.addSpecialty(ThermalModsHelper.dustAerotheum, 0.09f);
TE_GROUNDED.addSpecialty(ThermalModsHelper.dustBasalz, 0.09f);
TE_ROCKING.addSpecialty(ThermalModsHelper.dustPetrotheum, 0.09f);
TE_WINSOME.addSpecialty(ThermalModsHelper.dustPlatinum, 0.09f);
TE_ENDEARING.addSpecialty(ThermalModsHelper.enderiumNugget, 0.09f);
TE_SIGNALUS.addSpecialty(ThermalModsHelper.signalumNugget, 0.09f);
TE_LUMIUS.addSpecialty(ThermalModsHelper.lumiumNugget, 0.09f);
}
}
public static void initRedstoneArsenelProducts() {
RSA_FLUXED.addProduct(ForestryHelper.itemHoneycomb, 0.10f);
if (RedstoneArsenalHelper.isActive()) {
RSA_FLUXED.addSpecialty(RedstoneArsenalHelper.fluxNugget, 0.09f);
}
}
public static void initBotaniaProducts() {
BOT_ROOTED.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.10f);
BOT_BOTANIC
.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.10f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.05f);
BOT_BLOSSOM
.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.20f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.05f);
BOT_FLORAL
.addProduct(Config.combs.getStackForType(CombType.MUNDANE), 0.25f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.05f);
BOT_VAZBEE
.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.05f)
.addProduct(new ItemStack(Items.dye, 1, 9), 0.20f)
.addProduct(new ItemStack(Blocks.wool, 1, 9), 0.02f)
.addProduct(new ItemStack(Blocks.red_flower, 1, 7), 0.06f)
.addProduct(Config.combs.getStackForType(CombType.TRANSMUTED), 0.15f);
BOT_SOMNOLENT
.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.08f)
.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.15f);
BOT_DREAMING
.addProduct(Config.combs.getStackForType(CombType.WATERY), 0.16f)
.addProduct(Config.combs.getStackForType(CombType.SOUL), 0.33f);
BOT_ALFHEIM.addProduct(Config.combs.getStackForType(CombType.OTHERWORLDLY), 0.28f);
if (BotaniaHelper.isActive()) {
for (int i = 0; i < 16; ++i) {
ItemStack petal = new ItemStack(BotaniaHelper.itemPetal, 1, i);
BOT_BOTANIC.addSpecialty(petal, 0.01f);
BOT_BLOSSOM.addSpecialty(petal, 0.04f);
BOT_FLORAL.addSpecialty(petal, 0.16f);
}
for (PastureSeed type : PastureSeed.values()) {
BOT_VAZBEE.addSpecialty(new ItemStack(BotaniaHelper.itemPastureSeed, 1, type.ordinal()), 0.04f);
}
}
}
public static void initAppEngProducts() {
AE_SKYSTONE.addProduct(Config.combs.getStackForType(CombType.EARTHY), 0.19f);
if (AppliedEnergisticsHelper.skystone != null) {
AE_SKYSTONE.addSpecialty(new ItemStack(AppliedEnergisticsHelper.skystone), 0.02f);
} else {
AE_SKYSTONE.setInactive();
}
}
}
File diff suppressed because it is too large. Load diff
+182 -157
View File
@@ -1,23 +1,14 @@
package magicbees.bees;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import forestry.api.apiculture.hives.HiveManager;
import forestry.api.apiculture.hives.IHiveDescription;
import forestry.api.apiculture.hives.IHiveGen;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import magicbees.block.types.HiveType;
import magicbees.main.Config;
import magicbees.main.utils.BlockUtil;
@@ -26,166 +17,200 @@ import magicbees.world.feature.FeatureOreVein;
import magicbees.world.feature.HiveGenNether;
import magicbees.world.feature.HiveGenOblivion;
import magicbees.world.feature.HiveGenUnderground;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
public enum HiveDescription implements IHiveDescription {
CURIOUS(HiveType.CURIOUS, 3.0f, HiveManager.genHelper.tree(), false,
BiomeDictionary.Type.FOREST, BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.HILLS),
UNUSUAL(HiveType.UNUSUAL, 1.0f, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass), false,
BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.HILLS, BiomeDictionary.Type.RIVER),
RESONANT(HiveType.RESONANT, 0.9f, HiveManager.genHelper.ground(Blocks.sand, Blocks.sandstone), false,
BiomeDictionary.Type.SANDY, BiomeDictionary.Type.MESA, BiomeDictionary.Type.HOT, BiomeDictionary.Type.MAGICAL),
DEEP(HiveType.DEEP, 5.0f, new HiveGenUnderground(10, 15, 5), true,
BiomeDictionary.Type.HILLS, BiomeDictionary.Type.MOUNTAIN, BiomeDictionary.Type.MAGICAL) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.redstoneGen.generateVein(world, random, x + 1, y, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x - 1, y, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y + 1, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y - 1, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z + 1, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z - 1, 5);
}
},
INFERNAL(HiveType.INFERNAL, 50.0f, new HiveGenNether(0, 175, 6), true,
BiomeDictionary.Type.NETHER) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.netherQuartzGen.generateVein(world, random, x + 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x - 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y + 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y - 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z + 1, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z - 1, 4);
}
},
INFERNAL_OVERWORLD(HiveType.INFERNAL, 0.95f, new HiveGenUnderground(5, 13, 6), true,
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.HOT) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.glowstoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(4) + 1);
CURIOUS(
HiveType.CURIOUS,
3.0f,
HiveManager.genHelper.tree(),
false,
BiomeDictionary.Type.FOREST,
BiomeDictionary.Type.PLAINS,
BiomeDictionary.Type.HILLS),
UNUSUAL(
HiveType.UNUSUAL,
1.0f,
HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass),
false,
BiomeDictionary.Type.PLAINS,
BiomeDictionary.Type.MOUNTAIN,
BiomeDictionary.Type.HILLS,
BiomeDictionary.Type.RIVER),
RESONANT(
HiveType.RESONANT,
0.9f,
HiveManager.genHelper.ground(Blocks.sand, Blocks.sandstone),
false,
BiomeDictionary.Type.SANDY,
BiomeDictionary.Type.MESA,
BiomeDictionary.Type.HOT,
BiomeDictionary.Type.MAGICAL),
DEEP(
HiveType.DEEP,
5.0f,
new HiveGenUnderground(10, 15, 5),
true,
BiomeDictionary.Type.HILLS,
BiomeDictionary.Type.MOUNTAIN,
BiomeDictionary.Type.MAGICAL) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.redstoneGen.generateVein(world, random, x + 1, y, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x - 1, y, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y + 1, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y - 1, z, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z + 1, 5);
FeatureOreVein.redstoneGen.generateVein(world, random, x, y, z - 1, 5);
}
},
INFERNAL(HiveType.INFERNAL, 50.0f, new HiveGenNether(0, 175, 6), true, BiomeDictionary.Type.NETHER) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.netherQuartzGen.generateVein(world, random, x + 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x - 1, y, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y + 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y - 1, z, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z + 1, 4);
FeatureOreVein.netherQuartzGen.generateVein(world, random, x, y, z - 1, 4);
}
},
INFERNAL_OVERWORLD(
HiveType.INFERNAL,
0.95f,
new HiveGenUnderground(5, 13, 6),
true,
BiomeDictionary.Type.MAGICAL,
BiomeDictionary.Type.HOT) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.glowstoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(4) + 1);
if (BlockUtil.canBlockReplaceAt(world, x, y + 1, z, Blocks.stone)) {
world.setBlock(x, y + 1, z, Blocks.glowstone, 0, 3);
}
if (BlockUtil.canBlockReplaceAt(world, x, y + 1, z, Blocks.stone)) {
world.setBlock(x, y + 1, z, Blocks.glowstone, 0, 3);
}
if (BlockUtil.canBlockReplaceAt(world, x, y - 1, z, Blocks.stone)) {
world.setBlock(x, y - 1, z, Blocks.glowstone, 0, 3);
}
if (BlockUtil.canBlockReplaceAt(world, x, y - 1, z, Blocks.stone)) {
world.setBlock(x, y - 1, z, Blocks.glowstone, 0, 3);
}
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(4) + 1);
}
},
OBLIVION(HiveType.OBLIVION, 20.0f, new HiveGenOblivion(), true,
BiomeDictionary.Type.END) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
int obsidianSpikeHeight = world.rand.nextInt(8) + 3;
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(4) + 1);
FeatureOreVein.glowstoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(4) + 1);
}
},
OBLIVION(HiveType.OBLIVION, 20.0f, new HiveGenOblivion(), true, BiomeDictionary.Type.END) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
int obsidianSpikeHeight = world.rand.nextInt(8) + 3;
for (int i = 1; i < obsidianSpikeHeight && y - i > 0; ++i) {
world.setBlock(x, y - i, z, Blocks.obsidian, 0, 2);
}
}
},
OBLIVION_OVERWORLD(HiveType.OBLIVION, 0.87f, new HiveGenUnderground(5, 5, 5), true,
BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.COLD) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
for (int i = 1; i < obsidianSpikeHeight && y - i > 0; ++i) {
world.setBlock(x, y - i, z, Blocks.obsidian, 0, 2);
}
}
},
OBLIVION_OVERWORLD(
HiveType.OBLIVION,
0.87f,
new HiveGenUnderground(5, 5, 5),
true,
BiomeDictionary.Type.MAGICAL,
BiomeDictionary.Type.COLD) {
@Override
public void postGen(World world, int x, int y, int z) {
super.postGen(world, x, y, z);
Random random = world.rand;
FeatureOreVein.endStoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y + 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y - 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(6) + 1);
}
};
FeatureOreVein.endStoneGen.generateVein(world, random, x + 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x - 1, y, z, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y + 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y - 1, z, world.rand.nextInt(3) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z + 1, world.rand.nextInt(6) + 1);
FeatureOreVein.endStoneGen.generateVein(world, random, x, y, z - 1, world.rand.nextInt(6) + 1);
}
};
private static boolean logSpawns = Config.logHiveSpawns;
private static boolean logSpawns = Config.logHiveSpawns;
private final HiveType hiveType;
private final float genChance;
private final List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
private final IHiveGen hiveGen;
private final boolean spawnsIgnoreClimate;
private HiveDescription(HiveType type, float chance, IHiveGen genType, boolean ignoreClimate, BiomeDictionary.Type ... goodBiomeTypes) {
hiveType = type;
genChance = chance;
hiveGen = genType;
spawnsIgnoreClimate = ignoreClimate;
for (BiomeDictionary.Type biomeType : goodBiomeTypes) {
biomes.add(biomeType);
}
}
private final HiveType hiveType;
private final float genChance;
private final List<BiomeDictionary.Type> biomes = new ArrayList<BiomeDictionary.Type>();
private final IHiveGen hiveGen;
private final boolean spawnsIgnoreClimate;
@Override
public IHiveGen getHiveGen()
{
return hiveGen;
}
private HiveDescription(
HiveType type,
float chance,
IHiveGen genType,
boolean ignoreClimate,
BiomeDictionary.Type... goodBiomeTypes) {
hiveType = type;
genChance = chance;
hiveGen = genType;
spawnsIgnoreClimate = ignoreClimate;
for (BiomeDictionary.Type biomeType : goodBiomeTypes) {
biomes.add(biomeType);
}
}
@Override
public Block getBlock()
{
return Config.hive;
}
@Override
public IHiveGen getHiveGen() {
return hiveGen;
}
@Override
public int getMeta()
{
return hiveType.ordinal();
}
@Override
public Block getBlock() {
return Config.hive;
}
@Override
public boolean isGoodBiome(BiomeGenBase biome)
{
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
for (BiomeDictionary.Type type : types)
{
if (biomes.contains(type))
{
return true;
}
}
@Override
public int getMeta() {
return hiveType.ordinal();
}
return false;
}
@Override
public boolean isGoodBiome(BiomeGenBase biome) {
BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome);
for (BiomeDictionary.Type type : types) {
if (biomes.contains(type)) {
return true;
}
}
@Override
public boolean isGoodHumidity(EnumHumidity humidity)
{
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInHumidity(humidity);
}
return false;
}
@Override
public boolean isGoodTemperature(EnumTemperature temperature)
{
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInTemperature(temperature);
}
@Override
public boolean isGoodHumidity(EnumHumidity humidity) {
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInHumidity(humidity);
}
@Override
public float getGenChance()
{
return genChance;
}
@Override
public boolean isGoodTemperature(EnumTemperature temperature) {
return spawnsIgnoreClimate || hiveType.getOccupant().canWorkInTemperature(temperature);
}
@Override
public void postGen(World world, int x, int y, int z)
{
if (logSpawns)
{
LogHelper.info("Spawned " + this.toString().toLowerCase(Locale.ENGLISH) + " hive at: X " + x + ", Y: " + y + ", Z: " + z);
}
}
@Override
public float getGenChance() {
return genChance;
}
@Override
public void postGen(World world, int x, int y, int z) {
if (logSpawns) {
LogHelper.info("Spawned " + this.toString().toLowerCase(Locale.ENGLISH) + " hive at: X " + x + ", Y: " + y
+ ", Z: " + z);
}
}
}
+54 -65
View File
@@ -1,77 +1,66 @@
package magicbees.bees;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.item.ItemStack;
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 java.util.ArrayList;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class HiveDrop implements IHiveDrop
{
private IAllele[] template;
private int chance;
private ItemStack[] bonus;
private float ignoblePercent = 0f;
public HiveDrop(IAllele[] beeTemplate, ItemStack[] bonusDrops, int dropChance)
{
this.template = beeTemplate;
this.bonus = bonusDrops;
this.chance = dropChance;
}
public HiveDrop setIgnoblePercentage(float f)
{
this.ignoblePercent = f;
return this;
}
private IBee getBee(World w)
{
IBee bee = BeeManager.beeRoot.getBee(w, BeeManager.beeRoot.templateAsGenome(this.template));
if (w.rand.nextFloat() < this.ignoblePercent)
{
bee.setIsNatural(false);
}
return bee;
}
public class HiveDrop implements IHiveDrop {
private IAllele[] template;
private int chance;
private ItemStack[] bonus;
private float ignoblePercent = 0f;
@Override
public ItemStack getPrincess(World world, int x, int y, int z, int fortune)
{
return BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.PRINCESS.ordinal());
}
public HiveDrop(IAllele[] beeTemplate, ItemStack[] bonusDrops, int dropChance) {
this.template = beeTemplate;
this.bonus = bonusDrops;
this.chance = dropChance;
}
@Override
public Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> value = new ArrayList<ItemStack>(1);
value.add(BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.DRONE.ordinal()));
return value;
}
public HiveDrop setIgnoblePercentage(float f) {
this.ignoblePercent = f;
@Override
public Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune)
{
ArrayList<ItemStack> value = new ArrayList<ItemStack>(bonus.length);
for (int i = 0; i < bonus.length; ++i)
{
value.add(bonus[i].copy());
}
return value;
}
return this;
}
@Override
public int getChance(World world, int x, int y, int z)
{
return this.chance;
}
private IBee getBee(World w) {
IBee bee = BeeManager.beeRoot.getBee(w, BeeManager.beeRoot.templateAsGenome(this.template));
if (w.rand.nextFloat() < this.ignoblePercent) {
bee.setIsNatural(false);
}
return bee;
}
@Override
public ItemStack getPrincess(World world, int x, int y, int z, int fortune) {
return BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.PRINCESS.ordinal());
}
@Override
public Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune) {
ArrayList<ItemStack> value = new ArrayList<ItemStack>(1);
value.add(BeeManager.beeRoot.getMemberStack(getBee(world), EnumBeeType.DRONE.ordinal()));
return value;
}
@Override
public Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune) {
ArrayList<ItemStack> value = new ArrayList<ItemStack>(bonus.length);
for (int i = 0; i < bonus.length; ++i) {
value.add(bonus[i].copy());
}
return value;
}
@Override
public int getChance(World world, int x, int y, int z) {
return this.chance;
}
}
@@ -1,49 +1,59 @@
package magicbees.bees;
import net.minecraft.world.World;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.MoonPhase;
import net.minecraft.world.World;
// There is a bonus to this mutation during moon phases...
public class MoonPhaseMutationBonus implements IMutationCondition {
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
private final float mutationBonus;
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
private final float mutationBonus;
public MoonPhaseMutationBonus(MoonPhase phase, float bonus) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
this.mutationBonus = bonus;
}
public MoonPhaseMutationBonus(MoonPhase phase, float bonus) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
this.mutationBonus = bonus;
}
public MoonPhaseMutationBonus(MoonPhase start, MoonPhase end, float bonus) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
this.mutationBonus = bonus;
}
public MoonPhaseMutationBonus(MoonPhase start, MoonPhase end, float bonus) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
this.mutationBonus = bonus;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return this.mutationBonus;
}
return 1;
}
@Override
public float getChance(
World world,
int x,
int y,
int z,
IAllele allele0,
IAllele allele1,
IGenome genome0,
IGenome genome1,
IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return this.mutationBonus;
}
return 1;
}
@Override
public String getDescription() {
if (this.moonPhaseStart != this.moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.bonusPhase"),
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
} else {
return String.format(LocalizationManager.getLocalizedString("research.bonusPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
@Override
public String getDescription() {
if (this.moonPhaseStart != this.moonPhaseEnd) {
return String.format(
LocalizationManager.getLocalizedString("research.bonusPhase"),
moonPhaseStart.getLocalizedNameAlt(),
moonPhaseEnd.getLocalizedNameAlt());
} else {
return String.format(
LocalizationManager.getLocalizedString("research.bonusPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
}
@@ -1,46 +1,55 @@
package magicbees.bees;
import net.minecraft.world.World;
import forestry.api.core.IClimateProvider;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.MoonPhase;
import net.minecraft.world.World;
public class MoonPhaseMutationRestriction implements IMutationCondition {
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
public MoonPhaseMutationRestriction(MoonPhase phase) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
}
public MoonPhaseMutationRestriction(MoonPhase phase) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
}
public MoonPhaseMutationRestriction(MoonPhase start, MoonPhase end) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
}
public MoonPhaseMutationRestriction(MoonPhase start, MoonPhase end) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return 1;
}
return 0;
}
@Override
public float getChance(
World world,
int x,
int y,
int z,
IAllele allele0,
IAllele allele1,
IGenome genome0,
IGenome genome1,
IClimateProvider climate) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return 1;
}
return 0;
}
@Override
public String getDescription() {
if (moonPhaseStart != moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.requiresPhase"),
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
}
else {
return String.format(LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
@Override
public String getDescription() {
if (moonPhaseStart != moonPhaseEnd) {
return String.format(
LocalizationManager.getLocalizedString("research.requiresPhase"),
moonPhaseStart.getLocalizedNameAlt(),
moonPhaseEnd.getLocalizedNameAlt());
} else {
return String.format(
LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
}
@@ -1,87 +1,90 @@
package magicbees.bees.allele.effect;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import java.util.HashMap;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
public class AlleleEffectCrumbling extends AlleleEffect {
private static HashMap<ItemStack, ItemStack> crumbleMap = new HashMap<ItemStack, ItemStack>();
private static HashMap<ItemStack, ItemStack> crumbleMap = new HashMap<ItemStack, ItemStack>();
public static void addPairToMap(ItemStack source, ItemStack target) {
boolean add = true;
for (ItemStack i : crumbleMap.keySet()) {
if (OreDictionary.itemMatches(i, source, false)) {
add = false;
break;
}
}
if (add) {
crumbleMap.put(source, target);
}
}
public static void addPairToMap(ItemStack source, ItemStack target) {
boolean add = true;
for (ItemStack i : crumbleMap.keySet()) {
if (OreDictionary.itemMatches(i, source, false)) {
add = false;
break;
}
}
if (add) {
crumbleMap.put(source, target);
}
}
public AlleleEffectCrumbling(String id, boolean isDominant) {
super(id, isDominant, 600);
public AlleleEffectCrumbling(String id, boolean isDominant) {
super(id, isDominant, 600);
addPairToMap(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
addPairToMap(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone));
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Blocks.stonebrick, 1, 2));
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 2), new ItemStack(Blocks.stonebrick, 1, 1));
addPairToMap(new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall, 1, 1));
addPairToMap(new ItemStack(Blocks.gravel), new ItemStack(Blocks.sand));
}
addPairToMap(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
addPairToMap(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone));
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Blocks.stonebrick, 1, 2));
addPairToMap(new ItemStack(Blocks.stonebrick, 1, 2), new ItemStack(Blocks.stonebrick, 1, 1));
addPairToMap(new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall, 1, 1));
addPairToMap(new ItemStack(Blocks.gravel), new ItemStack(Blocks.sand));
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
// Get random coords within territory
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
// Get random coords within territory
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
Block block = world.getBlock(xCoord, yCoord, zCoord);
if (block != null) {
ItemStack source = new ItemStack(block, 1, world.getBlockMetadata(xCoord, yCoord, zCoord));
for (ItemStack key : crumbleMap.keySet()) {
if (OreDictionary.itemMatches(source, key, false)) {
ItemStack target = crumbleMap.get(key);
world.setBlock(xCoord, yCoord, zCoord, Block.getBlockFromItem(target.getItem()), target.getItemDamage(), 2);
Block block = world.getBlock(xCoord, yCoord, zCoord);
if (block != null) {
ItemStack source = new ItemStack(block, 1, world.getBlockMetadata(xCoord, yCoord, zCoord));
for (ItemStack key : crumbleMap.keySet()) {
if (OreDictionary.itemMatches(source, key, false)) {
ItemStack target = crumbleMap.get(key);
world.setBlock(
xCoord,
yCoord,
zCoord,
Block.getBlockFromItem(target.getItem()),
target.getItemDamage(),
2);
break;
}
}
}
break;
}
}
}
storedData.setInteger(0, 0);
return storedData;
}
storedData.setInteger(0, 0);
return storedData;
}
}
@@ -1,41 +1,37 @@
package magicbees.bees.allele.effect;
import java.util.List;
import magicbees.bees.AlleleEffect;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class AlleleEffectCure extends AlleleEffect {
public AlleleEffectCure(String id, boolean isDominant) {
super(id, isDominant, 200);
}
public AlleleEffectCure(String id, boolean isDominant) {
super(id, isDominant, 200);
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null) {
storedData = new EffectData(1, 0, 0);
}
return storedData;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null) {
storedData = new EffectData(1, 0, 0);
}
return storedData;
}
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
List<EntityPlayer> entityList = this.getEntitiesWithinRange(genome, housing, EntityPlayer.class);
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
List<EntityPlayer> entityList = this.getEntitiesWithinRange(genome, housing, EntityPlayer.class);
for (EntityPlayer player : entityList) {
player.curePotionEffects(new ItemStack(Items.milk_bucket));
}
storedData.setInteger(0, 0);
return storedData;
}
for (EntityPlayer player : entityList) {
player.curePotionEffects(new ItemStack(Items.milk_bucket));
}
storedData.setInteger(0, 0);
return storedData;
}
}
@@ -1,61 +1,60 @@
package magicbees.bees.allele.effect;
import static magicbees.main.utils.compat.thaumcraft.NodeHelper.getWeightedRandomAspect;
import static magicbees.main.utils.compat.thaumcraft.NodeHelper.updateNode;
import cpw.mods.fml.common.Optional;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import gregtech.api.interfaces.IAlleleBeeAcceleratableEffect;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cpw.mods.fml.common.Optional;
import gregtech.api.interfaces.IAlleleBeeAcceleratableEffect;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import magicbees.main.Config;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.nodes.INode;
import static magicbees.main.utils.compat.thaumcraft.NodeHelper.getWeightedRandomAspect;
import static magicbees.main.utils.compat.thaumcraft.NodeHelper.updateNode;
@Optional.Interface(iface = "gregtech.api.interfaces.IAlleleBeeAcceleratableEffect", modid = "gregtech")
public class AlleleEffectEmpowering extends AlleleEffect implements IAlleleBeeAcceleratableEffect {
public AlleleEffectEmpowering(String id, boolean isDominant) {
super(id, isDominant, 200);
combinable = true;
}
public AlleleEffectEmpowering(String id, boolean isDominant) {
super(id, isDominant, 200);
combinable = true;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (!(storedData instanceof EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (!(storedData instanceof EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = Math.max((int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range =
Math.max((int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.growNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle);
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
return storedData;
}
return storedData;
}
@Optional.Method(modid = "gregtech")
@Override
@@ -64,21 +63,20 @@ public class AlleleEffectEmpowering extends AlleleEffect implements IAlleleBeeAc
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = Math.max((int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
int range =
Math.max((int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
int idid = (int)did;
int idid = (int) did;
List<INode> nodes = new ArrayList<>(idid);
Collections.shuffle(chunks);
for(Chunk chunk : chunks) {
for (Chunk chunk : chunks) {
List<INode> l = NodeHelper.findNodesInChunkWithinRange(chunk, coords.posX, coords.posY, coords.posZ, range);
nodes.addAll(l);
idid -= l.size();
if(idid <= 0)
{
while(idid < 0)
{
if (idid <= 0) {
while (idid < 0) {
nodes.remove(0);
idid++;
}
@@ -86,15 +84,12 @@ public class AlleleEffectEmpowering extends AlleleEffect implements IAlleleBeeAc
}
}
if(nodes.isEmpty())
return storedData;
if (nodes.isEmpty()) return storedData;
did /= (float) nodes.size();
if(did < 1f)
did = 1f;
if (did < 1f) did = 1f;
for(INode node : nodes){
for (INode node : nodes) {
AspectList aspectsBase = node.getAspectsBase();
int randBase = Math.max(aspectsBase.visSize(), 1);
if (world.rand.nextInt(randBase) < 120) {
@@ -103,14 +98,13 @@ public class AlleleEffectEmpowering extends AlleleEffect implements IAlleleBeeAc
do {
aspectToAdd = getWeightedRandomAspect(world.rand);
++rollAttempts;
}
while (aspectsBase.getAmount(aspectToAdd) > (Config.thaumcraftNodeMaxSize -1) && rollAttempts < 20);
} while (aspectsBase.getAmount(aspectToAdd) > (Config.thaumcraftNodeMaxSize - 1) && rollAttempts < 20);
if (20 <= rollAttempts) {
continue;
}
short amount = (short)((int)did + world.rand.nextInt((int)(2f * did)));
short amount = (short) ((int) did + world.rand.nextInt((int) (2f * did)));
aspectsBase.add(aspectToAdd, amount);
node.getAspects().add(aspectToAdd, amount);
updateNode(node, world);
@@ -1,7 +1,10 @@
package magicbees.bees.allele.effect;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import magicbees.main.utils.BlockUtil;
@@ -10,41 +13,37 @@ import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import thaumcraft.api.nodes.NodeType;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
public class AlleleEffectNodeConversion extends AlleleEffect {
private NodeType targetType;
public AlleleEffectNodeConversion(String id, NodeType targetNodeType, boolean isDominant, int timeout) {
super(id, isDominant, timeout);
targetType = targetNodeType;
}
private NodeType targetType;
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
public AlleleEffectNodeConversion(String id, NodeType targetNodeType, boolean isDominant, int timeout) {
super(id, isDominant, timeout);
targetType = targetNodeType;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.convertNodeInRangeToType(chunks, world, coords.posX, coords.posY, coords.posZ, range, targetType)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
return storedData;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = (int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.convertNodeInRangeToType(
chunks, world, coords.posX, coords.posY, coords.posZ, range, targetType)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
return storedData;
}
}
@@ -1,46 +1,44 @@
package magicbees.bees.allele.effect;
import java.util.List;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
public class AlleleEffectNodeRepair extends AlleleEffect {
public AlleleEffectNodeRepair(String id, boolean isDominant) {
super(id, isDominant, 2);
}
public AlleleEffectNodeRepair(String id, boolean isDominant) {
super(id, isDominant, 2);
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.repairNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
return storedData;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = (int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.repairNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
return storedData;
}
}
@@ -7,18 +7,17 @@ import magicbees.bees.AlleleEffect;
public class AlleleEffectPlaceholder extends AlleleEffect {
public AlleleEffectPlaceholder(String id, boolean isDominant) {
super(id, isDominant, 100000);
}
public AlleleEffectPlaceholder(String id, boolean isDominant) {
super(id, isDominant, 100000);
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
return storedData;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome,IEffectData storedData, IBeeHousing housing) {
return storedData;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
return storedData;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
return storedData;
}
}
@@ -1,64 +1,61 @@
package magicbees.bees.allele.effect;
import java.util.List;
import magicbees.bees.AlleleEffect;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
public class AlleleEffectPotion extends AlleleEffect {
private int potionId;
private int duration;
private boolean isMalicious;
private int potionId;
private int duration;
private boolean isMalicious;
public AlleleEffectPotion(String name, Potion potionApplied, int effectDuration, boolean isDominant) {
super(name, isDominant, 200);
this.potionId = potionApplied.id;
this.duration = 20 * effectDuration;
this.isMalicious = false;
}
public AlleleEffectPotion(String name, Potion potionApplied, int effectDuration, boolean isDominant) {
super(name, isDominant, 200);
this.potionId = potionApplied.id;
this.duration = 20 * effectDuration;
this.isMalicious = false;
}
public AlleleEffectPotion setMalicious() {
this.isMalicious = true;
public AlleleEffectPotion setMalicious() {
this.isMalicious = true;
return this;
}
return this;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null) {
storedData = new EffectData(1, 0, 0);
}
return storedData;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null) {
storedData = new EffectData(1, 0, 0);
}
return storedData;
}
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
List<EntityLivingBase> entityList = this.getEntitiesWithinRange(genome, housing, EntityLivingBase.class);
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
List<EntityLivingBase> entityList = this.getEntitiesWithinRange(genome, housing, EntityLivingBase.class);
for (EntityLivingBase e : entityList) {
if (this.isMalicious) {
int armorPieces = BeeManager.armorApiaristHelper.wearsItems(e, getUID(), true);
int finalDuration = this.duration / 4 * (4 - armorPieces);
if (finalDuration > 0) {
e.addPotionEffect(new PotionEffect(this.potionId, finalDuration, 0));
}
} else {
if (e instanceof EntityPlayer) {
e.addPotionEffect(new PotionEffect(this.potionId, this.duration, 0));
}
}
}
storedData.setInteger(0, 0);
for (EntityLivingBase e : entityList) {
if (this.isMalicious) {
int armorPieces = BeeManager.armorApiaristHelper.wearsItems(e, getUID(), true);
int finalDuration = this.duration / 4 * (4 - armorPieces);
if (finalDuration > 0) {
e.addPotionEffect(new PotionEffect(this.potionId, finalDuration, 0));
}
} else {
if (e instanceof EntityPlayer) {
e.addPotionEffect(new PotionEffect(this.potionId, this.duration, 0));
}
}
}
storedData.setInteger(0, 0);
return storedData;
}
return storedData;
}
}
@@ -1,47 +1,45 @@
package magicbees.bees.allele.effect;
import java.util.List;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
public class AlleleEffectRecharge extends AlleleEffect {
public AlleleEffectRecharge(String id, boolean isDominant) {
super(id, isDominant, 20);
combinable = true;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
public AlleleEffectRecharge(String id, boolean isDominant) {
super(id, isDominant, 20);
combinable = true;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = (int) Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
if (NodeHelper.rechargeNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle);
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
return storedData;
}
return storedData;
}
}
@@ -1,10 +1,12 @@
package magicbees.bees.allele.effect;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import java.util.List;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@@ -12,175 +14,185 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
public class AlleleEffectSpawnMob extends AlleleEffect {
protected boolean aggosOnPlayer;
protected boolean spawnsWhilePlayerNear;
protected String alternateMob;
protected String mobName;
protected String mobSound;
protected int chanceToSpawn;
protected int maxMobsInArea;
protected boolean aggosOnPlayer;
protected boolean spawnsWhilePlayerNear;
protected String alternateMob;
protected String mobName;
protected String mobSound;
protected int chanceToSpawn;
protected int maxMobsInArea;
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn) {
this(id, isDominant, mobToSpawn, null);
}
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn) {
this(id, isDominant, mobToSpawn, null);
}
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn, String mobSoundFx) {
super(id, isDominant, 200);
this.aggosOnPlayer = false;
this.mobName = mobToSpawn;
this.chanceToSpawn = 100;
this.maxMobsInArea = 6;
this.mobSound = mobSoundFx;
}
public AlleleEffectSpawnMob(String id, boolean isDominant, String mobToSpawn, String mobSoundFx) {
super(id, isDominant, 200);
this.aggosOnPlayer = false;
this.mobName = mobToSpawn;
this.chanceToSpawn = 100;
this.maxMobsInArea = 6;
this.mobSound = mobSoundFx;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
// Throttle; Ready to spawn
storedData = new EffectData(1, 1, 0);
}
return storedData;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
// Throttle; Ready to spawn
storedData = new EffectData(1, 1, 0);
}
return storedData;
}
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
// Check if we're ready to spawn the mob.
boolean didSpawn = false;
if (storedData.getBoolean(0)) {
World w = housing.getWorld();
int roll = w.rand.nextInt(100);
if (roll <= chanceToSpawn) {
if (spawnsWhilePlayerNear) {
EntityPlayer target = findPlayerTarget(genome, housing);
// Let's spawn a mob. =D
if (target != null) {
didSpawn = spawnMob(genome, target, w, housing, false);
} else if (alternateMob != null) {
didSpawn = spawnMob(genome, null, w, housing, true);
}
} else {
storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true));
}
} else {
playMobLiveSound(genome, housing, w);
didSpawn = true;
}
if (didSpawn) {
storedData.setBoolean(0, !didSpawn);
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
}
else {
storedData.setBoolean(0, true);
}
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
// Check if we're ready to spawn the mob.
boolean didSpawn = false;
if (storedData.getBoolean(0)) {
World w = housing.getWorld();
return storedData;
}
int roll = w.rand.nextInt(100);
private void playMobLiveSound(IBeeGenome genome, IBeeHousing housing, World w) {
if (mobSound != null && w.rand.nextInt(100) < 35) {
ChunkCoordinates coords = housing.getCoordinates();
if (roll <= chanceToSpawn) {
if (spawnsWhilePlayerNear) {
EntityPlayer target = findPlayerTarget(genome, housing);
int range = genome.getTerritory()[0];
double x = coords.posX + w.rand.nextDouble() * (range * 2) - range;
range = genome.getTerritory()[1];
double y = coords.posY + w.rand.nextDouble() * (range * 2) - range;
range = genome.getTerritory()[2];
double z = coords.posZ + w.rand.nextDouble() * (range * 2) - range;
w.playSoundEffect(x, y, z, this.mobSound, 0.5f, (w.rand.nextFloat() - w.rand.nextFloat()) * 0.2f + 1.0f);
}
}
// Let's spawn a mob. =D
if (target != null) {
didSpawn = spawnMob(genome, target, w, housing, false);
} else if (alternateMob != null) {
didSpawn = spawnMob(genome, null, w, housing, true);
}
} else {
storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true));
}
} else {
playMobLiveSound(genome, housing, w);
didSpawn = true;
}
private EntityPlayer findPlayerTarget(IBeeGenome genome, IBeeHousing housing) {
List<EntityPlayer> entities = getEntitiesWithinRange(genome, housing, EntityPlayer.class);
for (EntityPlayer e : entities) {
// Check for wearing armor & cancel
// Full armor suit is treated as "invisible."
if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) e, getUID(), true) < 4) {
return e;
}
}
return null;
}
if (didSpawn) {
storedData.setBoolean(0, !didSpawn);
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
} else {
storedData.setBoolean(0, true);
}
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) {
boolean spawnedFlag = false;
return storedData;
}
EntityLiving mob;
if (spawnAlternate && alternateMob != null) {
mob = (EntityLiving) EntityList.createEntityByName(alternateMob, world);
} else {
mob = (EntityLiving) EntityList.createEntityByName(mobName, world);
}
private void playMobLiveSound(IBeeGenome genome, IBeeHousing housing, World w) {
if (mobSound != null && w.rand.nextInt(100) < 35) {
ChunkCoordinates coords = housing.getCoordinates();
if (mob != null) {
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
int range = genome.getTerritory()[0];
double x = coords.posX + w.rand.nextDouble() * (range * 2) - range;
range = genome.getTerritory()[1];
double y = coords.posY + w.rand.nextDouble() * (range * 2) - range;
range = genome.getTerritory()[2];
double z = coords.posZ + w.rand.nextDouble() * (range * 2) - range;
w.playSoundEffect(x, y, z, this.mobSound, 0.5f, (w.rand.nextFloat() - w.rand.nextFloat()) * 0.2f + 1.0f);
}
}
int entitiesCount = world.getEntitiesWithinAABB(mob.getClass(),
AxisAlignedBB.getBoundingBox((int) pos[0], (int) pos[1], (int) pos[2],
(int) pos[0] + 1, (int) pos[1] + 1, (int) pos[2] + 1)
.expand(8.0D,4.0D, 8.0D)).size();
private EntityPlayer findPlayerTarget(IBeeGenome genome, IBeeHousing housing) {
List<EntityPlayer> entities = getEntitiesWithinRange(genome, housing, EntityPlayer.class);
for (EntityPlayer e : entities) {
// Check for wearing armor & cancel
// Full armor suit is treated as "invisible."
if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) e, getUID(), true)
< 4) {
return e;
}
}
return null;
}
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
protected boolean spawnMob(
IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) {
boolean spawnedFlag = false;
if (entitiesCount < maxMobsInArea && mob.getCanSpawnHere()) {
spawnedFlag = world.spawnEntityInWorld(mob);
if (aggosOnPlayer && player != null) {
if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true) < 4) {
// Protect fully suited player from initial murder intent.
mob.setAttackTarget(player);
}
}
}
}
EntityLiving mob;
if (spawnAlternate && alternateMob != null) {
mob = (EntityLiving) EntityList.createEntityByName(alternateMob, world);
} else {
mob = (EntityLiving) EntityList.createEntityByName(mobName, world);
}
return spawnedFlag;
}
if (mob != null) {
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
public AlleleEffectSpawnMob setSpawnsOnPlayerNear(String alternateMobToSpawn) {
spawnsWhilePlayerNear = true;
alternateMob = alternateMobToSpawn;
return this;
}
int entitiesCount = world.getEntitiesWithinAABB(
mob.getClass(),
AxisAlignedBB.getBoundingBox(
(int) pos[0],
(int) pos[1],
(int) pos[2],
(int) pos[0] + 1,
(int) pos[1] + 1,
(int) pos[2] + 1)
.expand(8.0D, 4.0D, 8.0D))
.size();
public AlleleEffectSpawnMob setAggrosPlayerOnSpawn() {
aggosOnPlayer = true;
return this;
}
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
public AlleleEffectSpawnMob setThrottle(int val) {
throttle = val;
return this;
}
if (entitiesCount < maxMobsInArea && mob.getCanSpawnHere()) {
spawnedFlag = world.spawnEntityInWorld(mob);
if (aggosOnPlayer && player != null) {
if (forestry.api.apiculture.BeeManager.armorApiaristHelper.wearsItems(
(EntityLivingBase) player, getUID(), true)
< 4) {
// Protect fully suited player from initial murder intent.
mob.setAttackTarget(player);
}
}
}
}
public AlleleEffectSpawnMob setChanceToSpawn(int value) {
chanceToSpawn = value;
return this;
}
return spawnedFlag;
}
public AlleleEffectSpawnMob setMaxMobsInSpawnZone(int value) {
maxMobsInArea = value;
return this;
}
public AlleleEffectSpawnMob setSpawnsOnPlayerNear(String alternateMobToSpawn) {
spawnsWhilePlayerNear = true;
alternateMob = alternateMobToSpawn;
return this;
}
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
public AlleleEffectSpawnMob setAggrosPlayerOnSpawn() {
aggosOnPlayer = true;
return this;
}
double pos[] = new double[3];
pos[0] = coords.posX + (world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[0] / 2);
pos[1] = coords.posY + world.rand.nextInt(3) - 1;
pos[2] = coords.posZ + (world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[2] / 2);
return pos;
}
public AlleleEffectSpawnMob setThrottle(int val) {
throttle = val;
return this;
}
public AlleleEffectSpawnMob setChanceToSpawn(int value) {
chanceToSpawn = value;
return this;
}
public AlleleEffectSpawnMob setMaxMobsInSpawnZone(int value) {
maxMobsInArea = value;
return this;
}
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
double pos[] = new double[3];
pos[0] = coords.posX
+ (world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f))
- bee.getTerritory()[0] / 2);
pos[1] = coords.posY + world.rand.nextInt(3) - 1;
pos[2] = coords.posZ
+ (world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f))
- bee.getTerritory()[2] / 2);
return pos;
}
}
@@ -1,87 +1,90 @@
package magicbees.bees.allele.effect;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
public class AlleleEffectSpawnMobWeighted extends AlleleEffect {
private String[] entityNames;
private int[] spawnChance;
private String[] entityNames;
private int[] spawnChance;
public AlleleEffectSpawnMobWeighted(String id, boolean isDominant, int throttle, String[] mobs, int[] chance) {
super(id, isDominant, throttle);
if (mobs.length != chance.length) {
throw new IllegalArgumentException("Array lengths must be equal!");
}
this.entityNames = mobs;
this.spawnChance = chance;
}
public AlleleEffectSpawnMobWeighted(String id, boolean isDominant, int throttle, String[] mobs, int[] chance) {
super(id, isDominant, throttle);
if (mobs.length != chance.length) {
throw new IllegalArgumentException("Array lengths must be equal!");
}
this.entityNames = mobs;
this.spawnChance = chance;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new EffectData(1, 0, 0);
}
return storedData;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new EffectData(1, 0, 0);
}
return storedData;
}
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
if (this.spawnMob(genome, housing)) {
storedData.setInteger(0, 0);
}
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
if (this.spawnMob(genome, housing)) {
storedData.setInteger(0, 0);
}
return storedData;
}
return storedData;
}
protected boolean spawnMob(IBeeGenome genome, IBeeHousing housing) {
boolean flag = false;
protected boolean spawnMob(IBeeGenome genome, IBeeHousing housing) {
boolean flag = false;
World w = housing.getWorld();
int roll = 0;
World w = housing.getWorld();
int roll = 0;
for (int i = 0; i < this.spawnChance.length && !flag; ++i) {
roll = 100 - w.rand.nextInt(100) + 1;
if (roll < this.spawnChance[i]) {
Entity mob = EntityList.createEntityByName(this.entityNames[i], w);
if (mob != null) {
flag = true;
double[] coords = this.randomMobSpawnCoords(w, genome, housing);
mob.setPositionAndRotation(coords[0], coords[1], coords[2], w.rand.nextFloat() * 360f, 0f);
if (mob instanceof EntityLiving) {
if (((EntityLiving) mob).getCanSpawnHere()) {
w.spawnEntityInWorld(mob);
}
} else {
w.spawnEntityInWorld(mob);
}
}
}
}
for (int i = 0; i < this.spawnChance.length && !flag; ++i) {
roll = 100 - w.rand.nextInt(100) + 1;
if (roll < this.spawnChance[i]) {
Entity mob = EntityList.createEntityByName(this.entityNames[i], w);
if (mob != null) {
flag = true;
double[] coords = this.randomMobSpawnCoords(w, genome, housing);
return flag;
}
mob.setPositionAndRotation(coords[0], coords[1], coords[2], w.rand.nextFloat() * 360f, 0f);
if (mob instanceof EntityLiving) {
if (((EntityLiving) mob).getCanSpawnHere()) {
w.spawnEntityInWorld(mob);
}
} else {
w.spawnEntityInWorld(mob);
}
}
}
}
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
return flag;
}
double pos[] = new double[3];
pos[0] = coords.posX + world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[0] / 2;
pos[1] = coords.posY + world.rand.nextDouble() * (bee.getTerritory()[1] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[1] / 2;
pos[2] = coords.posZ + world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f)) - bee.getTerritory()[2] / 2;
return pos;
}
protected double[] randomMobSpawnCoords(World world, IBeeGenome bee, IBeeHousing housing) {
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
double pos[] = new double[3];
pos[0] = coords.posX
+ world.rand.nextDouble() * (bee.getTerritory()[0] * beeModifier.getTerritoryModifier(bee, 1f))
- bee.getTerritory()[0] / 2;
pos[1] = coords.posY
+ world.rand.nextDouble() * (bee.getTerritory()[1] * beeModifier.getTerritoryModifier(bee, 1f))
- bee.getTerritory()[1] / 2;
pos[2] = coords.posZ
+ world.rand.nextDouble() * (bee.getTerritory()[2] * beeModifier.getTerritoryModifier(bee, 1f))
- bee.getTerritory()[2] / 2;
return pos;
}
}
@@ -1,7 +1,9 @@
package magicbees.bees.allele.effect;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import java.lang.reflect.Field;
import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
@@ -10,68 +12,70 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
public class AlleleEffectSpawnWisp extends AlleleEffectSpawnMob {
private byte[] wispTypes = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 23, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47
};
private byte[] wispTypes = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47
};
public AlleleEffectSpawnWisp(String id, boolean isDominant, String mobToSpawn, String soundToPlay) {
super(id, isDominant, mobToSpawn, soundToPlay);
}
public AlleleEffectSpawnWisp(String id, boolean isDominant, String mobToSpawn, String soundToPlay) {
super(id, isDominant, mobToSpawn, soundToPlay);
}
@Override
protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) {
boolean spawnedFlag = false;
@Override
protected boolean spawnMob(
IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) {
boolean spawnedFlag = false;
EntityLiving mob;
if (spawnAlternate && this.alternateMob != null) {
mob = (EntityLiving) EntityList.createEntityByName(this.alternateMob, world);
} else {
mob = (EntityLiving) EntityList.createEntityByName(this.mobName, world);
}
EntityLiving mob;
if (spawnAlternate && this.alternateMob != null) {
mob = (EntityLiving) EntityList.createEntityByName(this.alternateMob, world);
} else {
mob = (EntityLiving) EntityList.createEntityByName(this.mobName, world);
}
if (mob != null) {
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
if (mob != null) {
double pos[] = this.randomMobSpawnCoords(world, bee, housing);
int entitiesCount = world.getEntitiesWithinAABB(
mob.getClass(),
AxisAlignedBB.getBoundingBox((int) pos[0], (int) pos[1], (int) pos[2], (int) pos[0] + 1, (int) pos[1] + 1, (int) pos[2] + 1).expand(8.0D,
4.0D, 8.0D)).size();
int entitiesCount = world.getEntitiesWithinAABB(
mob.getClass(),
AxisAlignedBB.getBoundingBox(
(int) pos[0],
(int) pos[1],
(int) pos[2],
(int) pos[0] + 1,
(int) pos[1] + 1,
(int) pos[2] + 1)
.expand(8.0D, 4.0D, 8.0D))
.size();
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f);
if (entitiesCount < this.maxMobsInArea && mob.getCanSpawnHere()) {
// Try some Reflection on TC code. This could be dangerous.
try {
Class<?> wispEntity = Class.forName(ThaumcraftHelper.Entity.WISP.getClassName());
Field type = wispEntity.getDeclaredField("type");
type.setByte(mob, wispTypes[world.rand.nextInt(wispTypes.length)]);
} catch (Exception e) { /*
* Last time I had a request to post
* error messages, I regretted it.
*/
}
if (entitiesCount < this.maxMobsInArea && mob.getCanSpawnHere()) {
// Try some Reflection on TC code. This could be dangerous.
try {
Class<?> wispEntity = Class.forName(ThaumcraftHelper.Entity.WISP.getClassName());
Field type = wispEntity.getDeclaredField("type");
type.setByte(mob, wispTypes[world.rand.nextInt(wispTypes.length)]);
} catch (Exception e) {
/*
* Last time I had a request to post
* error messages, I regretted it.
*/
}
spawnedFlag = world.spawnEntityInWorld(mob);
if (this.aggosOnPlayer && player != null) {
if (BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true) < 4) {
// Protect fully suited player from initial murder
// intent.
mob.setAttackTarget(player);
}
}
}
}
spawnedFlag = world.spawnEntityInWorld(mob);
if (this.aggosOnPlayer && player != null) {
if (BeeManager.armorApiaristHelper.wearsItems((EntityLivingBase) player, getUID(), true) < 4) {
// Protect fully suited player from initial murder
// intent.
mob.setAttackTarget(player);
}
}
}
}
return spawnedFlag;
}
return spawnedFlag;
}
}
@@ -1,55 +1,61 @@
package magicbees.bees.allele.effect;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeModifier;
import forestry.api.genetics.IEffectData;
import magicbees.bees.AlleleEffect;
import magicbees.bees.BeeManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
public class AlleleEffectTransmuting extends AlleleEffect {
private TransmutationEffectController transmutationController;
public AlleleEffectTransmuting(String id, boolean isDominant, TransmutationEffectController effectController, int timeoutBeeTicks) {
super(id, isDominant, timeoutBeeTicks);
this.transmutationController = effectController;
}
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
private TransmutationEffectController transmutationController;
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
public AlleleEffectTransmuting(
String id, boolean isDominant, TransmutationEffectController effectController, int timeoutBeeTicks) {
super(id, isDominant, timeoutBeeTicks);
this.transmutationController = effectController;
}
// Get random coords within territory
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
transmutationController.attemptTransmutations(world, biome,
new ItemStack(world.getBlock(xCoord, yCoord, zCoord), 1, world.getBlockMetadata(xCoord, yCoord, zCoord)), xCoord, yCoord, zCoord);
// Get random coords within territory
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
storedData.setInteger(0, 0);
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
return storedData;
}
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
transmutationController.attemptTransmutations(
world,
biome,
new ItemStack(
world.getBlock(xCoord, yCoord, zCoord), 1, world.getBlockMetadata(xCoord, yCoord, zCoord)),
xCoord,
yCoord,
zCoord);
storedData.setInteger(0, 0);
return storedData;
}
}
@@ -1,89 +1,70 @@
package magicbees.bees.allele.effect;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.genetics.IEffectData;
import net.minecraft.nbt.NBTTagCompound;
public class EffectData implements IEffectData
{
private int[] intData;
private boolean[] boolData;
private float[] floatData;
public EffectData(int intCount, int boolCount, int floatCount)
{
this.intData = new int[intCount];
this.boolData = new boolean[boolCount];
this.floatData = new float[floatCount];
}
public class EffectData implements IEffectData {
private int[] intData;
private boolean[] boolData;
private float[] floatData;
@Override
public void readFromNBT(NBTTagCompound nbttagcompound)
{
}
public EffectData(int intCount, int boolCount, int floatCount) {
this.intData = new int[intCount];
this.boolData = new boolean[boolCount];
this.floatData = new float[floatCount];
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound)
{
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {}
@Override
public void setInteger(int index, int val)
{
if (index >= 0 && index < this.intData.length)
{
this.intData[index] = val;
}
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {}
@Override
public void setFloat(int index, float val)
{
if (index >= 0 && index < this.floatData.length)
{
this.floatData[index] = val;
}
}
@Override
public void setInteger(int index, int val) {
if (index >= 0 && index < this.intData.length) {
this.intData[index] = val;
}
}
@Override
public void setBoolean(int index, boolean val)
{
if (index >= 0 && index < this.boolData.length)
{
this.boolData[index] = val;
}
}
@Override
public void setFloat(int index, float val) {
if (index >= 0 && index < this.floatData.length) {
this.floatData[index] = val;
}
}
@Override
public int getInteger(int index)
{
int val = 0;
if (index >= 0 && index < this.intData.length)
{
val = this.intData[index];
}
return val;
}
@Override
public void setBoolean(int index, boolean val) {
if (index >= 0 && index < this.boolData.length) {
this.boolData[index] = val;
}
}
@Override
public float getFloat(int index)
{
float val = 0f;
if (index >= 0 && index < this.floatData.length)
{
val = this.floatData[index];
}
return val;
}
@Override
public int getInteger(int index) {
int val = 0;
if (index >= 0 && index < this.intData.length) {
val = this.intData[index];
}
return val;
}
@Override
public boolean getBoolean(int index)
{
boolean val = false;
if (index >= 0 && index < this.boolData.length)
{
val = this.boolData[index];
}
return val;
}
@Override
public float getFloat(int index) {
float val = 0f;
if (index >= 0 && index < this.floatData.length) {
val = this.floatData[index];
}
return val;
}
@Override
public boolean getBoolean(int index) {
boolean val = false;
if (index >= 0 && index < this.boolData.length) {
val = this.boolData[index];
}
return val;
}
}
@@ -3,7 +3,6 @@ package magicbees.bees.allele.effect;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import magicbees.api.bees.ITransmutationEffectController;
import magicbees.api.bees.ITransmutationEffectLogic;
import magicbees.main.utils.LogHelper;
@@ -12,35 +11,35 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
public class TransmutationEffectController implements ITransmutationEffectController {
private List<ITransmutationEffectLogic> logicObjects;
private List<ITransmutationEffectLogic> logicObjects;
public TransmutationEffectController(ITransmutationEffectLogic... effectLogic) {
logicObjects = new ArrayList<ITransmutationEffectLogic>();
for (ITransmutationEffectLogic logic : effectLogic) {
logicObjects.add(logic);
}
}
public TransmutationEffectController(ITransmutationEffectLogic... effectLogic) {
logicObjects = new ArrayList<ITransmutationEffectLogic>();
for (ITransmutationEffectLogic logic : effectLogic) {
logicObjects.add(logic);
}
}
public void attemptTransmutations(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
Collections.shuffle(logicObjects);
for (ITransmutationEffectLogic logic : logicObjects) {
try {
if (logic.tryTransmutation(world, biome, sourceBlock, x, y, z)) {
break;
}
} catch (Exception e) {
LogHelper.warn(String.format("Magic Bees encountered an issue with an ITransmutationEffectLogic provider %s. Debug information follows.",
logic.getClass().getName()));
LogHelper.info(e.getMessage());
}
}
}
@Override
public void addEffectLogic(ITransmutationEffectLogic logic) {
if (logic != null && !logicObjects.contains(logic)) {
logicObjects.add(logic);
}
}
public void attemptTransmutations(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
Collections.shuffle(logicObjects);
for (ITransmutationEffectLogic logic : logicObjects) {
try {
if (logic.tryTransmutation(world, biome, sourceBlock, x, y, z)) {
break;
}
} catch (Exception e) {
LogHelper.warn(String.format(
"Magic Bees encountered an issue with an ITransmutationEffectLogic provider %s. Debug information follows.",
logic.getClass().getName()));
LogHelper.info(e.getMessage());
}
}
}
@Override
public void addEffectLogic(ITransmutationEffectLogic logic) {
if (logic != null && !logicObjects.contains(logic)) {
logicObjects.add(logic);
}
}
}
@@ -9,23 +9,21 @@ import net.minecraftforge.oredict.OreDictionary;
public class TransmutationEffectLBotaniaLiving implements ITransmutationEffectLogic {
@Override
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
int[] oreIDs = OreDictionary.getOreIDs(sourceBlock);
for (int oreId : oreIDs) {
if (oreId == OreDictionary.getOreID("logWood")) {
world.setBlock(x, y, z, BotaniaHelper.blockLivingWood);
return true;
}
else if (oreId == OreDictionary.getOreID("stone")) {
world.setBlock(x, y, z, BotaniaHelper.blockLivingRock);
return true;
}
else if (oreId == OreDictionary.getOreID("livingwood")) {
world.setBlock(x, y, z, BotaniaHelper.blockDreamWood);
return true;
}
}
return false;
}
@Override
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
int[] oreIDs = OreDictionary.getOreIDs(sourceBlock);
for (int oreId : oreIDs) {
if (oreId == OreDictionary.getOreID("logWood")) {
world.setBlock(x, y, z, BotaniaHelper.blockLivingWood);
return true;
} else if (oreId == OreDictionary.getOreID("stone")) {
world.setBlock(x, y, z, BotaniaHelper.blockLivingRock);
return true;
} else if (oreId == OreDictionary.getOreID("livingwood")) {
world.setBlock(x, y, z, BotaniaHelper.blockDreamWood);
return true;
}
}
return false;
}
}
@@ -1,8 +1,7 @@
package magicbees.bees.allele.effect;
import java.util.Locale;
import cpw.mods.fml.common.registry.GameRegistry;
import java.util.Locale;
import magicbees.api.bees.ITransmutationEffectLogic;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
@@ -13,37 +12,40 @@ import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.oredict.OreDictionary;
public class TransmutationEffectRailcraft implements ITransmutationEffectLogic {
@Override
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false;
if (OreDictionary.itemMatches(new ItemStack(Blocks.stone), sourceBlock, false)
|| OreDictionary.itemMatches(new ItemStack(Blocks.cobblestone), sourceBlock, false)) {
flag = trySpawnQuarriedStone(world, biome, sourceBlock, x, y, z) || trySpawnAbyssalStone(world, biome, sourceBlock, x, y, z);
}
return flag;
}
@Override
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false;
if (OreDictionary.itemMatches(new ItemStack(Blocks.stone), sourceBlock, false)
|| OreDictionary.itemMatches(new ItemStack(Blocks.cobblestone), sourceBlock, false)) {
flag = trySpawnQuarriedStone(world, biome, sourceBlock, x, y, z)
|| trySpawnAbyssalStone(world, biome, sourceBlock, x, y, z);
}
return flag;
}
private boolean trySpawnQuarriedStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false;
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST) && !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.quarried", 1);
if (item != null) {
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
flag = true;
}
}
return flag;
}
private boolean trySpawnQuarriedStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false;
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)
&& !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.quarried", 1);
if (item != null) {
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
flag = true;
}
}
return flag;
}
private boolean trySpawnAbyssalStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false;
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WATER) && !biome.biomeName.toLowerCase(Locale.ENGLISH).contains("river")) {
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.abyssal", 1);
if (item != null) {
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
flag = true;
}
}
return flag;
}
private boolean trySpawnAbyssalStone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false;
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WATER)
&& !biome.biomeName.toLowerCase(Locale.ENGLISH).contains("river")) {
ItemStack item = GameRegistry.findItemStack("Railcraft", "cube.stone.abyssal", 1);
if (item != null) {
world.setBlock(x, y, z, Block.getBlockFromItem(item.getItem()), item.getItemDamage(), 2);
flag = true;
}
}
return flag;
}
}
@@ -9,17 +9,18 @@ import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.oredict.OreDictionary;
public class TransmutationEffectVanilla implements ITransmutationEffectLogic {
@Override
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
return trySpawnSandstone(world, biome, sourceBlock, x, y, z);
}
@Override
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
return trySpawnSandstone(world, biome, sourceBlock, x, y, z);
}
private boolean trySpawnSandstone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false;
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY) && OreDictionary.itemMatches(new ItemStack(Blocks.sand), sourceBlock, false)) {
world.setBlock(x, y, z, Blocks.sandstone);
flag = true;
}
return flag;
}
private boolean trySpawnSandstone(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
boolean flag = false;
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY)
&& OreDictionary.itemMatches(new ItemStack(Blocks.sand), sourceBlock, false)) {
world.setBlock(x, y, z, Blocks.sandstone);
flag = true;
}
return flag;
}
}
@@ -1,31 +1,29 @@
package magicbees.bees.allele.flowerProvider;
import java.util.Set;
import net.minecraft.block.Block;
import forestry.api.apiculture.FlowerManager;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerProvider;
import java.util.Set;
import net.minecraft.block.Block;
public abstract class FlowerProvider implements IFlowerProvider {
@Override
@Deprecated
public Set<IFlower> getFlowers() {
return FlowerManager.flowerRegistry.getAcceptableFlowers(getFlowerType());
}
@Override
@Deprecated
public Set<IFlower> getFlowers() {
return FlowerManager.flowerRegistry.getAcceptableFlowers(getFlowerType());
}
protected void registerPlantableFlower(Block block, int meta, int weight) {
FlowerManager.flowerRegistry.registerPlantableFlower(block, meta, weight, getFlowerType());
}
protected void registerPlantableFlower(Block block, int meta, int weight) {
FlowerManager.flowerRegistry.registerPlantableFlower(block, meta, weight, getFlowerType());
}
protected void registerAcceptableFlower(Block block, int meta) {
FlowerManager.flowerRegistry.registerAcceptableFlower(block, meta, getFlowerType());
}
protected void registerAcceptableFlower(Block block, int meta) {
FlowerManager.flowerRegistry.registerAcceptableFlower(block, meta, getFlowerType());
}
protected void registerGrowthRule(IFlowerGrowthRule growthRule) {
FlowerManager.flowerRegistry.registerGrowthRule(growthRule, getFlowerType());
}
protected void registerGrowthRule(IFlowerGrowthRule growthRule) {
FlowerManager.flowerRegistry.registerGrowthRule(growthRule, getFlowerType());
}
}
@@ -1,5 +1,10 @@
package magicbees.bees.allele.flowerProvider;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.ArsMagicaHelper;
import net.minecraft.block.Block;
@@ -7,87 +12,82 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
public class FlowerProviderArsMagicaFlower extends FlowerProvider implements IFlowerGrowthRule {
public FlowerProviderArsMagicaFlower() {
registerPlantableFlower(ArsMagicaHelper.blackOrchid, 0, 1);
registerPlantableFlower(ArsMagicaHelper.desertNova, 0, 1);
registerPlantableFlower(ArsMagicaHelper.aum, 0, 1);
registerPlantableFlower(ArsMagicaHelper.wakebloom, 0, 1);
registerPlantableFlower(ArsMagicaHelper.tarmaRoot, 0, 1);
registerGrowthRule(this);
}
public FlowerProviderArsMagicaFlower() {
registerPlantableFlower(ArsMagicaHelper.blackOrchid, 0, 1);
registerPlantableFlower(ArsMagicaHelper.desertNova, 0, 1);
registerPlantableFlower(ArsMagicaHelper.aum, 0, 1);
registerPlantableFlower(ArsMagicaHelper.wakebloom, 0, 1);
registerPlantableFlower(ArsMagicaHelper.tarmaRoot, 0, 1);
registerGrowthRule(this);
}
@Override
public String getFlowerType() {
return "flowersArsMagica";
}
@Override
public String getFlowerType() {
return "flowersArsMagica";
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.arsmagica");
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.arsmagica");
}
@Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
return products;
}
@Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
return products;
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return pollinatable.getPlantType().size() > 1;
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return pollinatable.getPlantType().size() > 1;
}
@Override
@Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
@Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
@Deprecated
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
@Deprecated
public boolean growFlower(
IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z);
}
private boolean growFlower(World world, int x, int y, int z) {
boolean flag = false;
Block blockDown = world.getBlock(x, y - 1, z);
if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
int dart = world.rand.nextInt(100);
Block block;
if (dart > 60) {
block = ArsMagicaHelper.blackOrchid;
} else if (dart > 30) {
block = ArsMagicaHelper.aum;
} else {
block = ArsMagicaHelper.tarmaRoot;
}
world.setBlock(x, y, z, block);
flag = true;
} else if (blockDown == Blocks.sand) {
world.setBlock(x, y, z, ArsMagicaHelper.desertNova);
flag = true;
} else if (blockDown == Blocks.stone) {
world.setBlock(x, y, z, ArsMagicaHelper.tarmaRoot);
flag = true;
} else if (blockDown == Blocks.water || blockDown == Blocks.water) {
world.setBlock(x, y, z, ArsMagicaHelper.wakebloom);
flag = true;
}
}
return flag;
}
private boolean growFlower(World world, int x, int y, int z) {
boolean flag = false;
Block blockDown = world.getBlock(x, y - 1, z);
if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
int dart = world.rand.nextInt(100);
Block block;
if (dart > 60) {
block = ArsMagicaHelper.blackOrchid;
} else if (dart > 30) {
block = ArsMagicaHelper.aum;
} else {
block = ArsMagicaHelper.tarmaRoot;
}
world.setBlock(x, y, z, block);
flag = true;
} else if (blockDown == Blocks.sand) {
world.setBlock(x, y, z, ArsMagicaHelper.desertNova);
flag = true;
} else if (blockDown == Blocks.stone) {
world.setBlock(x, y, z, ArsMagicaHelper.tarmaRoot);
flag = true;
} else if (blockDown == Blocks.water || blockDown == Blocks.water) {
world.setBlock(x, y, z, ArsMagicaHelper.wakebloom);
flag = true;
}
}
return flag;
}
}
@@ -1,66 +1,65 @@
package magicbees.bees.allele.flowerProvider;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
public class FlowerProviderAuraNode extends FlowerProvider {
public FlowerProviderAuraNode() {
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.NODE.ordinal());
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.ENERGIZED_NODE.ordinal());
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return pollinatable.getPlantType().size() > 0;
}
public FlowerProviderAuraNode() {
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.NODE.ordinal());
registerAcceptableFlower(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.ENERGIZED_NODE.ordinal());
}
@Override
@Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
return true;
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return pollinatable.getPlantType().size() > 0;
}
@Override
public String getFlowerType() {
return "flowersThaumcraftAuraNode";
}
@Override
@Deprecated
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 String getFlowerType() {
return "flowersThaumcraftAuraNode";
}
@Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
return products;
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.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);
}
}
}
@Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
return products;
}
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;
}
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);
}
}
}
return products;
}
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;
}
}
@@ -1,46 +1,45 @@
package magicbees.bees.allele.flowerProvider;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import java.util.EnumSet;
import magicbees.main.utils.LocalizationManager;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
public class FlowerProviderBookshelf extends FlowerProvider {
public FlowerProviderBookshelf() {
registerAcceptableFlower(Blocks.bookshelf, OreDictionary.WILDCARD_VALUE);
}
@Override
@Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int i, int j) {
return true;
}
public FlowerProviderBookshelf() {
registerAcceptableFlower(Blocks.bookshelf, OreDictionary.WILDCARD_VALUE);
}
@Override
public String getFlowerType() {
return "flowersBookshelf";
}
@Override
@Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int i, int j) {
return true;
}
@Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int i, int j, ItemStack products[]) {
return products;
}
@Override
public String getFlowerType() {
return "flowersBookshelf";
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
EnumSet<EnumPlantType> types = pollinatable.getPlantType();
return types.size() > 0 && !types.contains(EnumPlantType.Nether) && !types.contains(EnumPlantType.Water);
}
@Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int i, int j, ItemStack products[]) {
return products;
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.book");
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
EnumSet<EnumPlantType> types = pollinatable.getPlantType();
return types.size() > 0 && !types.contains(EnumPlantType.Nether) && !types.contains(EnumPlantType.Water);
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.book");
}
}
@@ -1,66 +1,66 @@
package magicbees.bees.allele.flowerProvider;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.BotaniaHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.BotaniaHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
public class FlowerProviderBotania extends FlowerProvider implements IFlowerGrowthRule {
public FlowerProviderBotania() {
registerPlantableFlower(BotaniaHelper.blockMysticalFlower, OreDictionary.WILDCARD_VALUE, 1);
registerGrowthRule(this);
}
@Override
@Deprecated
public boolean growFlower(World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z);
}
public FlowerProviderBotania() {
registerPlantableFlower(BotaniaHelper.blockMysticalFlower, OreDictionary.WILDCARD_VALUE, 1);
registerGrowthRule(this);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
@Deprecated
public boolean growFlower(World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
@Deprecated
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z);
}
private boolean growFlower(World world, int x, int y, int z) {
if (world.isAirBlock(x, y, z) && BotaniaHelper.blockMysticalFlower.canPlaceBlockAt(world, x, y, z)) {
world.setBlock(x, y, z, BotaniaHelper.blockMysticalFlower);
world.setBlockMetadataWithNotify(x, y, z, world.rand.nextInt(16), 2);
}
return false;
}
@Override
@Deprecated
public boolean growFlower(
IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
public ItemStack[] affectProducts(World world, IIndividual individual, int x, int y, int z, ItemStack[] products) {
return products;
}
private boolean growFlower(World world, int x, int y, int z) {
if (world.isAirBlock(x, y, z) && BotaniaHelper.blockMysticalFlower.canPlaceBlockAt(world, x, y, z)) {
world.setBlock(x, y, z, BotaniaHelper.blockMysticalFlower);
world.setBlockMetadataWithNotify(x, y, z, world.rand.nextInt(16), 2);
}
return false;
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.botania");
}
@Override
public ItemStack[] affectProducts(World world, IIndividual individual, int x, int y, int z, ItemStack[] products) {
return products;
}
@Override
public String getFlowerType() {
return "flowersBotania";
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.botania");
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return pollinatable.getPlantType().size() > 0;
}
@Override
public String getFlowerType() {
return "flowersBotania";
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return pollinatable.getPlantType().size() > 0;
}
}
@@ -1,5 +1,10 @@
package magicbees.bees.allele.flowerProvider;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.block.Block;
@@ -7,69 +12,64 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IFlowerGrowthHelper;
import forestry.api.genetics.IFlowerGrowthRule;
import forestry.api.genetics.IFlowerRegistry;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
public class FlowerProviderThaumcraftFlower extends FlowerProvider implements IFlowerGrowthRule {
public FlowerProviderThaumcraftFlower() {
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 1);
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 1);
registerGrowthRule(this);
}
@Override
public String getFlowerType() {
return "flowersThaumcraft";
}
public FlowerProviderThaumcraftFlower() {
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 1);
registerPlantableFlower(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 1);
registerGrowthRule(this);
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.magic");
}
@Override
public String getFlowerType() {
return "flowersThaumcraft";
}
@Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
return products;
}
@Override
public String getDescription() {
return LocalizationManager.getLocalizedString("flowerProvider.magic");
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return 0 < pollinatable.getPlantType().size();
}
@Override
public ItemStack[] affectProducts(World world, IIndividual genome, int x, int y, int z, ItemStack[] products) {
return products;
}
@Override
@Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
return 0 < pollinatable.getPlantType().size();
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
@Deprecated
public boolean growFlower(World world, IIndividual genome, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
@Deprecated
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z);
}
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
return growFlower(world, x, y, z);
}
private boolean growFlower(World world, int x, int y, int z) {
boolean flag = false;
Block blockDown = world.getBlock(x, y - 1, z);
if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 2);
flag = true;
} else if (blockDown == Blocks.sand) {
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 2);
flag = true;
}
}
return flag;
}
@Override
@Deprecated
public boolean growFlower(
IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
return growFlower(world, x, y, z);
}
private boolean growFlower(World world, int x, int y, int z) {
boolean flag = false;
Block blockDown = world.getBlock(x, y - 1, z);
if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 2);
flag = true;
} else if (blockDown == Blocks.sand) {
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 2);
flag = true;
}
}
return flag;
}
}