mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 18:30:27 -04:00
Merge branch master-MC1.7.10 into master-MC1.10
# Conflicts: # src/main/scala/li/cil/oc/common/block/Cable.scala
This commit is contained in:
commit
c054a0e598
@ -56,11 +56,14 @@ class UpgradeCrafting(val host: EnvironmentHost with internal.Robot) extends pre
|
||||
load()
|
||||
val cm = CraftingManager.getInstance
|
||||
var countCrafted = 0
|
||||
val canCraft = cm.findMatchingRecipe(CraftingInventory, host.world) != null
|
||||
val originalCraft = cm.findMatchingRecipe(CraftingInventory, host.world)
|
||||
breakable {
|
||||
while (countCrafted < wantedCount) {
|
||||
val result = cm.findMatchingRecipe(CraftingInventory, host.world)
|
||||
if (result == null || result.stackSize < 1) break()
|
||||
if (!originalCraft.isItemEqual(result)) {
|
||||
break()
|
||||
}
|
||||
countCrafted += result.stackSize
|
||||
FMLCommonHandler.instance.firePlayerCraftingEvent(host.player, result, this)
|
||||
val surplus = mutable.ArrayBuffer.empty[ItemStack]
|
||||
@ -91,7 +94,7 @@ class UpgradeCrafting(val host: EnvironmentHost with internal.Robot) extends pre
|
||||
load()
|
||||
}
|
||||
}
|
||||
Seq(canCraft, countCrafted)
|
||||
Seq(originalCraft != null, countCrafted)
|
||||
}
|
||||
|
||||
def load() {
|
||||
|
@ -77,15 +77,18 @@ class ComputerAPI(owner: NativeLuaArchitecture) extends NativeLuaAPI(owner) {
|
||||
})
|
||||
lua.setField(-2, "users")
|
||||
|
||||
lua.pushScalaFunction(lua => try {
|
||||
machine.addUser(lua.checkString(1))
|
||||
lua.pushBoolean(true)
|
||||
1
|
||||
} catch {
|
||||
case e: Throwable =>
|
||||
lua.pushNil()
|
||||
lua.pushString(Option(e.getMessage).getOrElse(e.toString))
|
||||
2
|
||||
lua.pushScalaFunction(lua => {
|
||||
val user = lua.checkString(1)
|
||||
try {
|
||||
machine.addUser(user)
|
||||
lua.pushBoolean(true)
|
||||
1
|
||||
} catch {
|
||||
case e: Throwable =>
|
||||
lua.pushNil()
|
||||
lua.pushString(Option(e.getMessage).getOrElse(e.toString))
|
||||
2
|
||||
}
|
||||
})
|
||||
lua.setField(-2, "addUser")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user