mirror of
https://github.com/GTNewHorizons/gendustry.git
synced 2026-11-19 11:59:32 +00:00
Merged changes from -fu, build against forestry 3.4
This commit is contained in:
commit
71df219738
8 files changed
+71
-57
No files matched your search
+1
-1
@@ -70,7 +70,7 @@ dependencies {
|
||||
compile "codechicken:CodeChickenCore:1.7.10-1.0.4.29:dev"
|
||||
compile "com.mod-buildcraft:buildcraft:6.2.6:dev"
|
||||
compile "net.industrial-craft:industrialcraft-2:2.2.650-experimental:api"
|
||||
compile "net.sengir.forestry:forestry_1.7.10:3.3.0.6:api"
|
||||
compile "net.sengir.forestry:forestry_1.7.10:3.4.0.7:api"
|
||||
compile "mcp.mobius.waila:Waila:1.5.6a_1.7.10"
|
||||
compile "net.bdew.thirdparty:CoFHLib:R1.0.1:api"
|
||||
}
|
||||
|
||||
@@ -114,9 +114,6 @@ gendustry.label.mod.sieve=* Pollen Collection
|
||||
gendustry.label.mod.temperature=* Temperature
|
||||
gendustry.label.mod.humidity=* Humidity
|
||||
|
||||
gendustry.error.power=Not enough power
|
||||
gendustry.error.disabled=Disabled by settings
|
||||
|
||||
gendustry.label.sample.rootBees=Taken from a Bee
|
||||
gendustry.label.sample.rootTrees=Taken from a Sapling
|
||||
gendustry.label.sample.rootButterflies=Taken from a Butterfly
|
||||
@@ -257,6 +254,9 @@ itemGroup.bdew.gendustry=Gendustry
|
||||
itemGroup.bdew.templates=Genetic Templates
|
||||
itemGroup.bdew.samples=Genetic Samples
|
||||
|
||||
for.gendustry.errorstate.disabled.description=Disabled
|
||||
for.gendustry.errorstate.disabled.help=The machine is disabled by it's configuration
|
||||
|
||||
#this will be moved to bdlib at some point
|
||||
bdlib.label.empty=Empty
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.bdew.gendustry.config.loader.TuningLoader
|
||||
import net.bdew.gendustry.custom.CustomContent
|
||||
import net.bdew.gendustry.forestry.GeneRecipe
|
||||
import net.bdew.gendustry.gui.HintIcons
|
||||
import net.bdew.gendustry.machines.apiary.ErrorCodes
|
||||
import net.bdew.gendustry.machines.apiary.upgrades.Upgrades
|
||||
import net.bdew.gendustry.misc._
|
||||
import net.minecraft.command.CommandHandler
|
||||
@@ -63,6 +64,8 @@ object Gendustry {
|
||||
configDir = new File(event.getModConfigurationDirectory, "gendustry")
|
||||
TuningLoader.loadConfigFiles()
|
||||
|
||||
ErrorCodes.init()
|
||||
|
||||
if (PowerProxy.haveModVersion("BuildCraftAPI|statements"))
|
||||
TriggerProvider.registerTriggers()
|
||||
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
package net.bdew.gendustry.compat.triggers
|
||||
|
||||
import buildcraft.api.statements.StatementManager
|
||||
import forestry.api.core.EnumErrorCode
|
||||
import forestry.api.core.IErrorState
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.bdew.gendustry.machines.apiary.ErrorCodes
|
||||
import net.bdew.lib.Misc
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
@@ -19,10 +20,10 @@ import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
trait ForestryErrorSource extends TileEntity {
|
||||
def getErrorOrdinal: Int
|
||||
def getErrorState: EnumErrorCode
|
||||
def getErrorState: IErrorState
|
||||
}
|
||||
|
||||
case class ForestryErrorTrigger(state: EnumErrorCode) extends BaseTrigger("forestry.error." + state.ordinal(), "y%03d".format(state.ordinal()), classOf[ForestryErrorSource]) {
|
||||
case class ForestryErrorTrigger(state: IErrorState) extends BaseTrigger("forestry.error." + state.getID, "y%03d".format(state.getID), classOf[ForestryErrorSource]) {
|
||||
override def getIcon = state.getIcon
|
||||
override def getDescription = Misc.toLocal("for." + state.getDescription)
|
||||
override def registerIcons(ir: IIconRegister) {}
|
||||
@@ -32,20 +33,21 @@ case class ForestryErrorTrigger(state: EnumErrorCode) extends BaseTrigger("fores
|
||||
|
||||
object ForestryErrorTriggers {
|
||||
|
||||
val apiaryTriggerStates = Seq(
|
||||
EnumErrorCode.OK,
|
||||
EnumErrorCode.INVALIDBIOME,
|
||||
EnumErrorCode.NOTGLOOMY,
|
||||
EnumErrorCode.NOTLUCID,
|
||||
EnumErrorCode.NOTDAY,
|
||||
EnumErrorCode.NOTNIGHT,
|
||||
EnumErrorCode.NOFLOWER,
|
||||
EnumErrorCode.NOQUEEN,
|
||||
EnumErrorCode.NODRONE,
|
||||
EnumErrorCode.NOSKY,
|
||||
EnumErrorCode.NOSPACE,
|
||||
EnumErrorCode.NOPOWER
|
||||
)
|
||||
val apiaryTriggerStates = List(
|
||||
"Forestry:ok",
|
||||
"Forestry:invalidBiome",
|
||||
"Forestry:isRaining",
|
||||
"Forestry:notGloomy",
|
||||
"Forestry:notLucid",
|
||||
"Forestry:notDay",
|
||||
"Forestry:notNight",
|
||||
"Forestry:noFlower",
|
||||
"Forestry:noQueen",
|
||||
"Forestry:noDrone",
|
||||
"Forestry:noSky",
|
||||
"Forestry:noSpace",
|
||||
"Forestry:noPower"
|
||||
) map ErrorCodes.getErrorByName
|
||||
|
||||
val validTriggerStates = apiaryTriggerStates.toSet
|
||||
val validTriggers = validTriggerStates.map(x => x -> ForestryErrorTrigger(x)).toMap
|
||||
|
||||
@@ -96,7 +96,7 @@ class BeeSpecies(cfg: ConfigSection, ident: String) extends IAlleleBeeSpecies {
|
||||
var highest = 0
|
||||
excludeSpecies += species
|
||||
import scala.collection.JavaConversions._
|
||||
getRoot.getPaths(species, EnumBeeChromosome.SPECIES.ordinal) foreach { mutation =>
|
||||
getRoot.getPaths(species, getRoot.getKaryotypeKey) foreach { mutation =>
|
||||
if (!excludeSpecies.contains(mutation.getAllele0)) {
|
||||
val otherAdvance = getMutationPathLength(mutation.getAllele0, excludeSpecies)
|
||||
if (otherAdvance > highest) highest = otherAdvance
|
||||
|
||||
@@ -9,15 +9,45 @@
|
||||
|
||||
package net.bdew.gendustry.machines.apiary
|
||||
|
||||
import forestry.api.core.EnumErrorCode
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import forestry.api.core.{ErrorStateRegistry, IErrorState}
|
||||
import net.bdew.lib.Misc
|
||||
import net.bdew.lib.gui.Texture
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.util.IIcon
|
||||
|
||||
object ErrorCodes {
|
||||
val values = EnumErrorCode.values().zipWithIndex.map(_.swap).toMap
|
||||
def getValueSafe(i: Int) = values.getOrElse(i, EnumErrorCode.UNKNOWN)
|
||||
def isValid(i: Int) = values.isDefinedAt(i)
|
||||
def getIcon(i: Int) = Texture(Texture.ITEMS, values(i).getIcon)
|
||||
def getDescription(i: Int) = Misc.toLocal("for." + values(i).getDescription)
|
||||
def getHelp(i: Int) = Misc.toLocal("for." + values(i).getHelp)
|
||||
val UNKNOWN = ErrorStateRegistry.getErrorState("Forestry:unknown")
|
||||
|
||||
def getErrorById(i: Int) = Option(ErrorStateRegistry.getErrorState(i.toShort)).getOrElse(UNKNOWN)
|
||||
def getErrorByName(n: String) = Option(ErrorStateRegistry.getErrorState(n)).getOrElse(UNKNOWN)
|
||||
|
||||
def isValid(i: Int) = ErrorStateRegistry.getErrorState(i.toShort) != null
|
||||
def getIcon(i: Int) = Texture(Texture.ITEMS, getErrorById(i).getIcon)
|
||||
def getDescription(i: Int) = Misc.toLocal("for." + getErrorById(i).getDescription)
|
||||
def getHelp(i: Int) = Misc.toLocal("for." + getErrorById(i).getHelp)
|
||||
|
||||
def init() {
|
||||
ErrorStateRegistry.registerErrorState(GendustryErrorStates.Disabled)
|
||||
}
|
||||
}
|
||||
|
||||
case class GendustryErrorState(name: String, id: Short) extends IErrorState {
|
||||
var icon: IIcon = null
|
||||
override def getID = id
|
||||
override def getUniqueName = "gendustry:" + name
|
||||
override def getDescription = "gendustry.errorstate." + name + ".description"
|
||||
override def getHelp = "gendustry.errorstate." + name + ".help"
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def getIcon = icon
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(register: IIconRegister) {
|
||||
icon = register.registerIcon("gendustry:error/" + name)
|
||||
}
|
||||
}
|
||||
|
||||
object GendustryErrorStates {
|
||||
val Disabled = GendustryErrorState("disabled", 500)
|
||||
}
|
||||
@@ -11,7 +11,7 @@ package net.bdew.gendustry.machines.apiary
|
||||
|
||||
import forestry.api.apiculture._
|
||||
import forestry.api.arboriculture.EnumGermlingType
|
||||
import forestry.api.core.{BiomeHelper, EnumErrorCode, EnumHumidity, EnumTemperature}
|
||||
import forestry.api.core._
|
||||
import forestry.api.genetics.{AlleleManager, IIndividual}
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.bdew.gendustry.api.ApiaryModifiers
|
||||
@@ -111,13 +111,13 @@ with IIndustrialApiary {
|
||||
movePrincess = false
|
||||
|
||||
if (!canWork) {
|
||||
setErrorState(-2)
|
||||
setErrorState(GendustryErrorStates.Disabled)
|
||||
} else if (power.stored >= cfg.baseMjPerTick * mods.energy) {
|
||||
logic.update()
|
||||
if ((logic.getQueen != null || logic.getBreedingTime > 0) && (errorState :== 1))
|
||||
power.extract(cfg.baseMjPerTick * mods.energy, false)
|
||||
} else {
|
||||
setErrorState(EnumErrorCode.NOPOWER)
|
||||
setErrorState(ErrorCodes.getErrorByName("Forestry:noPower"))
|
||||
}
|
||||
|
||||
if (movePrincess && getStackInSlot(slots.queen) == null)
|
||||
@@ -237,8 +237,8 @@ with IIndustrialApiary {
|
||||
|
||||
override def getWorld = worldObj
|
||||
override def setErrorState(state: Int) = errorState := state
|
||||
override def getErrorState = ErrorCodes.getValueSafe(errorState)
|
||||
override def setErrorState(state: EnumErrorCode) = errorState := state.ordinal()
|
||||
override def getErrorState = ErrorCodes.getErrorById(errorState)
|
||||
override def setErrorState(state: IErrorState) = errorState := state.getID
|
||||
override def getOwnerName = owner
|
||||
override def getXCoord = xCoord
|
||||
override def getYCoord = yCoord
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
package net.bdew.gendustry.machines.apiary
|
||||
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.bdew.gendustry.gui.Textures
|
||||
import net.bdew.lib.Misc
|
||||
import net.bdew.lib.gui.widgets.Widget
|
||||
import net.bdew.lib.gui.{Point, Rect}
|
||||
|
||||
@@ -20,29 +17,11 @@ import scala.collection.mutable
|
||||
class WidgetError(x: Int, y: Int, apiary: TileApiary) extends Widget {
|
||||
val rect: Rect = new Rect(x, y, 16, 16)
|
||||
override def draw(mouse: Point) {
|
||||
val err = apiary.errorState.value
|
||||
if (err == -1) {
|
||||
parent.drawTexture(rect, Textures.errors.noPower)
|
||||
} else if (err == -2) {
|
||||
parent.drawTexture(rect, Textures.errors.disabled)
|
||||
} else if (ErrorCodes.isValid(err)) {
|
||||
parent.drawTexture(rect, ErrorCodes.getIcon(err))
|
||||
} else {
|
||||
parent.drawTexture(rect, ErrorCodes.getIcon(0))
|
||||
}
|
||||
parent.drawTexture(rect, ErrorCodes.getIcon(apiary.errorState.value))
|
||||
}
|
||||
|
||||
override def handleTooltip(p: Point, tip: mutable.MutableList[String]) {
|
||||
val err = apiary.errorState.value
|
||||
if (err == -1) {
|
||||
tip += Misc.toLocal(Gendustry.modId + ".error.power")
|
||||
} else if (err == -2) {
|
||||
tip += Misc.toLocal(Gendustry.modId + ".error.disabled")
|
||||
} else if (ErrorCodes.isValid(err)) {
|
||||
tip += ErrorCodes.getDescription(err)
|
||||
} else {
|
||||
tip += ErrorCodes.getDescription(0)
|
||||
}
|
||||
tip += ErrorCodes.getDescription(apiary.errorState.value)
|
||||
tip ++= apiary.getStats
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user