| package li.cil.oc.integration.thaumicenergistics |
| |
| import appeng.tile.misc.TileInterface |
| import li.cil.oc.api.driver.EnvironmentProvider |
| import li.cil.oc.api.network.ManagedEnvironment |
| import li.cil.oc.api.prefab.DriverTileEntity |
| import li.cil.oc.integration.ManagedTileEntityEnvironment |
| import li.cil.oc.integration.appeng.AEUtil |
| import net.minecraft.item.ItemStack |
| import net.minecraft.world.World |
| |
| object DriverBlockInterface extends DriverTileEntity { |
| def getTileEntityClass: Class[_] = classOf[TileInterface] |
| |
| def createEnvironment(world: World, x: Int, y: Int, z: Int): ManagedEnvironment = |
| new Environment(world.getTileEntity(x, y, z).asInstanceOf[TileInterface]) |
| |
| final class Environment(val tile: TileInterface) extends ManagedTileEntityEnvironment[TileInterface](tile, "me_interface") with NetworkControl[TileInterface] |
| |
| object Provider extends EnvironmentProvider { |
| override def getEnvironment(stack: ItemStack): Class[_] = |
| if (AEUtil.isBlockInterface(stack)) |
| classOf[Environment] |
| else null |
| } |
| |
| } |