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:
payonel 2018-02-21 11:41:24 -08:00
commit c054a0e598
2 changed files with 17 additions and 11 deletions

View File

@ -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() {

View File

@ -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")