Some tweaks to flowers. Daybloom only works in day. Bellethorne has a cooldown.

This commit is contained in:
Vasco Lavos committed 2014-02-09 14:48:32 +00:00
1 parent f82f08eb7e
commit aa4b776a0b
2 files changed
+20 -11

No files matched your search

@@ -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;
@@ -38,14 +38,16 @@ public class SubTileBellethorn extends SubTileFunctional {
final int range = 6;
final int manaToUse = 16;
List<EntityLivingBase> 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<EntityLivingBase> 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;
}
}
}
}