Merge pull request #56 from GTNewHorizons/feature/APU-components

fix the number of components for the creative APU
This commit is contained in:
Martin Robertz 2022-03-05 11:06:11 +01:00 committed by GitHub
commit 6e8fe17c86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 4 deletions

View File

@ -15,6 +15,7 @@ class APU(val parent: Delegator, val tier: Int) extends traits.Delegate with tra
else super.rarity(stack)
override def cpuTier = math.min(Tier.Three, tier + 1)
override def cpuTierForComponents = tier + 1
override def gpuTier = tier

View File

@ -6,6 +6,7 @@ class CPU(val parent: Delegator, val tier: Int) extends traits.Delegate with tra
override val unlocalizedName = super.unlocalizedName + tier
override def cpuTier = tier
override def cpuTierForComponents = tier
override protected def tooltipName = Option(super.unlocalizedName)
}

View File

@ -17,8 +17,9 @@ import scala.language.existentials
trait CPULike extends Delegate {
def cpuTier: Int
def cpuTierForComponents: Int // Creative APU provides components like T4 CPU, but there is no T4 CPU
override protected def tooltipData: Seq[Any] = Seq(Settings.get.cpuComponentSupport(cpuTier))
override protected def tooltipData: Seq[Any] = Seq(Settings.get.cpuComponentSupport(cpuTierForComponents))
override protected def tooltipExtended(stack: ItemStack, tooltip: util.List[String]) {
tooltip.addAll(Tooltip.get("CPU.Architecture", api.Machine.getArchitectureName(DriverCPU.architecture(stack))))

View File

@ -1,11 +1,9 @@
package li.cil.oc.integration.opencomputers
import li.cil.oc.Constants
import li.cil.oc.api
import li.cil.oc.{Constants, Settings, api, common}
import li.cil.oc.api.driver.EnvironmentProvider
import li.cil.oc.api.driver.item.HostAware
import li.cil.oc.api.network.EnvironmentHost
import li.cil.oc.common
import li.cil.oc.common.Tier
import li.cil.oc.common.item.Delegator
import li.cil.oc.server.component
@ -26,6 +24,11 @@ object DriverAPU extends DriverCPU with HostAware {
case _ => null
}
override def supportedComponents(stack: ItemStack) = Delegator.subItem(stack) match {
case Some(apu: common.item.APU) => Settings.get.cpuComponentSupport(apu.cpuTierForComponents)
case _ => Settings.get.cpuComponentSupport(1)
}
override def cpuTier(stack: ItemStack) =
Delegator.subItem(stack) match {
case Some(apu: common.item.APU) => apu.cpuTier