mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8.9
This commit is contained in:
commit
ff9a01c1ff
@ -24,6 +24,8 @@ import scala.collection.convert.WrapAsJava._
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
|
||||
class UpgradeExperience(val host: EnvironmentHost with internal.Agent) extends prefab.ManagedEnvironment with DeviceInfo {
|
||||
final val MaxLevel = 30
|
||||
|
||||
override val node = api.Network.newNode(this, Visibility.Network).
|
||||
withComponent("experience").
|
||||
withConnector(30 * Settings.get.bufferPerLevel).
|
||||
@ -50,7 +52,7 @@ class UpgradeExperience(val host: EnvironmentHost with internal.Agent) extends p
|
||||
def xpForNextLevel = xpForLevel(level + 1)
|
||||
|
||||
def addExperience(value: Double) {
|
||||
if (level < 30) {
|
||||
if (level < MaxLevel) {
|
||||
experience = experience + value
|
||||
if (experience >= xpForNextLevel) {
|
||||
updateXpInfo()
|
||||
@ -80,6 +82,9 @@ class UpgradeExperience(val host: EnvironmentHost with internal.Agent) extends p
|
||||
|
||||
@Callback(doc = """function():boolean -- Tries to consume an enchanted item to add experience to the upgrade.""")
|
||||
def consume(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
if (level >= MaxLevel) {
|
||||
return result(Unit, "max level")
|
||||
}
|
||||
val stack = host.mainInventory.getStackInSlot(host.selectedSlot)
|
||||
if (stack == null || stack.stackSize < 1) {
|
||||
return result(Unit, "no item")
|
||||
|
Loading…
x
Reference in New Issue
Block a user