use of forestry.api.core.EnumTemperature in project ForestryMC by ForestryMC.
the class AlleleEffectGlacial 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 = genome.getTerritory();
Vec3i offset = VectUtil.scale(area, -1 / 2.0f);
BlockPos housingCoords = housing.getCoordinates();
for (int i = 0; i < 10; i++) {
BlockPos randomPos = VectUtil.getRandomPositionInArea(world.rand, area);
BlockPos posBlock = VectUtil.add(randomPos, housingCoords, offset);
// Freeze water
if (world.isBlockLoaded(posBlock)) {
Block block = world.getBlockState(posBlock).getBlock();
if (block == Blocks.WATER) {
if (world.isAirBlock(new BlockPos(posBlock.getX(), posBlock.getY() + 1, posBlock.getZ()))) {
world.setBlockState(posBlock, Blocks.ICE.getDefaultState());
}
}
}
}
return storedData;
}
use of forestry.api.core.EnumTemperature in project ForestryMC by ForestryMC.
the class ItemHabitatLocator method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, @Nullable World world, List<String> list, ITooltipFlag flag) {
super.addInformation(itemstack, world, list, flag);
Minecraft minecraft = Minecraft.getMinecraft();
if (world != null && minecraft.player != null) {
EntityPlayerSP player = minecraft.player;
Biome currentBiome = player.world.getBiome(player.getPosition());
float temperatureValue = ClimateUtil.getTemperature(world, player.getPosition());
EnumTemperature temperature = EnumTemperature.getFromValue(temperatureValue);
EnumHumidity humidity = EnumHumidity.getFromValue(ClimateUtil.getHumidity(world, player.getPosition()));
list.add(Translator.translateToLocal("for.gui.currentBiome") + ": " + currentBiome.getBiomeName());
list.add(Translator.translateToLocal("for.gui.temperature") + ": " + AlleleManager.climateHelper.toDisplay(temperature));
list.add(Translator.translateToLocal("for.gui.humidity") + ": " + AlleleManager.climateHelper.toDisplay(humidity));
}
}
use of forestry.api.core.EnumTemperature in project ForestryMC by ForestryMC.
the class JubilanceDefault method isJubilant.
@Override
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
EnumTemperature temperature = housing.getTemperature();
EnumHumidity humidity = housing.getHumidity();
return temperature == species.getTemperature() && humidity == species.getHumidity();
}
use of forestry.api.core.EnumTemperature in project ForestryMC by ForestryMC.
the class Butterfly method isAcceptedEnvironment.
private boolean isAcceptedEnvironment(World world, int x, int y, int z) {
BlockPos pos = new BlockPos(x, y, z);
Biome biome = world.getBiome(pos);
EnumTemperature biomeTemperature = EnumTemperature.getFromBiome(biome, world, pos);
EnumHumidity biomeHumidity = EnumHumidity.getFromValue(ClimateUtil.getHumidity(world, pos));
return AlleleManager.climateHelper.isWithinLimits(biomeTemperature, biomeHumidity, getGenome().getPrimary().getTemperature(), getGenome().getToleranceTemp(), getGenome().getPrimary().getHumidity(), getGenome().getToleranceHumid());
}
use of forestry.api.core.EnumTemperature in project ForestryMC by ForestryMC.
the class Butterfly method getCanGrow.
@Override
public Set<IErrorState> getCanGrow(IButterflyNursery nursery, @Nullable IButterflyCocoon cocoon) {
World world = nursery.getWorldObj();
Set<IErrorState> errorStates = new HashSet<>();
// / And finally climate check
IAlleleButterflySpecies species = genome.getPrimary();
EnumTemperature actualTemperature = nursery.getTemperature();
EnumTemperature baseTemperature = species.getTemperature();
EnumTolerance toleranceTemperature = genome.getToleranceTemp();
EnumHumidity actualHumidity = nursery.getHumidity();
EnumHumidity baseHumidity = species.getHumidity();
EnumTolerance toleranceHumidity = genome.getToleranceHumid();
ClimateUtil.addClimateErrorStates(actualTemperature, actualHumidity, baseTemperature, toleranceTemperature, baseHumidity, toleranceHumidity, errorStates);
return errorStates;
}
Aggregations