mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-08-03 19:17:27 -04:00
Add creative component bus (#2670)
Supports 1024 components by default, and fits into a tier 3 slot.
This commit is contained in:
parent
ed6fe13ba4
commit
f485c7a898
BIN
assets/items.psd
BIN
assets/items.psd
Binary file not shown.
@ -145,11 +145,12 @@ opencomputers {
|
|||||||
eepromDataSize: 256
|
eepromDataSize: 256
|
||||||
|
|
||||||
# The number of components the different CPU tiers support. This list
|
# The number of components the different CPU tiers support. This list
|
||||||
# must contain exactly three entries, or it will be ignored.
|
# must contain exactly four entries, or it will be ignored.
|
||||||
cpuComponentCount: [
|
cpuComponentCount: [
|
||||||
8
|
8
|
||||||
12
|
12
|
||||||
16
|
16
|
||||||
|
1024
|
||||||
]
|
]
|
||||||
|
|
||||||
# The provided call budgets by the three tiers of CPU and memory. Higher
|
# The provided call budgets by the three tiers of CPU and memory. Higher
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
#REDIRECT componentBus1.md
|
@ -0,0 +1 @@
|
|||||||
|
#REDIRECT componentBus1.md
|
@ -0,0 +1 @@
|
|||||||
|
#REDIRECT componentBus1.md
|
@ -0,0 +1 @@
|
|||||||
|
#REDIRECT componentBus1.md
|
@ -0,0 +1 @@
|
|||||||
|
#REDIRECT componentBus1.md
|
@ -57,6 +57,7 @@ item.oc.CircuitBoard.name=Circuit Board
|
|||||||
item.oc.ComponentBus0.name=Component Bus (Tier 1)
|
item.oc.ComponentBus0.name=Component Bus (Tier 1)
|
||||||
item.oc.ComponentBus1.name=Component Bus (Tier 2)
|
item.oc.ComponentBus1.name=Component Bus (Tier 2)
|
||||||
item.oc.ComponentBus2.name=Component Bus (Tier 3)
|
item.oc.ComponentBus2.name=Component Bus (Tier 3)
|
||||||
|
item.oc.ComponentBus3.name=Component Bus (Creative)
|
||||||
item.oc.ControlUnit.name=Control Unit (CU)
|
item.oc.ControlUnit.name=Control Unit (CU)
|
||||||
item.oc.CPU0.name=Central Processing Unit (CPU) (Tier 1)
|
item.oc.CPU0.name=Central Processing Unit (CPU) (Tier 1)
|
||||||
item.oc.CPU1.name=Central Processing Unit (CPU) (Tier 2)
|
item.oc.CPU1.name=Central Processing Unit (CPU) (Tier 2)
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
@ -73,6 +73,7 @@ object Constants {
|
|||||||
final val ComponentBusTier1 = "componentBus1"
|
final val ComponentBusTier1 = "componentBus1"
|
||||||
final val ComponentBusTier2 = "componentBus2"
|
final val ComponentBusTier2 = "componentBus2"
|
||||||
final val ComponentBusTier3 = "componentBus3"
|
final val ComponentBusTier3 = "componentBus3"
|
||||||
|
final val ComponentBusCreative = "componentBusCreative"
|
||||||
final val CPUTier1 = "cpu1"
|
final val CPUTier1 = "cpu1"
|
||||||
final val CPUTier2 = "cpu2"
|
final val CPUTier2 = "cpu2"
|
||||||
final val CPUTier3 = "cpu3"
|
final val CPUTier3 = "cpu3"
|
||||||
|
@ -62,11 +62,11 @@ class Settings(val config: Config) {
|
|||||||
val eepromSize = config.getInt("computer.eepromSize") max 0
|
val eepromSize = config.getInt("computer.eepromSize") max 0
|
||||||
val eepromDataSize = config.getInt("computer.eepromDataSize") max 0
|
val eepromDataSize = config.getInt("computer.eepromDataSize") max 0
|
||||||
val cpuComponentSupport = Array(config.getIntList("computer.cpuComponentCount"): _*) match {
|
val cpuComponentSupport = Array(config.getIntList("computer.cpuComponentCount"): _*) match {
|
||||||
case Array(tier1, tier2, tier3) =>
|
case Array(tier1, tier2, tier3, tierCreative) =>
|
||||||
Array(tier1: Int, tier2: Int, tier3: Int)
|
Array(tier1: Int, tier2: Int, tier3: Int, tierCreative: Int)
|
||||||
case _ =>
|
case _ =>
|
||||||
OpenComputers.log.warn("Bad number of CPU component counts, ignoring.")
|
OpenComputers.log.warn("Bad number of CPU component counts, ignoring.")
|
||||||
Array(8, 12, 16)
|
Array(8, 12, 16, 1024)
|
||||||
}
|
}
|
||||||
val callBudgets = Array(config.getDoubleList("computer.callBudgets"): _*) match {
|
val callBudgets = Array(config.getDoubleList("computer.callBudgets"): _*) match {
|
||||||
case Array(tier1, tier2, tier3) =>
|
case Array(tier1, tier2, tier3) =>
|
||||||
|
@ -540,6 +540,8 @@ object Items extends ItemAPI {
|
|||||||
registerItem(new item.DiamondChip(multi), Constants.ItemName.DiamondChip)
|
registerItem(new item.DiamondChip(multi), Constants.ItemName.DiamondChip)
|
||||||
Recipes.addSubItem(new item.UpgradeMF(multi), Constants.ItemName.MFU, "oc:mfu")
|
Recipes.addSubItem(new item.UpgradeMF(multi), Constants.ItemName.MFU, "oc:mfu")
|
||||||
|
|
||||||
|
registerItem(new item.ComponentBus(multi, Tier.Four), Constants.ItemName.ComponentBusCreative)
|
||||||
|
|
||||||
// Register aliases.
|
// Register aliases.
|
||||||
for ((k, v) <- aliases) {
|
for ((k, v) <- aliases) {
|
||||||
descriptors.getOrElseUpdate(k, descriptors(v))
|
descriptors.getOrElseUpdate(k, descriptors(v))
|
||||||
|
@ -1,10 +1,20 @@
|
|||||||
package li.cil.oc.common.item
|
package li.cil.oc.common.item
|
||||||
|
|
||||||
import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
|
import li.cil.oc.common.Tier
|
||||||
|
import li.cil.oc.util.Rarity
|
||||||
|
import net.minecraft.item.EnumRarity
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
|
||||||
class ComponentBus(val parent: Delegator, val tier: Int) extends traits.Delegate with traits.ItemTier {
|
class ComponentBus(val parent: Delegator, val tier: Int) extends traits.Delegate with traits.ItemTier {
|
||||||
override val unlocalizedName = super.unlocalizedName + tier
|
override val unlocalizedName = super.unlocalizedName + tier
|
||||||
|
|
||||||
|
// Because the driver considers the creative bus to be tier 3, the superclass
|
||||||
|
// will believe it has T3 rarity. We override that here.
|
||||||
|
override def rarity(stack: ItemStack): EnumRarity =
|
||||||
|
if (tier == Tier.Four) Rarity.byTier(Tier.Four)
|
||||||
|
else super.rarity(stack)
|
||||||
|
|
||||||
override protected def tooltipName = Option(super.unlocalizedName)
|
override protected def tooltipName = Option(super.unlocalizedName)
|
||||||
|
|
||||||
override protected def tooltipData = Seq(Settings.get.cpuComponentSupport(tier))
|
override protected def tooltipData = Seq(Settings.get.cpuComponentSupport(tier))
|
||||||
|
@ -15,15 +15,17 @@ object DriverComponentBus extends Item with Processor {
|
|||||||
override def worksWith(stack: ItemStack) = isOneOf(stack,
|
override def worksWith(stack: ItemStack) = isOneOf(stack,
|
||||||
api.Items.get(Constants.ItemName.ComponentBusTier1),
|
api.Items.get(Constants.ItemName.ComponentBusTier1),
|
||||||
api.Items.get(Constants.ItemName.ComponentBusTier2),
|
api.Items.get(Constants.ItemName.ComponentBusTier2),
|
||||||
api.Items.get(Constants.ItemName.ComponentBusTier3))
|
api.Items.get(Constants.ItemName.ComponentBusTier3),
|
||||||
|
api.Items.get(Constants.ItemName.ComponentBusCreative))
|
||||||
|
|
||||||
override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = null
|
override def createEnvironment(stack: ItemStack, host: EnvironmentHost) = null
|
||||||
|
|
||||||
override def slot(stack: ItemStack) = Slot.ComponentBus
|
override def slot(stack: ItemStack) = Slot.ComponentBus
|
||||||
|
|
||||||
|
// Clamp item tier because the creative bus needs to fit into tier 3 slots.
|
||||||
override def tier(stack: ItemStack) =
|
override def tier(stack: ItemStack) =
|
||||||
Delegator.subItem(stack) match {
|
Delegator.subItem(stack) match {
|
||||||
case Some(bus: item.ComponentBus) => bus.tier
|
case Some(bus: item.ComponentBus) => bus.tier min Tier.Three
|
||||||
case _ => Tier.One
|
case _ => Tier.One
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user