mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-28 15:30:08 -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
f49b10aab1
@ -92,8 +92,8 @@ repositories {
|
|||||||
url = "http://mobiusstrip.eu/maven"
|
url = "http://mobiusstrip.eu/maven"
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name = "builtbroken"
|
name = "dmodoomsirius"
|
||||||
url = "http://ci.builtbroken.com/maven/"
|
url = "http://ci.dmodoomsirius.me/maven/"
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name = "ue"
|
name = "ue"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
minecraft.version=1.7.10
|
minecraft.version=1.7.10
|
||||||
forge.version=10.13.4.1448-1.7.10
|
forge.version=10.13.4.1448-1.7.10
|
||||||
|
|
||||||
oc.version=1.5.16
|
oc.version=1.5.17
|
||||||
oc.subversion=
|
oc.subversion=
|
||||||
|
|
||||||
ae2.version=rv2-beta-26
|
ae2.version=rv2-beta-26
|
||||||
@ -32,7 +32,7 @@ mekanism.version=7.1.2
|
|||||||
mfr.cf=2229/626
|
mfr.cf=2229/626
|
||||||
mfr.version=[1.7.10]2.8.0RC8-86
|
mfr.version=[1.7.10]2.8.0RC8-86
|
||||||
nei.version=1.0.3.57
|
nei.version=1.0.3.57
|
||||||
nek.version=1.0.0b35dev
|
nek.version=1.0.0b2dev
|
||||||
projred.version=1.7.10-4.6.2.82
|
projred.version=1.7.10-4.6.2.82
|
||||||
qmunitylib.version=0.1.105
|
qmunitylib.version=0.1.105
|
||||||
rc.cf=2219/321
|
rc.cf=2219/321
|
||||||
@ -46,4 +46,4 @@ wrcbe.version=1.4.1.2
|
|||||||
cofhcore.cf=2246/697
|
cofhcore.cf=2246/697
|
||||||
cofhcore.version=[1.7.10]3.0.3B4-302-dev
|
cofhcore.version=[1.7.10]3.0.3B4-302-dev
|
||||||
|
|
||||||
maven.url=file:///home/www/maven.cil.li/web
|
maven.url=file:///home/www/maven.cil.li/web
|
||||||
|
@ -8,9 +8,13 @@ import li.cil.oc.common.item.data.HoverBootsData
|
|||||||
import net.minecraft.client.model.ModelBiped
|
import net.minecraft.client.model.ModelBiped
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.EntityLivingBase
|
import net.minecraft.entity.EntityLivingBase
|
||||||
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
import net.minecraft.item.EnumRarity
|
import net.minecraft.item.EnumRarity
|
||||||
import net.minecraft.item.ItemArmor
|
import net.minecraft.item.ItemArmor
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.potion.Potion
|
||||||
|
import net.minecraft.potion.PotionEffect
|
||||||
|
import net.minecraft.world.World
|
||||||
|
|
||||||
class HoverBoots extends ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 0, 3) with traits.SimpleItem with traits.Chargeable {
|
class HoverBoots extends ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 0, 3) with traits.SimpleItem with traits.Chargeable {
|
||||||
setNoRepair()
|
setNoRepair()
|
||||||
@ -61,6 +65,13 @@ class HoverBoots extends ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 0, 3) with t
|
|||||||
else null
|
else null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override def onArmorTick(world: World, player: EntityPlayer, stack: ItemStack): Unit = {
|
||||||
|
super.onArmorTick(world, player, stack)
|
||||||
|
if (player.getActivePotionEffect(Potion.moveSlowdown) == null && getCharge(stack) == 0) {
|
||||||
|
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId, 20, 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override def getDisplayDamage(stack: ItemStack): Int = {
|
override def getDisplayDamage(stack: ItemStack): Int = {
|
||||||
val data = new HoverBootsData(stack)
|
val data = new HoverBootsData(stack)
|
||||||
(Settings.get.bufferHoverBoots * (1 - data.charge / Settings.get.bufferHoverBoots)).toInt
|
(Settings.get.bufferHoverBoots * (1 - data.charge / Settings.get.bufferHoverBoots)).toInt
|
||||||
@ -70,4 +81,15 @@ class HoverBoots extends ItemArmor(ItemArmor.ArmorMaterial.DIAMOND, 0, 3) with t
|
|||||||
|
|
||||||
// Always show energy bar.
|
// Always show energy bar.
|
||||||
override def isDamaged(stack: ItemStack): Boolean = true
|
override def isDamaged(stack: ItemStack): Boolean = true
|
||||||
|
|
||||||
|
// Contradictory as it may seem with the above, this avoids actual damage value changing.
|
||||||
|
override def isDamageable: Boolean = false
|
||||||
|
|
||||||
|
override def setDamage(stack: ItemStack, damage: Int): Unit = {
|
||||||
|
// Subtract energy when taking damage instead of actually damaging the item.
|
||||||
|
charge(stack, -damage, simulate = false)
|
||||||
|
|
||||||
|
// Set to 0 for old boots that may have been damaged before.
|
||||||
|
super.setDamage(stack, 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,10 @@ package li.cil.oc.common.item.traits
|
|||||||
import java.util
|
import java.util
|
||||||
|
|
||||||
import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
|
import li.cil.oc.api
|
||||||
|
import li.cil.oc.api.driver.item.MutableProcessor
|
||||||
import li.cil.oc.integration.opencomputers.DriverCPU
|
import li.cil.oc.integration.opencomputers.DriverCPU
|
||||||
|
import li.cil.oc.server.machine.Machine
|
||||||
import li.cil.oc.util.Tooltip
|
import li.cil.oc.util.Tooltip
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
@ -19,22 +22,26 @@ trait CPULike extends Delegate {
|
|||||||
override protected def tooltipData: Seq[Any] = Seq(Settings.get.cpuComponentSupport(cpuTier))
|
override protected def tooltipData: Seq[Any] = Seq(Settings.get.cpuComponentSupport(cpuTier))
|
||||||
|
|
||||||
override protected def tooltipExtended(stack: ItemStack, tooltip: util.List[String]) {
|
override protected def tooltipExtended(stack: ItemStack, tooltip: util.List[String]) {
|
||||||
tooltip.addAll(Tooltip.get("CPU.Architecture", DriverCPU.getArchitectureName(DriverCPU.architecture(stack))))
|
tooltip.addAll(Tooltip.get("CPU.Architecture", Machine.getArchitectureName(DriverCPU.architecture(stack))))
|
||||||
}
|
}
|
||||||
|
|
||||||
override def onItemRightClick(stack: ItemStack, world: World, player: EntityPlayer) = {
|
override def onItemRightClick(stack: ItemStack, world: World, player: EntityPlayer) = {
|
||||||
if (player.isSneaking) {
|
if (player.isSneaking) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
val architectures = DriverCPU.allArchitectures.toList
|
api.Driver.driverFor(stack) match {
|
||||||
if (architectures.nonEmpty) {
|
case driver: MutableProcessor =>
|
||||||
val currentIndex = architectures.indexOf(DriverCPU.architecture(stack))
|
val architectures = driver.allArchitectures.toList
|
||||||
val newIndex = (currentIndex + 1) % architectures.length
|
if (architectures.nonEmpty) {
|
||||||
val archClass = architectures(newIndex)
|
val currentIndex = architectures.indexOf(driver.architecture(stack))
|
||||||
val archName = DriverCPU.getArchitectureName(archClass)
|
val newIndex = (currentIndex + 1) % architectures.length
|
||||||
DriverCPU.setArchitecture(stack, archClass)
|
val archClass = architectures(newIndex)
|
||||||
player.addChatMessage(new ChatComponentTranslation(Settings.namespace + "tooltip.CPU.Architecture", archName))
|
val archName = Machine.getArchitectureName(archClass)
|
||||||
|
driver.setArchitecture(stack, archClass)
|
||||||
|
player.addChatMessage(new ChatComponentTranslation(Settings.namespace + "tooltip.CPU.Architecture", archName))
|
||||||
|
}
|
||||||
|
player.swingItem()
|
||||||
|
case _ => // No known driver for this processor.
|
||||||
}
|
}
|
||||||
player.swingItem()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stack
|
stack
|
||||||
|
@ -12,6 +12,7 @@ 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 li.cil.oc.server.machine.Machine
|
||||||
import li.cil.oc.server.machine.luac.NativeLuaArchitecture
|
import li.cil.oc.server.machine.luac.NativeLuaArchitecture
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
@ -66,13 +67,6 @@ abstract class DriverCPU extends Item with MutableProcessor {
|
|||||||
if (!worksWith(stack)) throw new IllegalArgumentException("Unsupported processor type.")
|
if (!worksWith(stack)) throw new IllegalArgumentException("Unsupported processor type.")
|
||||||
if (!stack.hasTagCompound) stack.setTagCompound(new NBTTagCompound())
|
if (!stack.hasTagCompound) stack.setTagCompound(new NBTTagCompound())
|
||||||
stack.getTagCompound.setString(Settings.namespace + "archClass", architecture.getName)
|
stack.getTagCompound.setString(Settings.namespace + "archClass", architecture.getName)
|
||||||
stack.getTagCompound.setString(Settings.namespace + "archName", getArchitectureName(architecture))
|
stack.getTagCompound.setString(Settings.namespace + "archName", Machine.getArchitectureName(architecture))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Move to Machine API in 1.6
|
|
||||||
def getArchitectureName(architecture: Class[_ <: Architecture]) =
|
|
||||||
architecture.getAnnotation(classOf[Architecture.Name]) match {
|
|
||||||
case annotation: Architecture.Name => annotation.value
|
|
||||||
case _ => architecture.getSimpleName
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -980,6 +980,13 @@ object Machine extends MachineAPI {
|
|||||||
|
|
||||||
override def architectures = checked.toSeq
|
override def architectures = checked.toSeq
|
||||||
|
|
||||||
|
// TODO Expose in Machine API in 1.6
|
||||||
|
def getArchitectureName(architecture: Class[_ <: Architecture]) =
|
||||||
|
architecture.getAnnotation(classOf[Architecture.Name]) match {
|
||||||
|
case annotation: Architecture.Name => annotation.value
|
||||||
|
case _ => architecture.getSimpleName
|
||||||
|
}
|
||||||
|
|
||||||
override def create(host: MachineHost) = new Machine(host)
|
override def create(host: MachineHost) = new Machine(host)
|
||||||
|
|
||||||
/** Possible states of the computer, and in particular its executor. */
|
/** Possible states of the computer, and in particular its executor. */
|
||||||
|
@ -5,7 +5,7 @@ import li.cil.oc.api
|
|||||||
import li.cil.oc.api.driver.item.MutableProcessor
|
import li.cil.oc.api.driver.item.MutableProcessor
|
||||||
import li.cil.oc.api.driver.item.Processor
|
import li.cil.oc.api.driver.item.Processor
|
||||||
import li.cil.oc.api.network.Connector
|
import li.cil.oc.api.network.Connector
|
||||||
import li.cil.oc.integration.opencomputers.DriverCPU
|
import li.cil.oc.server.machine.Machine
|
||||||
import li.cil.oc.util.ExtendedLuaState.extendLuaState
|
import li.cil.oc.util.ExtendedLuaState.extendLuaState
|
||||||
|
|
||||||
import scala.collection.convert.WrapAsScala._
|
import scala.collection.convert.WrapAsScala._
|
||||||
@ -117,7 +117,7 @@ class ComputerAPI(owner: NativeLuaArchitecture) extends NativeLuaAPI(owner) {
|
|||||||
case (stack, processor: Processor) => Seq(processor.architecture(stack))
|
case (stack, processor: Processor) => Seq(processor.architecture(stack))
|
||||||
} match {
|
} match {
|
||||||
case Some(architectures) =>
|
case Some(architectures) =>
|
||||||
lua.pushValue(architectures.map(DriverCPU.getArchitectureName))
|
lua.pushValue(architectures.map(Machine.getArchitectureName))
|
||||||
case _ =>
|
case _ =>
|
||||||
lua.newTable()
|
lua.newTable()
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ class ComputerAPI(owner: NativeLuaArchitecture) extends NativeLuaAPI(owner) {
|
|||||||
lua.pushScalaFunction(lua => {
|
lua.pushScalaFunction(lua => {
|
||||||
machine.host.internalComponents.map(stack => (stack, api.Driver.driverFor(stack))).collectFirst {
|
machine.host.internalComponents.map(stack => (stack, api.Driver.driverFor(stack))).collectFirst {
|
||||||
case (stack, processor: Processor) =>
|
case (stack, processor: Processor) =>
|
||||||
lua.pushString(DriverCPU.getArchitectureName(processor.architecture(stack)))
|
lua.pushString(Machine.getArchitectureName(processor.architecture(stack)))
|
||||||
1
|
1
|
||||||
}.getOrElse(0)
|
}.getOrElse(0)
|
||||||
})
|
})
|
||||||
@ -137,7 +137,7 @@ class ComputerAPI(owner: NativeLuaArchitecture) extends NativeLuaAPI(owner) {
|
|||||||
lua.pushScalaFunction(lua => {
|
lua.pushScalaFunction(lua => {
|
||||||
val archName = lua.checkString(1)
|
val archName = lua.checkString(1)
|
||||||
machine.host.internalComponents.map(stack => (stack, api.Driver.driverFor(stack))).collectFirst {
|
machine.host.internalComponents.map(stack => (stack, api.Driver.driverFor(stack))).collectFirst {
|
||||||
case (stack, processor: MutableProcessor) => processor.allArchitectures.find(arch => DriverCPU.getArchitectureName(arch) == archName) match {
|
case (stack, processor: MutableProcessor) => processor.allArchitectures.find(arch => Machine.getArchitectureName(arch) == archName) match {
|
||||||
case Some(archClass) =>
|
case Some(archClass) =>
|
||||||
if (archClass != processor.architecture(stack)) {
|
if (archClass != processor.architecture(stack)) {
|
||||||
processor.setArchitecture(stack, archClass)
|
processor.setArchitecture(stack, archClass)
|
||||||
|
@ -5,7 +5,7 @@ import li.cil.oc.api
|
|||||||
import li.cil.oc.api.driver.item.MutableProcessor
|
import li.cil.oc.api.driver.item.MutableProcessor
|
||||||
import li.cil.oc.api.driver.item.Processor
|
import li.cil.oc.api.driver.item.Processor
|
||||||
import li.cil.oc.api.network.Connector
|
import li.cil.oc.api.network.Connector
|
||||||
import li.cil.oc.integration.opencomputers.DriverCPU
|
import li.cil.oc.server.machine.Machine
|
||||||
import li.cil.oc.util.ScalaClosure._
|
import li.cil.oc.util.ScalaClosure._
|
||||||
import li.cil.repack.org.luaj.vm2.LuaValue
|
import li.cil.repack.org.luaj.vm2.LuaValue
|
||||||
import li.cil.repack.org.luaj.vm2.Varargs
|
import li.cil.repack.org.luaj.vm2.Varargs
|
||||||
@ -65,21 +65,21 @@ class ComputerAPI(owner: LuaJLuaArchitecture) extends LuaJAPI(owner) {
|
|||||||
case (stack, processor: MutableProcessor) => processor.allArchitectures.toSeq
|
case (stack, processor: MutableProcessor) => processor.allArchitectures.toSeq
|
||||||
case (stack, processor: Processor) => Seq(processor.architecture(stack))
|
case (stack, processor: Processor) => Seq(processor.architecture(stack))
|
||||||
} match {
|
} match {
|
||||||
case Some(architectures) => LuaValue.listOf(architectures.map(DriverCPU.getArchitectureName).map(LuaValue.valueOf).toArray)
|
case Some(architectures) => LuaValue.listOf(architectures.map(Machine.getArchitectureName).map(LuaValue.valueOf).toArray)
|
||||||
case _ => LuaValue.tableOf()
|
case _ => LuaValue.tableOf()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
computer.set("getArchitecture", (args: Varargs) => {
|
computer.set("getArchitecture", (args: Varargs) => {
|
||||||
machine.host.internalComponents.map(stack => (stack, api.Driver.driverFor(stack))).collectFirst {
|
machine.host.internalComponents.map(stack => (stack, api.Driver.driverFor(stack))).collectFirst {
|
||||||
case (stack, processor: Processor) => LuaValue.valueOf(DriverCPU.getArchitectureName(processor.architecture(stack)))
|
case (stack, processor: Processor) => LuaValue.valueOf(Machine.getArchitectureName(processor.architecture(stack)))
|
||||||
}.getOrElse(LuaValue.NONE)
|
}.getOrElse(LuaValue.NONE)
|
||||||
})
|
})
|
||||||
|
|
||||||
computer.set("setArchitecture", (args: Varargs) => {
|
computer.set("setArchitecture", (args: Varargs) => {
|
||||||
val archName = args.checkjstring(1)
|
val archName = args.checkjstring(1)
|
||||||
machine.host.internalComponents.map(stack => (stack, api.Driver.driverFor(stack))).collectFirst {
|
machine.host.internalComponents.map(stack => (stack, api.Driver.driverFor(stack))).collectFirst {
|
||||||
case (stack, processor: MutableProcessor) => processor.allArchitectures.find(arch => DriverCPU.getArchitectureName(arch) == archName) match {
|
case (stack, processor: MutableProcessor) => processor.allArchitectures.find(arch => Machine.getArchitectureName(arch) == archName) match {
|
||||||
case Some(archClass) =>
|
case Some(archClass) =>
|
||||||
if (archClass != processor.architecture(stack)) {
|
if (archClass != processor.architecture(stack)) {
|
||||||
processor.setArchitecture(stack, archClass)
|
processor.setArchitecture(stack, archClass)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user