mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-28 07:25:35 -04:00
Merge branch 'master-MC1.8' of github.com:MightyPirates/OpenComputers into OC1.5-MC1.8
Conflicts: build.properties
This commit is contained in:
commit
2abd68845f
BIN
assets/items.psd
BIN
assets/items.psd
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
minecraft.version=1.8
|
||||
forge.version=11.14.1.1354
|
||||
|
||||
oc.version=1.5.11
|
||||
oc.version=1.5.12
|
||||
oc.subversion=
|
||||
|
||||
ae2.version=rv2-beta-26
|
||||
|
@ -45,6 +45,7 @@ item.oc.ALU.name=Arithmetic Logic Unit (ALU)
|
||||
item.oc.Analyzer.name=Analyzer
|
||||
item.oc.APU0.name=Accelerated Processing Unit (APU) (Tier 1)
|
||||
item.oc.APU1.name=Accelerated Processing Unit (APU) (Tier 2)
|
||||
item.oc.APU2.name=Accelerated Processing Unit (APU) (Creative)
|
||||
item.oc.ArrowKeys.name=Arrow Keys
|
||||
item.oc.ButtonGroup.name=Button Group
|
||||
item.oc.CardBase.name=Card Base
|
||||
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "opencomputers:item/flat",
|
||||
"textures": {
|
||||
"layer0": "opencomputers:items/apuCreative"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 887 B |
@ -0,0 +1,18 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 1,
|
||||
"frames": [
|
||||
{ "index": 0, "time": 3 },
|
||||
{ "index": 1, "time": 3 },
|
||||
{ "index": 2, "time": 3 },
|
||||
{ "index": 3, "time": 3 },
|
||||
{ "index": 4, "time": 3 },
|
||||
{ "index": 5, "time": 3 },
|
||||
{ "index": 4, "time": 3 },
|
||||
{ "index": 3, "time": 3 },
|
||||
{ "index": 2, "time": 3 },
|
||||
{ "index": 1, "time": 3 },
|
||||
{ "index": 0, "time": 3 }
|
||||
]
|
||||
}
|
||||
}
|
@ -49,6 +49,7 @@ object Constants {
|
||||
final val Alu = "alu"
|
||||
final val Analyzer = "analyzer"
|
||||
final val AngelUpgrade = "angelUpgrade"
|
||||
final val APUCreative = "apuCreative"
|
||||
final val APUTier1 = "apu1"
|
||||
final val APUTier2 = "apu2"
|
||||
final val ArrowKeys = "arrowKeys"
|
||||
|
@ -121,13 +121,15 @@ object Cable {
|
||||
case _ => !world.isAirBlock(tpos)
|
||||
}) {
|
||||
val neighborTileEntity = world.getTileEntity(tpos)
|
||||
val neighborHasNode = hasNetworkNode(neighborTileEntity, side.getOpposite)
|
||||
val canConnectColor = canConnectBasedOnColor(tileEntity, neighborTileEntity)
|
||||
val canConnectFMP = !Mods.ForgeMultipart.isAvailable ||
|
||||
(canConnectFromSideFMP(tileEntity, side) && canConnectFromSideFMP(neighborTileEntity, side.getOpposite))
|
||||
val canConnectIM = canConnectFromSideIM(tileEntity, side) && canConnectFromSideIM(neighborTileEntity, side.getOpposite)
|
||||
if (neighborHasNode && canConnectColor && canConnectFMP && canConnectIM) {
|
||||
result |= (1 << side.getIndex)
|
||||
if (neighborTileEntity != null && neighborTileEntity.getWorld != null) {
|
||||
val neighborHasNode = hasNetworkNode(neighborTileEntity, side.getOpposite)
|
||||
val canConnectColor = canConnectBasedOnColor(tileEntity, neighborTileEntity)
|
||||
val canConnectFMP = !Mods.ForgeMultipart.isAvailable ||
|
||||
(canConnectFromSideFMP(tileEntity, side) && canConnectFromSideFMP(neighborTileEntity, side.getOpposite))
|
||||
val canConnectIM = canConnectFromSideIM(tileEntity, side) && canConnectFromSideIM(neighborTileEntity, side.getOpposite)
|
||||
if (neighborHasNode && canConnectColor && canConnectFMP && canConnectIM) {
|
||||
result |= (1 << side.getIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,12 @@ package li.cil.oc.common.block
|
||||
|
||||
import java.util.Random
|
||||
|
||||
import li.cil.oc.Constants
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.BlockPosition
|
||||
import li.cil.oc.util.ExtendedEnumFacing._
|
||||
import li.cil.oc.util.InventoryUtils
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.material.Material
|
||||
import net.minecraft.block.state.IBlockState
|
||||
@ -87,10 +90,12 @@ class Keyboard extends SimpleBlock(Material.rock) with traits.OmniRotatable {
|
||||
|
||||
override def onNeighborBlockChange(world: World, pos: BlockPos, state: IBlockState, neighborBlock: Block) =
|
||||
world.getTileEntity(pos) match {
|
||||
case keyboard: tileentity.Keyboard if canPlaceBlockOnSide(world, pos, keyboard.facing) => // Can stay.
|
||||
case keyboard: tileentity.Keyboard =>
|
||||
if (!canPlaceBlockOnSide(world, pos, keyboard.facing)) {
|
||||
world.setBlockToAir(pos)
|
||||
InventoryUtils.spawnStackInWorld(BlockPosition(pos, world), api.Items.get(Constants.BlockName.Keyboard).createItemStack(1))
|
||||
}
|
||||
case _ =>
|
||||
dropBlockAsItem(world, pos, world.getBlockState(pos), 0)
|
||||
world.setBlockToAir(pos)
|
||||
}
|
||||
|
||||
override def localOnBlockActivated(world: World, pos: BlockPos, player: EntityPlayer, side: EnumFacing, hitX: Float, hitY: Float, hitZ: Float) =
|
||||
|
@ -19,7 +19,7 @@ import scala.collection.mutable.ArrayBuffer
|
||||
class ServerRack extends RedstoneAware with traits.PowerAcceptor with traits.Rotatable with traits.StateAware with traits.GUI {
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def getMixedBrightnessForBlock(world: IBlockAccess, pos: BlockPos) = {
|
||||
world.getTileEntity(pos) match {
|
||||
if (pos.getY >= 0 && pos.getY < 256) world.getTileEntity(pos) match {
|
||||
case rack: tileentity.ServerRack =>
|
||||
def brightness(pos: BlockPos) = world.getCombinedLight(pos, getLightValue(world, pos))
|
||||
val value = brightness(pos.offset(rack.facing))
|
||||
@ -28,6 +28,7 @@ class ServerRack extends RedstoneAware with traits.PowerAcceptor with traits.Rot
|
||||
((skyBrightness * 3 / 4) << 20) | ((blockBrightness * 3 / 4) << 4)
|
||||
case _ => super.getMixedBrightnessForBlock(world, pos)
|
||||
}
|
||||
else super.getMixedBrightnessForBlock(world, pos)
|
||||
}
|
||||
|
||||
override def isOpaqueCube = false
|
||||
|
@ -296,6 +296,8 @@ object Items extends ItemAPI {
|
||||
|
||||
Option(get(Constants.ItemName.SignUpgrade).createItemStack(1)),
|
||||
Option(get(Constants.ItemName.PistonUpgrade).createItemStack(1)),
|
||||
Option(get(Constants.BlockName.Geolyzer).createItemStack(1)),
|
||||
Option(get(Constants.ItemName.NavigationUpgrade).createItemStack(1)),
|
||||
|
||||
Option(get(Constants.ItemName.GraphicsCardTier2).createItemStack(1)),
|
||||
Option(get(Constants.ItemName.RedstoneCardTier2).createItemStack(1)),
|
||||
@ -420,6 +422,9 @@ object Items extends ItemAPI {
|
||||
// 1.5.10
|
||||
Recipes.addSubItem(new item.APU(components, Tier.One), Constants.ItemName.APUTier1, "oc:apu1")
|
||||
Recipes.addSubItem(new item.APU(components, Tier.Two), Constants.ItemName.APUTier2, "oc:apu2")
|
||||
|
||||
// 1.5.12
|
||||
registerItem(new item.APU(components, Tier.Three), Constants.ItemName.APUCreative)
|
||||
}
|
||||
|
||||
// Card components.
|
||||
|
@ -1,11 +1,20 @@
|
||||
package li.cil.oc.common.item
|
||||
|
||||
import li.cil.oc.common.Tier
|
||||
import li.cil.oc.util.Rarity
|
||||
import net.minecraft.item.EnumRarity
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
import scala.language.existentials
|
||||
|
||||
class APU(val parent: Delegator, val tier: Int) extends traits.Delegate with traits.ItemTier with traits.CPULike with traits.GPULike {
|
||||
override val unlocalizedName = super[Delegate].unlocalizedName + tier
|
||||
|
||||
override def cpuTier = tier + 1
|
||||
override def rarity(stack: ItemStack): EnumRarity =
|
||||
if (tier == Tier.Three) Rarity.byTier(Tier.Four)
|
||||
else super.rarity(stack)
|
||||
|
||||
override def cpuTier = math.min(Tier.Three, tier + 1)
|
||||
|
||||
override def gpuTier = tier
|
||||
|
||||
|
@ -63,7 +63,7 @@ class HoverBoots extends ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 0, 3) with t
|
||||
|
||||
override def getDurabilityForDisplay(stack: ItemStack): Double = {
|
||||
val data = new HoverBootsData(stack)
|
||||
data.charge / Settings.get.bufferHoverBoots
|
||||
1 - data.charge / Settings.get.bufferHoverBoots
|
||||
}
|
||||
|
||||
override def getMaxDamage(stack: ItemStack): Int = Settings.get.bufferHoverBoots.toInt
|
||||
|
@ -43,7 +43,7 @@ class Server(val parent: Delegator, val tier: Int) extends traits.Delegate {
|
||||
val itemName = item.getDisplayName
|
||||
items += itemName -> (if (items.contains(itemName)) items(itemName) + 1 else 1)
|
||||
}
|
||||
if (items.size > 0) {
|
||||
if (items.nonEmpty) {
|
||||
tooltip.addAll(Tooltip.get("Server.Components"))
|
||||
for (itemName <- items.keys.toArray.sorted) {
|
||||
tooltip.add("- " + items(itemName) + "x " + itemName)
|
||||
|
@ -17,7 +17,14 @@ object TabletTemplate extends Template {
|
||||
override protected val suggestedComponents = Array(
|
||||
"BIOS" -> hasComponent(Constants.ItemName.EEPROM) _,
|
||||
"Keyboard" -> hasComponent(Constants.BlockName.Keyboard) _,
|
||||
"GraphicsCard" -> ((inventory: IInventory) => Array(Constants.ItemName.GraphicsCardTier1, Constants.ItemName.GraphicsCardTier2, Constants.ItemName.GraphicsCardTier3).exists(name => hasComponent(name)(inventory))),
|
||||
"GraphicsCard" -> ((inventory: IInventory) => Array(
|
||||
Constants.ItemName.APUCreative,
|
||||
Constants.ItemName.APUTier1,
|
||||
Constants.ItemName.APUTier2,
|
||||
Constants.ItemName.GraphicsCardTier1,
|
||||
Constants.ItemName.GraphicsCardTier2,
|
||||
Constants.ItemName.GraphicsCardTier3).
|
||||
exists(name => hasComponent(name)(inventory))),
|
||||
"OS" -> hasFileSystem _)
|
||||
|
||||
override protected def hostClass = classOf[internal.Tablet]
|
||||
|
@ -23,7 +23,14 @@ abstract class Template {
|
||||
"BIOS" -> hasComponent(Constants.ItemName.EEPROM) _,
|
||||
"Screen" -> hasComponent(Constants.BlockName.ScreenTier1) _,
|
||||
"Keyboard" -> hasComponent(Constants.BlockName.Keyboard) _,
|
||||
"GraphicsCard" -> ((inventory: IInventory) => Array(Constants.ItemName.GraphicsCardTier1, Constants.ItemName.GraphicsCardTier2, Constants.ItemName.GraphicsCardTier3).exists(name => hasComponent(name)(inventory))),
|
||||
"GraphicsCard" -> ((inventory: IInventory) => Array(
|
||||
Constants.ItemName.APUCreative,
|
||||
Constants.ItemName.APUTier1,
|
||||
Constants.ItemName.APUTier2,
|
||||
Constants.ItemName.GraphicsCardTier1,
|
||||
Constants.ItemName.GraphicsCardTier2,
|
||||
Constants.ItemName.GraphicsCardTier3).
|
||||
exists(name => hasComponent(name)(inventory))),
|
||||
"Inventory" -> hasInventory _,
|
||||
"OS" -> hasFileSystem _)
|
||||
|
||||
|
@ -13,6 +13,7 @@ import li.cil.oc.common.tileentity.RobotProxy
|
||||
import li.cil.oc.common.tileentity.traits
|
||||
import li.cil.oc.integration.opencomputers.DriverRedstoneCard
|
||||
import li.cil.oc.integration.util.Waila
|
||||
import li.cil.oc.server.agent
|
||||
import li.cil.oc.server.{PacketSender => ServerPacketSender}
|
||||
import li.cil.oc.util.ExtendedNBT._
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
@ -178,7 +179,10 @@ trait Computer extends Environment with ComponentInventory with Rotatable with B
|
||||
}
|
||||
|
||||
override def isUseableByPlayer(player: EntityPlayer) =
|
||||
super.isUseableByPlayer(player) && canInteract(player.getName)
|
||||
super.isUseableByPlayer(player) && (player match {
|
||||
case fakePlayer: agent.Player => canInteract(fakePlayer.agent.ownerName())
|
||||
case _ => canInteract(player.getName)
|
||||
})
|
||||
|
||||
override protected def onRotationChanged() {
|
||||
super.onRotationChanged()
|
||||
|
@ -34,7 +34,7 @@ object Mods {
|
||||
val ComputerCraft = new SimpleMod(IDs.ComputerCraft)
|
||||
val CraftingCosts = new SimpleMod(IDs.CraftingCosts)
|
||||
val DeepStorageUnit = new ClassBasedMod(IDs.DeepStorageUnit, "powercrystals.minefactoryreloaded.api.IDeepStorageUnit")()
|
||||
val ElectricalAge = new SimpleMod(IDs.ElectricalAge)
|
||||
val ElectricalAge = new SimpleMod(IDs.ElectricalAge, providesPower = true)
|
||||
val EnderIO = new SimpleMod(IDs.EnderIO)
|
||||
val EnderStorage = new SimpleMod(IDs.EnderStorage)
|
||||
val Factorization = new SimpleMod(IDs.Factorization, providesPower = true)
|
||||
@ -79,43 +79,43 @@ object Mods {
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
val Proxies = Array(
|
||||
// integration.appeng.ModAppEng,
|
||||
// integration.bloodmagic.ModBloodMagic,
|
||||
// integration.bluepower.ModBluePower,
|
||||
// integration.buildcraft.tools.ModBuildCraftAPITools,
|
||||
// integration.buildcraft.tiles.ModBuildCraftAPITiles,
|
||||
// integration.buildcraft.transport.ModBuildCraftAPITransport,
|
||||
// integration.cofh.energy.ModCoFHEnergy,
|
||||
// integration.cofh.item.ModCoFHItem,
|
||||
// integration.cofh.tileentity.ModCoFHTileEntity,
|
||||
// integration.cofh.transport.ModCoFHTransport,
|
||||
// integration.enderstorage.ModEnderStorage,
|
||||
// integration.dsu.ModDeepStorageUnit,
|
||||
// integration.forestry.ModForestry,
|
||||
// integration.fmp.ModForgeMultipart,
|
||||
// integration.gc.ModGalacticraft,
|
||||
// integration.gregtech.ModGregtech,
|
||||
// integration.ic2.ModIndustrialCraft2,
|
||||
// integration.mfr.ModMineFactoryReloaded,
|
||||
// integration.mystcraft.ModMystcraft,
|
||||
// integration.nek.ModNotEnoughKeys,
|
||||
// integration.projectred.ModProjectRed,
|
||||
// integration.railcraft.ModRailcraft,
|
||||
// integration.redlogic.ModRedLogic,
|
||||
// integration.stargatetech2.ModStargateTech2,
|
||||
// integration.thaumcraft.ModThaumcraft,
|
||||
// integration.thermalexpansion.ModThermalExpansion,
|
||||
// integration.tcon.ModTinkersConstruct,
|
||||
// integration.tmechworks.ModTMechworks,
|
||||
// integration.appeng.ModAppEng,
|
||||
// integration.bloodmagic.ModBloodMagic,
|
||||
// integration.bluepower.ModBluePower,
|
||||
// integration.buildcraft.tools.ModBuildCraftAPITools,
|
||||
// integration.buildcraft.tiles.ModBuildCraftAPITiles,
|
||||
// integration.buildcraft.transport.ModBuildCraftAPITransport,
|
||||
// integration.cofh.energy.ModCoFHEnergy,
|
||||
// integration.cofh.item.ModCoFHItem,
|
||||
// integration.cofh.tileentity.ModCoFHTileEntity,
|
||||
// integration.cofh.transport.ModCoFHTransport,
|
||||
// integration.enderstorage.ModEnderStorage,
|
||||
// integration.dsu.ModDeepStorageUnit,
|
||||
// integration.forestry.ModForestry,
|
||||
// integration.fmp.ModForgeMultipart,
|
||||
// integration.gc.ModGalacticraft,
|
||||
// integration.gregtech.ModGregtech,
|
||||
// integration.ic2.ModIndustrialCraft2,
|
||||
// integration.mfr.ModMineFactoryReloaded,
|
||||
// integration.mystcraft.ModMystcraft,
|
||||
// integration.nek.ModNotEnoughKeys,
|
||||
// integration.projectred.ModProjectRed,
|
||||
// integration.railcraft.ModRailcraft,
|
||||
// integration.redlogic.ModRedLogic,
|
||||
// integration.stargatetech2.ModStargateTech2,
|
||||
// integration.thaumcraft.ModThaumcraft,
|
||||
// integration.thermalexpansion.ModThermalExpansion,
|
||||
// integration.tcon.ModTinkersConstruct,
|
||||
// integration.tmechworks.ModTMechworks,
|
||||
integration.vanilla.ModVanilla,
|
||||
integration.versionchecker.ModVersionChecker,
|
||||
integration.waila.ModWaila,
|
||||
// integration.wrcbe.ModWRCBE,
|
||||
// integration.wrsve.ModWRSVE,
|
||||
// integration.wrcbe.ModWRCBE,
|
||||
// integration.wrsve.ModWRSVE,
|
||||
|
||||
// // Register the general IPeripheral driver last, if at all, to avoid it
|
||||
// // being used rather than other more concrete implementations.
|
||||
// integration.computercraft.ModComputerCraft,
|
||||
// // Register the general IPeripheral driver last, if at all, to avoid it
|
||||
// // being used rather than other more concrete implementations.
|
||||
// integration.computercraft.ModComputerCraft,
|
||||
|
||||
// We go late to ensure all other mod integration is done, e.g. to
|
||||
// allow properly checking if wireless redstone is present.
|
||||
@ -123,7 +123,7 @@ object Mods {
|
||||
|
||||
// Run IGW registration after OC registration because we use the manual
|
||||
// in there to know which pages to register.
|
||||
// integration.igw.ModIngameWiki
|
||||
// integration.igw.ModIngameWiki
|
||||
)
|
||||
|
||||
def init(): Unit = {
|
||||
@ -168,7 +168,8 @@ object Mods {
|
||||
final val Factorization = "factorization"
|
||||
final val Forestry = "Forestry"
|
||||
final val ForgeMultipart = "ForgeMultipart"
|
||||
final val DeepStorageUnit = "MineFactoryReloaded|DeepStorageUnit" // Doesn't really exist.
|
||||
final val DeepStorageUnit = "MineFactoryReloaded|DeepStorageUnit"
|
||||
// Doesn't really exist.
|
||||
final val Galacticraft = "Galacticraft API"
|
||||
final val GregTech = "gregtech"
|
||||
final val IndustrialCraft2 = "IC2"
|
||||
|
@ -1,14 +1,5 @@
|
||||
package li.cil.oc.integration.appeng
|
||||
|
||||
import appeng.api.AEApi
|
||||
import appeng.api.config.Actionable
|
||||
import appeng.api.networking.crafting.ICraftingLink
|
||||
import appeng.api.networking.crafting.ICraftingRequester
|
||||
import appeng.api.networking.security.IActionHost
|
||||
import appeng.api.networking.security.MachineSource
|
||||
import appeng.api.storage.data.IAEItemStack
|
||||
import appeng.me.helpers.IGridProxyable
|
||||
import appeng.util.item.AEItemStack
|
||||
import com.google.common.collect.ImmutableSet
|
||||
import li.cil.oc.OpenComputers
|
||||
import li.cil.oc.api.machine.Arguments
|
||||
@ -23,7 +14,6 @@ import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraftforge.common.DimensionManager
|
||||
import net.minecraftforge.common.util.Constants.NBT
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
import scala.collection.convert.WrapAsJava._
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
@ -55,7 +45,7 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
||||
case Some(pattern) => pattern.getOutputs.find(_.isSameType(stack)).get
|
||||
case _ => stack.copy.setStackSize(0) // Should not be possible, but hey...
|
||||
}
|
||||
new Craftable(tile, result)
|
||||
new NetworkControl.Craftable(tile, result)
|
||||
}).toArray)
|
||||
}
|
||||
|
||||
@ -101,8 +91,11 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
||||
filter.get("name").forall(_.equals(Item.itemRegistry.getNameForObject(stack.getItem))) &&
|
||||
filter.get("label").forall(_.equals(stack.getItemStack.getDisplayName))
|
||||
}
|
||||
}
|
||||
|
||||
class Craftable(var controller: AETile, var stack: IAEItemStack) extends AbstractValue with ICraftingRequester {
|
||||
object NetworkControl {
|
||||
|
||||
class Craftable(var controller: TileEntity with IGridProxyable with IActionHost, var stack: IAEItemStack) extends AbstractValue with ICraftingRequester {
|
||||
def this() = this(null, null)
|
||||
|
||||
private val links = mutable.Set.empty[ICraftingLink]
|
||||
@ -186,8 +179,8 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
||||
EventHandler.schedule(() => {
|
||||
val world = DimensionManager.getWorld(dimension)
|
||||
val tileEntity = world.getTileEntity(x, y, z)
|
||||
if (tileEntity != null && tileEntity.isInstanceOf[AETile]) {
|
||||
controller = tileEntity.asInstanceOf[AETile]
|
||||
if (tileEntity != null && tileEntity.isInstanceOf[TileEntity with IGridProxyable with IActionHost]) {
|
||||
controller = tileEntity.asInstanceOf[TileEntity with IGridProxyable with IActionHost]
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -256,4 +249,4 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -14,12 +14,14 @@ import net.minecraft.item.ItemStack
|
||||
object DriverAPU extends DriverCPU with HostAware with EnvironmentAware {
|
||||
override def worksWith(stack: ItemStack) = isOneOf(stack,
|
||||
api.Items.get(Constants.ItemName.APUTier1),
|
||||
api.Items.get(Constants.ItemName.APUTier2))
|
||||
api.Items.get(Constants.ItemName.APUTier2),
|
||||
api.Items.get(Constants.ItemName.APUCreative))
|
||||
|
||||
override def createEnvironment(stack: ItemStack, host: EnvironmentHost) =
|
||||
gpuTier(stack) match {
|
||||
case Tier.One => new component.GraphicsCard.Tier1()
|
||||
case Tier.Two => new component.GraphicsCard.Tier2()
|
||||
case Tier.Three => new component.GraphicsCard.Tier3()
|
||||
case _ => null
|
||||
}
|
||||
|
||||
|
@ -3,13 +3,14 @@ package li.cil.oc.integration.opencomputers
|
||||
import li.cil.oc.Constants
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.api.driver.EnvironmentHost
|
||||
import li.cil.oc.api.driver.item.HostAware
|
||||
import li.cil.oc.common.Slot
|
||||
import li.cil.oc.common.Tier
|
||||
import li.cil.oc.common.item
|
||||
import li.cil.oc.common.item.Delegator
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
object DriverUpgradeHover extends Item {
|
||||
object DriverUpgradeHover extends Item with HostAware {
|
||||
override def worksWith(stack: ItemStack) = isOneOf(stack,
|
||||
api.Items.get(Constants.ItemName.HoverUpgradeTier1),
|
||||
api.Items.get(Constants.ItemName.HoverUpgradeTier2))
|
||||
|
@ -78,7 +78,7 @@ private[oc] object Registry extends api.detail.DriverAPI {
|
||||
val hostAware = items.collect {
|
||||
case driver: HostAware if driver.worksWith(stack) => driver
|
||||
}
|
||||
if (hostAware.size > 0) {
|
||||
if (hostAware.nonEmpty) {
|
||||
hostAware.find(_.worksWith(stack, host)).orNull
|
||||
}
|
||||
else driverFor(stack)
|
||||
@ -113,7 +113,7 @@ private[oc] object Registry extends api.detail.DriverAPI {
|
||||
memo.get(valueRef)
|
||||
}
|
||||
else valueRef match {
|
||||
case null | Unit | None => null
|
||||
case null | None => null
|
||||
|
||||
case arg: java.lang.Boolean => arg
|
||||
case arg: java.lang.Byte => arg
|
||||
|
@ -26,6 +26,7 @@ import li.cil.oc.api.prefab
|
||||
import li.cil.oc.common.EventHandler
|
||||
import li.cil.oc.common.SaveHandler
|
||||
import li.cil.oc.common.Slot
|
||||
import li.cil.oc.common.Tier
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.server.PacketSender
|
||||
import li.cil.oc.server.driver.Registry
|
||||
@ -112,7 +113,7 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
||||
}))
|
||||
maxCallBudget = components.foldLeft(0.0)((sum, item) => sum + (Option(item) match {
|
||||
case Some(stack) => Option(Driver.driverFor(stack, host.getClass)) match {
|
||||
case Some(driver: Processor) if driver.slot(stack) == Slot.CPU => Settings.get.callBudgets(driver.tier(stack))
|
||||
case Some(driver: Processor) if driver.slot(stack) == Slot.CPU => Settings.get.callBudgets(driver.tier(stack) max Tier.One min Tier.Three)
|
||||
case _ => 0
|
||||
}
|
||||
case _ => 0
|
||||
@ -832,7 +833,7 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
||||
}
|
||||
|
||||
private def close() = state.synchronized(
|
||||
if (state.size == 0 || state.top != Machine.State.Stopped) {
|
||||
if (state.isEmpty || state.top != Machine.State.Stopped) {
|
||||
this.synchronized {
|
||||
state.clear()
|
||||
state.push(Machine.State.Stopped)
|
||||
|
Loading…
x
Reference in New Issue
Block a user