use of forestry.api.core.EnumTemperature in project ForestryMC by ForestryMC.
the class ClimateGrowthProvider method isBiomeValid.
@Override
public boolean isBiomeValid(ITree tree, Biome biome) {
EnumTemperature biomeTemperature = EnumTemperature.getFromBiome(biome);
EnumHumidity biomeHumidity = EnumHumidity.getFromValue(biome.getRainfall());
ITreeGenome genome = tree.getGenome();
if (temperature == null) {
temperature = genome.getPrimary().getTemperature();
}
if (humidity == null) {
humidity = genome.getPrimary().getHumidity();
}
return AlleleManager.climateHelper.isWithinLimits(biomeTemperature, biomeHumidity, temperature, temperatureTolerance, humidity, humidityTolerance);
}
use of forestry.api.core.EnumTemperature in project ForestryMC by ForestryMC.
the class AlleleEffectSnowing method doEffectThrottled.
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorldObj();
EnumTemperature temp = housing.getTemperature();
switch(temp) {
case HELLISH:
case HOT:
case WARM:
return storedData;
default:
}
Vec3i area = getModifiedArea(genome, housing);
Vec3i offset = VectUtil.scale(area, -1 / 2.0f);
for (int i = 0; i < 1; i++) {
BlockPos randomPos = VectUtil.getRandomPositionInArea(world.rand, area);
BlockPos posBlock = randomPos.add(housing.getCoordinates()).add(offset);
// Put snow on the ground
if (world.isBlockLoaded(posBlock) && world.isSideSolid(posBlock.down(), EnumFacing.UP, false)) {
IBlockState state = world.getBlockState(posBlock);
Block block = state.getBlock();
if (block == Blocks.SNOW_LAYER) {
Integer layers = state.getValue(BlockSnow.LAYERS);
if (layers < 7) {
IBlockState moreSnow = state.withProperty(BlockSnow.LAYERS, layers + 1);
world.setBlockState(posBlock, moreSnow);
} else {
world.setBlockState(posBlock, Blocks.SNOW.getDefaultState());
}
} else if (block.isReplaceable(world, posBlock)) {
world.setBlockState(posBlock, Blocks.SNOW_LAYER.getDefaultState());
}
}
}
return storedData;
}
use of forestry.api.core.EnumTemperature in project ForestryMC by ForestryMC.
the class ClimateLedger method draw.
@Override
public void draw(int x, int y) {
EnumTemperature temperature = tile.getTemperature();
// Draw background
drawBackground(x, y);
// Draw icon
drawSprite(temperature.getSprite(), x + 3, y + 4);
if (!isFullyOpened()) {
return;
}
drawHeader(Translator.translateToLocal("for.gui.climate"), x + 22, y + 8);
drawSubheader(Translator.translateToLocal("for.gui.temperature") + ':', x + 22, y + 20);
drawText(AlleleManager.climateHelper.toDisplay(temperature) + ' ' + StringUtil.floatAsPercent(tile.getExactTemperature()), x + 22, y + 32);
drawSubheader(Translator.translateToLocal("for.gui.humidity") + ':', x + 22, y + 44);
drawText(AlleleManager.climateHelper.toDisplay(tile.getHumidity()) + ' ' + StringUtil.floatAsPercent(tile.getExactHumidity()), x + 22, y + 56);
}
use of forestry.api.core.EnumTemperature in project Binnie by ForestryMC.
the class GardeningManager method canTolerate.
@Override
public boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos) {
if (flower == null) {
return false;
}
IBlockState soil = world.getBlockState(pos.down());
Biome biome = world.getBiome(pos);
EnumAcidity acidity = soil.getValue(BlockSoil.ACIDITY);
EnumMoisture moisture = soil.getValue(BlockSoil.MOISTURE);
EnumTemperature temperature = EnumTemperature.getFromValue(biome.getTemperature());
return canTolerate(flower, acidity, moisture, temperature);
}
Aggregations