mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-25 22:14:09 -04:00
Dire Autocrafting table support
This commit is contained in:
parent
00b8d190fb
commit
334253061d
@ -1,7 +1,7 @@
|
||||
minecraft.version=1.7.10
|
||||
forge.version=10.13.4.1614-1.7.10
|
||||
|
||||
oc.version=1.7.5.9-GTNH
|
||||
oc.version=1.7.5.10-GTNH
|
||||
|
||||
ae2.version=rv3-beta-31
|
||||
bc.version=7.0.9
|
||||
|
BIN
libs/Avaritiaddons-1.4b.jar
Normal file
BIN
libs/Avaritiaddons-1.4b.jar
Normal file
Binary file not shown.
@ -19,6 +19,7 @@ object Mods {
|
||||
|
||||
val AgriCraft = new SimpleMod(IDs.AgriCraft, version = "@[1.4.0,)")
|
||||
val AppliedEnergistics2 = new SimpleMod(IDs.AppliedEnergistics2, version = "@[rv1,)")
|
||||
val AvaritiaAddons = new SimpleMod(IDs.AvaritiaAddons)
|
||||
val BattleGear2 = new SimpleMod(IDs.BattleGear2)
|
||||
val BetterRecords = new SimpleMod(IDs.BetterRecords)
|
||||
val BloodMagic = new SimpleMod(IDs.BloodMagic)
|
||||
@ -89,6 +90,7 @@ object Mods {
|
||||
val Proxies = Array(
|
||||
integration.agricraft.ModAgriCraft,
|
||||
integration.appeng.ModAppEng,
|
||||
integration.avaritiaaddons.ModAvaritiaAddons,
|
||||
integration.betterrecords.ModBetterRecords,
|
||||
integration.bloodmagic.ModBloodMagic,
|
||||
integration.bluepower.ModBluePower,
|
||||
@ -168,6 +170,7 @@ object Mods {
|
||||
object IDs {
|
||||
final val AgriCraft = "AgriCraft"
|
||||
final val AppliedEnergistics2 = "appliedenergistics2"
|
||||
final val AvaritiaAddons = "avaritiaddons"
|
||||
final val BattleGear2 = "battlegear2"
|
||||
final val BetterRecords = "betterrecords"
|
||||
final val BloodMagic = "AWWayofTime"
|
||||
|
@ -0,0 +1,64 @@
|
||||
package li.cil.oc.integration.avaritiaaddons
|
||||
|
||||
import li.cil.oc.api.driver.EnvironmentProvider
|
||||
import li.cil.oc.api.internal.Database
|
||||
import li.cil.oc.api.machine.{Arguments, Callback, Context}
|
||||
import li.cil.oc.api.network.{Component, ManagedEnvironment}
|
||||
import li.cil.oc.api.prefab.DriverSidedTileEntity
|
||||
import li.cil.oc.integration.ManagedTileEntityEnvironment
|
||||
import li.cil.oc.util.ResultWrapper.result
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import wanion.avaritiaddons.block.extremeautocrafter.{BlockExtremeAutoCrafter, TileEntityExtremeAutoCrafter}
|
||||
|
||||
object DriverExtremeAutocrafter extends DriverSidedTileEntity {
|
||||
def getTileEntityClass: Class[_] = classOf[TileEntityExtremeAutoCrafter]
|
||||
|
||||
override def createEnvironment(world: World, x: Int, y: Int, z: Int, side: ForgeDirection): ManagedEnvironment = new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileEntityExtremeAutoCrafter])
|
||||
|
||||
final class Environment(val tile: TileEntityExtremeAutoCrafter) extends ManagedTileEntityEnvironment[TileEntityExtremeAutoCrafter](tile, "extreme_autocrafter") {
|
||||
@Callback(doc = "function(slot:number, database:string, database_slot:number):boolean -- Set the ghost item at the specified slot. Item should be in database.")
|
||||
def setGhostItem(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
val slot = args.checkInteger(0)
|
||||
if (slot > 80) throw new IllegalArgumentException("Slot number should be from 0 to 80 (inclusive)")
|
||||
tile.setInventorySlotContents(slot + 81, getStack(args))
|
||||
result(true)
|
||||
}
|
||||
@Callback(doc = "function(slot:number):table -- Returns the ghost item at the specified slot.")
|
||||
def getGhostItem(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
val slot = args.checkInteger(0)
|
||||
if (slot > 80) throw new IllegalArgumentException("Slot number should be from 0 to 80 (inclusive)")
|
||||
result(tile.getStackInSlot(slot + 81))
|
||||
}
|
||||
private def getStack(args: Arguments) =
|
||||
if (args.count > 1) {
|
||||
val (address, entry, size) =
|
||||
if (args.isString(0)) (args.checkString(0), args.checkInteger(1), args.optInteger(2, 1))
|
||||
else (args.checkString(1), args.checkInteger(2), args.optInteger(3, 1))
|
||||
|
||||
node.network.node(address) match {
|
||||
case component: Component => component.host match {
|
||||
case database: Database =>
|
||||
val dbStack = database.getStackInSlot(entry - 1)
|
||||
if (dbStack == null || size < 1) null
|
||||
else {
|
||||
dbStack.stackSize = math.min(size, dbStack.getMaxStackSize)
|
||||
dbStack
|
||||
}
|
||||
case _ => throw new IllegalArgumentException("not a database")
|
||||
}
|
||||
case _ => throw new IllegalArgumentException("no such component")
|
||||
}
|
||||
}
|
||||
else null
|
||||
}
|
||||
object Provider extends EnvironmentProvider {
|
||||
override def getEnvironment(stack: ItemStack): Class[_] = {
|
||||
if (stack.getItem == Item.getItemFromBlock(BlockExtremeAutoCrafter.instance))
|
||||
classOf[Environment]
|
||||
else null
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package li.cil.oc.integration.avaritiaaddons
|
||||
|
||||
import li.cil.oc.api.Driver
|
||||
import li.cil.oc.integration.{ModProxy, Mods}
|
||||
|
||||
object ModAvaritiaAddons extends ModProxy {
|
||||
override def getMod = Mods.AvaritiaAddons
|
||||
override def initialize(): Unit = {
|
||||
Driver.add(DriverExtremeAutocrafter)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user