From aa4b776a0b4fb75f40477df0313a059cc15aa586 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Sun, 9 Feb 2014 14:48:32 +0000 Subject: [PATCH] Some tweaks to flowers. Daybloom only works in day. Bellethorne has a cooldown. --- .../common/block/subtile/SubTileGenerating.java | 15 +++++++++++---- .../subtile/functional/SubTileBellethorn.java | 16 +++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/MODSRC/vazkii/botania/common/block/subtile/SubTileGenerating.java b/MODSRC/vazkii/botania/common/block/subtile/SubTileGenerating.java index 54cb5feb6..3ab63ddf6 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/SubTileGenerating.java +++ b/MODSRC/vazkii/botania/common/block/subtile/SubTileGenerating.java @@ -52,10 +52,12 @@ public class SubTileGenerating extends SubTileEntity { linkCollector(); - int delay = getDelayBetweenPassiveGeneration(); - if(delay > 0 && supertile.worldObj.getWorldTime() % delay == 0) - addMana(1); - emptyManaIntoCollector(); + if(canGeneratePassively()) { + int delay = getDelayBetweenPassiveGeneration(); + if(delay > 0 && supertile.worldObj.getWorldTime() % delay == 0) + addMana(1); + emptyManaIntoCollector(); + } if(supertile.worldObj.isRemote) { double particleChance = 1F - (double) mana / (double) getMaxMana() / 2F; @@ -103,6 +105,11 @@ public class SubTileGenerating extends SubTileEntity { } } } + + public boolean canGeneratePassively() { + boolean rain = supertile.worldObj.getWorldChunkManager().getBiomeGenAt(supertile.xCoord, supertile.zCoord).getIntRainfall() > 0 && (supertile.worldObj.isRaining() || supertile.worldObj.isThundering()); + return supertile.worldObj.isDaytime() && !rain && supertile.worldObj.canBlockSeeTheSky(supertile.xCoord, supertile.yCoord + 1, supertile.zCoord); + } public int getDelayBetweenPassiveGeneration() { return 30; diff --git a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileBellethorn.java b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileBellethorn.java index 1bdec656c..16d2571fe 100644 --- a/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileBellethorn.java +++ b/MODSRC/vazkii/botania/common/block/subtile/functional/SubTileBellethorn.java @@ -38,14 +38,16 @@ public class SubTileBellethorn extends SubTileFunctional { final int range = 6; final int manaToUse = 16; - List entities = supertile.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + 1, supertile.zCoord + range)); - for(EntityLivingBase entity : entities) { - if(entity instanceof EntityPlayer) - continue; + if(supertile.worldObj.getTotalWorldTime() % 15 == 0) { + List entities = supertile.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + 1, supertile.zCoord + range)); + for(EntityLivingBase entity : entities) { + if(entity instanceof EntityPlayer) + continue; - if(entity.hurtTime == 0 && mana >= manaToUse) { - entity.attackEntityFrom(DamageSource.magic, 1); - mana -= manaToUse; + if(entity.hurtTime == 0 && mana >= manaToUse) { + entity.attackEntityFrom(DamageSource.magic, 1); + mana -= manaToUse; + } } } }