mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 03:05:30 -04:00
Merge branch master-MC1.11 into master-MC1.12
fix appeng export bus exportIntoSlot fix appeng export bus setExportConfiguration fix appeng interface set configuration closes #2658 for 1.12
This commit is contained in:
parent
3b627076f5
commit
f90dcaaf32
@ -55,7 +55,7 @@ object DriverBlockInterface extends DriverSidedTileEntity {
|
||||
case component: Component => component.host match {
|
||||
case database: Database =>
|
||||
val dbStack = database.getStackInSlot(entry - 1)
|
||||
if (dbStack == null || size < 1) null
|
||||
if (dbStack == null || size < 1 || dbStack.isEmpty) ItemStack.EMPTY
|
||||
else {
|
||||
dbStack.setCount(math.min(size, dbStack.getMaxStackSize))
|
||||
dbStack
|
||||
@ -65,9 +65,9 @@ object DriverBlockInterface extends DriverSidedTileEntity {
|
||||
case _ => throw new IllegalArgumentException("no such component")
|
||||
}
|
||||
}
|
||||
else null
|
||||
config.extractItem(slot, config.getStackInSlot(slot).getCount, true)
|
||||
config.insertItem(slot, stack, true)
|
||||
else ItemStack.EMPTY
|
||||
config.extractItem(slot, config.getStackInSlot(slot).getCount, false)
|
||||
config.insertItem(slot, stack, false)
|
||||
context.pause(0.5)
|
||||
result(true)
|
||||
}
|
||||
|
@ -50,9 +50,10 @@ object DriverExportBus extends driver.DriverBlock {
|
||||
val side = args.checkSideAny(0)
|
||||
val part = host.getPart(side)
|
||||
|
||||
if(AEUtil.isExportBus(part.getItemStack(PartItemStack.PICK))) {
|
||||
if (part != null && AEUtil.isExportBus(part.getItemStack(PartItemStack.PICK))) {
|
||||
val export = part.asInstanceOf[ISegmentedInventory with IConfigurableObject with IUpgradeableHost with IActionHost with IGridHost]
|
||||
InventoryUtils.inventoryAt(new BlockPosition(host.getLocation.x, host.getLocation.y, host.getLocation.z).offset(side), side.getOpposite) match {
|
||||
val location = host.getLocation
|
||||
InventoryUtils.inventoryAt(new BlockPosition(location.x, location.y, location.z, Some(location.getWorld)).offset(side), side.getOpposite) match {
|
||||
case Some(inventory) =>
|
||||
val targetSlot = args.checkSlot(inventory, 1)
|
||||
val config = export.getInventoryByName("config")
|
||||
|
@ -9,6 +9,7 @@ import li.cil.oc.api.network.Component
|
||||
import li.cil.oc.api.network.ManagedEnvironment
|
||||
import li.cil.oc.util.ExtendedArguments._
|
||||
import li.cil.oc.util.ResultWrapper.result
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
import scala.reflect.ClassTag
|
||||
|
||||
@ -44,7 +45,7 @@ trait PartEnvironmentBase extends ManagedEnvironment {
|
||||
case component: Component => component.host match {
|
||||
case database: Database =>
|
||||
val dbStack = database.getStackInSlot(entry - 1)
|
||||
if (dbStack == null || size < 1) null
|
||||
if (dbStack == null || size < 1 || dbStack.isEmpty) ItemStack.EMPTY
|
||||
else {
|
||||
dbStack.setCount(math.min(size, dbStack.getMaxStackSize))
|
||||
dbStack
|
||||
@ -54,9 +55,9 @@ trait PartEnvironmentBase extends ManagedEnvironment {
|
||||
case _ => throw new IllegalArgumentException("no such component")
|
||||
}
|
||||
}
|
||||
else null
|
||||
config.extractItem(slot, config.getStackInSlot(slot).getCount, true)
|
||||
config.insertItem(slot, stack, true)
|
||||
else ItemStack.EMPTY
|
||||
config.extractItem(slot, config.getStackInSlot(slot).getCount, false)
|
||||
config.insertItem(slot, stack, false)
|
||||
context.pause(0.5)
|
||||
result(true)
|
||||
case _ => result(Unit, "no matching part")
|
||||
|
Loading…
x
Reference in New Issue
Block a user