mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 16:57:32 -04:00
parent
2e5cca8dbf
commit
add65a0f65
@ -56,11 +56,14 @@ class UpgradeCrafting(val host: EnvironmentHost with internal.Robot) extends pre
|
|||||||
load()
|
load()
|
||||||
val cm = CraftingManager.getInstance
|
val cm = CraftingManager.getInstance
|
||||||
var countCrafted = 0
|
var countCrafted = 0
|
||||||
val canCraft = cm.findMatchingRecipe(CraftingInventory, host.world) != null
|
val originalCraft = cm.findMatchingRecipe(CraftingInventory, host.world)
|
||||||
breakable {
|
breakable {
|
||||||
while (countCrafted < wantedCount) {
|
while (countCrafted < wantedCount) {
|
||||||
val result = cm.findMatchingRecipe(CraftingInventory, host.world)
|
val result = cm.findMatchingRecipe(CraftingInventory, host.world)
|
||||||
if (result == null || result.stackSize < 1) break()
|
if (result == null || result.stackSize < 1) break()
|
||||||
|
if (!originalCraft.isItemEqual(result)) {
|
||||||
|
break()
|
||||||
|
}
|
||||||
countCrafted += result.stackSize
|
countCrafted += result.stackSize
|
||||||
FMLCommonHandler.instance.firePlayerCraftingEvent(host.player, result, this)
|
FMLCommonHandler.instance.firePlayerCraftingEvent(host.player, result, this)
|
||||||
val surplus = mutable.ArrayBuffer.empty[ItemStack]
|
val surplus = mutable.ArrayBuffer.empty[ItemStack]
|
||||||
@ -91,7 +94,7 @@ class UpgradeCrafting(val host: EnvironmentHost with internal.Robot) extends pre
|
|||||||
load()
|
load()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Seq(canCraft, countCrafted)
|
Seq(originalCraft != null, countCrafted)
|
||||||
}
|
}
|
||||||
|
|
||||||
def load() {
|
def load() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user