mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-30 00:26:16 -04:00
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into OC1.5-MC1.7.10
Conflicts: build.properties
This commit is contained in:
commit
28d862df67
BIN
assets/items.psd
BIN
assets/items.psd
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
minecraft.version=1.7.10
|
minecraft.version=1.7.10
|
||||||
forge.version=10.13.3.1395-1710ls
|
forge.version=10.13.3.1395-1710ls
|
||||||
|
|
||||||
oc.version=1.5.11
|
oc.version=1.5.12
|
||||||
oc.subversion=
|
oc.subversion=
|
||||||
|
|
||||||
ae2.version=rv2-beta-26
|
ae2.version=rv2-beta-26
|
||||||
|
@ -45,6 +45,7 @@ item.oc.ALU.name=Arithmetic Logic Unit (ALU)
|
|||||||
item.oc.Analyzer.name=Analyzer
|
item.oc.Analyzer.name=Analyzer
|
||||||
item.oc.APU0.name=Accelerated Processing Unit (APU) (Tier 1)
|
item.oc.APU0.name=Accelerated Processing Unit (APU) (Tier 1)
|
||||||
item.oc.APU1.name=Accelerated Processing Unit (APU) (Tier 2)
|
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.ArrowKeys.name=Arrow Keys
|
||||||
item.oc.ButtonGroup.name=Button Group
|
item.oc.ButtonGroup.name=Button Group
|
||||||
item.oc.CardBase.name=Card Base
|
item.oc.CardBase.name=Card Base
|
||||||
|
BIN
src/main/resources/assets/opencomputers/textures/items/APU2.png
Normal file
BIN
src/main/resources/assets/opencomputers/textures/items/APU2.png
Normal file
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 Alu = "alu"
|
||||||
final val Analyzer = "analyzer"
|
final val Analyzer = "analyzer"
|
||||||
final val AngelUpgrade = "angelUpgrade"
|
final val AngelUpgrade = "angelUpgrade"
|
||||||
|
final val APUCreative = "apuCreative"
|
||||||
final val APUTier1 = "apu1"
|
final val APUTier1 = "apu1"
|
||||||
final val APUTier2 = "apu2"
|
final val APUTier2 = "apu2"
|
||||||
final val ArrowKeys = "arrowKeys"
|
final val ArrowKeys = "arrowKeys"
|
||||||
|
@ -17,7 +17,7 @@ object Print {
|
|||||||
|
|
||||||
def render(data: PrintData, state: Boolean, facing: ForgeDirection, x: Int, y: Int, z: Int, block: Block, renderer: RenderBlocks): Unit = {
|
def render(data: PrintData, state: Boolean, facing: ForgeDirection, x: Int, y: Int, z: Int, block: Block, renderer: RenderBlocks): Unit = {
|
||||||
val shapes = if (state) data.stateOn else data.stateOff
|
val shapes = if (state) data.stateOn else data.stateOff
|
||||||
if (shapes.size == 0) {
|
if (shapes.isEmpty) {
|
||||||
printBlock.textureOverride = Option(resolveTexture("missingno"))
|
printBlock.textureOverride = Option(resolveTexture("missingno"))
|
||||||
renderer.setRenderBounds(0, 0, 0, 1, 1, 1)
|
renderer.setRenderBounds(0, 0, 0, 1, 1, 1)
|
||||||
renderer.renderStandardBlock(block, x, y, z)
|
renderer.renderStandardBlock(block, x, y, z)
|
||||||
|
@ -2,10 +2,12 @@ package li.cil.oc.common.block
|
|||||||
|
|
||||||
import java.util.Random
|
import java.util.Random
|
||||||
|
|
||||||
|
import li.cil.oc.Constants
|
||||||
import li.cil.oc.api
|
import li.cil.oc.api
|
||||||
import li.cil.oc.common.tileentity
|
import li.cil.oc.common.tileentity
|
||||||
import li.cil.oc.util.BlockPosition
|
import li.cil.oc.util.BlockPosition
|
||||||
import li.cil.oc.util.ExtendedWorld._
|
import li.cil.oc.util.ExtendedWorld._
|
||||||
|
import li.cil.oc.util.InventoryUtils
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.block.material.Material
|
import net.minecraft.block.material.Material
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
@ -88,10 +90,12 @@ class Keyboard extends SimpleBlock(Material.rock) with traits.SpecialBlock {
|
|||||||
|
|
||||||
override def onNeighborBlockChange(world: World, x: Int, y: Int, z: Int, block: Block) =
|
override def onNeighborBlockChange(world: World, x: Int, y: Int, z: Int, block: Block) =
|
||||||
world.getTileEntity(x, y, z) match {
|
world.getTileEntity(x, y, z) match {
|
||||||
case keyboard: tileentity.Keyboard if canPlaceBlockOnSide(world, x, y, z, keyboard.facing.getOpposite) => // Can stay.
|
case keyboard: tileentity.Keyboard =>
|
||||||
case _ =>
|
if (!canPlaceBlockOnSide(world, x, y, z, keyboard.facing.getOpposite)) {
|
||||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0)
|
|
||||||
world.setBlockToAir(x, y, z)
|
world.setBlockToAir(x, y, z)
|
||||||
|
InventoryUtils.spawnStackInWorld(BlockPosition(x, y, z, world), api.Items.get(Constants.BlockName.Keyboard).createItemStack(1))
|
||||||
|
}
|
||||||
|
case _ =>
|
||||||
}
|
}
|
||||||
|
|
||||||
override def onBlockActivated(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, side: ForgeDirection, hitX: Float, hitY: Float, hitZ: Float) =
|
override def onBlockActivated(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, side: ForgeDirection, hitX: Float, hitY: Float, hitZ: Float) =
|
||||||
|
@ -28,7 +28,7 @@ class ServerRack extends RedstoneAware with traits.SpecialBlock with traits.Powe
|
|||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
override def getMixedBrightnessForBlock(world: IBlockAccess, x: Int, y: Int, z: Int) = {
|
override def getMixedBrightnessForBlock(world: IBlockAccess, x: Int, y: Int, z: Int) = {
|
||||||
world.getTileEntity(x, y, z) match {
|
if (y >= 0 && y < world.getHeight) world.getTileEntity(x, y, z) match {
|
||||||
case rack: tileentity.ServerRack =>
|
case rack: tileentity.ServerRack =>
|
||||||
def brightness(x: Int, y: Int, z: Int) = world.getLightBrightnessForSkyBlocks(x, y, z, getLightValue(world, x, y, z))
|
def brightness(x: Int, y: Int, z: Int) = world.getLightBrightnessForSkyBlocks(x, y, z, getLightValue(world, x, y, z))
|
||||||
val value = brightness(x + rack.facing.offsetX, y + rack.facing.offsetY, z + rack.facing.offsetZ)
|
val value = brightness(x + rack.facing.offsetX, y + rack.facing.offsetY, z + rack.facing.offsetZ)
|
||||||
@ -37,6 +37,7 @@ class ServerRack extends RedstoneAware with traits.SpecialBlock with traits.Powe
|
|||||||
((skyBrightness * 3 / 4) << 20) | ((blockBrightness * 3 / 4) << 4)
|
((skyBrightness * 3 / 4) << 20) | ((blockBrightness * 3 / 4) << 4)
|
||||||
case _ => super.getMixedBrightnessForBlock(world, x, y, z)
|
case _ => super.getMixedBrightnessForBlock(world, x, y, z)
|
||||||
}
|
}
|
||||||
|
else super.getMixedBrightnessForBlock(world, x, y, z)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def isBlockSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = side != ForgeDirection.SOUTH
|
override def isBlockSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = side != ForgeDirection.SOUTH
|
||||||
|
@ -288,6 +288,8 @@ object Items extends ItemAPI {
|
|||||||
|
|
||||||
Option(get(Constants.ItemName.SignUpgrade).createItemStack(1)),
|
Option(get(Constants.ItemName.SignUpgrade).createItemStack(1)),
|
||||||
Option(get(Constants.ItemName.PistonUpgrade).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.GraphicsCardTier2).createItemStack(1)),
|
||||||
Option(get(Constants.ItemName.RedstoneCardTier2).createItemStack(1)),
|
Option(get(Constants.ItemName.RedstoneCardTier2).createItemStack(1)),
|
||||||
@ -533,5 +535,8 @@ object Items extends ItemAPI {
|
|||||||
|
|
||||||
// 1.5.11
|
// 1.5.11
|
||||||
Recipes.addItem(new item.HoverBoots(), Constants.ItemName.HoverBoots, "oc:hoverBoots")
|
Recipes.addItem(new item.HoverBoots(), Constants.ItemName.HoverBoots, "oc:hoverBoots")
|
||||||
|
|
||||||
|
// 1.5.12
|
||||||
|
registerItem(new item.APU(multi, Tier.Three), Constants.ItemName.APUCreative)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
package li.cil.oc.common.item
|
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
|
import scala.language.existentials
|
||||||
|
|
||||||
class APU(val parent: Delegator, val tier: Int) extends traits.Delegate with traits.ItemTier with traits.CPULike with traits.GPULike {
|
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 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
|
override def gpuTier = tier
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class Server(val parent: Delegator, val tier: Int) extends traits.Delegate {
|
|||||||
val itemName = item.getDisplayName
|
val itemName = item.getDisplayName
|
||||||
items += itemName -> (if (items.contains(itemName)) items(itemName) + 1 else 1)
|
items += itemName -> (if (items.contains(itemName)) items(itemName) + 1 else 1)
|
||||||
}
|
}
|
||||||
if (items.size > 0) {
|
if (items.nonEmpty) {
|
||||||
tooltip.addAll(Tooltip.get("Server.Components"))
|
tooltip.addAll(Tooltip.get("Server.Components"))
|
||||||
for (itemName <- items.keys.toArray.sorted) {
|
for (itemName <- items.keys.toArray.sorted) {
|
||||||
tooltip.add("- " + items(itemName) + "x " + itemName)
|
tooltip.add("- " + items(itemName) + "x " + itemName)
|
||||||
|
@ -17,7 +17,14 @@ object TabletTemplate extends Template {
|
|||||||
override protected val suggestedComponents = Array(
|
override protected val suggestedComponents = Array(
|
||||||
"BIOS" -> hasComponent(Constants.ItemName.EEPROM) _,
|
"BIOS" -> hasComponent(Constants.ItemName.EEPROM) _,
|
||||||
"Keyboard" -> hasComponent(Constants.BlockName.Keyboard) _,
|
"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 _)
|
"OS" -> hasFileSystem _)
|
||||||
|
|
||||||
override protected def hostClass = classOf[internal.Tablet]
|
override protected def hostClass = classOf[internal.Tablet]
|
||||||
|
@ -23,7 +23,14 @@ abstract class Template {
|
|||||||
"BIOS" -> hasComponent(Constants.ItemName.EEPROM) _,
|
"BIOS" -> hasComponent(Constants.ItemName.EEPROM) _,
|
||||||
"Screen" -> hasComponent(Constants.BlockName.ScreenTier1) _,
|
"Screen" -> hasComponent(Constants.BlockName.ScreenTier1) _,
|
||||||
"Keyboard" -> hasComponent(Constants.BlockName.Keyboard) _,
|
"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 _,
|
"Inventory" -> hasInventory _,
|
||||||
"OS" -> hasFileSystem _)
|
"OS" -> hasFileSystem _)
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import li.cil.oc.common.tileentity.traits
|
|||||||
import li.cil.oc.integration.opencomputers.DriverRedstoneCard
|
import li.cil.oc.integration.opencomputers.DriverRedstoneCard
|
||||||
import li.cil.oc.integration.stargatetech2.DriverAbstractBusCard
|
import li.cil.oc.integration.stargatetech2.DriverAbstractBusCard
|
||||||
import li.cil.oc.integration.util.Waila
|
import li.cil.oc.integration.util.Waila
|
||||||
|
import li.cil.oc.server.agent
|
||||||
import li.cil.oc.server.{PacketSender => ServerPacketSender}
|
import li.cil.oc.server.{PacketSender => ServerPacketSender}
|
||||||
import li.cil.oc.util.ExtendedNBT._
|
import li.cil.oc.util.ExtendedNBT._
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
@ -194,7 +195,10 @@ trait Computer extends Environment with ComponentInventory with Rotatable with B
|
|||||||
}
|
}
|
||||||
|
|
||||||
override def isUseableByPlayer(player: EntityPlayer) =
|
override def isUseableByPlayer(player: EntityPlayer) =
|
||||||
super.isUseableByPlayer(player) && canInteract(player.getCommandSenderName)
|
super.isUseableByPlayer(player) && (player match {
|
||||||
|
case fakePlayer: agent.Player => canInteract(fakePlayer.agent.ownerName())
|
||||||
|
case _ => canInteract(player.getCommandSenderName)
|
||||||
|
})
|
||||||
|
|
||||||
override protected def onRotationChanged() {
|
override protected def onRotationChanged() {
|
||||||
super.onRotationChanged()
|
super.onRotationChanged()
|
||||||
|
@ -34,7 +34,7 @@ object Mods {
|
|||||||
val ComputerCraft = new SimpleMod(IDs.ComputerCraft)
|
val ComputerCraft = new SimpleMod(IDs.ComputerCraft)
|
||||||
val CraftingCosts = new SimpleMod(IDs.CraftingCosts)
|
val CraftingCosts = new SimpleMod(IDs.CraftingCosts)
|
||||||
val DeepStorageUnit = new ClassBasedMod(IDs.DeepStorageUnit, "powercrystals.minefactoryreloaded.api.IDeepStorageUnit")()
|
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 EnderIO = new SimpleMod(IDs.EnderIO)
|
||||||
val EnderStorage = new SimpleMod(IDs.EnderStorage)
|
val EnderStorage = new SimpleMod(IDs.EnderStorage)
|
||||||
val Factorization = new SimpleMod(IDs.Factorization, providesPower = true)
|
val Factorization = new SimpleMod(IDs.Factorization, providesPower = true)
|
||||||
|
@ -55,7 +55,7 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
|||||||
case Some(pattern) => pattern.getOutputs.find(_.isSameType(stack)).get
|
case Some(pattern) => pattern.getOutputs.find(_.isSameType(stack)).get
|
||||||
case _ => stack.copy.setStackSize(0) // Should not be possible, but hey...
|
case _ => stack.copy.setStackSize(0) // Should not be possible, but hey...
|
||||||
}
|
}
|
||||||
new Craftable(tile, result)
|
new NetworkControl.Craftable(tile, result)
|
||||||
}).toArray)
|
}).toArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,8 +101,11 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
|||||||
filter.get("name").forall(_.equals(Item.itemRegistry.getNameForObject(stack.getItem))) &&
|
filter.get("name").forall(_.equals(Item.itemRegistry.getNameForObject(stack.getItem))) &&
|
||||||
filter.get("label").forall(_.equals(stack.getItemStack.getDisplayName))
|
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)
|
def this() = this(null, null)
|
||||||
|
|
||||||
private val links = mutable.Set.empty[ICraftingLink]
|
private val links = mutable.Set.empty[ICraftingLink]
|
||||||
@ -186,8 +189,8 @@ trait NetworkControl[AETile >: Null <: TileEntity with IGridProxyable with IActi
|
|||||||
EventHandler.schedule(() => {
|
EventHandler.schedule(() => {
|
||||||
val world = DimensionManager.getWorld(dimension)
|
val world = DimensionManager.getWorld(dimension)
|
||||||
val tileEntity = world.getTileEntity(x, y, z)
|
val tileEntity = world.getTileEntity(x, y, z)
|
||||||
if (tileEntity != null && tileEntity.isInstanceOf[AETile]) {
|
if (tileEntity != null && tileEntity.isInstanceOf[TileEntity with IGridProxyable with IActionHost]) {
|
||||||
controller = tileEntity.asInstanceOf[AETile]
|
controller = tileEntity.asInstanceOf[TileEntity with IGridProxyable with IActionHost]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,14 @@ import net.minecraft.item.ItemStack
|
|||||||
object DriverAPU extends DriverCPU with HostAware with EnvironmentAware {
|
object DriverAPU extends DriverCPU with HostAware with EnvironmentAware {
|
||||||
override def worksWith(stack: ItemStack) = isOneOf(stack,
|
override def worksWith(stack: ItemStack) = isOneOf(stack,
|
||||||
api.Items.get(Constants.ItemName.APUTier1),
|
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) =
|
override def createEnvironment(stack: ItemStack, host: EnvironmentHost) =
|
||||||
gpuTier(stack) match {
|
gpuTier(stack) match {
|
||||||
case Tier.One => new component.GraphicsCard.Tier1()
|
case Tier.One => new component.GraphicsCard.Tier1()
|
||||||
case Tier.Two => new component.GraphicsCard.Tier2()
|
case Tier.Two => new component.GraphicsCard.Tier2()
|
||||||
|
case Tier.Three => new component.GraphicsCard.Tier3()
|
||||||
case _ => null
|
case _ => null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,13 +3,14 @@ package li.cil.oc.integration.opencomputers
|
|||||||
import li.cil.oc.Constants
|
import li.cil.oc.Constants
|
||||||
import li.cil.oc.api
|
import li.cil.oc.api
|
||||||
import li.cil.oc.api.driver.EnvironmentHost
|
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.Slot
|
||||||
import li.cil.oc.common.Tier
|
import li.cil.oc.common.Tier
|
||||||
import li.cil.oc.common.item
|
import li.cil.oc.common.item
|
||||||
import li.cil.oc.common.item.Delegator
|
import li.cil.oc.common.item.Delegator
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
|
||||||
object DriverUpgradeHover extends Item {
|
object DriverUpgradeHover extends Item with HostAware {
|
||||||
override def worksWith(stack: ItemStack) = isOneOf(stack,
|
override def worksWith(stack: ItemStack) = isOneOf(stack,
|
||||||
api.Items.get(Constants.ItemName.HoverUpgradeTier1),
|
api.Items.get(Constants.ItemName.HoverUpgradeTier1),
|
||||||
api.Items.get(Constants.ItemName.HoverUpgradeTier2))
|
api.Items.get(Constants.ItemName.HoverUpgradeTier2))
|
||||||
|
@ -77,7 +77,7 @@ private[oc] object Registry extends api.detail.DriverAPI {
|
|||||||
val hostAware = items.collect {
|
val hostAware = items.collect {
|
||||||
case driver: HostAware if driver.worksWith(stack) => driver
|
case driver: HostAware if driver.worksWith(stack) => driver
|
||||||
}
|
}
|
||||||
if (hostAware.size > 0) {
|
if (hostAware.nonEmpty) {
|
||||||
hostAware.find(_.worksWith(stack, host)).orNull
|
hostAware.find(_.worksWith(stack, host)).orNull
|
||||||
}
|
}
|
||||||
else driverFor(stack)
|
else driverFor(stack)
|
||||||
@ -112,7 +112,7 @@ private[oc] object Registry extends api.detail.DriverAPI {
|
|||||||
memo.get(valueRef)
|
memo.get(valueRef)
|
||||||
}
|
}
|
||||||
else valueRef match {
|
else valueRef match {
|
||||||
case null | Unit | None => null
|
case null | None => null
|
||||||
|
|
||||||
case arg: java.lang.Boolean => arg
|
case arg: java.lang.Boolean => arg
|
||||||
case arg: java.lang.Byte => 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.EventHandler
|
||||||
import li.cil.oc.common.SaveHandler
|
import li.cil.oc.common.SaveHandler
|
||||||
import li.cil.oc.common.Slot
|
import li.cil.oc.common.Slot
|
||||||
|
import li.cil.oc.common.Tier
|
||||||
import li.cil.oc.common.tileentity
|
import li.cil.oc.common.tileentity
|
||||||
import li.cil.oc.server.PacketSender
|
import li.cil.oc.server.PacketSender
|
||||||
import li.cil.oc.server.driver.Registry
|
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 {
|
maxCallBudget = components.foldLeft(0.0)((sum, item) => sum + (Option(item) match {
|
||||||
case Some(stack) => Option(Driver.driverFor(stack, host.getClass)) 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
|
||||||
}
|
}
|
||||||
case _ => 0
|
case _ => 0
|
||||||
@ -832,7 +833,7 @@ class Machine(val host: MachineHost) extends prefab.ManagedEnvironment with mach
|
|||||||
}
|
}
|
||||||
|
|
||||||
private def close() = state.synchronized(
|
private def close() = state.synchronized(
|
||||||
if (state.size == 0 || state.top != Machine.State.Stopped) {
|
if (state.isEmpty || state.top != Machine.State.Stopped) {
|
||||||
this.synchronized {
|
this.synchronized {
|
||||||
state.clear()
|
state.clear()
|
||||||
state.push(Machine.State.Stopped)
|
state.push(Machine.State.Stopped)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user