forked from bdew-minecraft/gendustry
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'forestry_unstable' into mc1710
- Loading branch information
Showing
25 changed files
with
272 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) bdew, 2013 - 2015 | ||
* https://github.com/bdew/gendustry | ||
* | ||
* This mod is distributed under the terms of the Minecraft Mod Public | ||
* License 1.0, or MMPL. Please check the contents of the license located in | ||
* http://bdew.net/minecraft-mod-public-license/ | ||
*/ | ||
|
||
package net.bdew.gendustry.forestry | ||
|
||
import forestry.api.apiculture.{IBeeGenome, IBeeHousing, IBeeModifier} | ||
|
||
import scala.collection.JavaConversions._ | ||
|
||
/** | ||
* Combines multiple IBeeModifier together | ||
* Conceptually based on BeeHousingModifier from Forestry | ||
* @param modifiers collection of modifiers | ||
*/ | ||
case class BeeModifiers(modifiers: Traversable[IBeeModifier]) extends IBeeModifier { | ||
override def getTerritoryModifier(genome: IBeeGenome, currentModifier: Float): Float = | ||
modifiers.foldLeft(1F)((v, m) => m.getTerritoryModifier(genome, v * currentModifier)) | ||
|
||
override def getMutationModifier(genome: IBeeGenome, mate: IBeeGenome, currentModifier: Float): Float = | ||
modifiers.foldLeft(1F)((v, m) => m.getMutationModifier(genome, mate, v * currentModifier)) | ||
|
||
override def getLifespanModifier(genome: IBeeGenome, mate: IBeeGenome, currentModifier: Float): Float = | ||
modifiers.foldLeft(1F)((v, m) => m.getLifespanModifier(genome, mate, v * currentModifier)) | ||
|
||
override def getProductionModifier(genome: IBeeGenome, currentModifier: Float): Float = | ||
modifiers.foldLeft(1F)((v, m) => m.getProductionModifier(genome, v * currentModifier)) | ||
|
||
override def getFloweringModifier(genome: IBeeGenome, currentModifier: Float): Float = | ||
modifiers.foldLeft(1F)((v, m) => m.getFloweringModifier(genome, v * currentModifier)) | ||
|
||
override def getGeneticDecay(genome: IBeeGenome, currentModifier: Float): Float = | ||
modifiers.foldLeft(1F)((v, m) => m.getGeneticDecay(genome, v * currentModifier)) | ||
|
||
override def isSealed: Boolean = modifiers.exists(_.isSealed) | ||
override def isSelfLighted: Boolean = modifiers.exists(_.isSelfLighted) | ||
override def isSunlightSimulated: Boolean = modifiers.exists(_.isSunlightSimulated) | ||
override def isHellish: Boolean = modifiers.exists(_.isHellish) | ||
} | ||
|
||
object BeeModifiers { | ||
def from(beeHousing: IBeeHousing) = BeeModifiers(beeHousing.getBeeModifiers) | ||
} |
Oops, something went wrong.