use of binnie.botany.api.gardening.EnumMoisture 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);
}
use of binnie.botany.api.gardening.EnumMoisture in project Binnie by ForestryMC.
the class BlockSoil method updateTick.
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
EnumMoisture moisture = state.getValue(MOISTURE);
EnumMoisture desiredMoisture = BotanyCore.getGardening().getNaturalMoisture(world, pos);
if (desiredMoisture.ordinal() > moisture.ordinal()) {
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
} else if (desiredMoisture.ordinal() < moisture.ordinal()) {
moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY);
}
IBlockState blockState = state.withProperty(MOISTURE, moisture);
if (state != blockState) {
world.setBlockState(pos, blockState, 2);
}
if (!weedKilled) {
if (rand.nextInt(5 - getType(world, pos).ordinal()) != 0) {
return;
}
pos = pos.up();
if (!world.isAirBlock(pos)) {
return;
}
world.setBlockState(pos, ModuleGardening.plant.getStateFromMeta(PlantType.WEEDS.ordinal()), 2);
}
}
use of binnie.botany.api.gardening.EnumMoisture in project Binnie by ForestryMC.
the class BlockSoil method registerModel.
@Override
@SideOnly(Side.CLIENT)
public void registerModel(Item item, IModelManager manager) {
for (EnumAcidity acidity : EnumAcidity.values()) {
for (EnumMoisture moisture : EnumMoisture.values()) {
String modelName = "";
if (acidity != EnumAcidity.NEUTRAL) {
modelName += acidity.getName();
}
if (moisture != EnumMoisture.NORMAL) {
if (!modelName.isEmpty()) {
modelName += "_";
}
modelName += moisture.getName();
}
if (modelName.isEmpty()) {
modelName = "normal";
}
String identifier;
if (weedKilled) {
identifier = type.getName() + "_no_weed/" + modelName;
} else {
identifier = type.getName() + '/' + modelName;
}
manager.registerItemModel(item, moisture.ordinal() + acidity.ordinal() * 3, identifier);
}
}
}
Aggregations