use of forestry.core.vect.Vect in project ForestryMC by ForestryMC.
the class GuiBeealyzer method drawAnalyticsPage1.
private void drawAnalyticsPage1(IBee bee, EnumBeeType type) {
startPage(COLUMN_0, COLUMN_1, COLUMN_2);
drawLine(StringUtil.localize("gui.active"), COLUMN_1);
drawLine(StringUtil.localize("gui.inactive"), COLUMN_2);
newLine();
newLine();
{
String customPrimaryBeeKey = "bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.", "");
String customSecondaryBeeKey = "bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getSecondary().getUnlocalizedName().replace("bees.species.", "");
drawSpeciesRow(StringUtil.localize("gui.species"), bee, EnumBeeChromosome.SPECIES, checkCustomName(customPrimaryBeeKey), checkCustomName(customSecondaryBeeKey));
}
drawChromosomeRow(StringUtil.localize("gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
drawChromosomeRow(StringUtil.localize("gui.speed"), bee, EnumBeeChromosome.SPEED);
drawChromosomeRow(StringUtil.localize("gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
drawChromosomeRow(StringUtil.localize("gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
drawLine(StringUtil.localize("gui.fertility"), COLUMN_0);
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY);
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY);
drawFertilityInfo(primaryFertility.getValue(), COLUMN_1, getColorCoding(primaryFertility.isDominant()), 0);
drawFertilityInfo(secondaryFertility.getValue(), COLUMN_2, getColorCoding(secondaryFertility.isDominant()), 0);
newLine();
IAlleleArea activeTerritory = (IAlleleArea) bee.getGenome().getActiveAllele(EnumBeeChromosome.TERRITORY);
IAlleleArea inactiveTerritory = (IAlleleArea) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TERRITORY);
drawRow(StringUtil.localize("gui.area"), new Vect(activeTerritory.getValue()).toString(), new Vect(inactiveTerritory.getValue()).toString(), bee, EnumBeeChromosome.TERRITORY);
drawChromosomeRow(StringUtil.localize("gui.effect"), bee, EnumBeeChromosome.EFFECT);
newLine();
endPage();
}
use of forestry.core.vect.Vect in project ForestryMC by ForestryMC.
the class AlleleEffectSnowing method doEffect.
@Override
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
if (isHalted(storedData, housing)) {
return storedData;
}
EnumTemperature temp = EnumTemperature.getFromValue(BiomeGenBase.getBiome(housing.getBiomeId()).temperature);
switch(temp) {
case HELLISH:
case HOT:
case WARM:
return storedData;
default:
}
int[] areaAr = genome.getTerritory();
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]);
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2));
for (int i = 0; i < 1; i++) {
Vect randomPos = new Vect(world.rand.nextInt(area.x), world.rand.nextInt(area.y), world.rand.nextInt(area.z));
Vect posBlock = randomPos.add(new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()));
posBlock = posBlock.add(offset);
// Put snow on the ground
if (!world.isSideSolid(posBlock.x, posBlock.y - 1, posBlock.z, ForgeDirection.UP, false)) {
continue;
}
if (!world.isAirBlock(posBlock.x, posBlock.y, posBlock.z)) {
continue;
}
Proxies.common.setBlockWithNotify(world, posBlock.x, posBlock.y, posBlock.z, Blocks.snow_layer);
}
return storedData;
}
use of forestry.core.vect.Vect in project ForestryMC by ForestryMC.
the class Bee method plantFlowerRandom.
@Override
public void plantFlowerRandom(IBeeHousing housing) {
int chance = Math.round(genome.getFlowering() * housing.getFloweringModifier(getGenome(), 1f));
World world = housing.getWorld();
Random random = world.rand;
// Correct speed
if (random.nextInt(100) >= chance) {
return;
}
// Gather required info
IFlowerProvider provider = genome.getFlowerProvider();
Vect area = getArea(genome, housing);
Vect offset = new Vect(-area.x / 2, -area.y / 4, -area.z / 2);
Vect housingPos = new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
for (int i = 0; i < 10; i++) {
Vect randomPos = Vect.getRandomPositionInArea(random, area);
Vect posBlock = Vect.add(housingPos, randomPos, offset);
if (provider.growFlower(world, this, posBlock.x, posBlock.y, posBlock.z)) {
break;
}
}
}
use of forestry.core.vect.Vect in project ForestryMC by ForestryMC.
the class Bee method getArea.
private static Vect getArea(IBeeGenome genome, IBeeHousing housing) {
int[] genomeTerritory = genome.getTerritory();
float housingModifier = housing.getTerritoryModifier(genome, 1f);
return new Vect(genomeTerritory).multiply(housingModifier * 3.0f);
}
use of forestry.core.vect.Vect in project ForestryMC by ForestryMC.
the class AlleleEffectGlacial method doEffect.
@Override
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
if (isHalted(storedData, housing)) {
return storedData;
}
EnumTemperature temp = EnumTemperature.getFromValue(BiomeGenBase.getBiome(housing.getBiomeId()).temperature);
switch(temp) {
case HELLISH:
case HOT:
case WARM:
return storedData;
default:
}
int[] areaAr = genome.getTerritory();
Vect area = new Vect(areaAr[0], areaAr[1], areaAr[2]);
Vect offset = new Vect(-Math.round(area.x / 2), -Math.round(area.y / 2), -Math.round(area.z / 2));
for (int i = 0; i < 10; i++) {
Vect randomPos = new Vect(world.rand.nextInt(area.x), world.rand.nextInt(area.y), world.rand.nextInt(area.z));
Vect posBlock = randomPos.add(new Vect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord()));
posBlock = posBlock.add(offset);
// Freeze water
Block block = world.getBlock(posBlock.x, posBlock.y, posBlock.z);
if (block != Blocks.water) {
continue;
}
if (!world.isAirBlock(posBlock.x, posBlock.y + 1, posBlock.z)) {
continue;
}
Proxies.common.setBlockWithNotify(world, posBlock.x, posBlock.y, posBlock.z, Blocks.ice);
}
return storedData;
}
Aggregations